An Approach to Implementation
of Physical Simulation Models
Shpakov Vladimir
St.Petersburg Institute for Informatics and Automation of the Russian Academy of Sciences
39, 14th line, St. Petersburg, Russian Federation
Keywords: Process-Oriented, Hybrid Simulation, Model Design, Transitive Model, Rule-based Approach.
Abstract: Advantages of a rule-based approach to dynamic system physical models specification and implementation
are discussed. Much need for the approach at the modern state of system engineering is pointed out. In par-
ticular, such an approach may be useful for simulation of control and self-organizing systems. A rule-based
situation formalism of an interacting hybrid processes specification is briefly stated and some ways of its
use for physical simulation model implementation are shown. Facilities of the considered methods are illus-
trated by examples of some simple dynamic system models implementations. Specifications of these physi-
cal models and some results of simulation are presented.
1 INTRODUCTION
A mathematical approach to dynamic system simu-
lation serves now as accepted. It consists in follow-
ing. At first, mathematic model of the system works
out on base of corresponding dynamic laws (me-
chanics, thermodynamics, electrodynamics and oth-
ers). As a rule, the model is a set of differential and
algebraic equations about abstract variables. Here
system physical parameters form equations coeffi-
cients. Once, the coefficients constitute rather com-
plicated dependences upon parameters. Model ex-
periments carry out on computers using numerical
methods of the equations solution.
An imperfection of such an approach is mani-
fested already when system parameters modifying in
course of model experiments. It is caused by neces-
sity of equations coefficients recalculation. Initial
system model modification or extension causes al-
teration of the equations and the software for their
processing.
An alternative of this abstract mathematical ap-
proach is using of physical models of dynamic sys-
tems. In this case the model variables are real system
process states, such as distances, velocities, forces,
angles, temperatures, pressures, levels and so on.
The states evolutions are executed with procedures,
which realize corresponding dynamic laws, subject
to satisfying of existing constraints and relations
between system elements. Among physical models
advantages, it is worth to note less labor expendi-
tures on the model development, its modification
and expansion. The physical approach is rather con-
venient for synergetic systems simulation. It enables
comparatively easy to realize systems interacting
with each other and with environment.
There are a lot of computer means for dynamic
system simulation including that intended for physi-
cal simulation models development (Modelica, Sim-
ulink, SimMechanics, SimElectronics and others)
(Avvizano, 2008). Available computer means for
physical model realization (physics engines) are
oriented substantially on carrying out model experi-
ments, system analysis and computer games devel-
opment (Boeing, 2007). Their usage for creation of
the models embedded for example in control sys-
tems, training or teaching equipment is rather awk-
ward. At the same time, high processing power of
modern computers enables to develop relatively
simple methods of such models specification and
implementation.
Hereinafter a short description of a rule-based
formalism is presented and capability of its using for
implementation of the physical simulation models is
discussed. In the third section an example of simple
dynamic system specification and some results of its
simulation are presented.
173
Vladimir S..
An Approach to Implementation of Physical Simulation Models.
DOI: 10.5220/0003981501730176
In Proceedings of the 2nd International Conference on Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH-2012),
pages 173-176
ISBN: 978-989-8565-20-4
Copyright
c
2012 SCITEPRESS (Science and Technology Publications, Lda.)
2 PROCESSES REALIZATION IN
TERMS OF USING A
RULE-BASED SITUATION
FORMALISM OF PROCESSES
SPECIFICATION
Real physical interacting processes almost always
are hybrid ones that is they have discrete and contin-
uous components. A base of the formalism is an
abstract model of hybrid automaton (Henzinger,
1996), in which discrete states are represented by
logical variables. A set of logical variables contains
also a subset of predicates of the continuous states.
The predicates are used to specify interactions be-
tween continuous and discrete-event components of
the processes. The logic variables can determine
both discrete changes of continuous component and
changes of their evolution dynamic. Thus a state of
the processes model may be represented by a set of
real variables
X
for the continuous components and
a set of logic variables
W for the discrete compo-
nents. The last consists of subset
Q for the discrete
states and subset
G of predicates, that is GQW U
=
.
To specify processes it is necessary to define transi-
tion functions of the following types:
},{: TrueFalseQW ×σ — function of dis-
crete state transitions;
XXW ×δ : — function of continuous state
transitions;
},{: TrueFalseGX ×
γ
— predicate value de-
pendence of continuous process states.
The formalism expressiveness and effectiveness
of the model implementation essentially depend up-
on specific forms of these functions. A definitional
domain of the transition function σ may be repre-
sented with help of logic formulae that makes the
representation rather obvious. In the general case,
the model specification may need whatever logic
formulae. To our mind as the condition it is conven-
ient to use an elementary conjunction of the logic
variables. Such conjunctions may be understandably
interpreted as logic-dynamic situations (Shpakov,
2004). The situation
j
S may be defined as
following:
ni
jjjj
sssS ,...,,...
1
= , where
ii
jj
ws = , or
ii
jj
ws ¬=
,
Ww
i
j
, ||,...1 WNNn
ww
== .
Designating the set of situations
S the type of
the transition function of discrete states may now be
defined as following:
},{: TrueFalseQS ×
σ
.
This function may be assigned with help of a collec-
tion of production rules “condition action”. In
the rules the logic-dynamic situation is used as a
condition and the procedure, which assigns defined
values to logic states, is used as an action. At that the
rule takes the following form:
'''
,...,,...,
1 mi
jjjj
rrrS
,
(1)
where
''
ii
jj
qr = or
''
ii
jj
qr ¬= , Qq
i
j
'
.
To implement an arbitrary logic formula it is
necessary to use several rules with the different con-
ditions and the same executive parts. It is a specifi-
cation of a normal disjunction form and it enables to
realize any logic formula.
The function
δ
must for every mode determine
new values of the process states which correspond
with a current process state, the system dynamic and
also with current states of some processes interacting
with this process. The hybrid process mode may be
naturally represented by a logic situation considered
above. It was proposed to find the new values of the
continuous process states by calculation of their
transitive relations with the current states (Alur,
2000). Algorithms of the transitive relations calcula-
tions for some elementary processes (integration,
differentiation, smoothing and others) are presented
in (Shpakov, 2006). Complicated processes may be
implemented by different connections of the elemen-
tary ones and using arithmetic operations and func-
tional procedures. In this case the transitive function
δ
may be represented with help of a collection of
following rules:
),('
ikkkj
xxxS τ=
,
(2)
where
SS
j
— the situation, corresponding to the
mode,
k
τ
— transitive relation, Xxx
ik
,
states of the continuous processes.
Since the hybrid process modes very often de-
pend on their states being at some assigned ranges it
is convenient to represent the function
γ
by a col-
lection of following rules:
kjkjjkj
gxbxxax +
))()((
4321
,
(3)
where
GgXxxxx
kjjjj
,,,,
4321
,
k
a and
k
b -
constants, corresponding to the range. More compli-
cated predicates may be received by using simple
ones and rules (1).
A computer implementation of the processes
specified by rules (1, 2, 3) is executed with help of
SIMULTECH2012-2ndInternationalConferenceonSimulationandModelingMethodologies,Technologiesand
Applications
174
an interpreter of these rules. The sets of process
states variables (
X
and W ) are represented in the
interpreter with arrays of records. All rules are im-
plemented with help of condition operators
if…then…”. The interpreter base is an executing
procedure which scanning lists of rules in a cycle.
The processing algorithm calculates the value of the
rule condition part. If this value is equal to
True
then a procedure of the executive part of the rule is
triggered.
3 AN EXAMPLE OF PHYSICAL
MODEL IMPLEMENTATION
The approach described was used when developing
in SPIIRAS a prototype of computer environment
oriented on a collection of interacting hybrid pro-
cesses simulation. The environment has quite intui-
tive and obvious interface for editing rules (1, 2, 3)
and processes visualization. Later, specifications in
the environment of a springy hoop dropping on a
plane are presented.
Physical parameters of the hoop are mass
)(m , a
radius
)(R and an elastic stiffness )(k . The process
states are vertical acceleration
)(
y
A , velocity )(
y
V ,
and a center of mass height over the plane
)(h and
the hoop elastic deformation
)( hR , which origi-
nates when the hoop getting in contact with the
plane. It is necessary to simulate the hoop moving in
two situations: a free fall when
)( Rh > , and an elas-
tic contact interaction when
)( Rh >¬ . The hoop
free fall is occurred under the action of the weight
)(P , and at the elastic impact its movement is de-
termined by the simultaneous actions of the weight
and the elastic reaction force
)(
y
F
. At the situation
)( Rh > the hoop acceleration is equal to the gravita-
tional acceleration
)(g , the velocity and the height
is determined by integrals of the acceleration and the
velocity, respectively. The elastic reaction force is
proportional to the elastic deformation
)( hR
. In
figure 1 there is a copy of part of the environment
editor where the rules of the hoop state transition are
presented.
Figure 1: State transition rules of a spring hoop dropping
on a plane.
Variable names in the rules correspond to ones
pointed above. The situations with names (braking)
and (speed-up) are determined as follows
)()0(),( brakingVRh
y
,
)()0(),( upspeedVRh
y
><
.
The rules number 2 and 3 calculate current sizes
of elastic reaction forces on sections of braking and
speeding up. The fourth rule calculates a sum of the
forces and the fifth one does the hoop acceleration.
The rules number 6 and 7 calculate the hoop current
velocity and the height correspondingly. And the
eighth rule calculates the size of the elastic hoop
deformation.
A chart of the hoop mass center height changing
is presented in figure 2.
Figure 2: A chart of the hoop mass center changing.
A graphical chart of the elastic reaction force
changing is presented in figure 3. The force differs
from zero only when
)( Rh
. It increases on the
section of braking and decreases on the section of
speeding up.
Now we show how to extend the model to the
case when there is a horizontal component of the
velocity. In this case in the presence of friction the
hoop begins to rotate as a result of its contact with
the plane. At the same time the hoop horizontal ve-
locity decreases.
AnApproachtoImplementationofPhysicalSimulationModels
175
Figure 3: Change of the hoop spring force during its con-
tact with the plane.
It is necessary to assign a hoop moment of inertia
and include in the state vector variables for represen-
tation of new process states: a horizontal coordinate
)(X , a horizontal acceleration )(
x
A , a velocity
)(
x
V , a friction force )(
x
F , a moment of the couple
)(
tng
M
, an angle, an angle acceleration, an angle
rate and a velocity of the band in regard to the plane
)(
tng
V
. The friction force originates in a situation
defined
slideVRh
tng
>< )0||()(
.
Figure 4: The transition rules for simulation of the hoop
moving after its contact with the plane.
Figure 5: Changes of the hoop height, its horizontal and
angle velocities during its contact with the plane.
The rules for the process states evolution specifi-
cation are presented in figure 4. An addition of these
12 rules to the existing 8 ones enables to simulate an
elastic hoop dropping in the presence of the horizon-
tal component of the velocity and the hoop rotation.
Curves of the height, the horizontal and angle ve-
locities found in result of such hoop dropping simu-
lation are presented in figure 5.
4 CONCLUSIONS
A programming of dynamic system computer mod-
els based on use of transition rules (1, 2, 3) has a
number of advantages in comparison with using of
universal programming languages. A usage of the
rules enables to shorten the time of the model devel-
opment. The program is turned out more obvious.
The model modification, extension and validation
are simplified essentially. A transmission of
knowledge from technicians to programmers is facil-
itated.
ACKNOWLEDGEMENTS
The present research was supported partly by project
funded by grants 12-01-00015 of the Russian Foun-
dation for Basic Research.
REFERENCES
Alur R., Henzinger T.A., Lafferriere G., Pappas G. J.,
2000. Discrete Abstractions of Hybrid Sys-
tems, Proceedings of the IEEE. No. 88.
Adrian Boeing, Thomas Bräunl, 2007. Evaluation of real-
time physics simulation sys-
tems, http://www.adrianboeing.com/pal/papers/p281-
boeing.pdf.
Carlo Alberto Avvizano, 2008 Review of existing simula-
tion tools, http://sirslab.dii.unisi.it/I-RAS/wp-
content/uploads/2008/05/simulinkreviewx.pdf.
Henzinger T.A., 1996. The Theory of Hybrid Automa-
ta, Proceedings of the 11
th
Annual IEEE Symposium
on Logic in Computer Science (LICS 96).
Shpakov V.M., 2004. Executable specifications of produc-
tion processes transition models, Mechatronics, au-
tomatization, control. No. 3, (in Russian).
Shpakov V. M., 2006. Dynamic knowledge specification
on the base of continuous process transition mod-
el, SPIIRAS Proceedings, issue 3, vol. 1, (in Russian).
SIMULTECH2012-2ndInternationalConferenceonSimulationandModelingMethodologies,Technologiesand
Applications
176