- •Table of Contents
- •Chapter 1. Using GPSS World
- •Lesson 1 - The GPSS World Program
- •Lesson 2 - Running a Simulation
- •Lesson 3 - Problems
- •Lesson 4 - The Text Editor
- •Lesson 6 - The ADVANCE Block
- •Lesson 9 - GPSS World Commands
- •Lesson 10 - Manual Simulation
- •Lesson 11 - The Graphics Windows
- •Lesson 12 - Reading from and Writing to External Files
- •Lesson 14 - Reports
- •Lesson 15 - Session Journaling
- •Lesson 16 - Continuous Modeling
- •Lesson 17 - PLUS
- •Lesson 19 - Experiments
- •Chapter 2. Applications
- •1. TURNSTIL.GPS
- •2. TELEPHON.GPS
- •3. PERIODIC.GPS
- •4. TVREPAIR.GPS
- •5. QCONTROL.GPS
- •6. ORDERPNT.GPS
- •7. MANUFACT.GPS
- •8. TEXTILE.GPS
- •9. OILDEPOT.GPS
- •10. ASSEMBLY.GPS
- •11. ROBOTFMS.GPS
- •12. BICYCLE.GPS
- •13. STOCKCTL.GPS
- •14. LOCKSIMN.GPS
- •15. FOUNDRY.GPS
- •16. TAPEPREP.GPS
- •17. TRAFFIC.GPS
- •18. POWDER.GPS
- •19. QTHEORY.GPS
- •20. SUPERMRK.GPS
- •21. SHIPPORT.GPS
- •22. EXCHANGE.GPS
- •23. FMSMODEL.GPS
- •24. ETHERNET.GPS
- •25. PREDATOR.GPS
World Session.
CLICK ON The X -Upper Right of the Simulation / Journal Window
and
CLICK ON The X-Upper Right of the Model Window
In the next lesson, we will go into the use of the INTEGRATE Command.
Lesson 16 - Continuous Modeling
When you can express changes to variables in terms of their derivatives with respect to time, GPSS World can automatically keep their values up to date. By using the INTEGRATE Command, you can incorporate a system of ordinary differential equations of any order into your simulation. Although continuous modeling is quite general, and easily handles nonlinear systems, it is usually slower than other methods.
Please familiarize yourself with the basic concepts by reading the section, Continuous Simulation, in Chapter 4 of the GPSS World Reference Manual. See you when you get back.
As you have seen, the primary tools for continuous modeling are the INTEGRATE Command, which sets up the differential equation and thresholds, and the INTEGRATION Block, which can turn each integration on or off.
It’s easy to set up a continuous variable. All you have to do is to initialize the User Variable and assert the INTEGRATE Command. This gives GPSS World the starting value and all it needs to know in order to keep updating it. Let’s try it.
CHOOSE File / New
CHOOSE Model
in the dialog box.
SELECT OK
Let’s assume that we have a manufacturing system that creates 2 widgets a second. When a full truckload of widgets has been produced, the supervisor sends for a truck to hauls away a full load to one of the distribution centers. We start the simulation with an inventory of 0.
TYPE Inventory EQU 0
to set up the initial condition. On the next line
TYPE Inventory INTEGRATE 2,Full_Load,Get_Truck
to set up the derivative. Usually, you will need to use a PLUS Procedure to define the derivative. Then, you would use a parenthesized procedure call in Operand A of the INTEGRATE Command.
Notice that when the threshold is crossed a transaction will be generated. We will use this to end the simulation.
TYPE Full_Load EQU 50
Now when 50 widgets are created, a transaction will be sent to the Block labeled Get_Truck.
That is all you need for the continuous part. For the discrete part, add the
following statements to the model.
TYPE GENERATE 100
TERMINATE
Get_truck TERMINATE 1
You always need the discrete part to start and end the simulation. In this case we will use the threshold to decrease the Termination Count.
Save the model if you might want to experiment later and don’t want to type it in again.
CHOOSE Command / Create Simulation
Before we start the simulation, open a Plot of the User Variable Inventory,
CHOOSE Window / Simulation Window / Plot Window
Then in the Edit Plot Window
TYPE Inventory
in all three fields: Label, Expression, and Title. Leave the other values as they are.
CLICK ON The Plot and Memorize Buttons
Let's mark the threshold on the plot, as well. In the Edit Plot Window in the Label entry field replace the current value
TYPE Threshold
and in the Expression entry field replace the current value
TYPE Full_Load
Leave the other values as they are and
CLICK ON The Plot and Memorize Buttons
SELECT OK
Expand the Plot Window to a good viewable size. Now start the simulation.
CHOOSE Command / START
SELECT OK
Your Plot Window should look like this.
Figure 16—1. Inventory Plot.
You should see the Inventory value increase to 50 very quickly, causing the simulation to end. In the Standard Report, it shows that it only took 25 simulated minutes to do the job. Therefore, you can determine that two widgets were manufactured per minute. The threshold was crossed at 25 simulated minutes, a transaction was created and sent to the Block labeled Get_Truck. The INTEGRATION Block is available for Transaction-level control. It’s described in Chapter 7 of the GPSS World Reference Manual.
This was a very simple example for showing the basics. Most integrated variables do not have constant derivatives. A more realistic model is in Chapter 2 of this manual, under PREDATOR.GPS.
If we had wanted to cause the Inventory value to drop when the truck left, we would have to decrease the value in a User Variable. Since the EQU Command cannot be asserted by a Transaction, how would we do this?
The answer is a PLUS Procedure, which we will consider in the next lesson. Close the Plot Window before you move on to the next example.
Now let’s turn to an example where we know the solution before we even start.
Consider the following system of ordinary differential equations: x_’ = y_
y_’ = -x_
and at time t = 0,
x_ = 1 y_ = 0
The solution is
x_ = sin( t ) y_ = -cos ( t )
Here we are using underscores to ensure that our variables will not clash with GPSS World keywords.
Let’s see what happens when we simulate this system. First close all open windows.
To run the simulation and create a Plot, in the Model Window.
CHOOSE File / Open
SELECT SAMPLE13
and then
SELECT Open
Next, the simulation must be created.
CHOOSE Command / Create Simulation
Now, we set up a Plot of the User Variables, to observe the dynamics.
CHOOSE Window / Simulation Window / Plot Window
Then in the Edit Plot Window
For the Label
TYPE x_
in the Expression field,
TYPE x_
and in the Plot Title,
TYPE Sine / Cosine Sample
For a Time Range
TYPE 120
For Y values for the Min
TYPE -2
and for Max
TYPE 2
and
CLICK ON The Plot and Memorize Buttons
Now add the other variable to the plot. In the Edit Plot Window
replace the Label and Expression fields
TYPE y_ in both and leave the other values as they are.
CLICK ON The Plot and Memorize Buttons
CHOOSE OK
Before we begin the simulation, arrange the Plot Window so that it is large enough to view the details.
Now, play out the integration. From the Main Window menu