9. Algorithmisation of system models and their implementation. The substages of the second stage of modelling

Lecture



At the second stage of modelling — the stage of algorithmisation of the model and its
computer implementation — the mathematical model formed at the first
stage, is embodied in a specific computer model. This stage represents
a stage of practical activity aimed at implementing the ideas and
mathematical schemes in the form of a computer model of the operating process
of system S. Before considering the sub-stages of algorithmisation and computer
implementation of the model, let us dwell on the basic principles of constructing simulation algorithms and the forms of their representation.
Principles of constructing simulation algorithms. The operating process of system S can be regarded as a sequential change of its
states
z (z (t) z (t) z (t)) k
, ,...,
= 1 2
in k-dimensional space. Obviously, the task of
modelling the operating process of the system S under study is
the construction of functions
z
, on the basis of which the characteristics of interest of the system's operating process can be calculated. For this
there must be relations connecting the functions
z
with the variables, parameters and time, as well as the initial conditions
( ( ) ( ) ( )) 1 0 2 0 0
0
z z t , z t ,...,z t = k
at the moment of time
0
t = t .
Let us consider the operating process of a certain deterministic
system
S D
, in which there are no random factors, i.e. the state vector
of such a system can be defined as
z (z , x,t)
0
= Φ . Then the state of the process at
the moment of time
t + jΔt
0
can be uniquely determined from the relations
of the mathematical model from the known initial conditions. This makes it possible
to construct a simulation algorithm for the system's operating process. For
this, we transform the relations of the model Z into a form convenient for calculating
z (t + Δt) 1
, z (t + Δt) 2
, …, z (t t) k + Δ
from the values
(τ ) i
z , i = 1, k , where
τ ≤ t
. Let us set up a counter of system time which at the initial moment
shows the time
0
t . For this moment
( )
0
i 0 i
z t = z
. Let us add the time interval
Δt , then the counter will show
t = t + Δt
1 0
. Let us calculate the values
z (t t) i 0 + Δ . Then let us move to the moment of time
t = t + Δt
2 1
and so on. If the step
Δt
is sufficiently small,
then in this way approximate values of z can be obtained.
Let us consider the operating process of a stochastic system
R S , i.
e. a system affected by random factors. For such
the system, the state function of the process z at the moment of time
τ ≤ t
and the relations
of the model determine only the probability distribution for
z (t t) i + Δ
at the moment
of time
t + Δt . In the general case, the initial conditions
0
z
may also be random, specified by a corresponding probability distribution. In this case
the structure of the simulation algorithm for stochastic systems basically
remains the same. Only instead of the state
z (t t) i + Δ
it is now necessary to calculate the probability distribution for the possible states. Let the system time counter show the time
0
t . In accordance with the given probability distribution,
0
i
z
. Next, based on the distribution, we obtain
the state
z (t t) i 0 + Δ
and so on, until one of the possible realisations of the random multidimensional process is constructed
z (t) i
in the given time interval.
The principle of constructing simulation algorithms considered above is called the principle of
Δt . This is the most universal principle, making it possible to
determine the successive states of the system's operating process
S at given time intervals
Δt . But from the point of view of computer
time expenditure, it sometimes turns out to be uneconomical.
When considering the operating processes of certain systems
it can be found that two types of states are characteristic of them:
1) special states, inherent in the system's operating process only at certain moments of time (moments of arrival of input or control
actions, disturbances of the external environment, and so on);
2) non-special states, in which the process remains the rest of the time. Special
states are also characterised by the fact that the state functions
z (t) i
change abruptly at these moments of time, while between special states
the change of coordinates
z (t) i
occurs smoothly and continuously, or does not occur
at all. Thus, by tracking, during the modelling of system S, only its special states at those moments of time when these states occur,
one can obtain the information necessary for constructing the functions
z (t) i
.
Obviously, for the type of systems described, simulation
algorithms can be constructed based on the «principle of special states». Let us denote the stepwise (relay-type) change of the state z as
δz , and the «principle of special states» — as
the principle
δz .
For example, for a queueing system (Q-scheme), as
special states, one can choose the states at the moments when requests arrive for service at device P and at the moments when the service of requests
by channels K ends, when the state of the system, estimated by the number of
requests present in it, changes abruptly.
Let us note that the characteristics of the operating process of such systems
with special states are estimated from information about the special states, while
non-special states are not considered during modelling. The «principle
δz
»
makes it possible for a number of systems to significantly reduce the computer
time spent on implementing simulation algorithms compared with the «principle
Δt
». The logic of constructing a simulation algorithm that implements the «principle
δz
» differs from that considered for the «principle
Δt
» only in that it
includes the procedure for determining the moment of time
δ
t , corresponding to the next special state of system S. For studying the process of
operation of large systems, it is rational to use a combined principle of constructing simulation algorithms, combining
the advantages of each of the principles considered.
Forms of representing simulation algorithms. A convenient form
for representing the logical structure of models of the operating processes
of systems and computer programs is a scheme (diagram). At various stages of model-
ling, generalised and detailed logical schemes of simulation algorithms are drawn up, as well as program schemes.
A generalised (aggregated) scheme of the simulation algorithm sets out the general order of actions when modelling the system, without any clarifying details. The generalised scheme shows what needs to be done at
the next step of modelling, for example, to refer to the random number
generator.
The detailed scheme of the simulation algorithm contains refinements absent from the generalised scheme. The detailed scheme shows not only what
should be done at the next step of modelling the system, but also how
to do it.
The logical scheme of the simulation algorithm represents the logical structure of the model of the operating process of system S. The logical
scheme indicates the time-ordered sequence of logical
operations associated with solving the modelling problem.
The program scheme reflects the order of software implementation of the simulation algorithm using specific mathematical support. The program scheme is an interpretation of the logical scheme
of the simulation algorithm by the program developer on the basis of a specific algorithmic language. The difference between these schemes lies in the fact that
the logical scheme reflects the logical structure of the model of the system's operating process, while the program scheme reflects the logic of the computer implementation of the model using specific software and hardware modelling tools.
The logical scheme of the algorithm and the program scheme can be drawn up
either in aggregated or in detailed form. To draw these schemes, a set of symbols is used, defined by GOST 19.701—90 (ISO 5807—85)
«Unified system of program documentation».
Sub-stages of the second stage of modelling. Let us consider the sub-stages carried out during the algorithmisation of the system model and its computer implementation,
paying primary attention to the tasks of each sub-stage and the methods of solving them.
2.1. Construction of the logical scheme of the model. It is recommended to build
the model on a block principle, i.e. in the form of a certain set of standard blocks. Constructing the model of system S from such blocks provides the necessary flexibility during its operation, especially at the stage of computer
debugging. When constructing a block model, the process of
the system's operation is broken down into separate, sufficiently autonomous sub-processes. Thus, the model is functionally divided into sub-models, each of which in turn can be broken down into even smaller elements. The blocks of such a model are of two types: primary and auxiliary.
Each primary block corresponds to a certain real sub-process,
taking place in the system S being modelled, while the auxiliary blocks are merely a component part of the computer model; they do not reflect
the functions of the system being modelled and are needed only for the computer implementation, recording and processing of the modelling results.
2.2. Obtaining mathematical relations. Simultaneously with carrying out the sub-stage of constructing the logical scheme of the model, it is necessary to obtain, if possible, mathematical relations in the form of explicit functions,
i.e. to construct analytical models. This sub-stage corresponds to the implicit specification of possible mathematical relations at the stage of constructing the conceptual model. When carrying out the first stage, there cannot yet be information about the specific form of such mathematical relations, whereas at the second
stage it is already necessary to obtain these relations. The scheme of the computer model
must represent a complete reflection of the concept embedded in the model
and must have: a) a description of all the blocks of the model with their names; b) a unified system of notation and numbering of blocks; c) a reflection of the logic of the model of the
system's operating process; d) the specification of mathematical relations in explicit
form.
2.3. Verification of the validity of the system model. This check is
the first of the checks carried out at the stage of implementing the model. Since the model
represents an approximate description of the operating process of the real system S, until the validity of the model has been proven, it cannot be asserted that the results obtained with its help will coincide with
those that could be obtained by carrying out a full-scale experiment with the real system S. Therefore, determining the validity of the model
can be considered the most important problem in the modelling of systems. The degree of confidence in the results obtained by the modelling method depends on the solution of this problem. The verification of the model at the sub-stage under consideration should
give an answer to the question of how far the logical scheme of the system model and the mathematical relations used reflect the concept of the model formed at the first stage. In doing so, the following are checked: a) the possibility of solving the problem posed; b) the accuracy with which the concept is reflected in the logical scheme; c) the completeness
of the logical scheme of the model; d) the correctness of the mathematical relations used.
Only after the developer has, by means of the appropriate
verification, made sure of the correctness of all these provisions, can it be considered that a logical scheme of the system model S exists that is suitable for further work on implementing the model on a computer.
2.4. Selection of tools for modelling. At this
sub-stage it is necessary to finally decide which computing machine (digital computer, analogue computer, or hybrid computing complex) and which software it is advisable to use for implementing the model of system S. In general, the choice of computing tools can also be made at previous sub-stages, but the sub-stage under consideration is the last one at which this choice must be made finally, since otherwise difficulties will arise in carrying out further work on implementing the model. The question of choosing a computer comes down
to meeting the following requirements: a) the availability of the necessary software
and hardware; b) the accessibility of the chosen computer to the developer of the mod-
el; c) provision for all stages of implementing the model; d) the possibility of obtaining the results in a timely manner.
2.5. Drawing up a plan for carrying out programming work.
Such a plan should help in programming the model, taking into account estimates
of the size of the program and the labour costs of drawing it up. When a
general-purpose computer is used, the plan should include: a) the choice of the programming language (system) for the model; b) an indication of the type of computer and the devices needed for modelling; c) an estimate of the approximate amount of the required operational and
external memory; d) the estimated computer time expenditure for modelling; e) the anticipated time expenditure for programming and debugging
the program on the computer.
2.6. Specification and construction of the program scheme. The specification
of the program is a formalised representation of the requirements imposed on
the program, which must be satisfied during its development, as well as
a description of the problem, the conditions and the effect of the action without indicating the method of achieving it. The presence of the logical block diagram of the model makes it possible to construct the scheme
of the program, which should reflect: a) the division of the model into blocks, sub-blocks
etc.; b) the specific features of programming the model; c) the carrying out of the necessary
changes; d) the possibilities for testing the program; e) an estimate of the computer time expenditure; f) the form of representation of the input and output data.
2.7. Verification and validity checking of the program scheme. Verification of the program is proof that the behaviour of the program corresponds to the specification for the program. This check is the second one at the stage of
the computer implementation of the system model. Obviously, there is no point in continuing
the work of implementing the model if there is no confidence that the program scheme, according to which further programming will be carried out, contains
errors that make it inadequate to the logical scheme of the model and, consequently, inadequate to the very object of modelling. In this case, a check is carried out
of the correspondence of each operation presented in the program scheme
to the analogous operation in the logical scheme of the model.
2.8. Carrying out the programming of the model. With a sufficiently detailed program scheme that reflects all the operations of the logical scheme of the model, one can proceed to programming the model. If there is an adequate
program scheme, then programming is work only for
the programmer, without the participation and help of the model developer. When using application software packages for modelling, working programs are directly generated for modelling a specific
object, i.e. the programming of the model is carried out in an automated mode.
2.9. Verification of the validity of the program. This is the last check at the
stage of the computer implementation of the model, which must be carried out by: a) back-translating the program into the original scheme; b) checking individual parts
of the program when solving various test problems; c) combining all parts of the program and checking it as a whole on a control example of modelling a variant of system S.
2.10. Drawing up technical documentation for the second stage. To
complete the stage of the computer implementation of the model, technical documentation must be drawn up, containing: a) the logical scheme of the model and its description; b) an adequate program scheme and the notation adopted; c) the full text
of the program; d) a list of input and output quantities with explanations; e) instructions for working with the program; f) an estimate of the computer time expenditure for modelling, indicating the required computer resources

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Information systems modeling"

Terms: Information systems modeling