MOOELLING
AND/
FOR/
INGE
BY
SIMULATION
TROCH*)
Various aspects of the close lnterconnectlon of the two tasks 'Modelling a System' and 'Simulating a System: shall be discussed for continuous systems. Some typlcal examples from different areas of application ~111 be given HI order to provide some insight into this matter. Then the importance of impllclt progranmnng ~11 be discussed shortly which allows for a 'one-to-one-mapplng' of the system block structure on the simulation program. Some remarks on available simulation tools ~11 complete the discussions. Keywords:
Modellug
- Simulation
- Dynamic
Systems
- Slmulatlon
tools
1. INTRODUCTION
It is quite well-known that there is a strong connection between modelling and simulation and that it is not always evident what comes first. At a first glance, modelling the system to be investigated is expected to come before the simulation. But then one realizes in many cases very quickly that the model has to be established in a special way to allow not only for an efficient simulation with the hard- and software tools available but also to get the insight in the system behaviour for which the simulation had been undertaken. Further, often simulation shows that an updating not only of model parameters but of the model itself is a necessity. Besides, there are many problems - especially in the wide field of the so-called soft systems - where simulation is used as a tool to develop a model. The following discussions shall be based on examples taken from different areas of application. They are chosen in a way not only to illustrate the remarks just made but also to give the occasion to discuss shortly some important aspects of modelling and simulation in a rather general way. Although these examples are chosen from the field of continuous-time systems - with which the author is more familiar - the following statements hold also for discrete-time systems. Many of the following explanations sound rather trivial, nevertheless it seems not superfluous to collect some aspects of the complex task of simulating a given real system.
2. MODELLING AND SIMULATION Speaking with Bratley et al., Lll, 'a model IS a descrlptlon
of some system
predict
any useful model
md
what happens
idealizes
grounds
. . .
to keep
if certan
Most
forces
the model
actions
are taken.
that impinge
tractable'.
Virtually
on the system
The result of
must be neglected
Intended
to
slmpllfies
on a prior1
these simplifications and idealiza-
tlons is a more or less complex model which can be investigated further analytically or numerically or by simulation. The effort of an analytic investigation usually is substantially higher but results in statements about stability or stability domains, about *) Professor at the Technical University Vienna, Karlsplatz 13, A-1040 Wien, Austria
24
system inputs being optimal with respect to a certain well-defined goal etc. Unfortunately, very often these conclusions can be made only at the cost of model simplification which may reduce its credibility. On the other hand simulation allows the use of rather complex models which lead to large computation times and often also to problems of numerical accwracy. Consequently, a model should be so detaited and complex as necessary to reflect adequately the features of the real system that are important to the application under consideration. But at the same time the model should be as simple as possible not only to reduce the computational burden but also to make it possible to obtain all necessary data and to estimate the required parameters. Especially for soft systems it is of importance to start with a simple model and to learn from experiences with it. If it is suitably modularized,particular modules of it can be specified in more detail later on. An example for this procedure is given e.g. in I61 where the glucagon-stimulated hepatic glucose production of an isolated rat liver was modelled with the help of simulation. A short description will be given in section 4.
The modularization leads to a program structure
that reflects the systems structure, It may require the use of implicit work
simulation tech-
whrch are rather easy to perform on an analog computer but require additional
niques,
and - in case the structure is maintained during the simulation - also additional
computation time on a digital one. On the other hand in physics and engineering it is often possible to derive quite accurate and complex models using basic laws. But then it turns out that it is not only costly to obtain the required data but also that the model is to complicated to be used in the application in mind. Then one tries to simplify the model either by simulation or analytically. An example is given in [5,73 and will be discussed shortly in section 3. In the latter case simulation is often used to validate the simplified model. It shall be remarked that any validation of a model by simulation requires a relatively large number of runs which have to be compared to reality. It is always a problem to obtain sufficient data about the input/output response ofthe real system. If there is not enough such data available then one has to be careful with conclusions especially with extrapolation about the systems future behaviour. In such a case one should speak better about a scenario investigation and be extremely careful not to risk by imposing constraints and assumptions that the simulation output supports preconceived opinions. Here, a sensitivity analysis as e.g. the one reported in example
I may be of value. As a 'conclusion' these remarks
about complexity can be summarized by a statement from [~]:PZXSL~O~Y in ~SSUITI~~JOIJS and parameters
IS good'.
It is always recommandable to test and validate the model and simulation program by using
input data different from that used during the development of the model. But, this is not possible in any case especially for soft systems such as the one reported in example 1. On the other hand example 3 gives a good illustration for this reconnnandation. It shows at the same time that the modelling effort sometimes has - unintentionally - the benefit of improving the understanding of what is really happening in the system being modelled.
As illustration of some of the remarks above take the following
Example 1: World models have become of comnon interest since Forresters report in 1971, Ill. His model has been improved later, f3,43, but these improvements lead more or less
25
to the same conclusions. The problem is not only difficult because 'world dynamics' is a soft system with a large number of variables, parameters and table functions but also because it is not possible to make a second experiment with changed parameters. Unfortunately, one has to expect further that the parameters used in the simulation study (it might be better to speak about a computation because there was not a large number of runs simulating different situations) may differ from their nominal values within a range of :30%. In L81 a computational sensitivity study had been undertaken with the goal to investigate these parameter uncertanties. It turned out that even very small changes in economic parameters only (which are' relatively reliable compared to others) can change
Fig.1: 5% changes to reference run in 1990: (a) World population, (b)Non-renewable resources fraction remeining, (c) Index of persistent pollution (acc.[dl) the result considerably and may consequently lead to conclusions different from the ones in [2-41, Fig.1. This must not necessarily mean that the model is false. If the real system 'world' is very sensitive to some parameters and/or table functions, then a good model must reflect this sensitivity. A definit answer is not possible as one must not experiment with the system, but there are enough indications for such a sensitivity. Nevertheless, one should be very careful with any conclusion drawn from the model, which can give a scenario only. 3. MODELLING FOR SIMULATION When setting up a model for simulation purposes one should be aware of the hard- and software to be used right from the beginning. Otherwise more or less additional work has to be put in the task of analyzing andbtansforming the model until the model equations have the required form. Let us illustrate this by the simulation model for the dynamic behaviour of a robot. Example 2: An industrial robot consists of the arm itself, the driving motors and the gears inbetween. If p denotes the vector of joint coordinates and kDr the vector of the driving forces and moments, the dynamic behaviour of the arm can be described in the form, [5,71,
kDr= M(p$+ .
h(p,l;)
(1)
lhe drives can be modelled in the form ; = f(z,u
(2)
S' kL)
where z describes the state of the drives, US is the control
input and kL the vector of
the moments of load. The gears usually are modelled statically by the relations
26
I; = Tz
(3a)
kL= S kDr
(3b)
The system structure is given in Fig.2. Analog (or hybrid) simulation allows a direct use of equs. (l)-(3). This has the advantage that not only p,i,v and z are outputs of the simulation but also the forces and moments kDr. This is impotant in view of the fact that they have to obey certain constraints originating from ~chanical
aspects\
Contrary to this,direct use of equs. (l)-(3) is not possible in a digital simulation. The programmer will realize this rather quickly in case he writes the program in a 'normal' language as e.g. FORTRAN, ALGOL,
PASCAL etc. Straightforward use of a simulation language,
e.g. ACSL,wil? result in the error message 'algebraic loop'. Its existence can be seen
Fig.2: Structure of the system 'robot+drives+gears'
quite easily if the equations are transformed to F;= Tz ; = f(z, u S, S where ;
(4)
[ M(p)T;+h(p,Tz)l
appears on both sides whereas the digital integration of differential equations
requires their explicit form. In case of an equ. (2) which is linear in kL, (4) can be transformed directly to it. If this analytic transformation into explicit form is not possible then an algorithm to compute p and f from equ. (4) has to be incorporated in the simulation program. This example shows that the simulation
hardware can decide whether or not implicit mo-
dels can be used, which often provide a 'one-to-one-mapping' of the model structure -and consequently of the system structure - on the computer program structure. But also the time needed for a single run, the form of stopping and/or switching conditions depend on this hardware. What can be done easily with a comparator and switches on an analog computer may cause numerical troubles on a digital as is well-known to all who had to handle events. As example think of a bang-bang control where the switching times are determined by a function depending on the state. Concerning computation time within the simulation)
( for a single run
it shall be remembered only that in a digital simulation, time
increases nonlinearly with complexitiy and order of the dynamic equations. This is contrary to analog or hybrid sjmulations where the available hardware limits the model complexity and order, although in hybrid simulation this can be overcome by an appropriate distribution of tasks between the analog and the digital part. Often, it is claimed, that analog or hybrid simulation requires more preparation time due to scaling etc. This is not true with modern computers which have autopatch capability and where modern simulation languages like HYBSYS can be used, which do the scaling automatically.
27
4. MODELLING BY SIMULATION
This topic includes establishing a model as well as simplification of a given model. The latter has been discussed for an industrial robot in [5,71. Consequently, only the first aspect shall be outlined in Example 3: Infusion of glucagon with stepwise increasing concentration causes in an iso-lated rat liver the hepatic glucose production to rise rapidly, Fig.3. The type of reaction leads to the idea of modelling the system behaviour as second order lag using thus
Fig.3: Comparison of measurement
(al
(ful line) and simulation (dotted line in fb,c)), act. 161.
4 ‘-a
0. 0.
a.
mm* 150.
0.
-+ , 0.
ID.
mm
* 120.
concept fitting as modelling method. During the simulation it turned out that - at least - two comparte~nts
have to be modelled: one giving the relation between the infused
glucagon dose and the cyclic AMP, the second the relation between the CAMP and the glucose production rate. The resulting model, described in detail in 161 has some essential properties; - It explains all observed phenomena qualitatively and quantitatively with an accuracy consistent with the one of the measurements - It is as simple as possible i.e. it does not contain more parameters than necessary - It was able to predict the existent of an intermediate signal (later identified as CAMP) and the reaction of the system to a stepwise decrease of the glucagon concentration (later verified by experiment) As the resulting equations contain limiters and some nonlinearities due 28
to the depen-
dence of some parameters on the actual state of the system, the development of the model as well as the parameter adaption process could be carried out only by simulation.
it
shall be pointed out, that again the model was developed step by step, starting with one modul. Once knowing that there are to be two compartements there respective models have been developed in more detail again in a step-by-step procedure. By this, example 3 illustrates also quite well that starting with a simple model which is fixed in more details at a later stage of investigations is a recommandable modelling procedures which is especially for soft systems - often easier to apply than staring with a complicated model (with unknown parameters) and simplifying it later on. 5. REFERENCES [IIP.Bradley, B.L. Fox, L.E.Schrage, A Guide to Simulation. Springer, New York, 1983 121J.W. Forrester, World Dynamics. Wright-Allen Press, Cambridge, Mass., 1971 L3ID.H. Meadows et al., The Limits to Growth. Potomac Ass.-llniv.Books, New York 1972 i4lD.H. Meadows et al., The Dynamics of Growth ina Finite World. Wright-Allen Press, Cambridge, Mass., 1974 [SII.Troch, P.Kopacek, Erstellung von Modellen fur die Dynamik von Industrierobotern mit Hilfe hybrider Simulation. Simulationstechnik (Eds.: F.Breitenecker, W.Kleinert), Springer, Berlin, 1984, 600 - 605 [611. Troth et al., Modelling by Simulation of Hepatic Glucose Production in Vitro. Proc. Int.Conf.'IMACS European Simulation Meeting on Simulation in Research and Development' 1984, Eger, Hungary, North-Holland, to appear. 171I.Troch et al., Models for Robots - A Simulation Approach. These Proceedings. 181P.J. Vermeulen, D.C.DeJongh, Growth in a Finite World - A Comprehensive Sensitivity Analysis, Automatica 13, 1977, 77 - 84
29