A motor drive is an electrical machine, a mechanical load, an inverter and a controller running at a fixed sample rate. Voltecx models all four in one circuit, and generates C for the controller from the same blocks.
Machines and loads
- Induction machines (squirrel cage and wound rotor), synchronous and PM synchronous machines, brushless DC with Hall signals, and DC machines.
- Mechanical loads and shafts, so torque, speed and inertia are part of the simulation.
- Start from the numbers on a data sheet or name plate. The equations, pins and parameter tables are in the motor-drive documentation.
Control schemes, as examples
| Scheme | Example |
|---|---|
| Induction motor, V/f | imVf |
| Induction motor, indirect field-oriented control | imIfoc |
| Induction motor, direct torque control (hysteresis and switching table) | imDtc |
| PMSM, field-oriented control | pmsmFoc |
PMSM, sensorless with a sliding-mode observer (smo block) |
pmsmSmo |
| BLDC, six-step commutation with a speed PI | bldcSixStep |
| DC motor | dcMotor |
| Robot joint servo: 48 V GaN inverter, encoder, cascaded position, speed and current loops, gear | robotJointServo |
| Regenerative braking into a bus that cannot take it, with a brake chopper | regenBrake |
Clarke, Park and dq transforms, SVPWM, PI and PID with anti-windup and the sample delay of a microcontroller (mcu block) are blocks you wire like any other.
Inverter losses and heat
inverter3Thermal adds dq current control and a thermal model for every device. analysis.losses splits conduction and switching loss per switch and diode; thermal networks give junction temperatures over a load cycle, with a slower thermal step so a one-second run stays quick. analysis.softSwitching checks the dead time of each leg against how long the switch node took to swing.
From model to firmware
Tools › Code Generation turns the sampled control blocks into C99 with no malloc, with set-up and interrupt code for STM32G474 (TIM1 and ADC1) or TI F28379D (ePWM1 and ADC-A, with a Code Composer Studio project). A UART logger in the generated code lets you compare what the real controller computed with the simulation. Tools › Real-Time Model exports the inverter and machine side as fixed-step C for a hardware-in-the-loop rig.
Know the limits
Generated C was checked against the simulator's block evaluation, not compiled in the tests: build and verify it with your toolchain. design.auto designs DC-DC converters, not drives; drive control loops are designed with the Design panel's current and speed loop tools. No drive has been compared with a test bench yet.
Related: Code generation · Dead-time effects · Analyses