0% found this document useful (0 votes)
56 views

Simulation Software For Teaching Dynamic System Behaviour

This document discusses simulation software for teaching dynamic system behavior. It introduces ESL, a continuous-system simulation language (CSSL) that can be used to simulate dynamic systems. ESL offers features like being able to operate as an interpreter for development or translate to FORTRAN for production runs. It also supports modeling digital components, distributed simulation, and interfacing with other software. The document provides examples of using ESL in courses on dynamics, differential equations, and simulation methods.

Uploaded by

pasha.bailey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Simulation Software For Teaching Dynamic System Behaviour

This document discusses simulation software for teaching dynamic system behavior. It introduces ESL, a continuous-system simulation language (CSSL) that can be used to simulate dynamic systems. ESL offers features like being able to operate as an interpreter for development or translate to FORTRAN for production runs. It also supports modeling digital components, distributed simulation, and interfacing with other software. The document provides examples of using ESL in courses on dynamics, differential equations, and simulation methods.

Uploaded by

pasha.bailey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Simulation Software for

Teaching Dynamic System


Behavior
ROY CROSBIE, 1 LIONEL BROOKS 2
1
Department of Electrical and Computer Engineering, California State University, Chico, CA 95929-0888
2
Dynamic Software Solutions, 2500 Zanella Way, Chico, CA 95928

Received 8 January 1996; accepted 26 November 1996

ABSTRACT: ESL is a continuous-system simulation language (CSSL) which is used for


simulating the behavior of dynamic systems. ESL offers a number of features which are
not commonly found in CSSLs. It can be operated as an interpreter (convenient in the
development phase) or as a translator to FORTRAN (more efficient execution of production
runs). It incorporates special features for describing and processing discontinuities and for
supporting the modeling of digital (discrete) components. It supports distributed simula-
tion and is capable of interfacing to other software packages in complex applications. ESL
is useful in courses addressing dynamics and control, differential equations, and simulation
methods. Several examples of its use are described ranging from very simple to advanced.
q 1997 John Wiley & Sons, Inc. Comput Appl Eng Educ 5: 71–83, 1997

Keywords: education; teaching; continuous simulation; ESL software; robots

INTRODUCTION tation systems. It has also provided an important


tool in many scientific areas from astronomy to par-
Computer simulation is a technique which is in- ticle physics, and from environmental pollution to
creasingly in the news, and the casual observer pharmacology.
could be forgiven for thinking that it is yet another The basic idea behind computer simulation is a
new development of the microelectronic age. In simple one. Take any system whose behavior is of
fact, computer simulation has been around since interest, identify a set of variables which character-
the dawn of computing, and was one of the first ize the behavior of the system, and build a mathe-
matical description or model which expresses pre-
applications which fueled early computer develop-
cisely the relationships between those variables.
ment. It has been particularly important in the aero-
Then program a computer to solve the resulting
space industry over a period of at least 40 years,
mathematical equations. Tabulate or plot the results
and has also played a key role in power and energy
to represent the simulated system behavior. Nor-
systems, the electronics industry, the chemical pro-
mally a validation phase follows during which the
cess industries, and automobiles and other transpor-
simulation is critically examined to ensure as far
as possible that the simulated behavior adequately
Correspondence to Roy Crosbie. represents the behavior of the actual system.
q 1997 John Wiley & Sons, Inc. CCC 1061-3773/97/010071-13 In addition to its many practical applications in
71

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


72 CROSBIE AND BROOKS

industry, commerce, research, etc., computer simu- used to represent digital electronic circuits, for ex-
lation can also be used as a powerful teaching aid. ample. Another area in which discrete modeling is
It can be used as a graphic means of reinforcing widely used is in the simulation of queue-server
scientific relationships and dynamic system behav- systems such as in supermarkets, manufacturing
ior. In some cases, simulation models can substitute facilities, air traffic control, etc.
for real systems which are too expensive or unsafe Many simulation programs which are used in
to install in teaching laboratories. engineering and scientific applications are written
Most simulation involves dynamic system be- in general purpose high-level languages such as
havior; in other words, the system variables are FORTRAN, C, and Ada. Others are written in lan-
changing with respect to time and the results of the guages designed specifically to handle simulation
simulation are in the form of time histories of the applications, known as simulation languages, which
system behavior. In some cases, the execution of first appeared in the 1950s. Simulation languages
the simulation program is synchronized with the are often divided into two main types. Discrete sim-
real time in which the system actually operates. The ulation languages (DSLs), such as GPSS [1], Sims-
results produced by the computer in these cases cript [2], and Siman [3] are designed specifically
represent in both magnitude and timing the changes for building models of queuing and other discrete
which take place in the real system. This is known systems; and continuous-system simulation lan-
as real-time simulation. Real-time simulation can guages (CSSLs), e.g., ESL [6], ACSL [7], and
take a further step toward realism by interfacing the CSSL4 [8] are used to model continuous systems.
computer to real hardware and, sometimes, a human In addition to these rather general-purpose simula-
operator. When one or more human operators ma- tion languages, special-purpose languages are avail-
nipulate realistic control mechanisms, which gener- able for particular application areas. Electrical cir-
ate input data for a computer simulation, whose cuits, for example, have been the target of a number
outputs are interfaced to actual instruments and of languages such as SPICE [4] for analog circuits
other hardware, the resulting system is called a sim- and VHDL [5] for digital circuits and systems.
ulator. Simulators are widely used for training pi- Other packages address mainly control systems
lots, drivers, and plant operators. In some cases, the analysis and design. The MATLAB system contains
simulation outputs drive hydraulic motion systems a simulation language, SIMULINK and other lan-
which reproduce realistic motion in the simulator guages such as SIMNON also emphasize control
platform. Add realistic computer-generated visual features.
and audio signals, and it can be difficult to distin- The choice of software for a particular applica-
guish simulation from the real thing. In fact, pilots tion will depend on a number of factors. All such
in training fly many more hours in simulators than languages provide ease of use at the cost of flexibil-
they do in real aircraft. Virtual reality is another ity. They do less, but they do it more easily and
application of real-time simulation in which helmets often more effectively. It is important to match the
and special garments are used to provide a visual, software to the needs of the application. Cost and
audible, and tactile interface between a human and availability on a convenient platform are also im-
a simulated environment. portant. The ability to interface to other software
The mathematical models on which simulations packages may also be a factor.
are based take a number of forms. One of the most ESL and similar languages such as ACSL and
important approaches uses sets of differential equa- CSSL4 offer a compromise between specialization
tions to describe the behavior of continuous, or ana- to a particular application field (e.g., SPICE, SIM-
log, systems. These are systems in which the state ULINK) and the complete generality of an HLL
variables vary continuously with time, and the mod- (such as C or FORTRAN). They aim to facilitate
els are called continuous models. For convenience, the simulation of any system which can be modeled
the term ‘‘continuous model’’ is also assumed to using differential equations. For this reason, they
cover cases in which variables are mostly continu- are useful as tools for general dynamic systems
ous but which experience occasional discontinuous analysis and design and as educational tools cov-
changes, such as when a switch operates. ering a range of application areas.
Another form of model is the discrete model Discrete languages assume a system state which
which assumes that the state of a system is un- changes only at discrete instants in time as the result
changed until an event occurs at a particular instant of an event. In between these events, the system
in time which causes an instantaneous change in the state is assumed to be unchanged. Many of these
system state. This is the basis of many of the models applications involve systems which can be de-

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 73

scribed in terms of queues and servers such as pro- program solves the differential and other equations
duction lines or supermarket checkout lines. Contin- describing the model over a range of integration
uous languages deal with systems described by dif- time (T) from T Å TSTART to T Å TFIN, where
ferential equations in which the system state is the values of TSTART and TFIN are specified by
considered to change continuously. Thermal, chem- the programmer (TSTART defaults to zero). The
ical, and mechanical systems and many other dy- ESL language, like most CSSLs, separates the defi-
namic phenomena fall into this category. The re- nition of a model into three sections, the INITIAL,
mainder of this article concentrates on continuous DYNAMIC, and TERMINAL sections of the pro-
languages and their applications. gram. Statements in the INITIAL section are exe-
Continuous-system simulation languages take a cuted only at time T Å TSTART; statements in the
lot of the programming effort, and the correspond- DYNAMIC section are executed repeatedly as time
ing potential for making errors, from the implemen- advances in discrete steps (the integration step
tation of a complex simulation. The algorithms length) from T Å TSTART to T Å TFIN; and state-
which solve the differential equations, the sequenc- ments in the optional TERMINAL section are exe-
ing of the program, the management of the simula- cuted once after the simulation run is completed (at
tion time clock, formatting, and generation of output T Å TFIN). The integration step length used in the
tables and graphs—these and many other aspects DYNAMIC section may be set by the user to a fixed
of the simulation process are taken care of by the value or automatically adjusted by the program, de-
CSSL. Modern CSSLs offer additional features pending on the user’s choice of integration algo-
which make them even easier to use. One is user rithm.
interaction, which allows the user to interact with Defining the model is not the only requirement.
a simulation, monitoring values of variables, chang- It is also necessary to specify how and under what
ing parameter values and rerunning the simulation, conditions it should be run. For example, you may
respecifying output requirements, etc. Another is wish simply to run the model once with data values
graphical input, allowing the user to define the sys- written into the program; or maybe you want to run
tem to be simulated by building a block diagram the model repeatedly with parameters entered from
representation. This technique, which is common in the keyboard before each run; or again, you may
electronic circuit simulators when it is referred to wish the program to select different parameter val-
as ‘‘schematic capture,’’ is possible any time there ues as it searches for optimum conditions. This part
exists a complete and unambiguous way of repre- of the process is referred to as the experiment, and
senting the system graphically. Transfer-function the combination of experiment and model forms, a
block diagrams and bond graphs are two examples. study. An ESL program is referred to as a STUDY
Using a graphical preprocessor has an advantage in and it contains a MODEL and an experiment. Note
that CSSL code which is automatically generated that for reasons which are now obscure, STUDY
does not contain syntax errors. and MODEL are required keywords in the ESL pro-
One of the more recently developed CSSLs, de- gram, but the experiment is identified by the context
veloped in Europe to meet the continuous simula- of the program and no keyword is necessary.
tion needs of the European Space Agency, is called As mentioned earlier, the automatic formatting
ESL [6] (the European Space Agency Simulation and generation of tabulated and graphical output is
Language). We shall use ESL to illustrate the use an important part of any CSSL. In ESL, the keyword
of CSSLs in the study of dynamic system behavior. TABULATE, followed by a list of variables to be
Using suitable examples, languages such as ESL tabulated is all that is required to produce a line of
can be used to support courses on differential equa- tabulated output at specified communication inter-
tions, linear and nonlinear systems, analog elec- vals; for example,
tronic circuits, mechanical dynamics, controls,
chemical kinetics, thermal systems, etc. TABULATE T, Y, Y*, Y9, ERR, STATE;

DESCRIPTION OF THE ESL LANGUAGE Graphical output can be produced in one of two
ways. For a quick look at the behavior of a single
Simulations using ESL can be produced either by variable with respect to time or some other variable,
programming using ESL statements or by devel- the PLOT statement is used. For example,
oping a block diagram model of the system using
the ESL graphical input interface, IMP. An ESL PLOT T,Y,0,100,010,30;

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


74 CROSBIE AND BROOKS

will produce a graph of Y versus T on the screen FORTRAN system. This is a convenient technique
with axes representing T from 0 to 100 and Y from for the software developer, because much of the
010 to 30 units. This can be a good diagnostic expression analysis, and most of the diagnostics can
feature because you get a good idea of how a simu- be left to the FORTRAN compiler. The disadvan-
lation is proceeding, from observing both whether tage of this approach is that error messages gener-
Y is behaving the way you think it should and the ated by the FORTRAN compiler often bear little
rate at which the solution proceeds. If, for example, relationship to the CSSL code. A major advantage
it seems to hang at some value of T, or the plotted of the method is that the program can link to FOR-
variable moves beyond its expected limits, you can TRAN libraries and user-written FORTRAN sub-
interrupt the solution from the keyboard and exam- routines which might be needed when the language
ine the values of key variables to see what is causing itself lacks necessary features. A second advantage
the problem. is that modern optimizing compilers generate effi-
A more flexible way of generating graphical out- cient code, keeping execution times low.
put is available for graphs which are generated after The second approach is to implement the lan-
a simulation run or sequence of runs. In this case, guage as an interpreter. This usually involves the
the values of named variables are saved at specified translation of the user’s source code to a form which
intervals into a file (known as a PREPARE file). consists of strings of instructions resembling assem-
The data stored in the file can later be plotted in a bly language (often for a stack-based machine).
variety of ways using the ESL graph-plotting pro- This code is interpreted at run time, one instruction
gram, DISP. When a PREPARE file has been pro- at a time, by the interpreter. Because it is self-con-
duced, DISP commands are used to generate the tained and does not rely on external compilers and
graphs. Several dependent variables (y axis) can be linking loaders, there is more control of error diag-
plotted at a time against a single independent vari- nostics both during translation and at run time. It is
able (x axis) for one or more selected simulation also easier to provide interactive features. Disadvan-
runs. You can leave the scaling of the axes to DISP tages are that there is no linkage to external routines
or you can specify them to suit your needs. You in other languages which reduces flexibility, and
might, for example, be interested in the precise point run times are generally significantly slower. This
at which a variable changes sign. After a quick look would be more noticeable for large models, or for
you can specify an x axis between narrow limits to applications which require many runs of the model
pinpoint the instant at which the sign changes. The at a time such as parametric studies or optimiza-
graphs can be printed on a printer or plotter. tions. The interpreter option is well suited to most
In addition to graphical output in the form of educational purposes; it is generally easier to use
graph plots, many simulation languages also support and provides better diagnostic features.
graphical input in the form of block diagrams. ESL ESL is probably the only CSSL which incorpo-
is no exception, and it allows a model to be de- rates both approaches in a single system. This is
scribed as a block diagram using a program called accomplished as follows. All ESL programs are pro-
IMP. The IMP processor generates an ESL program cessed by a compiler, esl_comp, which converts the
corresponding to the block diagram. A nice feature ESL source code into an intermediate form known
of IMP is that following a simulation run, it is possi- as H-code. H-code resembles an assembly language
ble to produce a block diagram into which graph for a stack-based machine. An interpreter, esl_run,
plots of key variables are inset. can be used to execute the H-code version of the
program. Alternatively a translator program,
esl_tran, can be used to translate the H-code version
The ESL System
of the program to FORTRAN. The resulting FOR-
The complete set of software which forms the ESL TRAN can then be compiled and run using a stan-
system is quite complex. To understand how it dard FORTRAN system. During execution of the
works, it is helpful to know how the majority of program, using either the interpreter or the transla-
CSSLs operate. There are two main approaches, tor, output files are generated by the PREPARE
referred to as the translator approach and the inter- statements in the program, which are used by the
preter approach. Well-known languages such as DISP program to produce graph plots.
ACSL [7] and CSSL4 [8] use a translator which An ESL demonstration disk is available on re-
converts the CSSL program to FORTRAN. The re- quest from Dynamic Software Solutions, the ad-
sulting FORTRAN program is then compiled, dress of which is on the title page. It contains an
linked, loaded, and executed by a conventional ESL system without the compiler and translator. It

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 75

also contains a number of ESL examples in com- (1, 17) ESL regards the entire program as a
piled form. This arrangement permits the execution STUDY and the first and last lines of the pro-
of the precompiled examples, but does not support gram show this.
the compilation and execution of new or modified (2, 13) The model, EX1, is defined within
examples. An accompanying set of notes explains these lines.
the features of ESL as they are introduced into suc- (3) The first section of the model consists of
cessive examples. Students at California State Uni- variable declarations. Variables can be real,
versity, Chico, and at Calgary University, Canada, integer or logical and, with some restrictions,
for example, have found that the demonstration disk can also be arrays.
is a great help in learning the language.
(4, 6, 8, 10) The model is separated into sev-
The following sections describe several ESL ex-
eral regions. INITIAL (line 4) introduces
amples. The first three are simple examples which
code which is executed once only, at the initial
are based on examples on the ESL demonstration
value of the independent variable, and estab-
disk.
lishes the initial state of the system. DY-
NAMIC (line 6) introduces the statements de-
ESL Examples fining the model, the differential and related
equations that describe the dynamic behavior
Example 1: Radioactive Decay. The first group of of the system. This code is the most frequently
examples on the demonstration disk deals with vari- executed (several times per integration step).
ations of a simple radioactive decay system which Statements in the STEP (line 8) region are
is described by the first-order differential equation executed once per integration step. This is a
common location for the PLOT statement to
dy/dt Å 00.03y; y(0) Å 200 give the maximum number of data points for
a smooth graph. Note that with variable-step
It is required to solve this equation for 0 õ t õ 100 integration routines these points may not be
s and to produce graphs of y and dy/dt against t equally spaced. The COMMUNICATION
and a tabulation of y against t at intervals of 1 s. (line 10) region, on the other hand, is exe-
An ESL program which does this is listed below. cuted at regular intervals. Each communica-
This is a modified version of several of the examples tion interval (CINT) is made up of one or
on the ESL demonstration disk. The line numbers more integration steps.
are for reference only and are not part of the pro- (7) The differential equation is defined here.
gram. Note the use of Y * to represent dY/dt. You
can also use Y 9 (two separate single quote
1 STUDY characters { ’’ }, not one double quote { 9 })
2 MODEL EX1; and higher-order derivatives. Derivatives need
3 REAL: Y; not be declared by the user; this is handled
4 INITIAL by the system.
5 Y:Å200.0; (9) PLOT produces a graph as the simulation
6 DYNAMIC proceeds, and so it is necessary to specify axis
7 Y*:Å00.3E001*Y; limits in the order x-minimum, x-maximum,
8 STEP y-minimum, y-maximum.
9 PLOT T,Y,0.0,100.0,0.0,200.0; (11) PREPARE saves data for later plotting
10 COMMUNICATION using DISP. %EX1% names the file. Multiple
11 PREPARE %EX1%,T,Y; files with different names could be generated.
12 TABULATE %EX1.TAB%,T,Y; Putting the PREPARE in the COMMUNICA-
13 END EX1; TION region reduces the amount of data
14 --Experiment saved, but may produce less smooth graphs.
15 TFIN:Å100.0; CINT:Å1.0; The alternative is to put it in the STEP region.
16 EX1; (12) TABULATE produces a tabulation of the
17 END_STUDY specified variables in a standard format. Col-
umn headings are automatically generated.
Notes on Example 1 (line numbers appear in paren- Since the tabulation is required at intervals
theses): of 1 time unit, the TABULATE statement is

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


76 CROSBIE AND BROOKS

placed in the COMMUNICATION region 20 PRINT %Final result is:%


with CINT set to 1. The extension TAB indi- 21 PRINT %T,Y%,T,Y;
cates the tabulation will be stored in a file 22 READ %Do you want another run?
named EX1.TAB and can be observed on the (Y/N):%, Y_E_S;
screen after the run. 23 TERMINATE NOT Y_E_S;
(14) The experiment consists of all the code 24 INTERACT;
which follows the model and there is no key- 25 END_LOOP;
word to introduce it. For clarity a comment 26 END_STUDY
statement is included here to show where the
experiment starts. On any line, all text follow- Notes on Example 2 (contains only minor changes
ing a double hyphen (--) is treated as a com- from Example 1 for lines 1–14. From that point, it
ment. is completely different):
(15) There are several reserved variables that
may need to be set, and the experiment is a (2, 3) The point of this example is that the
good place to do this. All these variables have experiment calls the model repeatedly with
default values and it is only necessary to set different values of the decay time constant.
variables which have values different from the Think of the experiment as a main line pro-
default values. In this case TFIN (final time gram which calls the model as a subprogram
0 default 10) is set to 100. Although CINT or procedure. Because this involves parameter
defaults to 1 it has been set here again to its passing between model and experiment, the
default value. This statement could be omitted declaration of the model must take a different
with no effect. Note that two or more state- form. It includes a declaration of the parame-
ments can appear on the same line separated ters passed to and from the experiment. In this
by semicolons. case values of K are passed to the model from
(16) The model is called by name, EX1. the experiment and values of Y are returned to
Rather than a simple call that executes the the model (for printout purposes). Variables
model once, this line could be replaced by declared before the :Å are regarded as outputs
statements which call the model several times, from the model, those to the right of :Å are
such as the LOOP used in the next example. inputs.
(7) The fixed value of the rate constant is re-
Example 2: Use of LOOP Statement. placed by the parameter, K.
(8–12) Both PLOT and PREPARE statements
1 STUDY are now in the STEP region; there is no TAB-
2 MODEL EX2(REAL:Y:ÅREAL:K); ULATE statement in this version.
3 --Declaration now in line 2 (15) This version of the experiment requires
4 INITIAL additional declarations. The experiment needs
5 Y:Å200.0; to know about K, which it passes to the model,
6 DYNAMIC Y, which it receives from the model and a
7 Y*:Å0K*Y; logical variable, Y_E_S (note that under-
8 STEP scores are valid in variable names) which is
9 PLOT ‘‘Radioactive-decay’’, used to terminate the program.
T,Y,0.0,100.0,0.0,200.0;
(17, 25) These statements define the start and
10 --No COMMUNICATION this time; PRE-
end of the loop which controls the experiment.
PARE is in STEP
11 PREPARE %EX2%,T,Y; (18) The user is asked to input a value for the
12 --No TABULATE either rate constant, K.
13 END EX2; (19) The model is now called with appropriate
14 --Experiment parameters. The current value of K is to be
15 REAL: K,Y; LOGICAL Y_E_S; passed to the model and the model output is
16 TFIN:Å100.0; CINT:Å1.0; to be loaded into Y. Note that there is no
17 LOOP computational significance to the use of the
18 READ K; same name, Y, in both the model and the ex-
19 EX2(Y:ÅK); periment.

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 77

constant multiplier block. This generates YD, thus


closing the loop. The integrator block provides a
means of setting the initial value of its output (to
3.0 in this case). The resulting IMP diagram cap-
tures the same information as the differential equa-
tion representation. The IMP processor analyzes the
diagram and generates an equivalent ESL program,
EX3, shown below.
Figure 1 Block diagram of radioactive decay.

1 STUDY
(20, 21) PRINT statements produce output to
2 MODEL EX3;
the default output device (normally the
screen). Text to be printed is between % 3 REAL: YD;
signs. Variables whose values are to be printed 4 --Multiplying constant
are separated by commas. 5 CONSTANT REAL: K_1/00.3E-01/;
(22) Another READ, this time with a prompt 6 REAL: Y;
between % signs. The user is invited to input 7 --Integator constant
Y for yes or N for no. 8 CONSTANT REAL: IC_3/3.000/;
9 INITIAL
(23) The TERMINATE causes the program to
finish if the condition NOT Y_E_S is true 10 Y:ÅIC_3;
(i.e., the logical variable, Y_E_S, is false). 11 DYNAMIC
12 YD:ÅK_1 * Y;
(24) If the program is not terminated at line
24, the INTERACT statement passes control 13 Y*:ÅYD;
temporarily to the user who can check the 14 STEP
values of selected variables, or change model 15 PLOT T,Y,0.0,100.000,0.0,3.00000;
or system parameters before continuing exe- 16 COMMUNICATION
cution. 17 PREPARE %ex3%,T,YD,Y;
(25) The END_LOOP transfers control back 18 TABULATE %ex3.tab%,T,Y;
to the start of the LOOP. 19 END ex3;
In this example, the LOOP is simply used as 20 --Experiment
a means of transferring control back to the 21 --
start of the experiment after the INTERACT. 22 --Definition of experiment to be
Additional forms of the LOOP are available carried out on system
which execute the loop a specified number of 23 --Model arguments
times or while a specified condition is true. 24 --Logical repeat variable
25 LOGICAL: Y_E_S;
Example 3: Using the IMP Graphical Inter- 26 --Define integration control
face. IMP provides an optional alternative method 27 TSTART :Å 0.0;
of defining a system model. This is a common way 28 TFIN :Å 100.000;
of representing systems, especially those with com- 29 CINT :Å 1.00000;
ponents described by transfer functions. The prob- 30 DISERR :Å 0.100000E-03;
lem of Example 1 is used to illustrate the basic 31 INTERR :Å 0.100000E-02;
features of IMP. This involves the solution of the 32 ALGO :Å 1;
first-order differential equation 33 NSTEP :Å 1;
34 --
dY/dt Å KY, given Y Å 3.0 at 0, 35 LOOP
and K Å 00.03 36 --Call the model
37 ex3;
This system can be represented graphically by the 38 PRINT %STUDY COMPLETED%;
IMP diagram in Figure 1, which shows that YD, 39 READ %Do you want another run?
the derivative of Y, is integrated (using an IMP (Y/N):%,Y_E_S;
integrator block) and is then multiplied by K in a 40 TERMINATE NOT Y_E_S;

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


78 CROSBIE AND BROOKS

41 INTERACT; (32) ALGO specifies the integration algorithm


42 END_LOOP; to be used. It is always set explicitly in an
43 -- IMP program, even when it indicates the de-
44 END_STUDY fault fifth-order variable-step algorithm
(ALGO Å 1).
The IMP screen is produced by entering the com- (33) NSTEP specifies the number of integra-
mand IMP in response to the ESL prompt. The user tion steps in each communication interval
is given the opportunity either to read an existing (CINT). The larger the value of NSTEP, the
IMP file or create a new one. A new file is created by smoother the graph, but the longer the run
entering a file name. Icons are selected, positioning time. NSTEP Å 1 is the default.
them with a mouse, and connecting them together. (39, 40) The user is given the choice of another
Numerical data are added to complete the model. run if required.
The IMP processor is then used to analyze the block
diagram and report any errors. If there are no errors,
the complete ESL program shown above is pro- These simple examples will convey something
duced. of the scope and potential for using a CSSL in a
This study contains all the information required variety of courses in science and engineering. In
to run Example 1, but is longer because it is built practice, these courses can be divided into courses
on a generic skeleton which is appropriate for a about simulation and courses using simulation as a
wide range of problems. Most of the lines of code teaching aid. The modern engineer needs to under-
in Example 3 have been explained in the previous stand the simulation process, and the subject of
two examples; the rest are explained below. computer modeling and simulation should be in-
cluded in the curriculum of all engineering majors.
(3) IMP handles derivatives by declaring them Exposure to a variety of simulation tools, both spe-
as a separate variable, in this case YD, and cial and general purpose, applied to a range of prob-
then including a definition of YD and the lems can form the basis of a course about simula-
statement Y* Å YD in the DYNAMIC region tion. If this course is taken early, then it becomes
(lines 12 and 13). much easier for students to use simulation tools
routinely in their engineering courses—for exam-
(4) Comments are generated by IMP to assist ple, in electronic circuit design, control systems, and
the user. vibrational dynamics. Simulation provides a bridge
(5) IMP has generated the name K_1 for the between the theory presented in lectures and the
constant and sets its value using floating-point practical experience gained in laboratory sessions.
notation. Note that IMP uses the underline It can even substitute for laboratory work in cases
character to minimize the risk of naming con- where the laboratory setup is impractical or overly
flicts. Consequently, users should avoid using expensive. The use of simulation languages such as
this symbol in variable names. ESL can be used to convey a sense of the dynamic
(7, 8) The comment in line 7 indicates that behavior of different types of system, sensitivity to
line 8 declares the integrator initial condition parameter changes, the effect of nonlinearity and
variable IC_3 and sets its value. linearization, the process of optimization of system
(10) The initial value of Y is set to the value behavior, and much more.
of the constant declared in line 8. It is important to choose the best simulation tool
(12, 13) The differential equation is defined. for a particular need. In many controls courses, for
example, interest focuses on mathematical processes
(22–25) More helpful comments in lines 22– involving a state–space matrix representation of sim-
24. Line 25 declares a logical variable Y_E_S ple linear or linearized systems models. In such cases,
which is used to give the user the option of a program such as SIMULINK, which is integrated
selecting another run or terminating the pro- with a control system analysis package, MATLAB, is
gram. (See lines 39 and 40). a good choice. As a means of simulating more com-
(27) TSTART is always set by IMP even when plex non-linear systems, however, SIMULINK suffers
it takes the default value. several disadvantages. The user can choose to define
(30, 31) DISERR and INTERR are the error the system graphically or textually. The SIMULINK
tolerances for discontinuity detection and nu- user’s guide (published by Math Works, Inc., of Not-
merical integration, respectively. ick, MA), suggests that even for a second-order, non-

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 79

Figure 2 Payload gimbal support system.

linear Van der Pol equation, an M-File representation model. The model described here deals only with the
written in MATLAB language, or a MEX-File in elevation gimbal control and is linearized around zero
FORTRAN or C may be easier. Furthermore, while elevation angle. The aim is to study the stability of
it supports a range of integration algorithms, none of the payload attitude when a shuttle reaction control
them have the kind of support for handling discontinu- jet is fired. Figure 3 contains a block diagram of the
ities efficiently and accurately which are provided by system. The system includes the following compo-
ESL and similar languages. nents, all of which are easily represented by ESL
statements (some of which are included):

PRACTICAL APPLICATIONS j Control jet rectangular pulse:


The above examples are intentionally made very simple
to clarify the features of the language. ESL is, however, Ed:Åif TõDON then 0.0 else_if T
a powerful language that is used to simulate complex úDOF then 0.0 else 1.0;
systems. The following applications will give some idea
of how ESL is used in practice.
j Continuous dynamics: six first-order and two
Space Shuttle Annular Suspension and second-order differential equations plus several
Pointing System algebraic equations.
The annular suspension and pointing system j Digital system clock (period Ts)
(ASPS) is used to maintain the attitude of a space- when (T0TO)/TsúÅ1.0 then
shuttle payload during changes in the shuttle orien- count:Åcount/1;
tation following the firing of a control jet. A com- TO:ÅTstart/count*Ts; end_when;
puter control system samples the output of a gyro j Sample and hold, quantizer, accumulator, and
mounted in the payload and an accelerometer in digital computer controller are discrete digital
the shuttle and generates torque command signals elements and are modeled using difference
which are used by the control motors to maintain equations. Discrete variables must be updated
the required payload attitude. to represent past values; for example,
The space shuttle and payload are depicted in Fig-
ure 2. The payload is supported and positioned by a
QA:ÅKc1*VT/Kc2*VTZ0Kc3*QAZ;
three-axis gimbal system. The flexibility of the struc-
ture between shuttle and payload is included in the QAZ:ÅQA;

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


80 CROSBIE AND BROOKS

Figure 3 Control system block diagram.

j Representation of digital computational delay: and the numerical integration algorithm is never
required to integrate across a discontinuity—a com-
when (T0TO)/TdúÅ1.0 mon source of errors when precautions are not
taken. In ESL, this process is totally automatic and
then DCOM:ÅTCOM;
transparent to the user.
end_when; Typical graphical outputs of the program are
shown in Figure 4.
Two further applications will demonstrate the
Note the when statements which cause the code versatility of ESL. One concerns a real-time ESL
within the body of the statement to be executed model of six-legged robots moving over an uneven
only when the when condition becomes true. This terrain with an animated graphics display. The other
is equivalent to defining an event time in a discrete is a simulation of a natural-gas extraction platform
language, and it affords a convenient method of which forms part of an operator training simulator.
handling discontinuous events, and especially dis-
crete subsystems. ESL controls the integration step ROBOT SIMULATION
length to ensure accurate timing of the event. In
other words, the step length is chosen so that the A six-legged robot moving over nonflat terrain was
event coincides with the end of an integration step, the basis of a demonstration project to establish the

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 81

Figure 4 Control torque signal.

ability of ESL to support distributed simulation with form to the ESL segment protocol. Real-time syn-
full-color animation [9]. The simulation is based on chronization is at a rate of 10 frames/s.
the walking robot ‘‘Genghis,’’ developed by Brooks The simulation allows the robot to walk forward
[10] at MIT and a similar robot developed later or in reverse, at various speeds; to turn to right or
by Barnes, et al. [11] at the University of Salford, left; and to track a target controlled by the user. The
England. The robot has three legs on each side of robot also adjusts its attitude, to maintain a sensible
its rectangular body, and moves by changing the body height above the surface, as it climbs or de-
angle of each leg with respect to the body. Alpha scends a slope in the terrain. To provide the neces-
motors move a leg forward or backward, and beta sary inputs for the VISTA animation, the simulation
motors raise or lower a leg. must define the positions of 13 different moving
The main output is a real-time full-color anima- robot parts (two for each leg plus the body).
tion of the robot moving across a contoured land- The simulation has recently been extended to
scape using visualization and technical animation support two robots with tracking and collision
(VISTA) software, which was developed by CASA avoidance features. This extended version operates
Space Division, Spain under ESA contract. VISTA on up to six computers and consists of a master
is driven directly from the ESL simulation of the model, two robot segments, two control panels, and
robot and from the interactive user control panel. the VISTA animation.
The control panel provides real-time input which
can control the robot directly by adjusting its speed,
direction and turn, or indirectly by manipulating a GAS PLATFORM TRAINING SIMULATOR
tracking target. The control panel also supports user
control of the position, zoom angle and ‘‘look-at’’ ESL was used in the implementation of an operator
point of the VISTA ‘‘camera.’’ training simulator for the North Morecambe off-
The complete simulation runs on three separate shore gas platform in the Irish Sea. The offshore
computers using the ESL distributed segment proto- platform may be controlled from onshore and off-
col. An ESL simulation runs as the master segment shore Rosemount control systems. The training sim-
on a Sun Sparc, the user interface on an HP 700, ulator embodies both an emulation of the Rose-
and the VISTA animation package on a Silicon mount system using the Cogsys real-time expert
Graphics. The user interface is written mainly in system software and a simulation of the platform
FORTRAN with some low-level C routines to con- written in ESL. The system provides both trainee

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


82 CROSBIE AND BROOKS

and instructor stations and the instructor can set up to and executed in the DOS editor, from a hard
various operational scenarios, to which the trainee disk. The examples, except the two presented in this
must respond correctly. The system grades the per- article, are taken from Speckhart and Green [12]. A
formance of the trainee. The system runs on a Sun README.DOC file gives appropriate instructions.
Sparcstation and an X-windows terminal. Information, software, manuals, and the demonstra-
The following software components are used in tion disk about ESL can be obtained from Dynamic
the simulator: Software Solutions (fax 916-343-4241).

j COGSYS real-time applications environment.


This real-time expert system package is used
to provide the overall environment, and to emu- REFERENCES
late the digital control system and to code
events and to program tables of events using [1] T. J. Schriber, ‘‘An Introduction to Simulation Us-
the COGSYS knowledge representation lan- ing GPSS/H,’’ Wiley, New York, 1990.
guage (KRL). [2] E. C. Russell, ‘‘Building simulation models with
j COGVIEWS graphical interface. Simscript, II.5,’’ CACI, 12011 San Vicente Blvd.,
This is a graphical extension to COGSYS and Los Angeles CA 90049; 1983.
is used to develop the display mimics, both for [3] C. D. Pegden, ‘‘Introduction to SIMAN,’’ Systems
the emulation of the Rosemount mimics, and Modeling Corporation, 504 Beaver St., Sewickley,
PA 15143; 1982.
for the instructor’s interface.
[4] P. W. Tuinenga, SPICE: A Guide to Circuit Simula-
j ESL tion and Analysis Using Spice, 3rd ed., Prentice
Simulates the physical behavior of the plat- Hall, Englewood Cliffs, NJ, 1995.
form. The translator option is used to generate [5] IEEE Std 1076-1993, Standard VHDL Language
FORTRAN code which is integrated into COG- Reference Manual, IEEE Computer Society, Pisca-
SYS using C interface routines. taway, NJ, 1994.
[6] J. L. Hay, R. E. Crosbie, and J. G. Pearce, ‘‘ESL:
This application provides further evidence of the A simulation language for the space industry,’’ ESA
ability of ESL to perform simulations (in real time J., Vol. 8, No. 1, 1984, pp. 37–44.
if necessary) as part of complex applications with [7] Advanced Continuous Simulation Language Refer-
requirements which extend far beyond the capabili- ence Manual, Mitchell Gauthier Associates, Con-
cord, MA 01742; 1986.
ties of conventional simulation languages.
[8] R. N. Nilson, CSSL IV User’s Guide and Reference
Manual, Simulation Services, 20926 Germain St.,
CONCLUSION Chatsworth, CA 91311.
[9] J. G. Pearce, J. L. Hay, and S. Pallett, ‘‘Distri-
ESL is a modern continuous-system simulation lan- b u t e d r e a l - t i m e E S L s i m u l a t i o n ,’’ R e f:
" estec " extlab " fin_wo1.001, May 1993, ISIM Sim-
guage (CSSL) with several unique features. Its
ulation Ltd., Technology House, Lissadel St., Sal-
capabilities extend from its ease of use in the class- ford M6 6AP, England.
room for simple dynamic simulations to complex [10] R. A. Brooks, ‘‘A robot that walks: Emergent Be-
real-time applications running on distributed sys- haviors from a Carefully Evolved Network,’’ IEEE
tems in combination with a wide range of compan- International Conference on Robotics and Automa-
ion software. tion, Scottsdale, AZ, May 1989, pp. 692–696.
[11] D. P. Barnes, C. G. Downes, and J. O. Gray, ‘‘The
real-time control of a hexapodal robot using multi-
THE SOFTWARE ple transputers,’’ Appl. Transputers.
[12] F. H. Speckhart and W. L. Green, A Guide to Using
The software contains an INSTALL command that CSMP—the Continuous System Modeling Program,
allows about 25 simulation examples to be copied Prentice-Hall, Englewood Cliffs, NJ, 1976.

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE


DYNAMIC SYSTEM BEHAVIOR 83

BIOGRAPHIES

Lionel H. Brooks received his PhD at UMIST, England, in 1951. Roy E. Crosbie received his PhD at Liverpool University, En-
He then spent 18 years with the UKAEA in chemical engineering gland, in 1963. He worked for the Marconi Company on radar
research, 13 years with General Atomic, La Jolla, California, on displays and then spent 20 years with the Department of Electri-
the High Temperature Gas Reactor fuel cycle, and 9 years with cal Engineering at the University of Salford, England. He moved
CarboMedics, Austin, Texas, a manufacturer of artificial hearts to California State University, Chico, in 1983 and is currently
and other medical products. Presently he is the marketing director director of research in the College of Engineering, Computer
of DSS and volunteering time as an adjunct professor at CSU Science, and Technology, and a professor of computer and elec-
Chico and as a research associate with the McLeod Institute of trical engineering. He is a former chair of the Department of
Simulation Sciences. He is a member of SCS, SME, and AIChE. Computer Engineering. He is a fellow of the Institution of Electri-
cal Engineers (UK) and of the Society for Computer Simulation.
He is a former president of the Society and currently serves as
chair of the Council of Past Presidents of SCS.

96137 / 8R09$$6137 04-09-97 11:02:50 caea W: CAE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy