Main Content

Get Started with Dual Motor (Dyno)

This example shows an SoC Blockset model controlling a coupled motor-dyno development board. The example uses this single model to develop field-oriented control (FOC) ofl two 3-phase permanent magnet synchronous motors (PMSM) coupled in a dyno setup. Motor 1 runs in the closed-loop speed control mode. Motor 2 runs in torque control mode and loads Motor 1 because they are mechanically coupled. You can use this example to test a motor in different load conditions.

For details on connecting the motor boards with the Texas Instruments™ C2000™ development board, see Instructions for Dyno (Dual Motor) Setup in Hardware Connections (Motor Control Blockset).

Hardware Requirements

Closed-Loop Control of Motor-Dyno Model

The model uses the C2000 processors to manage the inverter-motor-dyno system. The first C2000 processor contains an FOC motor speed controller. The second processor controls the dyno, allowing dynamic loading of the first motor to evaluate the control system. The SoC Blockset provides simulation of the processors and measurements with sufficiently high fidelity. Two model variants of the inverted-motor-dyno system are included in the model:

  • Low fidelity — Average switching inverter and Motor Control Blockset™ PMSM blocks

  • High fidelity — Full Simscape model of switching inverter and PMSM motors

While the low-fidelity model exhibits inconsistencies during transient responses when compared to the high-fidelity model, its faster simulation speed allows you to iterate more quickly on your design. The parameter values for the motors, inverters, and circuitry in these models are from the orginal equipement manufacturer (OEM) datasheets. To refine specific values of the inverter-motor models or if you cannot access the motor specifications from the OEM, then see Estimate PMSM Parameters Using Recommended Hardware (Motor Control Blockset).

You can open the model using this MATLAB command:



Simulation, Deployment, and Measurement

You can simulate the model to evaluate the baseline performance of the PI controller provided. Each simulation run generates a data set in the Simulation Data Inspector that you can review later. Then, using these steps, you can deploy the model onto the C2000 Delfino MCU F28379D LaunchPad™ development kit:

  1. On the System on Chip tab, click Configure, Build, & Deploy to launch the SoC Builder tool.

  2. In Hardware Mapping tool, check that the tasks are assigned to the expected interrupt sources, such as ADCA1_isr assigned as the event source for control task in CPU1.

  3. Review the next page, Map Peripherals in MCU Model. Configure the peripherals with the same values that you used for simulation.

  4. On the Validate Model page, confirm the successful compilation of the models. If the model fails to compile, try Update Model (Ctrl+D) from the Debug tab.

  5. On the Select Build Action page, select Build and load for External mode to monitor and collect data from the hardware.

  6. Click Load and Run.

The complete set of results from simulation and deployment on the hardware can now be accessed and viewed from the Simulation Data Inspector.

Analysis of Results

Open the Simulation Data Inspector to view the signals from the simulation and those recorded from the hardware. This image shows a comparison of the motor speed from the simulation and measured from the hardware. The motor-dyno system passes through three stages, startup into open-loop from 0 to 1.5 seconds, open-loop into closed-loop from 1.5 to 3 seconds, and dynamic loading at 3 seconds.

This image shows the region around the open-loop to closed-loop transition. Both the simulation and hardware measured motor speeds reached steady state within approximately 0.2 seconds. The simulation demonstrates a faster response than the response measured from the hardware. This difference can be directly attributed to the simplified physical plant model that using the average switching inverter that neglects some additional damping observable during the transient responses. You can optionally use the high-fidelity variant of the motor-dyno plant model, but this option can greatly increase the total execution time of the simulation.

This image shows the region where the motor is dynamically loaded using the dyno. As expected, both the simulation and hardware responses converge to the reference speed. Again, the simulation response demonstrates a faster convergence in the trainsient than the hardware due to the use of the low-fidelity plant model.

Using this framework model, you can now develop and verify other dynamically loaded motor control algorithms with verification of behavior on the hardware.

See Also