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.
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.
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.
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:
Run the host model and connect the target hardware through serial communication.
In Select Motor Operating mode, select Speed control.
Motor spins in speed control.
Select Id_meas in Monitor Signal #1 and
Iq_meas in Monitor signal #2. Read the
Id_meas
and Iq_meas
from
scope.
Convert the PU current to Amperes by multiplying with
PU_System.I_base
.
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
The measured Id current Id_meas
(in PU) equals
0.
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.
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.
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.
Run the host model and communicate the target hardware.
In Select Motor Operating Mode, change the mode from Stop to Speed control
Select the Speed_ref in Monitor Signal#1 and Speed_meas in Monitor Signal#2 in host model.
Open the scope in the host model
In host model interface, change the speed_ref
from 0.2
to 0.5 and observe the step change in scope.
As shown in below figure, compare the step response of the hardware results with simulation results.
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 results | 20.13% | 16.023 | 5.561 | 61.027 |
Hardware results | 22 % | 14.324 | 5.041 | 51.148 |
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.
For hardware measurements, run the host model.
In Select Motor Operating Mode, change the mode from Stop to Torque control.
Select the Id_ref in Monitor Signal#1 and Id_meas in Monitor Signal#2 in host model.
Open the scope in the host model
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.
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)
.
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).
Run the simulation and measure the Idref_PU
and
Idmeas_PU
in Simulink Data Inspector.
As shown in the below figure, compare the step response of the hardware results with simulation results.
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 results | 14 % | 300 | 150 | 500 |
Hardware results | 8.18 % | 400 | 150 | 800 |
If simulation results differs a lot with the hardware measurements, verify the delay and scaling factor in the plant model.
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.