Professional Documents
Culture Documents
Abstract- Presented in this paper are the results of closed-loop This methodology implies that the real motor drive is
control experiments using a virtual permanent magnet available at the RCP stage of the design process. Furthermore,
synchronous motor (PMSM) drive implemented on a field-
programmable gate array (FPGA) card connected to an external this set-up requires a 2nd drive (such as a DC motor drive) to be
controller. The FPGA-based PMSM motor drive is implemented connected to the motor drive under test to emulate the
on an eDRIVEsim simulator, based on the RT-LAB platform. The mechanical load. This is a complex setup, however it has been
eDRIVEsim simulator implements 2 types of motor drive models, proven to be very effective in detecting problems earlier in the
Park (d-q) and Finite Element Analysis (FEA), on an FPGA card design process.
of the simulator.
The FPGA-based motor model is designed with Xilinx System In cases where a physical drive is not available, or where
Generator (XSG) blockset with no HDL hand coding. Both motor only costly prototypes are available, an HIL-simulated motor
models compute motor currents using a phase-domain algorithm drive can be used during the RCP development stage. In such
solver that can take into account the instantaneous variation of cases, the dynamometer, real IGBT converter and motor are
inductance and non-sinusoidal induced voltage. The FEA-type replaced by a real-time virtual motor drive model. This
model uses inductance and Back-EMF profiles computed with
JMAG-RT. The d-q model uses sinusoidal induced Back-EMF approach has a number of advantages. For example, the
voltage and phase inductance values computed from Ld and Lq simulated motor drive can be tested with borderline conditions
using the well-known Park transformation. A 3-phase IGBT that would otherwise damage a real motor. In addition, setup of
inverter implemented in the FPGA chip drives the PMSM the controlled-speed test bench is simplified since the virtual
machine. shaft speed is set by a single model signal, as opposed to a
The PWM controller is designed using Rapid Control using real bench, where a 2nd drive would need to be used to
Prototyping (RCP) methodology based on Simulink. It is
control the shaft speed.
implemented on an separate RT-LAB system using standard
Opal-RT FPGA-based I/O cards for Analog Input capture and Other advantages of using a virtual motor drive system
PWM generation. include the ability to easily study the impact of motor drive
The paper presents results from the closed-loop control of the parameter variations on the controller itself.
PMSM drive in both current control and speed control modes and
discusses the advantages of using such a virtual test bench for Of course, the fidelity of the motor drive model is an
motor drives. important aspect of this process. Classical models, like the
PMSM single-frame d-q model [1], are often adequate but lack
I. INTRODUCTION some aspects of real motor drives, such as saturation and
inductance variations caused by stator slots. FEA-based models
A critical aspect in the deployment of motor drives lies in handle this limitation well [2][6]. The simulator latency also
the early detection of defects in the design process. The later in adds a delay in the control loop, which may change its
the process that a problem is found, the greater the cost to fix response.
it. Rapid prototyping of motor controllers is one methodology
Finally, most motor drives include high-bandwidth on-board
that enables the control engineer to quickly deploy control
protection that cannot be simulated on conventional RCP
algorithms and find eventual problems. This is typically
systems. For example, a real motor drive may include DC-link
performed using a small real-time simulator called a Rapid
current motoring for short-circuit detection. If this condition is
Control Prototyping system (RCP) connected in closed-loop
detected, IGBT pulses are disabled. Despite a sampling time
with a physical prototype of the drive to be controlled. Modern
below 10 microseconds, a high-performance classical CPU-
RCPs take advantage of a graphical programming language
based HIL simulation [4] is still too slow to simulate these
(such as Simulink) with automatic code generation support.
effects. FPGA-based HIL simulation offers a solution to this
Later in the design process, when this code has been converted
challenge.
and fitted into a production controller (using mass-production
low-cost devices), the same engineer can verify it against the This paper presents examples of closed-loop control tests
same physical motor drive, often a prototype or a pre- using an FPGA-based HIL motor drive controlled by an RCP
production unit. system. The controller (RCP) and motor drive (HIL) are
1077
978-1-4244-1742-1/08/$25.00
c 2008 IEEE
.
connected through I/O only, in the same manner as a real FPGA-coding of the motor drive simulator has posed many
controller and a real drive. The motor drive model will be challenges in comparison to CPU-based implementation of the
either a classical d-q model or a complete FEA-type model. same models [4]. The two main causes of these challenges are
1) fixed-point calculations are used for the model and 2) FPGA
II. ADVANTAGES AND CHALLENGES firmware is not as flexible as regular software. This results in
OF AN FPGA-BASED MOTOR DRIVE SIMULATOR the following model design considerations:
Hardware-In-the-Loop simulation of motor drives is a • Per-Unit scaling: The usage of fixed-point calculation is
proven test method that is used extensively in the industry and enforced by the usage of the XSG blockset. This
is typically conducted using CPU-based real-time requires a careful design of the model. In order for the
simulators[3][7][8]. However, the use of an FPGA processor as model to be adaptable to various motor drive parameters
the computational engine for a motor drive model still presents and ratings, all FPGA calculations are made on a Per-
several advantages over classical CPU-based implementation. Unit basis.
• Very low input-output latency: In some applications, the • Parameter modifications: The capability for conducting
delay between an IGBT gate action and the reversal of on-line parameter modifications is problematic because
the current slope can cause the tested controller to of the firmware nature of FPGA processors. In contrast
behave incorrectly. This is notably the case when the to CPU-based real-time models that allow the
motor current is sampled synchronously with the IGBT modification of all model variables, FPGA-based
gating. The presented models have a computation time models have no such built-in features. The presented
of 300 nanoseconds in addition to an Analog Output rate FPGA-based motor drives are designed so that
of 1 microsecond resulting in a total latency of 1.3 important motor drive parameter modifications do not
microseconds. Faster D/A converters are also available. require the re-generation of an FPGA bitstream.
• Capacity to include on-board drive protections: Many Finally, it is worth mentioning that an FPGA implementation
motor drive boards include fast protection circuits which does not automatically produce more accurate results by the
are not driven by the controller, due to their fast nature. virtue of the use of a small time step (10 nanoseconds). This is
For example, some IGBT driver boards monitor the DC- because of the fixed-point calculation used to compute the
link current or stator neutral point voltage, shutting machine drive equations. Of course, the user can tailor the
down IGBT pulses if abnormal conditions are detected. fixed-point format to meet high precision requirements by
Other boards insert minimal dead-time independently of using larger number formats and FPGA resources. However,
the controller. A complete test scenario for a controller because these resources are limited, there will be some tradeoff
should include its response to these autonomous drive to be made between precision and FPGA resource usage.
board protection circuits. The presented models have In the case of HIL applications, there is always an interface
been used to implement such features. with real-world signals through Analog I/O channels. Since
• Block diagram based coding of the FPGA: The these channels have limited resolution (typically 12 to 16 bits,
proposed model is made with Xilinx System Generator neglecting electrical noise), calculating at a precision higher
(XSG) and therefore requires no HDL (Hardware than that of the communicated signals (i.e. the Analog I/O
Description Language) programming skills, since the quantities) makes no sense. As a result, the trade-off problem is
FPGA code is automatically generated from a Simulink greatly simplified.
block diagram. This enables the engineer to quickly
Back-EMF
(FPGA)
Inductance
Rate= 10 ns
• Smart bandwidth-related task repartition: The
JMAG-RT
Subsystems AIO
(CPU)
Rate=10-100μs
eDRIVEsim simulator enables users to implement
multi-rate and multi-task complex models using FPGA
cards and Intel/AMD compatible computers. Resource RTW RT-LAB Xilinx/ ISE Code Generation
1078 2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008)
.
2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008) 1079
.
the device speed is usually computed from many different executed in real-time on one CPU of the simulator. This
torque sources like, for example, mechanical torque produced dynamic model can then be interfaced with the motor drive on
by the engine in hybrid propulsion cars[3][8]. the FPGA chip.
As for the d-q model, the storage of the nominal speed Back-
F. DC Source and AC fed System
EMF profile of the JMAG model on the FPGA enables the
computation of real Back-EMF voltages by multiplication of In the presented model, the DC-link voltage comes from one
the fixed table stored value by the actual speed. CPU of the RT-LAB simulator. If desired, a more complex
feeding circuit can be implemented, for example a 6-pulse
diode rectifier or a grid equivalent circuit, still computed on the
CPU and interfaced with the FPGA model. This can be done
Inductance and torque using standard Simulink, with or without specialized blocksets,
CPU data pre-computed from PMSM
(Intel/AMD) such as SimPowerSystems and ARTEMIS from Opal-RT
JMAG software
Technologies.
Digital Inputs
i*d=0 v*u,v,w
v'dr
ω* +- PI PWM
6
IGBT
v'qr T-1( θr)
i*q gen inverter
+ +- PI
- PI
iq 3 iabc
Analog Outputs
id T(θr)
Analog Inputs
speed PMSM
controller current controller θr
2
resolver angle decoder N
S
ωr 3
Outputs
Digital
Digital
Inputs
Fig. 5 Motor controller structure and interconnection with the eDRIVEsim PMSM drive
1080 2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008)
.
V. EXPERIMENTAL RESULTS B. Machine Drive Parameters
In this section, we describe the experiments that where The machine under test is a 4 poles (2 pairs) interior magnet
conducted using the FPGA-based PMSM drive (d-q and machine (IPM) with the parameters described in Table 1. The
JMAG) in closed-loop with a motor controller running on a 2nd 800V DC-link voltage is rather high and allows the motor to
independent simulator as a Rapidly Prototyped Controller. operate at 12000 RPM without flux weakening.
Using the set-up and models previously described, current and TABLE 1. MOTOR PARAMETERS
speed control tests were performed. Quantity Value
A. Real-Time Simulator Hardware set-up Stator resistance 3.3 Ω
As previously mentioned, the controller and the motor drive Park equivalent direct inductance 0.0109 H
are implemented on two independent RT-LAB simulators, as Park equivalent quadrature inductance 0.0310 H
depicted in Fig. 6. The controller is running on an MX Station-
type RT-LAB simulator (middle box) with I/O connections on Magnet flux 0.1584 Wb
the back. The MX Station is a 2.3 GHz Core2 Duo-based PC. Number of pair of poles 2
The MX Station I/Os are based on 2 different Opal-RT FPGA Total number of slots 24
cards: the OP5110 (PCI) implements the digital inputs and
Inertia 1.854*10-4 kg.m2
outputs while the OP5130 implements the analog inputs. It is
possible to use OP5110 for analog input, however, the OP5130 Friction 5.396*10-5 N.m.s
is user reconfigurable enabling it to be programmed with a Applied mechanical torque 1 N.m.
closed-loop Resolver-To-Digital model for future studies. The
DC-link voltage 800 V
Digital I/Os are isolated in both systems and the opto-coupler
circuits are powered by the 12V power supply of the RCP. FPGA sample time 10 ns
The motor drive is running on the eDRIVEsim RT-LAB CPU sample time 65 μs
simulator (bottom box). The eDRIVEsim simulator is a 2.3 Quadrature encoder 1024 pulses/channel
GHz dual quad-core (Intel Core2) PC with an onboard FPGA
card (Opal-RT OP5130). The FPGA card holds the machine C. Controller Parameters
and inverters models for both d-q and JMAG-type models. One The controller parameters used in these tests are enumerated
core of the PC computes the machine electrical torque with the in Table 2. The reference Id value is set to 0 in all tests as no
mechanical equations as well as the inductance values in the flux weakening is made. The Vdq limits are really the entry to
case of the JMAG model. the dq-abc transform that produce the modulation indexes for
A console PC (not shown) completes the simulator set-up all phases and are therefore limited to ±1. All PI controllers
and enables the control and monitoring of the real-time have anti-windup mechanisms.
systems themselves. All of these are connected together by an TABLE 2. CONTROLLER PARAMETERS
Ethernet switch (top box of Fig. 6) Quantity Value
Current controller Ki Kp/Ki gains 22.7 0.0017
Vdq limits (from current controller) ±1 pu
Speed controller Ki Kp/Ki gains 3.5 0.026
(except section E)
Iq limits (from speed controller) ±9.5 A
PWM frequency 5 kHz
Dead time 5 μs
Sample time 50 μs
2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008) 1081
.
D. Current control mode tests the one following the current amplitude. Nevertheless, the
One great advantage of a virtual motor drive test bench over difference between the d-q and JMAG models is quite modest.
a real one is ease of the hardware set-up. This becomes even It seems that the dead-time is causing a greater impact than the
clearer when one tries to test motor current control loops. In effects of non-ideal Back-EMF and inductances.
this case, with a real bench, one really needs two motor drives: The two figures actually display two acquisition frames
the PMSM drive itself and a second motor drive to control the acquired at the Windows console station of the RCP. This
shaft speed. With a virtual bench, one simply has to set the means that there is a time discontinuity in the figures. In Fig. 7
shaft speed state-variable to the desired speed! for example, the two frames begins at 4.25 and 4.37 sec. Since
the command is applied asynchronously from the motor drive,
this enables verification of the drive response relative to the
motor rotor angle at the time of the command application. The
results of Fig. 7 and Fig. 8 show that the controller response
does not depend on the motor angle.
1082 2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008)
.
CONCLUSION
JMAG models respectively, for a speed command step of 1000 This paper has presented experimental results of a motor
to 3000 RPM. The responses are again very similar. Both controller connected to a virtual motor drive. The controller
figures show two consecutive acquisition frames. It is was designed in Simulink and implemented on a RT-LAB RCP
interesting to see that because of the asynchronous speed step system. The motor drive was also designed in Simulink, and
application, the phase current responses differ from one frame implemented on an FPGA processor using Xilinx System
to another mainly because of the initial conditions of the motor Generator blockset. Both PMSM standard d-q and FEA-
at each application of the speed command steps. computed models were used for the tests.
Again, there is not a great difference between d-q and JMAG The control was successfully tested in closed-loop for both
model results. Tests on a drive with smaller inertia may reveal current and speed control modes using the eDRIVEsim real-
a greater sensibility of the drive to cogging torque. time plant simulator. The closed-loop set-up has been simply
and successfully used to tune a controller for stability.
F. HIL application: Speed Controller tuning using batch test
The results show certain corroboration between JMAG and
The controllers used in this experiment are rather simple but
d-q-type model simulation cases, as their responses are similar.
nevertheless have non-linearities like saturations. Because
This does not mean that increased precision of FEA models is
these effects are hard to account for by regular control theory, a
not needed, but rather that the test cases presented were not
thorough batch test procedure is often necessary to validate a
chosen to highlight the benefit of high-accuracy finite-element-
controller against the various control scenarios and
based models. Tests with a partially saturated machine and/or
contingencies of the motor drive.
with smaller inertia should demonstrate the usefulness of FEA
PI controller tuning is one good example of batch tests using models.
a real-time simulator. In this case, a set of speed commands is
By using a virtual motor drive, as the one presented here,
applied to the motor drive for various PI control gain values.
early in the design process, it is expected that algorithm errors
Results are analyzed for the best set of PI parameters. Fig. 11
can be pinpointed earlier by the control engineer and thus
shows that some instability results from a large speed
produce a more efficient design methodology. Leading power
command step (8000 to 12000 RPM). It was found that
electronic equipment and hybrid vehicle manufacturers now
dividing the Kp gain of the speed controller by 3 stabilizes the
successfully use such design methodology.
response of the motor. One can notice that the current
commands are identical in the first 20 milliseconds but diverge REFERENCES
after. This divergence is most likely caused by a saturation or
[1] C. Dufour, S. Abourida, J. Bélanger,V. Lapointe, “Real-Time Simulation
anti wind-up action in the speed control: referring to Table 2, of Permanent Magnet Motor Drive on FPGA Chip for High-Bandwidth
the controller Iq limit is set to ±9.5A. Controller Tests and Validation”, 32nd Annual Conference of the IEEE
Industrial Electronics Society(IECON-06), Paris, France, November 7-
10, 2006.
[2] C. Dufour, J. Bélanger, S. Abourida, V. Lapointe, “FPGA-Based Real-
Time Simulation of Finite-Element Analysis Permanent Magnet
Synchronous Machine Drives”, Proceedings of the 2007 Power
Electronics Specialists Conference (PESC-07), Orlando, Florida, June
17-21, 2007
[3] C. Dufour, T. Ishikawa, S. Abourida, J. Bélanger, “Modern Hardware-In-
the-Loop Simulation Technology for Fuel Cell Hybrid Electric
Vehicles”, Proceeding of the 2007 IEEE Vehicle Power and Propulsion
Conference (VPPC-07), Arlington, Texas, Sept. 9-12, 2007
[4] M. Harakawa, H. Yamasaki, T. Nagano, S. Abourida, C. Dufour, J.
Bélanger, “Real-Time Simulation of a Complete PMSM Drive at 10 us
Time Step”, Proceedings of the 2005 International Power Electronics
Conference (IPEC 2005) – April 4-8, 2005, Niigata, Japan.
[5] G.G. Parma, V. Dinavahi, “Real-Time Digital Hardware Simulation of
Power Electronics and Drives”,Transactions on Power Delivery, Vol 22,
No. 2, April 2007
[6] O. A. Mohammed, Fellow IEEE, S. Liu, Member IEEE, and Z. Liu,”A
Phase Variable PM Machine Model for Integrated Motor Drive
Systems”, 35th Annual IEEE Power Electronics Specialists Conference,
Aachen, Germany, 2004, pp. 4825-4831
[7] L.-F. Pak,, V. Dinavahi, G. Chang, M. Steurer, P.F. Ribeiro, “Real-Time
Digital Time-Varying Harmonic Modeling and Simulation Techniques”,
Fig. 11 Speed control PI tuning results (JMAG model) IEEE Trans. On Power Delivery Vol.22. No. 2, April 2007.
[8] D. Winkler, C. Gühmann, “Hardware-in-the-Loop simulation of a hybrid
electric vehicle using Modelica/Dymola” Proceedings of the 22nd
International Battery, Hybrid and Fuel Cell Electric Vehicle Symposium
(EVS-22), Yokohama, Japan, Oct 22-26 2006, pp 1054-1063.
2008 13th International Power Electronics and Motion Control Conference (EPE-PEMC 2008) 1083