
Sensorless Vector Control for Permanent Magnet Synchronous Machine
1 Overview
This RT Box demo model features a drive system with a permanent magnet synchronous machine
(PMSM). The following sections describe in detail the implementation of the power stage and controls
using the PLECS Electrical and Control domains. This demo model has the following features:
• The drive outputs a nominal torque of 0.11 Nm and is fed by a 24 V DC voltage source.
• Explanation how to convert data sheet parameters of a PMSM to use in the PLECS PMSM model.
• The implementation of a rotor position and speed observer for sensorless field oriented control strat-
egy.
• A closed-loop cascaded controller with inner d- and q- axis current controller and outer speed con-
troller.
• The model is split into two distinct subsystems called “Plant” and “Controller”. This allows the same
model to be used in an offline simulation in PLECS and for real-time simulations on the PLECS RT
Box. These subsystems can then be independently built on the PLECS RT Box either for Hardware-
in-the-loop (HIL) testing of an external controller, or for rapid control prototyping (RCP). The two
RT Boxes are connected for a complete closed-loop simulation.
The following sections provide a detailed description of the model and instructions on how to simulate
it.
The execution time represents the actual time it takes to execute one calculation step of the PLECS
model on the RT Box hardware. The chosen discretization step sizes and average execution times for
each subsystem in this demo model are shown in Fig. 1.
0.0 2.5
Time ( s)
RT Box 1
RT Box 2/3
80%
72%
Plant
0 50
Time ( s)
3%
3%
Controller
Execution Time
Disc. Time-Step
Figure 1: performance overview for the execution on two RT Boxes
1.1 Requirements
To run this demo model, the following items are needed (available at www.plexim.com):
• Two PLECS RT Boxes and one PLECS and PLECS Coder license
• The RT Box Target Support Library
• Follow the step-by-step instructions on configuring PLECS and the RT Box in the Quick Start guide
of the RT Box User Manual.
• Three 37 pin Sub-D cables to connect the boxes front-to-front.
Note that this demo model is targeted at two RT Boxes application, with one running the Plant and
the other running the Controller. In this way, the execution time of each real-time target is minimized.
Besides, the setup can easily transition to a HIL or RCP test later on.
However, if the user has only one RT Box available, please check the corresponding models targeted
for one RT Box application. In this case, two 37 pin Sub-D cables are still needed to connect in front
Analog Out interface with Analog In interface, and Digital Out interface with Digital In interface.
• For RT Box 2 and 3, by default the multi-tasking feature is enabled in this demo. “Controller” part
is circled with a Task frame block, and runs in one core. The rest of the circuit on the schematic be-
longs to the “Base task”, and runs in another core. In this way the computational effort is split onto
different cores. Please check the default setting under Scheduling tab of the Coder options... win-
dow.
www.plexim.com 1