Embedded Simulink models
Finally an example to embed the control law is proposed
The control proposed on this model is detailed in the page PMSM vector control. The implemented control is exactly the same as the simulation model.
- To build the code and flash it on the microcontroller, press ctrl+b.
- To select the mode, press button S2 on the MCLV2 board.
- Mode 0 : Off
- Mode 1 : Open loop, apply vq voltage from potentiometer [0 12V]
- Mode 2 : Current mode, apply iq reference current from potentiometer [0 4A]
- Mode 3 : Speed mode, apply om reference voltage from potentiometer [0 350rad/s]
- To change reference direction, press button S3 on the MCLV2 board.
- The solution proposes a Graphical User interface. Details on the use of this interface can be found here
- To open the GUI click on the block Interface TxMatlab » picgui in the simulink model.
- A GUI should open and looks with the configuration looks like this :
- The DataVisu mfile is available in the zip. It allows to plot data in realtime. For this example, for speed control it should be obtained :
The simulink model and the datavisu.m file can be download here