<html><HTML> <HEAD> <TITLE>Simulation Software - PASION example</TITLE> <META NAME="keywords" CONTENT="simulation,manufacturing,software,delphi, animation, discrete, events, queues"> <META NAME="description" CONTENT= "Simulation software for discrete event and continuous system simulation, example of a queuing model"> </HEAD> <BR> <P align=center><FONT color=red size=8><B>PASION Simulation System</B><BR></FONT><FONT color=blue size=4>Example: Manufacturing simulation<BR>An application of the PASION Queuing Model Generator QMGW<BR><BR></FONT> <HR> Consult also: <A href="http://www.raczynski.com/">http://www.raczynski.com</A> - - - - - <A href="http://storm.prohosting.com/stanracz/simulation.htm">http://www.raczynski.com/pn/pn.htm<BR>http://storm.prohosting.com/stanracz/simulation.htm</A> <P><FONT color=red size=8><IMG height=39 src="http://0049d37.netsolhost.com/newww.gif" width=38 border=0> </FONT><FONT size=5><FONT color=#0000ff>Low cost</FONT><FONT color=red> </FONT><FONT color=#800000>Queuing Model Simulator/Animator:</FONT></FONT><FONT color=#800000 size=4> </FONT><FONT color=#000000 size=4><A href="http://www.raczynski.com/pn/qms.htm">http://www.raczynski.com/pn/qms.htm</A>&nbsp;</FONT></P> <P><IMG height=32 src="http://0049d37.netsolhost.com/wasik.gif" width=32 align=bottom><STRONG> INTRODUCTION</STRONG><BR><BR>PASION is an object-oriented, Pascal-related simulation language. The language has a clear process/event structure and is equipped with appropriate environment. PASION translator generates a Pascal source code that can be run using a Pascal compiler (this new version generates code compatible with the Borland's Delphi 3 or 4). The following features make PASION the most complete and versatile simulation tool.<BR> <UL> <LI>Efficient scheduling and event queue management. <LI>Inheritance mechanism, that permits to add new properties to old processes without intervening the source code of processes declared earlier. <LI>State events. Discrete and continuous objects can run concurrently. The state events can be activated by continuous objects as well as by logical conditions changed according to the model state. <LI>The library of PASION predefined processes contains various frequently used processes, e.g. a rigid body dynamics, and several helpful processes that handle graphics and show simulation results. <LI>Program generator for ODE (Ordinary differential equations) models<B> DIFEQ</B>. <LI>Program generator for queuing models <B>QMGW</B>. This module includes graphical editor for queuing schemes, program and report generators. <LI>Program generator for continuous processes<B> FLOWD</B> described by signal flow diagrams or block schemes. <LI>Bond Graph editor and analyzer<B> BONDW</B>. This module includes a Bond graph editor and a program generator that creates source Pascal and Pasion code for a given Bond graph model. <LI>PASION<B> Animator</B>. Includes a Scenario and Icon Editor that permits to create 3D scenarios for animated simulation. The user creates the scenario and defines the possible routes for model components and the component icons. A simple calls to animation procedures from the source program makes the icons move according to the simulated component activities. <LI>VARAN: Post Mortem analyzer for stochastic (discrete and continuous) models. Shows variance, confidence intervals etc. <B>as functions of time</B>, particularly useful for the statistical analysis of transient processes. <LI>Complex System Simulator <B>CSS</B> - new versatile PASION module. Very useful for combined systems, permits model coupling. Submodels of different types (queuing, continuous, etc.) run concurrently in the same simulation program. Needs no or very little programming. Generates PASION source code. </LI></UL><BR><IMG height=129 src="http://0049d37.netsolhost.com/krolik2.gif" width=135 align=bottom><IMG height=129 src="http://0049d37.netsolhost.com/krolik2.gif" width=135 align=bottom><IMG height=129 src="http://0049d37.netsolhost.com/krolik2.gif" width=135 align=bottom> <IMG height=129 src="http://0049d37.netsolhost.com/krolik2.gif" width=135 align=bottom><BR><STRONG>EXAMPLE OF A QUEUING MODEL</STRONG><BR><BR>This example was prepared and run using the QMGW module of PASION32 package, version for Delphi 4. The program generator will be called shortly QMG in the following text. QMG is a source code generator for queuing models. It supports up to 1000 blocks like queues, servers, machines, buffers, conveyers, assembly operations etc. Using QMG you can simulate queuing and manufacturing systems without or with very little programming.<BR>The model is stored in the files EJEMP.BLW and MYSVOP.PAS on the original PASION installation disks. <BR><BR>Products to process in a processing cell with two machines come as a poisson input stream. There are two machines in sequence and then a quality control operation that can make a product to return to the second machine for adjustment. The adjustment mean time is equal to 0.25 of the normal processing time. Each machine has an unlimited input buffer and a palette with room for four products, when the product must be placed before being processed. <BR>Figure 1 shows the QMG scheme of the queuing part of the model. The meaning of the blocks is as follows: 1 - input flow (part generator), 2 - the first buffer, 3 - the palette of the first machine, 4 - the first machine, 5 - second buffer, 6 - palette of the second machine, 8 - the second machine, 10 - line of parts to be revised, 11 - quality control, 9 - split of flow, 7 - terminal point. <BR>After creating the model structure, the user can save it. After this, the model parameters must be defined. It can be done using the <B>Define parameters - All undefined blocks</B> options of the QMG menu. The program wil prompt you to give all the necesary data. Below you can see the listing that is generated by QMG after saving the model with all parameters defined. Short comments are inserted into the text.<BR><IMG height=155 src="http://0049d37.netsolhost.com/ejemp.gif" width=344 align=bottom><BR>Figure 1. QMG scheme of the model. <P>Listing of the block parameters generated by QMG:<BR></P><PRE>============================================================== PROGRAM QMGW - BLOCK PARAMETERS 26/01/99 ============================================================== Actual file : C:\pasionw\ejemp.blw Block 1 type: Generator Initial time = 0.0 Distribution NEGEXP(1.1) Generates groups of 1 Comments: NEGEXP is the exponential distribution for the time intervals between arrivals. The parts arrive one-by-one (groups of 1) ----------------------------------------------------------------------- Block 2 type: Queue of type FIFO Unlimited length. Zero initial length Cost per entity*time-unit = 0.00 Comments: a FIFO unlimitted queue. No cost declared. The user can define the cost of maintaining one part per one time unit in the queue. This cost will be added to the total cost of model operation. ----------------------------------------------------------------------- Block 3 type: Queue of type STORAGE Length limit = 4 Zero initial length Cost per entity*time-unit = 0.00 Time to remain in= 0.0 Comments: The palette of the first machine. STORAGE is similar to QUEUE. It must be limitted (4 parts in this case) and in addition, the minimal time to remain in can be specified. ----------------------------------------------------------------------- Block 4 Type: Server Distribution : 0.8+erlang(3,0.2) Additional delay on output = 0 Cost per unit of time = 1.00 Cost per operation = 1.00 Comments: The first machine. The service time has a constant component of 0.8 time units and a random component with Erlang distribution of order 3 with mean 0.2. ----------------------------------------------------------------------- Block 5 type: Queue of type FIFO Unlimited length. Zero initial length Cost per entity*time-unit = 0.00 ----------------------------------------------------------------------- Block 6 type: Queue of type STORAGE Length limit = 6 Zero initial length Cost per entity*time-unit = 0.00 Time to remain in= 0 Comments: the palette of the second machine. ----------------------------------------------------------------------- Block 7 type: Terminal point Without termination number Comments: A part that enters this block diappears from the model. ----------------------------------------------------------------------- Block 8 Type: Server Distribution : erlang(3,stime) Additional delay on output = 0 Cost per unit of time = 1.00 Cost per operation = 1.00 Comments: The second machine. Note that the mean of the service time is equal to STIME. This is an additional entity (part) attribute, where the service mean time is stored for each part. See the text below for more detail on the use of this attribute. ----------------------------------------------------------------------- Block 9 type: Split Point Selects output by probability Probabilities, top to bottom:0.850 0.150 Comments: 85% of parts go to the terminal point (block 7), 15% is returned to the second machine for adjustment. ----------------------------------------------------------------------- Block 10 type: Queue of type FIFO Unlimited length. Zero initial length Cost per entity*time-unit = 0.00 ----------------------------------------------------------------------- Block 11 Type: Server Distribution : erlang(3,0.6) Additional delay on output = 0 Cost per unit of time = 1.00 Cost per operation = 1.00 Comments: Quality control. ----------------------------------------------------------------------- </PRE>The mean service time of the second machine depends on where the part comes from. So, you can not fix it in the service time distribution. In such case, you must use an additional part attribute that will store the service time. You must use the QMG option <B>Define parameters - Additional attributes</B>. In this case the attribute was given the name STIME and type REAL. To define the attribute value you must use the SVOP procedure. Recall that SVOP is a Pascal procedure that may be called from the simulation program always when an entity passes through a QMG block. There are two cases when the corresponding calls to SVOP are generated: 1 - if you declare the use of semphores, 2 - if you require the creation of the SVOP template or SVOP operations. The SVOP template is useful, because it containes all necessary formal parameters. Note that the SVOP parameters can change from one model to another, if the additional attributes are different. The file where the SVOP template is stored will automatically appear on the list of include QMG files and will be inserted as the corresponding PASCAL include directive in the generated source code. <BR>After completing the model, save it and exit from QMG. Now, you must insert the necessary instructions into the body of the SVOP template. In our case the SVOP procedure should be as foolows. <P align=center><BR><PRE>PROCEDURE SVOP(N,SOURCE:INTEGER; TIMIN,TIMQ:REAL; VAR STIME:REAL); BEGIN if n=1 then stime:=1.0; if n=9 then stime:=0.25; END; </PRE><BR>Recall that the SVOP procedure is called from inside of an entity event code always when it passes through a QMG block, except the terminal block. The formal parameters are as follows:<BR><BR>N - number of the block the procedure is called from.<BR>SOURCE - number of the source or assembly block where the entity was created.<BR>TIMIN - creation time.<BR>TIMQ - time the entity is waiting if it is acually in a queue or storage.<BR>STIME - (in this case only) user-defined entity attribute.<BR><BR>As can be seen from the above SVOP code, the generator no.1 defines STIME equal to 1. Consequently, this will be the service mean time for the entities that enter the server 8 for the first time. If the entity passes through block 9, the STIME variable is set to 0.25. So, if the entity returns for adjustment, the service mean time of server 8 will be equal to 0.25.<BR>Note that the service distribution is the property of the server, but the service mean time is defined by the entity that enters the server, because it is an attribute of the entity and not of the server. All entity attributes are "attached" to the entity and move with the entity throuthout the model.<BR><BR>After completing the SVOP code, save it and return to QMG. Now, you can run the simulation. Use the <B>Genrate Code - Generate and run</B> options to do it. The results shown below were obtained with the following code options: PASION PROGRAM, PERMIT LOST ENTITIES, GENRATE SVOP TEMPLATE, GENERATE FILES FOR VARAN. Note that if you run QMG for second time, you should respond YES to the question "Generate SVOP template or SVOP operations ?" but do NOT generate the SVOP template (left the file name empty). Otherwise, you can easily overwrite the SVOP code you have prepared earlier. The files for VARAN will permit you to automatically repeat the simulation and then to use the resulted trajectories for more statisctical analyses using the VARAN utility.<BR><BR>The following figures show some selected plots generated by VARAN.<BR> <P align=center><IMG height=553 src="http://0049d37.netsolhost.com/scsc2.gif" width=800 align=bottom><BR>Figure 2. The average trajectory and confidence interval for the length of the queue 5, shown as a function of time. The confidence level is 0.9. This means, that with the propability 0.9 we are inside the corresponding vertical sections. <IMG height=553 src="http://0049d37.netsolhost.com/scsc3.gif" width=800 align=bottom><BR>Figure 3. The average trajectory and confidence interval for the length of the queue 10, shown as a function of time. Note how little informative is the average trajectory plot. <IMG height=470 src="http://0049d37.netsolhost.com/scsc4.gif" width=640 align=bottom><BR>Figure 4. The probability density function for the length of queue 3. The horizontal axes are the queue length and the time. The vertical axis is the value of the corresponding density function. Note that the probability that the queue is zero or maximum is higher than the probability that it has a medium length. <IMG height=470 src="http://0049d37.netsolhost.com/scsc5.gif" width=640 align=bottom><BR>Figure 5. The probability density function for the length of queue 5. <IMG height=470 src="http://0049d37.netsolhost.com/scsc6.gif" width=640 align=bottom><BR>Figure 6. The probability density function for the length of queue 10. </P> <P><I>Contact: Stanislaw Raczynski<BR>P.O.Box 22-783<BR>14000 Mexico D.F.Mexico<BR></I><A href="http://www.raczynski.com/">http://www.raczynski.com</A><BR>E-mail :<BR><A href="mailto:stanracz@prodigy.net.mx">stanracz@prodigy.net.mx</A><BR><A href="mailto:stanracz@altavista.net">stanracz@altavista.net</A><BR><BR></P> <P align=center>&nbsp; &nbsp; <A href="http://www.addme.com/"><IMG height=31 alt="Add Me!" src="http://www.addme.com/link8.gif" width=88 border=0></A> </P> <ADDRESS>Pasion Summary / Stanislaw Raczynski / stanracz@prodigy.net.mx <BR></ADDRESS> <HR> </html>