Skip to content

Add cascaded speed ADRC + MPC current demo (new path) - #42

Open
saeed95-lab wants to merge 7 commits into
feature/gen6-hybrid-adrc-mpccfrom
feature/gen6-speed-adrc-mpc-current
Open

Add cascaded speed ADRC + MPC current demo (new path)#42
saeed95-lab wants to merge 7 commits into
feature/gen6-hybrid-adrc-mpccfrom
feature/gen6-speed-adrc-mpc-current

Conversation

@saeed95-lab

Copy link
Copy Markdown
Collaborator

Summary

  • Adds new Control.SpeedAdrcMpcCurrent: outer LADRC speed (rpm)Iq*, inner Mode-3 deadbeat/MPC current → SVPWM
  • Adds speed_adrc_mpc_current_demo.json + bring-up doc
  • Does not modify Control.AdrcMpcc or hybrid_adrc_mpcc_demo.json

How to test

  1. Checkout feature/gen6-speed-adrc-mpc-current
  2. Flash Assets/Examples/speed_adrc_mpc_current_demo.json
  3. Bus ~55 V; CascadeMode=1; SpdVar=400 (rpm); enable
  4. Watch sam_rpm, sam_iq_cmd_a, phase currents, hz_tim_isr
  5. Optional FOC-like check: CascadeMode=0, ramp IqVar in amps

Test plan

  • Graph builds / flashes on Gen6
  • Cascade: rpm tracks ~400 without huge current spikes
  • Current-only mode still works (Iq in A)
  • Confirm previous hybrid demo still unchanged on its branch

Made with Cursor

saeedamooei and others added 7 commits August 3, 2026 21:24
New Control.SpeedAdrcMpcCurrent and speed_adrc_mpc_current_demo leave
Control.AdrcMpcc / hybrid_adrc_mpcc_demo unchanged. CascadeMode 1 runs
LADRC on rpm into Mode-3 deadbeat current; mode 0 stays FOC-like Iq in A.

Co-authored-by: Cursor <cursoragent@cursor.com>
SpeedAdrcMpc lacked the required position key, which made the graph
JSON invalid for the loader.

Co-authored-by: Cursor <cursoragent@cursor.com>
The extra Control.Slew on Spd_Ref cost ~16 B of DTCM. Rpm slewing now
lives in the controller's .dma_buffers state instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
HybridADRCMPC-9 showed cascade on but ~0 rpm: SpdVar shared IqVar's
position so the speed setpoint was not usable, and CascadeMode was a
hidden node parameter. Wire Cascade_Mode from a visible Values.Var and
separate SpdVar/log positions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This demo is always cascaded (SpdVar in rpm). Mode switching via an
extra Values.Var blew DTCM; use hybrid_adrc_mpcc_demo for Iq-in-amps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Previous commit left CascadeVar wired in the example JSON; remove it and
hard-code cascade so DTCM is free again.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants