Install
$ agentstack add skill-calebzu-pmsm-control-claude-skills-for-matlab-motor-fcs-mpc ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
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
- Plan first. Before any
add_block, write a numbered plan: parameter table, design-decision choices ([designdecisions.md](references/designdecisions.md)), build-script structure. Get user approval. - One-click reproducibility. Inject all parameters via
set_param(mdl, 'InitFcn', sprintf(...)). Model must Run from.slxdouble-click in fresh MATLAB session. See [critconditions.md §J-CRIT](references/critconditions.md). - MPC chart params via
sprintffrom build-script workspace. Chart hardcodesRs/Ld/Lq/ψf/Pn/Tscas numeric literals at build time. Never put MPC params in an external.mfile (drifts from plant). See [critconditions.md §K-CRIT](references/critconditions.md). - 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 chart output. See [critconditions.md §G-CRIT](references/critconditions.md). - Outer PI saturation is mandatory.
LimitOutput='on', limits[-iq_max, +iq_max]with1.5·Pn·ψf·iq_max ≥ 1.3·TL_max. Without saturation, runawayiq_refcollapses the cost-weight ratio and MPC abandons d-axis. See [outerpisaturation.md](references/outerpisaturation.md). - ZOH every chart input even if upstream is already discrete. INHERITED chart's effective trigger rate is set by the fastest upstream signal; one un-ZOH'd input poisons the whole chart. See [critconditions.md §A-CRIT](references/critconditions.md).
- Use From Workspace + inline matrix for
ω_ref, NOT Step+RateLimiter. Continuous-mode RateLimiter escapes its slew limit on first solver step. See [critconditions.md §H-CRIT](references/critconditions.md).
Build Flow
| Phase | Action | Reference | |---|---|---| | 0 | Validate inputs + sanity grid | base/[prebuildgrid.md](../motor-pmsm-base/references/prebuildgrid.md) | | 1 | Plant layer (powergui Discrete @ Ts, DC, UB Inverter, PMSM Salient-pole, TL Step) | (this skill) | | 2 | Measurement layer (Bus Selector → Goto/From) | (this skill) | | 3 | Outer speed PI (optional, RPM domain, mandatory saturation) | [outerpisaturation.md](references/outerpisaturation.md) | | 4 | Inner FCS-MPC chart | [algorithmpseudocode.md](references/algorithmpseudocode.md) + [critconditions.md §G/§A/§K](references/critconditions.md) | | 5 | Logging (To Workspace @ Tsc) | base/[measurementlogger.md](../motor-pmsm-base/references/measurementlogger.md) | | 6 | Solver (Variable-step Auto, MaxStep ≤ Ts; powergui handles SPS at Ts) | (this skill) | | 7 | InitFcn injection | base/[plantmodeling.md](../motor-pmsm-base/references/plantmodeling.md) §InitFcn | | 8 | Self-tests + acceptance | [acceptancecriteria.md](references/acceptancecriteria.md) |
If issues arise, consult [critconditions.md](references/critconditions.md) (A/D/G/H/J/K) and [antipatterns.md](references/antipatterns.md) (15 common mistakes).
Required User Inputs
Ask the user before starting. Defaults in [parameterdefaults.md](references/parameterdefaults.md).
| Group | Parameter | |---|---| | Machine | Rs (Ω), Ld, Lq (H), ψf (V·s), Pn, J (kg·m²), F (N·m·s) | | Power stage | Vdc (V) | | Sampling | Ts (plant solver, ~1–5 μs), Tsc (control period, ~20–50 μs; Tsc/Ts ≥ 10) | | Outer loop | Kp_w, Ki_w (RPM domain; recommend pi_design.m), iq_max (1.5·Pn·ψf·iq_max ≥ 1.3·TL_max) | | MPC | control objective (ripple-priority / balanced / torque-priority), λ_d, λ_q per objective, id_ref (SPMSM: 0; IPMSM: ask) | | Scenario | StopTime, ramp_time, ω_ref_target (RPM), TL_step_time, TL_value (1), delay compensation, weak-field, MTPA optimization | | Generalizing FCS-MPC to a new PMSM machine parameter set | Pure theory questions about MPC math | | | MATLAB perf (matlab-performance-optimizer) or unit tests (matlab-test-creator`) |
Generalization Across Machine Sub-Types
| Sub-type | Parameter constraint | Strategy | |---|---|---| | SPMSM | Ld == Lq | id_ref = 0 (no reluctance torque) | | IPMSM mild saliency | Lq > Ld, Lq/Ld ≤ 1.5 | id_ref = 0 workable; MTPA gives ~5% torque-per-amp gain | | IPMSM strong saliency | Lq/Ld ≥ 2 | id_ref from MTPA solver (out of scope; ask user) |
Topology does not change — same blocks, same wiring, same chart algorithm, same CRIT conditions. Only parameters and id_ref strategy differ.
Out-of-scope sub-types: SynRM (ψf ≈ 0), IM, BLDC trapezoidal — different prediction equations.
Sibling Skills
- [motor-pmsm-base](../motor-pmsm-base/SKILL.md) — base infrastructure (this skill layers on it)
- [motor-dtc-pmsm](../motor-dtc-pmsm/SKILL.md) — Direct Torque Control alternative
- [motor-smc-pmsm](../motor-smc-pmsm/SKILL.md) — Sliding Mode Control alternative
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: calebzu
- Source: calebzu/pmsm-control-claude-skills-for-matlab
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.