Validate the System

This section explains how to evaluate the accuracy of the plant (motor and inverter) model of physical motor and load connected to the motor. You need to validate the plant model and verify the results are close to the physical system measurements before using the plant model for Advanced algorithm implementations. You can validate the system by comparing the step response of speed control and current control in simulation and in target hardware connected to the motor.

Use the example Control Parameter Gain Tuning (Manual) in Hardware and Plant Validation to measure the step response of current controller and speed controller. The host model in this example communicates the current reference to the target hardware and measures the step response of the current controller.

Note

  • You can use any speed control example from Motor Control Blockset for system validation.

  • Validate speed control by comparing the step response in simulation and hardware test values.

  • Validate d-axis current control by electrically or mechanically locking the rotor and comparing the step response in simulation and hardware test results.

    There is also another way to validate d-axis current control: Run the motor at a constant speed and give step change in reference d-axis current. This requires two modifications in the Speed Control subsystem of the target model. Set a constant speed reference input. Command Id reference from host model. Compare the step response of d-axis current in simulation and in hardware tests.

  • Validate q-axis current control by mechanically coupling the motor with an external dynamometer running in speed control. This requires two modifications in the Speed Control subsystem of the target model. Discard the Id and Iq reference from Speed PI Controller output. Command Id reference from host model. Compare the step response of q-axis current in simulation and in hardware tests.

Warning

While taking step response in d-axis current control, always use positive step. Negative values of Id can damage the Permanent Magnet in the motor.

Refer the example Control Parameter Gain Tuning (Manual) in Hardware and Plant Validation for deploying the model to the hardware. Perform motor parameter estimation as accuracy of the plant modelling is important to match the simulation results with hardware measurements.

Calculate the Physical Motor Load in Target Hardware

Before comparing the controller responses in simulation and target hardware, the load torque in plant simulation must match the motor load in physical system. Follow the below steps to calculate the load torque in physical system and update the calculated load torque to the plant model:

  1. Run the host model and connect the target hardware through serial communication.

  2. In Select Motor Operating mode, select Speed control.

    Motor spins in speed control.

  3. Select Id_meas in Monitor Signal #1 and Iq_meas in Monitor signal #2. Read the Id_meas and Iq_meas from scope.

  4. Convert the PU current to Amperes by multiplying with PU_System.I_base.

  5. Calculate load torque in Nm using the below formula:

    Tload = 1.5 * pole_pair [flux_pm * Iq + (Ld – Lq) id*Iq]

    where,

    Flux_pm = permanment magnet flux linkage (pmsm.Flux_PM)

    Ld, Lq = Inductance in H (pmsm.Ld, pmsm.Lq)

    Id, Iq = current measured in A

    Note

    The measured Id current Id_meas (in PU) equals 0.

  6. In mcb_pmsm_operating_mode_f28379d/Motor and Inverter/Plant Model (sim), enter the above calculated value in LdTrq as an input to PMSM motor block.

Compare the Speed Controller Response in Simulation and in Target Hardware

In simulation, give a speed step input and note the speed response. On target hardware, command the speed reference step input and observe the speed feedback. Compare the results step response of simulation and target hardware to know the accuracy of the plant modelling.

  1. Simulate the model mcb_pmsm_operating_mode_f28379d. Plot the speed reference and speed measured signal. By default, a step input of 0.2 to 0.5 is input in the simulation model.

  2. Run the host model and communicate the target hardware.

  3. In Select Motor Operating Mode, change the mode from Stop to Speed control

  4. Select the Speed_ref in Monitor Signal#1 and Speed_meas in Monitor Signal#2 in host model.

  5. Open the scope in the host model

  6. In host model interface, change the speed_ref from 0.2 to 0.5 and observe the step change in scope.

  7. As shown in below figure, compare the step response of the hardware results with simulation results.

Step Response Analysis for Speed Controller

The step response from simulation is compared with the measurements made from the target hardware. The results may vary depends on the tolerances in plant modelling. Overall, the simulation results are close to measurement values from hardware.

 Peak overshoot (%)Peak time (ms)Rise time (ms)Settling time (ms)
Simulation results20.13%16.0235.56161.027
Hardware results22 %14.3245.04151.148

Compare the Current Controller Response in Simulation and in Target Hardware

In simulation, give step current reference and note the current response. This example requires changes to simulate the current reference step input. Refer the below steps for model changes and this applies only for simulation. In target hardware, command the current reference step input and observe the current feedback. Compare the results step response of simulation and target hardware to know the accuracy of the plant modelling.

  1. For hardware measurements, run the host model.

  2. In Select Motor Operating Mode, change the mode from Stop to Torque control.

  3. Select the Id_ref in Monitor Signal#1 and Id_meas in Monitor Signal#2 in host model.

  4. Open the scope in the host model

  5. Change the Id_ref from 0.02 to 0.22 and observe the step change in scope. Ensure that the motor is not spinning. The scope displays the step response for Id_ref input.

  6. For simulation, two changes are required in the simulation model. In mcb_pmsm_operating_mode_f28379d/TorqueControl/Control Modes/torque_control add a step input for d-axis current controller. Choose step input as 0.02 to 0.22 at 1 second. Select Time sample as -1. In Data-type conversion block, select the output datatype as fixdt(1,32,17).

  7. In mcb_pmsm_operating_mode_f28379d/Motor and Inverter/Plant Model (sim), PMSM motor block, change the Mechanical Input Configuration to Speed and input 0 to Spd (input port).

  8. Run the simulation and measure the Idref_PU and Idmeas_PU in Simulink Data Inspector.

  9. As shown in the below figure, compare the step response of the hardware results with simulation results.

Step response analysis for D-axis current controller

The scope image from simulation is compared with the measurements made from the target hardware. The results may vary depending on the tolerances in plant modelling. With an accurate plant model, the simulation results get closer to the measured results from target hardware.

 Peak overshoot (%)Peak time (µs)Rise time (µs)Settling time (µs)
Simulation results14 %300150500
Hardware results8.18 %400150800

Tip

If simulation results differs a lot with the hardware measurements, verify the delay and scaling factor in the plant model.

Note

For q-axis current controller, align motor to the d-axis and mechanically lock the rotor. Follow the same steps as D-axis current controller for comparative analysis. External mechanical locking can be achieved through mechanical braking system or coupled with a dyno motor running in speed control.

The accuracy of the plant modelling improves the accuracy of simulation and match the test hardware results.