Written by SOLO Team
08/07/2022
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset

Introduction

In this article, we are going to explain the torque and speed controlling methods of a Brushless Motor and compare them together and learn how you can seamlessly do it using our products and our Simulink Blockset that enables you to communicate with SOLO through USB, UART and CANopen from the Simulink environment but first, we are going to give a brief introduction to a PMSM and control scheme of it, PMSM motors are also known as AC brushless Motors too.
To get access to the source codes and the example codes please visit the link below:
The Blockset library: https://github.com/Solo-FL/SOLO-Motor-Controllers-SIMULINK

PMSM or AC brushless Motors, Dynamics and Theory

Permanent magnet synchronous motor (PMSM) technology is widely explored and employed in industrial equipment, aerospace aircraft, domestic appliances, and electric vehicles. The motor takes advantage of high working efficiency, high power density, highly accurate position tracking, and low power factor, as compared to induction motors. The reason that PMSM is popular is the ease of control.
The governing equations for PMSM are as follows:
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 1

psi_m is the magnetic flux of the permanent magnet, n is the number of pole pairs,omega is the mechanical speed of the rotor, J inertia of the rotor, R_s and L_s are stator resistance and inductance respectively.
As we can see from the equation the only parameter that contributes to torque is i_sq and i_sd is just related to the joule losses, for this reason when we are controlling a PMSM, we always put the i_sd=0. It needs to mention that when we are using field weakening the is_d is not equal to zero anymore and we should calculate the value for it.
Now we are going to use the field-oriented control (FOC) technique for PMSM. The overall scheme of FOC is as below.

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 2

Figure 1 – Complete FOC scheme

Torque Controlling of a PMSM

Some applications like traction(electrical vehicles and railway) require specific torque, for these applications we should use torque control mode.
The control block diagram of torque control corresponds to the figure below.

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 3

Figure 2 – FOC scheme for torque control

As shown in the equations, when user set a reference torque, we can easily derive the i_sq, just by multiplying it by 1/npsi_m . Afterwards, we are going to regulate i_sq,ref and generate the v_sq,ref.
The use of a torque control offers several advantages such as quick, and robust torque reaction and increase efficiency. On the other hand, there are some disadvantages of it such as poor dynamic response at low speed and possible problems during the starting.

Speed Controlling of a PMSM

Some applications like conveyors and power tools, it is needed to maintain a constant speed , in these cases we should use speed control mode.
The control block diagram of speed control is shown in the figure below.
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 4

Figure 3 – FOC scheme for speed control

Simulink Blockset

Now, in this section, we are going to explain torque speed control of a PMSM/BLDC by means of SOLO Simulink Blockset.
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 5

Figure 4 – Schematic of blocksets

Calibration/ Identification phase

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 6

Figure 5 – Calibration/Identification block

The first block is the calibration/identification. This block is used to find the motor parameters as resistance and inductance of the motor. In addition, it is used to find the offset as well.
To activate this block user should push one of the buttons related to calibration and identification (top right).

Note: For activating this block the motor should be off, otherwise if you push the calibration or identification, it is not going to do anything.

TX Block

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 7

Figure 6 – Tx Block

This block is related to communication with SOLO and sending the command to it.

The Serial Setup Block

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 8

Figure 7 – Initialization block

This block will set up and initialize for the first time the Serial port of SOLO in case of using USB or UART protocols of SOLO, thus this block can just be called only during the initializations or possible re-connection to SOLO and there is no need to call it afterward.

The inputs of this block are as followings:

Address: This input defines the Device address of the SOLO unit that you want to initialize, to set or change the device address of your unit you can use the SOLO Motion Terminal.

COM Port: This defines what COM port is assigned to the SOLO unit on your PC, on Windows devices you can check that in Device Manager.

Baud Rate: This defines at what baud rate your SOLO unit operates for UART communications, you can set the baud rate of the UART line in SOLO Motion Terminal.
If you are using the native USB on your SOLO unit, the value of the baud rate you put here has no effect and any value will be accepted as the notion of Baud-rate for the USB-2 protocol on SOLO is non-existent.
If you are using SOLO with a UART to USB converter connected to your PC then setting of this Baudrate will be necessary and it’s highly recommended to use the highest baud rates possible ( 937500 bits/s in SOLO UNO and MINI) to have the highest performance.

Timeout: This defines the timeout for commands in terms of milliseconds, if the DLL fails to communicate with SOLO within the timeout time, you will receive the timeout error code at the “Result” output.

Trials on Failure: This defines how many times the DLL should try automatically sending a failed command to SOLO later when you try to Write or Read some parameters, in case after finishing all the trials the command fails to be sent or received you will receive an error at the “Result” and “Error” outputs in your Write or Read functions.

Result: This output defines if the setup process went successful or if an error occurred during the process.

RX Block

This block is used for monitoring the speed [rpm], position [pulses] and Iq [A].
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 9

Figure 8 – Rx block

Control Panel

The user sets the preference configuration, by means of these blocks such as analog/digital mode, feedback mode (sensorless, encoder, or hall sensor), motor direction (clockwise or counterclockwise), and torque of the motor. In addition, the user can tune the current controller using these blocks.

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 10
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 11

Figure 9 – Control panel

How does it work?

It is really easy, you just need to connect SOLO and set the right COM port, motor type, and feedback mode. Now, everything is ready to run your motor.

Note: If the motor does not move when you turn it on, it is probably because the control mode is on analog mode and it is not initialized correctly and you should set it to digital by means of the switch related to it.

Note 2: you need to have the correct wiring configuration and offset, otherwise your motor is not going to move. For this purpose, you just need to push the calibration button to set the offset and then try to see if this configuration works or not, otherwise, you should change the wiring and repeat the same procedure again.

Note 3: In the speed control all the blocks are the same except the control panel. For speed control our control panel becomes as below:

Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 12
Torque and Speed Controlling of a PMSM/BLDC using Simulink and SOLO Blockset 13

Figure 10 – Control panel for speed control mode

Conclusion

using our Simulink Blockset that is built on top of our C++ DLL you can test and integrate SOLO into your systems rapidly and at the same time take advantage of the vast tools made available to you in Simulink and Mathworks environment.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Share This

Share This

Share this post with your friends!