Building a Hardware-in-the-Loop Real-Time Simulation Platform for PMLSMs

"Using the LabVIEW Real-Time and LabVIEW FPGA modules and CompactRIO for our platform, we constructed an HIL real-time simulation platform for PMLSM in half the time it takes to construct a traditional platform."

- Zhenbin Wang, Shanghai Electric Group Co. Ltd

The Challenge:

Rapidly developing a hardware-in-the-loop (HIL) real-time simulation system for Permanent Magnet Linear Synchronous Electric Motors (PMLSMs) to reduce improper operation and accidents.

The Solution:

Using NI LabVIEW and CompactRIO to successfully construct an HIL real-time simulation platform for PMLSMs that saves costs, shortens development, and decreases risks of operator error.

PMLSMs are widely popular in industrial, civil, and military applications due to their exceptional performance, ability to maintain high-speed, and their high degree of accuracy and rigidity. High-speed linear motion elements driven by the linear motor eliminate the intermediate gear link between the servo motor and the work bench, which reduces the transmission chain to zero – termed “zero transmission.” This type of transmission simplifies the system structure and improves speed, acceleration, flexibility, rigidity, and accuracy of the linear motion element.


Well-known machine manufacturers including Siemens and Fanuc use linear transmission without exception in their high-end products to increase precision and manufacturing efficiency. Because they require no electric excitation and have advantages such as high-thrust force density and high efficiency, PMLSMs represent a major trend in developing linear motors.


However, compared with traditional rotating motors with ball screw assembly, experiments with linear motors have proven difficult and dangerous. Unlike traditional rotating motors, the magnetic circuit of linear motors is open and there is no mechanical transmission buffer between load and motor. Improper operation can cause galloping, which can result in injury or property damage.


For this reason, developing an HIL real-time simulation platform for PMLSMs is critical. The rapid and successful construction of such a platform allows for preverification of the linear motor’s control algorithm, which makes it easier to detect potential errors and reduces the cost of debugging, shortens the debugging time, and decreases the risk of accidents.




We built the HIL real-time simulation platform for the PMLSM using LabVIEW and CompactRIO in a relatively short period of time. We used the vector control algorithm to implement closed-loop control of either three loops (position, velocity, and current) or two loops (velocity and current). The platform can simulate a variety of working conditions of PMLSMs, tracking velocity, and given position signals rapidly without error.


Programming the system with LabVIEW, CompactRIO, and NI high-speed digital and analog acquisition modules, the maximum current sampling frequency reached 20 kS/s (period of 50 µs), higher than the current sampling frequency of the Kollmorgen linear motor driver, which is 16 kS/s (period of 62.5 µs).


In addition, we can rapidly track the given position and velocity signals without error according to position and velocity output from the system, in which micron-level accuracy can be achieved. The parameter of the controller and the load of the linear motor can be adjusted online with results similar to those of the Kollmorgen system. Main function modules include those for parameter configuration, linear motor controller simulation, graphic display, and data logging and analysis. Figure 1 provides an illustration of the platform.



Additional modules we configured include the following:


Parameter configuration module: We use the parameter configuration module to configure the parameters of the motor, including load factor, viscous friction coefficient, DC link voltage, and sampling frequency as well as initial parameters for the controller. We use the NI cRIO-9074 and cRIO-9004 real-time controllers.


Linear motor model simulation module: We implement a mathematic model and motion equation to simulate the actual operation of the linear motor and transfer all data obtained from the motor to the linear motor model simulation module. Using the NI 9264 analog output module, we calculate signals such as acceleration, velocity, displacement, and electric angle based on the linear motor equation. Signals that contain phase currents, velocity, displacement, and electric angle are transferred to the linear motor model simulation module. We seamlessly developed this part of the system with CompactRIO. The block diagram in Figure 2 depicts the subprogram.


Linear motor controller simulation module: This module contains two subprograms – one with three loops close-loop control and the other with two loops close-loop control. Using analog acquisition boards from NI, we obtain the linear motor position, electric angular velocity, two phase currents of linear motor, and velocity. According to given position signals and feedback position signals, the deviation value is calculated and sent to position loop PI regulator with the output given as the velocity signal. We developed this functionality in the cRIO-9074 field-programmable gate array (FPGA).



Graphic display module: This module displays in real-time the displacement, velocity, three-phase current, position angular, and PWM wave curve of the linear motor. Using first in, first out (FIFO), we implemented real-time data interchange between the FPGA of the linear motor model simulation module and the linear motor controller simulation module to the cRIO-9004 real-time controller.


Data record and analysis module: Using the cRIO-9074/cRIO-9004 real-time controller, this element of the system analyzes the current of the linear motor and voltage harmonics distribution, providing a basis for further optimizing the algorithm.



Using the LabVIEW Real-Time and LabVIEW FPGA modules and CompactRIO for our platform, we constructed an HIL real-time simulation platform for PMLSM in half the time it takes to construct a traditional platform. Successful development of this platform has enabled preliminary testing of PMLSMs under hardware loop condition, and ultimately saved costs, shortened our development period, and decreased the possibility of accidents.


Author Information:

Zhenbin Wang
Shanghai Electric Group Co. Ltd

Figure 1. The PMLSM HIL Real-Time Simulation Platform
Figure 2. Block Diagram of PMLSM Model Simulation Subprogram
Figure 3. Block Diagram of PMLSM Position Loop Control Subprogram
Figure 4. Front Panel of PMLSM Position Loop Control Subprogram