motor-fcs-mpclisted
Install: claude install-skill calebzu/pmsm-control-claude-skills-for-matlab
# motor-fcs-mpc — PMSM Single-Vector Finite-Control-Set MPC Builder
Three-phase 2-level voltage-source inverter + PMSM (SPMSM / IPMSM via parameterization). Inner-loop = FCS-MPC current control in dq frame. Outer-loop (optional) = speed PI providing `iq_ref`. Generalizes across machine sub-types by parameterizing `Rs, Ld, Lq, ψf, Pn, J, F` — no topology change between sub-types.
Layered on [motor-pmsm-base](../motor-pmsm-base/SKILL.md). All base discipline applies (Goto TagVisibility, Vdc/BEMF rule, Visual 4-check, broken-FOC defense).
## Must-Follow Rules
1. **Plan first.** Before any `add_block`, write a numbered plan: parameter table, design-decision choices ([design_decisions.md](references/design_decisions.md)), build-script structure. Get user approval.
2. **One-click reproducibility.** Inject all parameters via `set_param(mdl, 'InitFcn', sprintf(...))`. Model must Run from `.slx` double-click in fresh MATLAB session. See [crit_conditions.md §J-CRIT](references/crit_conditions.md).
3. **MPC chart params via `sprintf` from build-script workspace.** Chart hardcodes `Rs/Ld/Lq/ψf/Pn/Tsc` as numeric literals at build time. Never put MPC params in an external `.m` file (drifts from plant). See [crit_conditions.md §K-CRIT](references/crit_conditions.md).
4. **Chart config = INHERITED + dual ZOH** (NOT DISCRETE+Tsc). `ch.SampleTime='-1'`, `ch.ChartUpdate='INHERITED'`, leave Inputs DataType/Size at Inherit. Rate is locked by ZOH @ Tsc on every chart input + ZOH @ Tsc on char