Main Content

Test Algorithm Design


When simulating or running a model on the target hardware, you can face problems because of defects in the implementation of the control algorithm. This can lead to an uncontrolled motor speed, differences in the current waveforms or mismatch in PI controller gains between simulation and target hardware.


Verify Parameters and Other Input Data

Verify that you identified and entered the inputs (for example, motor and inverter parameters, clock speed, and switching frequency) correctly. If the input data is incorrect, the motor control algorithm will not work. Use the Motor Control Blockset™ parameter estimation tool to compute the motor parameters. For more details, see Estimate Motor Parameters by Using Motor Control Blockset Parameter Estimation Tool.

Verify Waveforms of Measured Currents

After you load the motor shaft, verify that the waveforms for the measured signals match the shape visible in the simulations. For example, field-oriented control ensures perfect sinusoidal waveforms for currents. For exceptions, see Check ADC Inputs.

Verify Control System Design

Verify that all the controllers used in the model (for example, PI controllers and sliding mode observer) are designed correctly.

You can start by simulating the model by using the estimated motor parameters before deploying the model to the target hardware. Observe and verify the step responses for the current and speed by using both simulation and deployment on the target hardware.

Model-Based Design ensures that correct simulation of the model results in identical outcomes on the target hardware with identical gains (that match the gain values computed during simulation) for all the controllers.

Verify Signal Representation

Check if you can represent the signals correctly for a selected data type. For example, it is not possible to store the value 1024 in the 8-bit data-type. Similarly, it may not be possible to represent some gain values in the selected fixed-point resolution.

Verify Base Values for PU Representation

If you are working with the Per-Unit system, please check that the base value of a quantity (for example, base current), is selected correctly. For more details, see Per-Unit System.