AugmentClaude
https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.mdEngineeringSimulation

Simulink Control Motors

Design motor control systems with field-oriented control, sensorless estimation, and embedded code generation.

Installation

  1. Make sure Claude is on your device and in your terminal.

    Skills load from ~/.claude/skills/ when Claude Code starts up β€” so you need it on your machine first. If you don't have it yet, install it once with the command below, then run claude in any terminal to verify.

    One-time setup
    npm i -g @anthropic-ai/claude-code

    Already have it? Skip ahead.

  2. Paste into Claude Code or into your terminal.

    This copies the whole skill folder into ~/.claude/skills/simulink-control-motors-matlab/ β€” the SKILL.md plus any scripts, reference docs, or templates the skill ships with. Safe default: works for every skill.

    Faster alternative (instruction-only skills)

    Skips the clone and grabs only the SKILL.md file. Don't use this if the skill ships Python scripts, reference markdowns, or asset templates β€” they won't be downloaded and the skill will fail when it tries to load them.

    Quick install (SKILL.md only)
    Sign up to copy
  3. Restart Claude Code.

    Quit and reopen Claude Code (or any other agent that loads from ~/.claude/skills/). New skills are picked up on startup.

  4. Just ask Claude.

    Skills auto-activate when your request matches the skill's description β€” no slash command needed. Trigger phrases live in the skill's own frontmatter; you can read them in the β€œWhat this skill does” section above.

Prefer to read the source first? Open on GitHub.

When Claude uses it

Build motor control solutions using Motor Control Blockset for PMSM, induction motors, BLDC, and SynRM. Implement field oriented control, sensorless FOC, six-step control, speed control, current control, and torque control. Configure SVPWM, flux weakening, MTPA, MTPV, control of non-linear motors, inverter control, and motor parameter estimation. Compose motor drive models, tune gains, and generate embedded code.

What this skill does

Simulink Control Motors β€” Motor Control Blockset Skill

Build motor control solutions using Motor Control Blockset (MCB): characterize motors, select control algorithms (FOC, DTC, six-step, V/f), compose Simulink models, tune gains, configure sensorless estimation, and generate code for embedded targets.

When to Use

  • User explicitly requests motor control assistance or asks to load this skill
  • User works with Motor Control Blockset or motor drive design
  • Building, tuning, debugging, or designing motor control systems
  • User mentions PMSM, BLDC, induction motor, SynRM, FOC, sensorless, six-step, SVPWM, flux weakening, MTPA, MTPV

When NOT to Use

  • General Simulink modeling work that does not involve motor control
  • Simple factual questions about motors (no model building needed)

Dependencies

  • Required: Motor Control Blockset, Simulink
  • Optional: Embedded Coder, Simscape Electrical, Powertrain Blockset

How This Skill Works

  1. Read references/common/COMMON-mcb.md (shared conventions β€” always load first)
  2. Read references/common/ROUTER-mcb.md for block routing and resolution rules
  3. Identify user intent using the routing table below
  4. Follow the matching section β€” each section points to detailed reference files
  5. Consult references/configurations/ for non-FOC architectures (DTC, six-step, V/f, BLDC, ACIM)
  6. Use references/common/mcb-examples.md for official MCB example references

Intent Routing

User IntentSectionKey Reference
New to MCB / learningDesigningreferences/design/beginner-path.md
What pattern for my application?Designingreferences/design/application-catalog.md
Build a new modelBuildingreferences/wiring/wiring-topologies.md
Configure block parametersConfiguringreferences/block-config/block-configurations.md
Compute PI gains / tuneTuningreferences/common/detailed-workflows.md Β§ Tuning
Generate LUT / FEA dataNonlinear Datareferences/common/detailed-workflows.md Β§ Importing
Add sensorless (SMO, HFI)Sensorlessreferences/common/detailed-workflows.md Β§ Sensorless
Estimate Rs, Ld, Lq, JParametersreferences/common/detailed-workflows.md Β§ Estimating
Convert plant (MCB→Simscape)Plantreferences/common/detailed-workflows.md § Plant
Model errors / doesn't moveDiagnosingreferences/common/detailed-workflows.md Β§ Diagnosing
End-to-end workflowβ€”references/workflows/ directory

Quick Decision


Designing Motor Control

Recommends control strategies, selects patterns, evaluates feature compatibility.

Load: references/design/beginner-path.md for enquiry protocol and learning paths.

  1. Detect mode (Learn / Select / Validate / Enquiry) β€” see references/design/beginner-path.md
  2. Search references/design/application-catalog.md by user's keywords β†’ get Pattern + Features
  3. Validate combination against references/design/composition-rules-combining.md
  4. Review architecture details in references/design/architecture-patterns.md

Critical rules:

  • NEVER recommend Pattern A for speed control (structural instability with MCB discrete plant)
  • NEVER recommend Sensorless Six-Step + BLDC AVI together
  • Pattern B is the DEFAULT for standard speed-controlled FOC

Output: basePattern + features + motorType + controlMode β†’ carry to Building section.


Building Motor Controller

Constructs complete models using wiring topologies, composition rules, and model_edit.

Step 1: Check for a Dedicated Configuration

BEFORE using generic wiring tables, check references/configurations/ for a matching file:

ArchitectureConfiguration File
ACIM Indirect RFOCreferences/configurations/acim-indirect-rfoc.md
ACIM Simscape RFOCreferences/configurations/acim-simscape-rfoc.md
ACIM V/f Open-Loopreferences/configurations/acim-vf-openloop.md
BLDC Hall Six-Stepreferences/configurations/bldc-hall-sixstep.md
BLDC Sensorless BEMFreferences/configurations/bldc-sensorless-bemf.md
DTC (SVPWM)references/configurations/dtc-svpwm-pmsm.md
Nonlinear Gain-Scheduledreferences/configurations/nonlinear-gain-scheduled.md
Position Cascade FOCreferences/configurations/position-cascade-foc.md
Overmodulation FOCreferences/configurations/overmodulation-foc.md
HFI+SMO Hybridreferences/configurations/hfi-smo-hybrid.md
Dual Motor Syncreferences/configurations/dual-motor-sync.md
Wind Turbine PMSGreferences/configurations/wind-turbine-pmsg.md
ADRC Speedreferences/configurations/adrc-speed.md
Backstepping Speedreferences/configurations/backstepping-speed.md
Deadbeat Currentreferences/configurations/deadbeat-current.md
Sliding Mode Speedreferences/configurations/sliding-mode-speed.md

If a config file exists: follow it directly. Otherwise: proceed to Step 2.

Step 2: Generic FOC Wiring

PatternDocument
A, A+FF, A+PWM, B, B-Simple, Creferences/wiring/wiring-topologies.md
D, E, F, G, Hreferences/wiring/wiring-topologies-advanced.md

Step 3: Add Features

  • Core (FW, SMO, GainSched, FF, Position, I/f): references/wiring/composition-rules.md
  • Infrastructure (Protection, PWM, Multi-Rate): references/wiring/composition-rules-infrastructure.md
  • Integration (Logging, Speed Profiles): references/wiring/composition-rules-integration.md

Step 4: Set Structural Config

  • PI: ControllerParametersSource='internal', ExternalReset='none', InitialConditionSource='internal'
  • Park: ThetaInput='Electrical position', AngleInput='Radians'
  • Unit Delay on voltage path to plant

Key rules:

  • Always check references/configurations/ FIRST
  • Use wiring-topologies.md block lists verbatim (type strings are validated)
  • Composition-rules operations are STRUCTURAL (affect port count) β€” do during wiring
  • All structural changes go through model_edit

Configuring MCB Blocks

Sets mask parameters for 30+ MCB block types using motor datasheet values.

Reference files:

  • references/block-config/block-configurations.md β€” control blocks
  • references/plants/block-configurations-plants.md β€” plant/sensor blocks
  • references/block-config/block-configurations-utility.md β€” utility blocks
  • references/block-config/block-configurations-bldc.md β€” BLDC blocks

Critical configurations (must get right):

BlockCritical SettingWrong Default
FOC CCPort 6 VLimits = [Vmax;-Vmax;0;0]q-axis non-zero β†’ drift
SMOPositionUnit='Radians'Default 'Degrees' β†’ 57Γ— error
Interior PMSMP = pole pairs (not 2Γ—p)Double frequency β†’ zero torque
LUT Control RefHidden params: MTPA, FW enableDefaults leave FW disabled

Key rules:

  • Mask param names β‰  motor struct fields β€” always check reference table
  • Use model_edit configure for setting parameters
  • Single-precision plant outputs need DTC blocks before double-precision control

Tuning Motor FOC Gains

Computes PI gains, IIR filters, and PU normalization.

Full workflow: references/common/detailed-workflows.md Β§ Tuning Motor FOC Gains

Quick summary: Use mcb.calcFOCGains(pmsm, inverter, Ts, Ts_speed) for all categories except Category A (kt/J > 10,000) which needs manual Ki_speed override. MCB uses KiΓ—Ts convention β€” never pass raw Ki.

Reference files: references/tuning/parameter-computation.md, references/shared/gain-formulas.md


Importing Nonlinear Motor Data

Generates and validates LUTs from FEA/measurement data.

Full workflow: references/common/detailed-workflows.md Β§ Importing Nonlinear Motor Data

Quick summary: Use mcb.generateMotorLUT(pmsm, inverter, purpose) with correct purpose string. Validate trefVec symmetry and FluxDTable first row = 0.

Reference files: references/nonlinear-data/pmsmlut-structure.md


Building Motor Plant

Converts between MCB ideal plants, Simscape, and FEM-parameterized models.

Full workflow: references/common/detailed-workflows.md Β§ Building Motor Plant

Quick summary: Solver must change to ode14x for Simscape. Add angle adapter Gain(1/(2*pi)). Gains need re-tuning after plant swap.

Reference files: references/plants/plant-model-converters.md, references/plants/block-configurations-plants.md


Estimating Motor Parameters

Commissioning workflows for Rs, Ld, Lq, FluxPM, J, B.

Full workflow: references/common/detailed-workflows.md Β§ Estimating Motor Parameters

Quick summary: Estimate in order: Rs β†’ Ld/Lq β†’ FluxPM β†’ J/B. Motor must be stationary for Rs and Ld/Lq. Feed results into mcb.calcFOCGains.

Reference files: references/estimation/estimation-procedures.md, references/estimation/estimation-to-tuning.md


Estimating Sensorless Motor Position

Configures I/F startup, SMO, HFI, EEMF observers, and handoff logic.

Full workflow: references/common/detailed-workflows.md Β§ Estimating Sensorless Motor Position

Quick summary: SPM β†’ SMO + I/F. IPM β†’ HFI + SMO hybrid. ACIM β†’ Flux Observer + I/F. Always set SMO PositionUnit='Radians'.

Reference files: references/sensorless/sensorless-blocks.md, references/sensorless/hfi-scheduler.md


Diagnosing Motor Control

Diagnoses errors, oscillations, zero-torque using structured checklists.

Full workflow: references/common/detailed-workflows.md Β§ Diagnosing Motor Control

Quick summary: Identify symptom β†’ run matching checklist β†’ apply fix from auto-fix-recipes β†’ validate. Never rebuild from scratch.

Reference files: references/diagnostics/auto_fix/ERROR_PATTERNS.md, references/diagnostics/auto_fix/auto-fix-recipes.md, references/diagnostics/model-sanity-check.md


Copyright 2026 The MathWorks, Inc.

Related skills