# The modeling algorithm. - Modeling of systems

## Modeling algorithm.

A typical enlarged scheme of a modeling algorithm constructed on a block basis for systems with discrete events is shown in Fig. 8.2.

Fig. 8.2. Typical Enlarged Scheme of the Modeling Algorithm

This scheme contains the following enlarged modules: A is the module for setting initial states, containing two submodules (A x - for setting initial states the simulated variant and А у - to specify the initial states for one run of the model); In - the module for determining the next state change moment, which performs a state array scan and selects the model block/and "/ = 1, n , with a minimum time change of state min tf **; C is a logical switching module containing three sub-modules (C x - for a logical transition by the block number of the model i or by the time T, the question of the completion of the run, C 2 - to record information about the states that change when viewing the block, as well as to determine the moment of the next state change of the block /, and the next special state number 5 0 ; C 3 - to complete the run in the case when tY * & gt; G, fixing and preliminary processing of simulation results); D is a control and processing module containing two submodules (D l - to check the end of the study of the version of the model M s for a given number of runs or the accuracy of simulation results; D 2 - for the final processing of information obtained on the model L/ m ).

This enlarged scheme of the modeling algorithm corresponds to the statics of modeling. If it is necessary to organize the sequence modeling of the model M m and to optimize the simulated system 5, for example, at the stage of its design, questions related to modeling dynamics, an external loop should be added to vary the structure, algorithms, and parameters of the M m model.

Example 8.1. Let's consider the modular principle of realization of the model S, formalized in the form of a Q-scheme. Let there be a pound-multichannel Q-cxe.ua ^ -input streams of requests. In each phase there are Lf, j = 1, b, service channels. Determine the distribution of the waiting time of applications in each phase and the idle time of each serving channel.

As blocks of the model M n we will consider: m - blocks of application sources that simulate I , input streams; t - service channel blocks,

simulating the functioning of channels;/i - block of interaction, reflecting the interconnection of all blocks of the machine model M m . In this case, in the array state, we will fix the moments of receipt of applications, the release of channels and the end of the simulation, the number of elements of this array will be equal to

The scheme of the modeling algorithm for this example is shown in Fig. 8.3. As you can see from the diagram, there are three types of procedures in the submodule C 2 : C 2 , C 2 and C 2 . The first procedure C 2 works when an application arrives from any input stream, the second the procedure C 2 works at the time of release of the channel of any phase of maintenance, the latter, the third procedure Cd works at the release of the channel of the last phase, i.e. when the application service finishes. ^ -circle.

Let's consider in more detail the operators of the procedures C 2 , C2 and C '{. The operator C2 1 defines the membership l application to one of the b input streams generated by the B module. The C < 2 2 operator checks to see if there are any in the first phase, the queue of free service channels. If the queue is, then the control is passed to the Csz operator, otherwise to the C'24 operator. The C fixes the moment of receipt of the application in the array of the queue of requests of the first phase. The C < 2 4 operator selects the channel number from the first-channel channel queue array, decreasing its length by one, calculates and fixes the idle time of the channel, determines the duration of the service, and sends a new release point channel into the state array. The C 2 operator specifies a new time for the request to arrive and sends it to the appropriate cell in the state array.

The operator C serves to determine the ith phase of the ith channel,

Y • 2 & pound; - 1, * 1, C. The C22 operator checks for the existence of a queue of orders on the selected y'-th phase. If there is no queue, control is transferred to the operator C 23 , and, if available, to the C 2 operator 4 - The C 23 sends the release time of the channel to the queue of the channels of the ith phase, reduces the length of the queue by one, and fixes the waiting time for the selected application to begin servicing it. Next, the length of service of this application is determined by the released channel, the new release time of the channel is calculated and sent to the state array. The operators ^ 26 and C 2 7 perform the same actions with the application serviced in the y-th phase, that I operators C < sub> 22 , C2 and C24 with the application that entered the first phase of the Q-cx.

The C ** operator configures the operators of this procedure C 22 , C ' 23 and C 2 4 on the selected service channel of the last, i-th, phase. The work of the operators С'22, С 2 Z and С'24 is analogous to the work of the operators С 2 2 , C 23 and C 2 4 -

The purpose of the remaining submodules of the algorithm does not differ from the one considered earlier for the modeling algorithm shown in Fig. 8.2.

Building a modeling algorithm on a block basis allows, through the organization of software modules, to reduce the time spent on modeling the system H, since the machine time in this case is not spent looking at recurring situations. In addition, this scheme of the modeling algorithm is simpler than in the case when modules are not allocated.

Fig. 8.3. The scheme of modeling algorithm of multiphase multichannel

The autonomy of the procedures of the submodule C 2 allows for their parallel programming and debugging, and the described procedures can be standardized, used as the basis for developing the appropriate modeling software, and used to automate the process of modeling systems.

In terms of perspectives, the block approach creates a good basis for automating simulation experiments with system models that can fully or partially cover the stages of formalizing the process of the system 5 operation, preparing the initial data for modeling, analyzing the properties of the machine model M < sub> m systems, planning and conducting computer experiments, processing and interpreting the results of the system simulation. Such computer experiments should be scientific, not empirical, that is, as a result, not only the methods for solving a specific task should be offered, but also the boundaries of the effective use of these methods, and their capabilities should be assessed. Only the automation of the modeling process will create prospects for using modeling as a tool for the day-to-day work of the system specialist.

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

[...]

## Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

## How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)