Sunteți pe pagina 1din 2

Problem:

I have a simple model with a source, server and sink and I would like to know at what point in time during the
simulation run the queue for the server exceeds 9 for the first time.
Categories:
Add-On Process Logic, Custom Statistics
Key Concepts:
Add-On Process, Contents, CrossingStateChange, Event, InputBuffer, Monitor, On Entered, Process Triggering
Event, Real State Variable, Stopping Condition, Run.TimeNow

Assumption:
Since the time is the only information desired, the simulation stops running after the queue reaches 9 for the first
time.
Technical Approach:
A state variable is updated with the number of entities in the server queue each time a new entity enters the
server. A Monitor element is used to track this state variable and trigger an event when the state variable goes
over the value of 9. The triggering of this event executes a process that updates another variable with the current
simulation time and the simulation stops. The variable with the simulation time is displayed in the Results Window
as a State Statistic.
Details for Building the Model:
Simple System Setup
 Place a Source, Server and Sink in the Facility Window. Update the Processing Time property of the Server
to be ‘Random.Triangular(.2,.3,.5)’ so that the Server has some queuing.
 Connect the Source and Server, as well as the Server and Sink with Paths.

Creating Discrete State Variables


 Click on the Definitions tab and select the States panel. Create two discrete state variables, one called
‘NumberInQueue’ and the other called ‘TimeWhenOver9’.
Using an Add-On Process Trigger
 Within the Server object, create an Add-On Process by double-clicking on Entered. This will take you to
the Processes Window. In this process, add an Assign step that assigns the State Variable Name
‘NumberInQueue’ to the New Value of ‘Server1.InputBuffer.Contents’. (Note: This is a function that
returns the number in the InputBuffer queue for this Server).
Creating and Using a Monitor
 Select the Elements Panel within the Definitions tab to add a Monitor element with its Name as
‘Monitor_Over9’. The Monitor Type property should be changed to ‘CrossingStateChange’. The State
Variable Name that it is monitoring should be set to ‘NumberInQueue’ and the Threshold Value is ‘9’.
Adding a New Process
 Create a new process using the Create Process icon in Processes Window. Set the Triggering Event
property for the process to the name of the Monitor you just created, followed by .Event,
‘Monitor_Over9.Event’.
 Place an Assign step in this new process and have that Assign step update the State Variable Name
‘TimeWhenOver9’ to the current simulation time, using with the function ‘Run.TimeNow’ as the New
Value.
Stopping the Simulation Run
 Click on the Definitions Window and select the Elements panel to create a new State Statistic.
 Set the State Variable Name to ‘TimeWhenOver9’ and the Stopping Condition to ‘TimeWhenOver9 > 0’.
This will stop the simulation run once this threshold is met for the first time.

S-ar putea să vă placă și