Vous êtes sur la page 1sur 5

Real-Time Simulation using PC-based Kernels

Fabian M. Uriarte Karen L. Butler-Purry

Student Member, IEEE Senior Member, IEEE

 Traditionally, system modeling in real-time has depended

Abstract—National Instruments and The MathWorks, Inc. on dedicated hardware serving as the real-time engine, target,
make PC real-time simulation possible with the use of real-time or devoted processor. These real-time engines typically vary
kernels. In this work, a small three-phase radial power system is from DSP processor boards [3-7], PC-based clusters [8-10],
modeled and simulated using these real-time environments to FPGA processor boards [11] or specialized target boxes [12,
determine the feasibility, accuracy, and determinism of boot- 13] and are normally limited to small plants. The use of
loaders as an alternative to costly real-time simulators for
stand-alone PCs in the past, too, has limited the ability to
smaller systems. Implications and modeling methodologies of
simulating the power system in real-time using PCs are discussed model power systems in real-time due to processor speed and
providing a discussion at the end comparing both products for memory size unless the schematics were of simple to moderate
the interested public. complexity [14]. Instead, the role of the PC has traditionally
been to serve as the graphical user-interface depending on
Index Terms—GRT, ETS, matlab, NI, PC, PXI, power, real- external hardware to produce the real-time simulation.
time, simulink, system, xPC In this work we intend to provide with a comparison of two
different PC-based real-time simulation schemes and give an
I. INTRODUCTION idea of when a PC may start to overload when used as a real-
time simulator. The two real-time kernels by National
T he use of real-time simulators is increasingly becoming
more popular as hardware-in-the-loop prototyping has
proven as a reliable design tool, a decrease in time to
Instruments (NI) and The MathWorks, Inc are investigated by
modeling a small radial three-phase power system. In section
market products, and as a safe low-cost experimental II, a description of the radial power system model is given,
alternative to potentially damaging equipment. However, the including load and component information. In section III, the
modeling of complex systems in real-time can limit the ability real-time environment is described providing information
of processors to respond deterministically. For instance, when about the products reviewed, their implementation
power systems containing a large number of differential implications, and requirements to run. In section IV three
elements, switches, non-linear elements, or machines as it is in case studies show the mismatches (if any) of the real-time
common practice, are attempted to run in real-time, the simulation output, and in section V a comparative table
processor can easily overload. This is due, in part, by the summarizes the important aspects of implementation of these
rather large system matrices, number of switches forcing kenel-based real-time simulators.
topological changes, small step-size, and finite processor
speed and memory availability. If the real-time simulation II. POWER SYSTEM MODEL
cannot solve for the unknowns within the allocated time-step The power system modeled is small-scale distribution
ǻt, the simulation cannot be considered successful. Data feeder at Drexel University (DU) and is represented by Fig. 1.
logging also plays an important role as it must occur after the The system consists of a visible disconnect switch (main
system’s solution but before ǻt elapses. One way to get breaker), an autotransformer serving for isolation and voltage
around the large real-time burden’s that computers face when regulation, two parallel transmission lines, and three loads.
modeling complex systems is to use faster and costly real-time The loads were a 5HP induction motor loaded to 10N-m, a
simulators [1, 2]. A downside, though, with an investment of light-bulb bank, and a series-connected inductor cart. The
this magnitude is the uncertainty of the vendor in defining the transmission line, light-bulb bank, and inductor cart all have
limit of the system that can be modeled in real-time. Instead,
switches that can change their effective impedance.
vendors normally provide with example networks that are
Information about the loads can be found in Table 1 and Table
known to work. The end-user then has to asses whether the
example network is comparable in burden to the one intended
to be modeled.

This work was supported in part by the Office of Naval Research (ONR)
grant # N0014-01-1-0760.
F. M. Uriarte and Karen L. Butler-Purry are with the Power System
Automation Lab of the Electrical and Computer Engineering Department at
Texas A&M University (e-mail: fabian@tamu.edu, klbutler@ee.tamu.edu,
URL: http://psalserver.tamu.edu).

1­4244­0178­X/06/$20.00 ©2006 IEEE 1991 PSCE 2006

schemes: two by The MathWorks, Inc. (1.GRT, real-time
simulation in Windows and 2.xPC, a boot-loader real-time
kernel) and one by NI (ETS, a boot-loader real-time kernel).
A detailed description of each of these now follows.
The MathWorks, Inc. makes a fast-prototyping real-time
simulation target called the GRT for use on a host-PC (a
target-PC is not required). The GRT allows a computer
running MATLAB/SIMULINK® to temporarily isolate the
operating system from background processes and carry a real-
time simulation in Windows. As can be expected, in lieu of
Fig. 1. Single-phase representation of power system the operating system and running background processes, not
modeled offline and in real-time using targets GRT, xPC, much available processor power is available for a
and ETS. deterministic real-time simulation. Further, system interrupts
are not completely isolated during a GRT run. Therefore
PER NUMBER OF LIGHT BULBS IN PARALLEL using this target for real-time simulations is limited to models
Bulbs 5 10 20 30 40 50 60 of simple complexity or models in which network
R (Ÿ) 41.808 22.726 12.934 8.9825 7.10625 5.88125 5.035
reductions/optimizations can be afforded.
Previous work [17] showed that a power system of about
FOR ALL TAP SETTINGS (ROWS REPRESENT PHASES ABC) 90 states and 70 switches could be reduced to achieve a real-
Tap Tap Tap Tap Tap time simulation in Windows. The reductions included
1 2 3 4 5
1.45+j11.84 3.37+j23.18 4.65+j34.4 6.78+j45.11 9.92+j56.44 removing unused switches, removing system islands (groups
1.49+j11.95 3.14+j23.14 5+j34.48 6.55+j45.32 9.39+j56.7 of elements behind open switches), and forming equivalent
1.35+j11.94 2.96+j23.39 4.73+j34.59 6.36+j45.35 9.24+j56.73
impedances where possible. An advantage of the GRT is that
it allows for time-steps not achievable (for our model’s size)
with boot-loaders. With the GRT, a real-time simulation best
of ǻt=50µs was possible though ǻt=750µs was used during
The Real-Time Workshop® (RTW) by The MathWorks, this study to match it to the boot-loader real-time simulations.
Inc. [15] allows power system models built with the The advantages of the GRT are its fast implementation for
MATLAB/SIMULINK SimPowerSystems® library [16] to be prototyping, small ǻt, one PC requirement, that it runs under
compiled into machine language. The resulting code can Windows, and its free cost (ships with the RTW). Some
then be embedded in any of the targets made available by the disadvantages include its reduced determinism, small model
RTW (the term ‘target’ refers to the destination processor size limitation, lack of TCP/IP communication, interaction,
where the compiled code executes). The three targets tested in and parameter tuning during run-time. The settings used for
this work are (as listed in the RTW’s options) ‘grt.tlc’, the GRT simulation are listed in Table 3.
‘xpctarget.tlc’, and ‘nidll.tlc’.
Both companies The MathWorks, Inc. and NI make TABLE 3 - GRT’S REAL-TIME SIMULATION SETTINGS
available boot-loader real-time kernels that convert standard Step type Fixed
Solver type Ode5 (Dormand-Prince)
off-the-shelf PCs into real-time simulators. The reviewed
Simulation type Discrete
products by The MathWorks, Inc. are the Generic Real-Time Step size 750µs
Target (GRT) and xPC Target (xPC). The GRT is not a boot- Periodic sample time constant Unconstrained
loader, but instead a way of running real-time simulations Fixed step-size Auto
(fundamental sample time)
under Windows and is used in this work as an additional
Tasking mode Auto
comparison. xPC takes a standard off-the-shelf-PC and for periodic sample times
converts it solely into a real-time simulator by loading a real- Real-time target grt.tlc
time operating system kernel from a floppy disk; this machine C compiler MS Visual C/C++ 6.0
is commonly referred to as the target-PC. Then, with the use
of another PC (a host-PC), one can embed simulations onto B. xPC Target
the target-PC, command simulations to start and stop, and
xPC Target is a boot-loader real-time kernel that transforms
observe the results during or post-simulation. The product by
a standard off-the-shelf PC into a dedicated real-time
NI is similar to xPC, a boot-loader real-time operating system simulator. The boot-loader starts-up a PC using the xPC
kernel called Venturcom Phar Lap Embedded Tool Suite Target real-time operating system through a floppy disk
(ETS). ETS is actually made by a 3rd party company but is ensuring devoted processing power since Windows is not
partially supported and made available through NI. loaded. The simulation settings of the xPC environment are
The real-time environments used here, then, consist of the given in Table 4. As listed under xPC Target Mode, the
comparison between and 3 different real-time simulations polling option was chosen. The polling mode of xPC is a

primitive (or brute-force) mode of operation that is designed accomplish. The data from the real-time runs was logged to a
to execute target applications at samples times close to the delimited .TXT file. Although a smaller ǻt was possible with
limit of the CPU, interrupt-free, accurately, and with neither ETS, it was matched to xPC’s for comparison purposes to
overflow nor latency [18]. The advantage of this mode of compare equal time steps.
operation is its determinism for complex models such as DSP,
control, or power applications while its main disadvantage is IV. CASE STUDIES
that it shuts down all communication (tuning and data display) To determine the validity of the results in real-time, offline
during run-time. Polling mode was only used because the simulation results with variable ǻt using the ode23t solver
model was large and streaming real-time data was not of were used for comparison. The offline, xPC, and ETS
interest. simulations were able to simulate the system of Fig. 1 as a
whole while GRT required the optimizations noted. A table
xPC Target 2.6.1 comparing the whole and reduced-sized models is given in
C compiler MS Visual C/C++ 6.0 Table 5.
Max Model Size 1MB
Target Scope Enabled Whole Reduced
Target Mouse None (Offline, xPC and ETS) (GRT)
TCP/IP Target Driver I82559 States* 85 10
TCP/IP Bus Type PCI Inputs 71 11
Step type Fixed Outputs 74 14
Solver type Ode5 (Dormand-Prince) Switches 66 6
Simulation type Discrete *MATLAB/SIMULINK® uses a state-space based instead of nodal-based realization for the
Step size 750µs system’s solution
Execution Model Real-Time A. Cas e A
Real-Time interrupt source Timer
xPC Target Mode Polling The first study produced transients during system startup by
TLC Option -axpcCPUClockPoll=1700 closing and re-opening the master breaker. The observable
variable was the line voltage at the receiving-end as shown in
Fig. 2. During steady-state no differences were noted between
any of the four curves but during the master breaker’s
Made available by NI while produced by [19], ETS switching times, small transient differences are picked up by
converts a PC into a real-time simulator. The principle is the offline simulation but not by the fixed-step schemes (these
similar to xPC Target’s, except that ETS requires a secondary are shown encircled). For the study in question, the offline
FAT32 / IDE hard-drive (not so common anymore) to log data results are considered correct since produced under variable
and receive files from the host-PC. The target-PC is treated as step simulation conditions using the entire schematic as shown
a PXI device by NI and thus requires additional software to be in Table 5. Even though the GRT schematic was of different
installed on it such as NI-VISA Server and LabVIEW’s Real- size, it didn’t produce major differences in regards to xPC and
Time Module for communication purposes. Also, a boot-disk ETS in this case. The major differences in this case were
for a PXI device must be created to boot the target-PC. The produced by switching (a color printout is recommended to
communication from the host-PC to the target-PC is via distinguish the traces).
TCP/IP and has a more complete settings user-interface
(called Measurement and Automation Explorer or MAX) for B. Case B
file management than xPC Target’s (called xPC Explorer). A The second case disconnected all loads from the receiving-
product by NI called the Simulation Interface Toolkit (SIT) is end bus and observed the line voltage as shown in Fig. 3. No
required to make possible the connection between a differences in steady-state were observed either and only a
LabVIEW’s virtual interface (VI) Simulink models. When minor under-shoot in Vab at the time of disconnection was
the SIT is installed on the host-PC, it adds a target to the RTW noticed. During the exponential decay, the fixed-step schemes
appearing as ‘nidll.tlc’. When selected, the Simulink model is loss some phase accuracy in Vab while in the other phases it
compiled into a .DLL file which is then embedded onto the was not noticed as much. Overall, the results are in good
target-PC; in this case the target-PC running ETS. One can agreement. The GRT even with its optimized model didn’t
use the original LabVIEW interface associated (via SIT) with show any differences in transient realm either. xPC and ETS
an offline power system model in Windows to interact with produced identical results again.
the real-time simulation in ETS; this is one of the main
C. Case C
attractions of ETS.
The logging of data by ETS can be streamed to the VI The third study starts with the master breaker closed and
controlling the real-time simulation without loss of shows the steady-state load bus current. Transients are
determinism by using RT-FIFO programming techniques [20]. produced by switching the inductor cart from tap 4-to-1 at
These techniques create timed priority loops that allow the t=0.8s and switching the light-bulb bank from tap 5-to-7 at
processor to write data, if possible and when available, by t=0.85s. All simulations produced identical results. The only
giving priorities to certain events. A problem with this is that difference was a small overshoot in phase a’s current during
it requires somewhat advanced LabVIEW understanding to the offline simulation; steady-state and transient results shown

good agreement. noticed. A table comparing these facts and other important
facts is presented in Table 6.

Fig. 2. Case A – Start-up receiving-end line voltage when

the master breaker is closed and re-opened (differences
enclosed). Fig. 4. Case C - Line current when switching inductor cart
from tap 4-to-1 at t=0.8s and light-bulb bank from tap 5-
to-7 at t=0.85s (differences enclosed).
Characteristic GRT xPC ETS
Determinism Poor Best Good
ǻt Smaller Largest Larger
Simulink model size Smaller Larger Largest
TCP/IP streaming No Yes Yes
Allows run-time No Yes/No* Yes
parameter tuning
Hardware-in-the-loop No Yes Yes
Transient and phase Ok Ok Ok
Level of implementation Easier Moderate Harder
CPU overload warning No Yes No
Data logging, to: MATLAB MATLAB .TXT file
workspace workspace
Fig. 3. Case B -Receiving-end line voltage when Real-time environment None Good (xPC Better (MAX)
disconnecting all loads at once (noted differences are manager friendliness and Explorer)
enclosed). (name)
Software req’d (in None xPC Target LabVIEW, SIT,
The GRT used a simplified model of the system. The addition to RTW) VISA, RT-Module,
simplifications included using equivalent impedances and ETS
removing elements behind open switches. xPC and ETS Will run even if not in Yes No No**
simulations used the whole model including all switches, used real-time
and unused, and all possible differential elements. One of the Number of PCs required 1 2 2
*parameter tuning not available in polling mode
advantages of using xPC is its true determinism; the fact that it **Real-time FIFO VI’s required, else simulation may run in non-real time without
takes the same amount of time to simulate every time and that warning
it wont simulate if it cant guarantee a solution and logging in
<ǻt. With the GRT, it depends on what other applications are
running and the system’s available resources at the time of V. CONCLUSIONS
simulation. Without simplifications, the GRT could not Modeling implications, methodology, comparison and
produce results in real-time. Consistent real-time simulation results have been discussed by modeling a small-scale
times with GRT are not always guaranteed but on the other distribution feeder on an off-the-shelf PC using The
hand it has potential for a better time-step resolution than xPC MathWorks, Inc. and NI’s real-time kernels. For the use of
(as low-as 50µs was achievable with GRT). xPC and ETS are GRT, it was known beforehand that real-time simulations
able to model larger power systems than the GRT but with could not be guaranteed on host computers running Windows;
larger ǻt. A compromise between model- and step-size was nevertheless optimizations simplified the schematic a point
where the described hardware returned real-time results. On

the other hand, real-time simulations with xPC and ETS were [13] P. S. Shiakolas and D. Piyabongkarn, "On the development of a
real-time digital control system using xPC-Target and a magnetic
achieved without simplifications running on an external stand-
levitation device," presented at Decision and Control, 2001.
alone machine where it was devoted full processing power. Proceedings of the 40th IEEE Conference on Volume 2, 4-7 Dec.
As of this work, it has been shown that a conventional PC 2001 Page(s):1348 - 1353 vol.2, 2001.
alone still lacks the power to model larger power systems in [14] B. A. Guvenc, B. Sencer, M. Giray, and L. Guvenc, "Use of a
real-time due to the small step size requirement and large simulink engine blockset in real time hardware in the loop
simulations," presented at Mechatronics, 2004. ICM '04.
schematic size. It is true that PCs can handle real-time Proceedings of the IEEE International Conference on 3-5 June
simulations of a power system as shown in this work, but it is 2004 Page(s):410 - 414 2004.
recommended that they still be smaller plants of about the [15] MathWorks Inc., REAL-TIME WORKSHOP: for use with simulink:
shown network, sections of bigger plants, and limited to the getting started: version 6. Natick, MA: MathWorks, 2005.
[16] MathWorks Inc., SIMPOWERSYTEMS: for use with simulink:
use of equivalent networks where possible. Also the use of version 4. Natick, MA: MathWorks, 2005.
stand-alone or dedicated hardware is recommended when [17] F. M. Uriarte and K. L. Butler-Purry, "Real-Time Simulation of a
available For larger and more complex power system Small-Scale Distribution Feeder Using Simulink and a Single PC,"
models, costly real-time simulators or PC clusters [10] must presented at NAPS (North American Power Symposium), Iowa
State University, 2005.
still be used. Nevertheless, in all cases, the steady-state result [18] MathWorks Inc., xPC TARGET: for use with real-time workshop:
was the same. Generally speaking, the results are in good user's guide version 2. Natick, MA: MathWorks, 2005.
agreement and the feasibility of using PCs for real-time [19] [online] Ardence (formerly VenturCom), http://www.ardence.com.
simulations of smaller-size power systems was confirmed as [20] National Instruments, LabVIEW Real-Time Model User's Manual.
Austin, TX: National Instruments, 2004.
shown in this study.

[1] [online] Opal-RT RTEES, http://www.opal-
[2] [online] RTDS, http://www.rtds.com.
[3] C. D. French and P. P. Acarnley, "Simulink real time controller
implementation in a DSP based motor drive system," presented at
DSP Chips in Real Time Measurement and Control (Digest No:
1997/301), IEE Colloquium on 25 Sept. 1997 Page(s):3/1 - 3/5,
[4] C. D. French, J. W. Finch, and P. P. Acarnley, "Rapid prototyping
of a real time DSP based motor drive controller using Simulink,"
presented at Simulation '98. International Conference on (Conf.
Publ. No. 457) 30 Sept.-2 Oct. 1998 Page(s):284 - 291, 1998.
[5] A. G. Jack, D. J. Atkinson, and H. J. Slater, "Real-time emulation
for power equipment development. I. Real-time simulation,"
Electric Power Applications, IEE Proceedings, vol. 145, pp. 92,
[6] H. J. Slater, D. J. Atkinson, and A. G. Jack, "Real-time emulation
for power equipment development. II. The virtual machine,"
Electric Power Applications, IEE Proceedings, vol. 145, pp. 153,
[7] R. Crosbie, J. Zenor, R. Bednar, D. Word, N. Hingorani, and T.
Ericsen, "High-Speed, scalable, real-time simulation using DSP
arrays," presented at Parallel and Distributed Simulation, 2004.
PADS 2004. 18th Workshop on 16-19 May 2004 Page(s):52 - 59
[8] M. Basso and G. Bagni, "ARTIST: a real-time interactive
Simulink-based telelab," presented at Computer Aided Control
Systems Design, 2004 IEEE International Symposium on 2-4 Sept.
2004 Page(s):196 - 201, 2004.
[9] C. Dufour and J. Belanger, "A PC-Based Real-Time Parallel
Simulator of Electric Systems and Drives," presented at Parallel
Computing in Electrical Engineering, 2004. International
Conference on 7-10 Sept. 2004 Page(s):105 - 113, 2004.
[10] J. A. Hollman and J. R. Marti, "Real Time Network Simulation
With PC-cluster," IEEE Transactions on Power Systems, vol. 18,
pp. 563-569, 2003.
[11] M. Matar, M. Abdel-Rahman, and A. Soliman, "Developing an
FPGA coprocessor for real-time simulation of power systems,"
presented at Electrical, Electronic and Computer Engineering,
2004. ICEEC '04. 2004 International Conference on 5-7 Sept. 2004
Page(s):791 - 794 2004.
[12] F. C. Teng, "Real-time control using Matlab Simulink," presented
at Systems, Man, and Cybernetics, 2000 IEEE International
Conference on Volume 4, 8-11 Oct. 2000 Page(s):2697 - 2702
vol.4, 2000.