You are on page 1of 11

<BACK

JIM A. LEDIN
f e a t u r e

Hardware-in-the-Loop
Simulation
Hardware-in-the-loop (HIL) simulation is a technique for performing system-level testing of embedded systems
in a comprehensive, cost-effective, and repeatable manner. This article provides an overview of the techniques of
HIL simulation, along with hardware and software requirements, implementation methods, algorithms, and rules
of thumb.

S
ystem level testing is one of the major expenses for performing system-level testing of embedded systems in
in developing a complex product that incorpo- a comprehensive, cost effective, and repeatable manner.
rates embedded computing. The need to mini- HIL simulation is most often used in the development and
mize time to market while simultaneously pro- testing of embedded systems, when those systems cannot be
ducing a thoroughly tested product presents tested easily, thoroughly, and repeatably in their opera-
tremendous challenges. Increasing levels of com- tional environments.
plexity in system hardware and software are making this HIL simulation requires the development of a real-time
problem more severe with each new generation of prod- simulation that models some parts of the embedded system
ucts. Additionally, any significant changes made to an exist- under test (SUT) and all significant interactions with its
ing product’s hardware or software must be thoroughly operational environment. The simulation monitors the
regression-tested to confirm that the changes do not pro- SUT’s output signals and injects synthetically generated
duce unintended effects. input signals into the SUT at appropriate points. Output
Embedded computing is becoming more pervasive in signals from the SUT typically include actuator commands
systems that are safety-critical, which makes the need for and operator display information. Inputs to the SUT might
thorough testing even more acute. Clearly, there is an include sensor signals and commands from an operator.
urgent need to accelerate and automate system-level testing The outputs from the embedded system serve as inputs to
as much as possible within the constraints of test system cost the simulation and the simulation generates outputs that
and development effort. become inputs to the embedded system. Figure 1 shows a
Hardware-in-the-loop (HIL) simulation is a technique high-level view of an example HIL simulation.

42 FEBRUARY 1999 Embedded Systems Programming


The HIL simulation test concept can be applied to a wide variety of
systems, from relatively simple devices such as a room temperature
controller to complex systems like an aircraft flight control system.

In the figure, the SUT is represent- product development phase, HIL sim- ment. This step can be performed
ed as having interfaces to sensors and ulation is a valuable tool for perform- before a prototype of the SUT has
actuators, as well as an operator inter- ing design optimization and hard- even been developed. Verification is
face that displays information and ware/software debugging. typically performed by comparing HIL
accepts command inputs. In this However, for an HIL simulation (or simulation results with the results of
example, operator commands are syn- any simulation, for that matter) to pro- analytical calculations or results from
thetically generated by the simulation duce reliable outputs, it is critical to independently developed simulations
to stimulate the SUT during testing. demonstrate that the simulated envi- of the SUT. Other techniques such as
The use of synthetically generated ronment is an adequate representa- source code peer reviews can be effec-
operator commands allows the tion of reality. This is where the con- tive verification tools.
automation of test sequences and per- cepts of simulation verification and Validation consists of demonstrat-
mits precise repeatability of tests. It validation must come into play. ing that the HIL simulation models
may also be possible to run the simu-
lation in a mode in which humans
observe the operator displays and gen- FIGURE 1 Example HIL simulation
erate inputs. This mode may be valu-
able for usability testing and operator
training, but the ability to precisely
Embedded
repeat test sequences is lost. System
You can apply the HIL simulation (SUT)
test concept to a wide variety of sys-
tems, from relatively simple devices Sensor input signals Actuator control signals
Operator commands Operator displays
such as a room temperature controller
to complex systems like an aircraft
flight control system. HIL simulation Real-Time
has historically been used in the devel- Simulation
opment and testing of complex and
costly systems such as military tactical
missiles, aircraft flight control systems,
satellite control systems, and nuclear
reactor controllers. Simulation verification and the embedded system and the real
Ongoing performance advances validation world operational environment with
and price reductions in computer Before the HIL simulation can be acceptable accuracy. A standard
hardware have made it possible to used to produce useful results, there approach to validation is to use the
develop cost-effective HIL simulations must first be a demonstration that the results of system operational tests for
for a much wider range of products. SUT and its simulated environment in comparison against simulation results.
This article is intended to promote the the HIL simulation sufficiently repre- This type of validation test involves
application of HIL simulation to areas sent the operational system and envi- running the embedded system in the
where this technique may not have ronment. The major steps in the HIL simulation through a test sce-
been used in the past. process of demonstrating and docu- nario that is identical to one that was
HIL simulation can help you to menting that the correctness and performed by an actual system in an
develop products more quickly and fidelity of the simulation are adequate operational environment. The results
cost effectively with improved test are called verification and validation. of the two tests are compared and any
thoroughness. Another benefit of HIL Verification is the process of differences are analyzed to determine
simulation is that it significantly demonstrating that the HIL simula- if they represent a significant devia-
BEN FISHMAN

reduces the possibility of serious prob- tion contains an accurate implementa- tion between the simulation and the
lems being discovered after a product tion of the conceptual mathematical real world.
has gone into production. During the models of the SUT and its environ- If the operational test results don’t

Embedded Systems Programming FEBRUARY 1999 43


hil simulation
accurately match the HIL simulation tests to verify that simulation perfor- is sometimes necessary. This situation
results, improving the fidelity of the mance isn’t adversely affected as can occur when a question arises as to
simulation modeling in particular changes are made. Restoring and run- whether an unexpected result is
areas may be necessary. Defects in the ning a previous version of a simulation caused by actual behavior of the SUT,
simulation software or hardware inter-
facing may also become apparent
when comparing simulation results to Real-time integration algorithms
operational test results. If changes In an HIL simulation, the interactions between the SUT and the real-world environment
must be made to the HIL simulation are usually modeled as a continuous system defined by a set of nonlinear differential
to correct problems, you’ll have to equations. This system must be arranged as a set of first-order differential equations,
rerun any validation tests that have which are solved numerically in the real-time simulation.
already been performed to confirm Differential equations can be solved approximately by advancing time in small, dis-
adequate simulation performance. crete steps and approximating the solution at each step using a numerical integration
By carefully selecting the scenarios algorithm. In a non real-time simulation, a variety of algorithms exists for varying the
for operational system tests, you can time step size so that a predefined degree of accuracy is maintained. These methods
validate the simulation for a limited are usually unsuitable for use in a real-time environment due to requirements to sam-
number of specific test conditions and ple inputs and update outputs at precise time intervals.
then proceed on the assumption that Some popular fixed-step size integration algorithms such as the fourth-order
the simulation is valid over interpola- Runge-Kutta algorithm require inputs for their derivative sub-step calculations that
tions between those conditions. You occur at a time in the future relative to the time of the current sub-step. This makes
must take care to demonstrate that the them unsuitable for use in a real-time application.
intervals over which interpolation is Algorithms that are suitable for real time generally use fixed-time step sizes and
being performed are smooth and do only require inputs for derivative evaluation that are available at the current time or
not contain any hidden surprises. earlier. The simplest algorithm that meets these criteria is Euler integration. The formu-
After all deviations between the la for integrating a state x from the current time step (denoted by the subscript n) to a

performance of the embedded system time h seconds into the future (subscript n+1) with a current derivative x n is:
in the operational environment and in ◊
the HIL simulation have been xn +1 = xn + h x n
reduced to an acceptable level and
properly documented, the HIL simu- While it has the advantage of simplicity, Euler integration has poor performance
lation is considered validated. HIL characteristics in terms of the error in approximating the solution. It’s a first-order algo-
simulation tests can then be used to rithm, so its local truncation error (the error in the solution after a single step) is pro-
replace or augment operational tests portional to h.
of the system as long as the environ- An algorithm that provides much better accuracy while remaining suitable for real-
ment being simulated falls within the time use is the Adams-Bashforth second order algorithm. It uses the current value of
◊ ◊
validated range of the simulation. the derivative x n as well as the previous frame’s derivative x n – 1:
When working with a validated sim-
ulation, you must always be careful to Ê ◊ ˆ
xn +1 = xn + hÁ 3 x n - 1 x n -1˜

understand the range of conditions
over which the simulation has been Ë2 2 ¯
validated. If a proposed test is for a sit-
uation where the simulation has not This is a second-order method with local truncation error proportional to h2. It is the
been validated and an extrapolation most commonly used integration method in real-time continuous system simulations.
from validated conditions cannot be Its main drawback is that a significant transient error can occur if there is a discontinu-
justified, you must use the simulation ity in the derivative function. It also requires an initial step using the Euler algorithm

only with extreme caution. In these because x n – 1 isn’t available during the first simulation frame.
cases, the simulation results should be Many additional real-time integration algorithms are available at orders from sec-
accompanied with a statement of the ond to fourth. Some, such as versions of the Runge-Kutta methods modified to be
assumptions that had to be made in compatible with real-time inputs, provide additional features such as superior perfor-
using the simulation. mance in dealing with discontinuous derivatives. This property is valuable when inter-
When making modifications to a facing a model of a continuous system to a model of a discrete system.
validated simulation, you’ll have to In practice, the Adams-Bashforth second-order method is usually suitable. If this
maintain adequate software configura- method doesn’t work well, you may need to reduce the integration step time h.
tion control and carry out regression

Embedded Systems Programming FEBRUARY 1999 45


hil simulation
or is the result of a change that has the embedded system to be tested and • The complexity of the SUT ele-
been made to the simulation software. its operational environment, such as: ments and operational environ-
You can quickly resolve these ques- ment to be modeled in the simula-
tions if the simulation software is • The SUT’s I/O update rates and tion software
under proper configuration manage- I/O data transfer speeds
ment. Reasonably priced software ver- • The bandwidth of the dynamic sys- I/O devices
sion control tools are available that tem composed of the SUT and its Many different categories of I/O
can make the configuration manage- environment devices are used in embedded systems.
ment process robust and relatively
easy.
Verification and validation are
indispensable parts of simulation
development. If the simulation does
not undergo an adequate verification
and validation process, its results will
lack credibility with decision makers
and significant project risks may be
created. To minimize these risks, you
must allocate adequate resources for a
verification and validation effort from
the beginning of an HIL simulation
development project.

HIL simulation hardware


and software
To develop an HIL simulation, you’ll
need suitable computing and I/O
hardware, as well as software to per-
form the real-time simulation model-
ing and I/O operations. Let’s examine
the requirements for these compo-
nents in more detail.

Simulation computer
hardware
In addition to the SUT, the hardware
used in an HIL simulation must
include:

• A computer system capable of


meeting the real-time performance
requirements of the simulation
• Facilities on the simulation com-
puter (or on a connected host com-
puter) to allow operator control of
the simulation as well as simulation
data collection, storage, analysis,
and display
• A set of I/O interfaces between the
simulation computer and the SUT

The real-time performance


requirements for the simulation com-
puter depend on the characteristics of

Embedded Systems Programming FEBRUARY 1999 47


hil simulation

In an HIL simulation, an I/O device overly complex, an ordinary PC run- low I/O rate HIL simulation. This
must be installed in the simulation ning a non real-time operating system condition may necessitate the use of
computer that connects to each SUT such as Windows NT may be capable an RTOS or a dedicated real-time soft-
I/O port of interest. I/O interfaces of running a valid and useful HIL sim- ware environment on the simulation
are available from several sources that ulation. For complex, high I/O rate computer.
support signal types, such as: SUTs, a high-performance computer A summary of requirements for a
system is essential. In these applica- high-performance real-time simula-
• Analog (DACs and ADCs) tions, you’ll need more than just raw tion computer system includes:
• Discrete digital (for example, TTL CPU speed. The simulation computer
or differential) must also have well-defined and • High-performance CPUs
• Serial (for example, RS-232 or RS- repeatable real-time performance • Support for real-time operations
422) characteristics. A high-performance • High data transfer rates
• Real-time data bus (for example, simulation might require that the soft- • Support for a variety of I/O devices
MIL-STD-1553, CAN, or ARINC- ware update all the simulation models
429) and perform I/O at precise intervals In years past, these requirements
• Instrumentation bus (IEEE-488, for of a few hundred microseconds. were met by specially designed,
example) The simulation computer must extremely expensive simulation com-
• Network (Ethernet, for example) provide system-level software that sup- puters. While more recently, many
• Device simulators (for simulating ports real-time computing and doesn’t HIL simulation developers have
LVDT transducers, thermocouples, allow code execution to be blocked in turned to the VME bus as the basis for
and the like) inappropriate ways. Most general-pur- their simulation computer systems. In
pose operating systems don’t provide the future, newer buses such as
For an SUT with low I/O rates and sufficient support of real-time features CompactPCI may provide a lower cost
a simulated environment that isn’t to be useful in anything other than a foundation for developers of real-time
simulations.

Simulation software
structure
The simulation software contains sec-
tions of code that perform the tasks
needed during real-time simulation. A
diagram of the basic software flow of
an HIL simulation is shown in Figure
2.
As examination of the flow diagram
reveals, the HIL simulation software
can be separated into three basic
parts:

• Initialization of the simulation soft-


ware and external hardware
• A dynamic loop that includes I/O,
simulation model evaluation, and
state variable integration
• Shutdown of the simulation soft-
ware and external hardware

At the bottom of each pass through


the dynamic loop, an interval timer
must expire before execution of the
next frame begins. The length of this
interval, known as the simulation
frame time, is a critical parameter for
the HIL simulation. The frame time

48 FEBRUARY 1999 Embedded Systems Programming


hil simulation

must be short enough to maintain sim- In this formula, ts is the shortest Faster frame rate models that use
ulation model accuracy and numerical time constant in seconds of the simu- values computed by slower models
stability. At the same time, it must be lated dynamic system and h is the may need to use interpolation or
long enough to tolerate the worst-case frame time in seconds. As h is extrapolation techniques to compute
time to complete all the calculations increased above the range given by the input values appropriate for the cur-
and I/O operations in the dynamic formula, the accuracy of the simula- rent time. State variables in a slow
loop. A shorter frame time require- tion will begin to suffer and eventually frame are suitable for interpolation,
ment implies higher performance it will become numerically unstable. and algebraic variables must be
requirements for the simulation com- extrapolated. The interpolation or
puter hardware. Alternatively, a short- Multiframing extrapolation may be done using
er frame time may require simplifica- Some subsystems modeled in a simula- methods of first or higher order.
tion of the simulation models so that tion may have time constants that vary If the simulation computer sup-
their calculations can complete in the significantly from those of other sub- ports multithreading, a scheduling
available time. As the frame time is systems. When this occurs, improving technique such as Rate Monotonic
lengthened, simulation accuracy simulation performance is possible by Scheduling can manage the execution
degrades. At a certain point, the using the technique of multiframing. of the models and their I/O opera-
numerical integration algorithm A multiframe simulation has more tions at the different frame rates (see
becomes unstable. The following for- than one frame rate. The frame times the sidebar on Rate Monotonic
mula is a rule of thumb for determin- h1, h2, and so forth are generally set at Scheduling). Appropriate inter-thread
ing the longest acceptable frame time integer multiples of a common factor, communication techniques must be
for a simulation model: with the fastest frame time called hf. used to allow data to be passed among
The simulation updates each model at the models in a controlled manner. A
ts the times appropriate for that model’s multiframe simulation can provide

20 frame rate. comparable accuracy to a single frame
rate simulation that updates all its
models at the hf rate while requiring
far less CPU power.

Simulation programming
languages and environ-
ments
Over the years, a number of special-
ized programming languages and
environments have been developed to
ease the task of developing simula-
tions of dynamic systems. Some simu-
lation languages are text-based while
other development environments are
graphical. Graphical tools allow the
user to construct diagrams describing
the system to be simulated. Many of
these tools are intended for use only
in non real-time applications, and
therefore aren’t suitable for develop-
ing HIL simulations. In addition,
many of these languages and tools are
either proprietary or are supported by
only a single company.
Common attributes of full-featured
dynamic simulation languages and
graphical development environments
include:

• Numeric integration of state variables

50 FEBRUARY 1999 Embedded Systems Programming


hil simulation

• Support for multidimensional • Perform simulation runs ical integration, interpolation func-
interpolation functions • Collect and store simulation data tion generation, coordinate transfor-
• Support for matrix and vector data • Analyze, display, and print simula- mation, and so forth.
types and mathematical operations tion results
• A library of simulation component • Debug and optimize the simulation Developing simulation
models such as transfer functions, models
limiters, or quaternions In addition to the specialized simu- Developing simulation models is a
lation languages and graphical devel- field unto itself. For a relatively simple
For a simulation language or opment tools, it is common to use gen- application, it may be possible to
graphical programming tool to be use- eral purpose programming languages develop a model that consists of a few
ful for HIL simulation, it must be able such as Fortran and C to develop HIL equations describing the physics of the
to generate code optimized for use on simulations. Many HIL simulations subsystem or phenomenon being
a real-time simulation computer. It have been written from scratch, using modeled. For a more complex system,
should also provide a simulation oper- only the tools and libraries supplied a model might be based on a large
ator interface that allows the user to: with the target system compiler. While number of complex mathematical
this approach can succeed, it requires algorithms and voluminous tables of
• Examine and modify simulation a great deal of effort developing effi- experimentally measured data.
variables cient and correct methods for numer- A real-time simulation model of a
continuous dynamic system is usually
implemented as a set of simultaneous,
FIGURE 2 HIL simulation software flow nonlinear, first-order ordinary differ-
ential equations. These equations are
supplemented by algebraic equations
that are used to compute intermediate
Initialize simulation
Initialization and other miscellaneous values. This
and hardware
entire set of equations is used to com-
pute the derivatives of the state vari-
Read from input ables during each simulation frame.
devices After evaluating the derivatives, the
state variables are integrated numeri-
cally to produce the state variable val-
Evaluate simulation
ues that will be valid at the start of the
models
next frame.
For subsystems that operate in a
Write to output discrete-time manner, models can be
Dynamic Loop devices developed in terms of difference equa-
tions. In a difference equation, the
next-frame value of a state is comput-
Yes
End of run? ed during the evaluation of the cur-
rent frame. At the end of the frame,
No
the discrete states are updated to their
Integrate state
next-frame values. Discrete states can
variables be used to implement algorithms such
as digital filters and to model subsys-
tems such as DAC output signals.
Delay until time to Continuous-system models and dis-
start next frame
crete-system models can be combined
in a simulation as long as integration
algorithms are used for the continu-
Shut down simulation
Shutdown ous system that can accommodate the
and hardware
discontinuities introduced by the dis-
crete time model.
In general, simulation models are
not precise representations of their

52 FEBRUARY 1999 Embedded Systems Programming


hil simulation

physical counterparts. Assumptions Many techniques have been lation may be faster than evaluating
and simplifications must be made to employed in HIL simulations to imple- an expression containing several
develop simulation models. The fewer ment models of adequate fidelity transcendental function calls, float-
assumptions made, the more complex while remaining within simulation ing point divisions, or other time-
a model must be. Some major limita- computer execution time and memo- consuming operations
tions on model complexity are: ry limits. Some of these techniques • In a real-time simulation, the worst-
include: case execution time for a model is
• The time it takes to design, devel- all that matters, rather than the
op, verify, and validate the simula- • Precompute as much as possible average time. Therefore, focus on
tion model during program initialization. optimizing only those execution
• The effort required to collect and Although the compiler’s optimizer paths that contribute to the worst-
analyze experimental data needed can help with techniques such as case execution time. Good profil-
to develop the model common subexpression elimina- ing and debugging tools are invalu-
• The execution time and memory tion, you can enhance perfor- able during this process
space that the model’s implementa- mance further by removing calcula-
tion consumes on the simulation tions that produce unchanging val- Although developing and validat-
computer ues from the simulation dynamic ing a simulation model that meets the
frame requirements discussed above is chal-
The developer must design and • Use interpolation functions to lenging, the model can then be used
implement a model that has adequate approximate the evaluation of in a variety of applications in addition
fidelity for its intended purpose while complex expressions. Doing a mul- to real-time simulation. For example,
remaining within these constraints. tidimensional lookup and interpo- the model can be used by product

54 FEBRUARY 1999 Embedded Systems Programming


hil simulation

it isn’t always obvious what the best


FIGURE 3 Example production line control system point in the system is at which to
implement the interface. As an exam-
Production ple, consider the application shown in
line Figure 3, in which a video camera
monitors items moving along a pro-
Feature Video
set signal duction line. The signal from the cam-
Control Image era is captured by an image processor,
processor processor which extracts a feature set from the
image. This feature set is then
Video
camera processed by the production line con-
trol processor.
An HIL simulation used for devel-
opment of the production line control
developers to perform their own sys- Implementation issues system would require an interface to
tem analyses, and they can modify it to Several issues in the development and the information coming in from the
examine the effects of proposed prod- operation of an HIL simulation can be video camera. Where should this inter-
uct changes and enhancements. problematic. Some areas that have cre- face be located? One possibility is that
These changes can then be imple- ated difficulties in past HIL simula- the simulation computer simulates the
mented in the HIL simulation for fur- tions are examined in this section. operation of the production line,
ther testing. This sharing of simula- video camera, and image processor,
tion models among different groups Selection of appropriate interface points. and synthesizes feature sets for trans-
can result in tremendous benefits to When you are interfacing an embed- mission to the control processor. This
the product development process. ded system to a simulation computer, method would probably have the low-
est cost because it would be done
entirely in the digital domain and the
feature set data is relatively low-band-
width as compared to the video signal.
However, in this approach the video
camera and image processor aren’t
tested in the HIL simulation. If the
operational details of the camera and
image processor aren’t thoroughly
understood and accurately modeled,
this approach may be inadequate.
A more costly alternative would be
to have the simulation computer syn-
thetically generate a scene in real time
and transfer it to the image processor
with the same format and timing the
video camera uses. This would require
additional processing and I/O hard-
ware in the simulation computer,
along with software to control them.
With this technique, the image proces-
sor is tested in the HIL simulation,
and testing can be performed repeat-
ably. However, the video camera still
isn’t being tested.
Another even more expensive
alternative would be to set up a video
projection system that places the real-
time, synthetically generated image on
a screen in front of the video camera.

56 FEBRUARY 1999 Embedded Systems Programming


hil simulation

This allows the entire subsystem to be Finally, you could use a simulated select the appropriate points at which
tested, including the video camera, or real production line to create the to interface the system under test to
image processor, and production line scene viewed by the video camera in the simulation computer. Selection of
control computer. Drawbacks to this real time. This method may or may the proper interface point depends on
approach, besides the hardware cost not be feasible, depending on consid- the simulation purpose, the adequacy
and development expense, include erations such as whether such produc- of models of subsystems that might be
the need to align and calibrate the tion lines exist, how complex it would simulated rather than implemented as
projected image so that it appears real- be to build a simulated line, and so real hardware in the simulation, and
istic to the system. Although this tech- forth. funding available to develop the HIL
nique may seem farfetched for this This example demonstrates how simulation.
application, it is used effectively in the important it is to identify the require-
test of some tactical missile sensors. ments for an HIL simulation and Budget realistically for simulation develop-
ment and ongoing operations. An HIL
simulation can be an expensive propo-
Rate Monotonic Scheduling in real-time simulations sition. Its value will be realized,
Rate Monotonic Scheduling (RMS) is a method for scheduling real-time tasks so that though, if overall project cost and risk
each task’s deadlines will always be met. The technique is applicable to run-time envi- can be reduced compared to the cost
ronments that support prioritized, preemptive multitasking or multithreading. Here, we if the simulation had not been used.
use the term task to mean either a task or a thread. The mathematical basis of RMS The initial development of an HIL
has been rigorously developed and analyzed (visit the Software Engineering Institute at simulation can be quite expensive and
www.sei.cmu.edu and search for “Rate Monotonic Analysis”). this must be understood during pro-
To use RMS, the execution frequency of each task must first be identified. In our ject planning. Continuing operation
HIL simulation application, this frequency will be the inverse of the task’s integration of the simulation will also require
step size, h. The scheduling priority of the tasks is then assigned so that the highest fre- competent technical staffing to imple-
quency task has the highest priority on down to the lowest frequency task, which has ment upgrades and troubleshoot
the lowest priority. This assignment of priorities as a monotonic function of task exe- problems.
cution rate is what gives RMS its name. The project phase at which the HIL
The execution time of each task cannot be so long that it causes itself or any lower- is brought on-line can have a signifi-
priority tasks to miss deadlines. Upper bounds for each task’s execution time can be cant impact on overall product devel-
determined such that the entire system will be guaranteed to not miss any deadlines as opment cost. The availability of an
long as all tasks stay within their allotted execution time. HIL simulation early in the project
Applying RMS to real-time simulation must involve consideration of the following can be invaluable to system designers
elements: who need a tool for studying alterna-
tives and refining their designs.
• Task switch overhead must be accommodated in developing timing requirements
• Data must be passed among the tasks in a properly timed manner Consider in advance how to deal with
• Extrapolation and interpolation may need to be performed on data passed between unexpected results. Inevitably, there will
different-rate tasks be times when a simulation doesn’t
• I/O operation timing must be considered when selecting integration time step sizes produce the expected results. If this
• State variable integration must be coordinated with the intertask data transfers occurs while a deadline is creating
severe time pressures, these results
If these items are properly handled, RMS can provide significant benefits in multi- may be ignored. This situation is espe-
frame real-time simulations. Multiframe simulation is used when subsystems must be cially likely to occur if the simulation
simulated at different frame rates. Using RMS allows these different frame rates to run hasn’t gone through a thorough vali-
on a single CPU while I/O operations occur at the correct times for each different frame dation process and won the support of
rate. all interested parties.
If the RMS-based multiframe simulation is carefully designed, it should be possible Some preplanning should be done
to move tasks to different CPUs with relative ease as new CPUs are added to the sys- to decide what actions to take in these
tem. Tasks can be relocated among CPUs to provide optimization through load bal- situations. Ideally, sufficient resources
ancing. should be devoted to determining the
RMS is a tool that developers can use to implement high-performance, real-time reason for the discrepancy. If it turns
simulations that make the best possible use of available resources. out that there is a system problem, the
HIL simulation will have demonstrat-
ed its value.

58 FEBRUARY 1999 Embedded Systems Programming


hil simulation

It isn’t unusual for an HIL simulation to be capable of


generating and storing 100K of data per second of operation. An HIL simulation is a cost-effec-
What do you do with all this data? tive and technically valid approach in
the following situations:

Simulations can produce massive amounts will be required to identify the source • When the cost of an operational
of data. It isn’t unusual for an HIL sim- of the anomaly. system test failure may be unac-
ulation to be capable of generating Reasonably priced software config- ceptably high, such as when testing
and storing 100K of data per second of uration management tools are avail- aircraft, missiles, and satellites
operation. If this simulation is in oper- able that make the process relatively • When the cost of developing and
ation for a full day, it will produce sev- painless. There really is no excuse for operating the HIL simulation can
eral gigabytes of data. What do you do not having your simulation under con- be saved by reductions in the num-
with all this data? figuration control. ber of operational tests. For exam-
A plan must be in place for per- ple, this may be the case with an
forming data reduction, analysis, and Consider having the users of the results pro- automotive antilock brake control
archiving. Users who request test runs vide a simulation accreditation. As previ- system that must be tested under a
of the simulation must specify what ously mentioned, verification and vali- wide variety of operator input and
types of data output they require. All dation of the simulation are critical road surface conditions
data that may be of interest at a later steps in the simulation’s development. • When it is necessary to be able to
date must be archived by the simula- Performing an additional step called duplicate test conditions precisely.
tion operation staff. accreditation often makes sense. An This allows comprehensive regres-
Data analysis and plotting pro- accredited simulation has had its veri- sion testing to be performed as
grams are the most general tools used fication and validation tests developed changes are made to the SUT
to examine the raw simulation output based partially on inputs from the ulti- • When it would be valuable to per-
data. More specialized automated mate users of the simulation results. form development testing on sys-
tools can be a great help for generat- Those users then examine the results tem component prototypes. This
ing summary reports and other tasks, of the verification and validation tests allows subsystems to be thoroughly
such as scanning the data to make sure and have authority to approve the sim- tested before a full system proto-
tolerances aren’t violated. ulation as demonstrating acceptable type has even been constructed
fidelity.
Configuration management must be part Involving the expert users in the HIL simulation is a valuable tech-
of the process from the beginning. The soft- verification and validation process can nique that has been used for decades
ware that is used in the HIL simulation provide powerful feedback that results in the development and testing of
must be maintained under adequate in an improved simulation and more complex systems such as missiles, air-
configuration management at all extensive simulation usage than would craft, and spacecraft. By taking advan-
times. Making any changes to the soft- otherwise occur. Accrediting the simu- tage of low-cost, high-powered com-
ware in such a way that the change lation can provide crucial “buy-in” puters and I/O devices, the advan-
cannot be undone is simply an unac- from people who might otherwise be tages of HIL simulation can be real-
ceptable scenario. dismissive when presented with simu- ized by a much broader range of sys-
Sometimes an anomaly will occur lation results that don’t match their tem developers. A properly designed
in a test situation that didn’t occur expectations. and implemented HIL simulation can
during a similar test in the past. Of help you develop your products faster
course, in the time since the previous A reasonable simulation? and test them more thoroughly at a
test, both the system under test and The development of an HIL simula- cost that may be significantly less than
the simulation have most likely under- tion can be a complex and time-con- the cost of using traditional system test
gone significant changes. If the simu- suming process. Getting system methods. esp
lation software has been under config- experts to accept the results of an HIL
uration control, it will be possible to simulation as valid is often a formida- Jim A. Ledin, PE, is an electrical engineer
restore the software version used in ble obstacle. A simulated operational in Camarillo, CA. He has worked in the
the previous test and run it again. In environment will never be a perfect field of HIL simulation for the past 14
attempting this, a problem may arise if representation of the real thing. Given years. He is a principal developer of HIL
the hardware interfaces or embedded the costs and potential difficulties simulations for several U.S. Navy tactical
system communication protocols have involved, when does it make economic missile systems at the Naval Air Warfare
changed between the two simulation and technical sense to develop and Center in Point Mugu, CA. He can be
versions. In this case, additional effort use an HIL simulation? reached by email at jledin@ix.netcom.com.

60 FEBRUARY 1999 Embedded Systems Programming

You might also like