simscript ii.5 building simulation model with simscript ii.5

25
Simscript II.5 Building simulation model with SIMSCRIPT II.5

Post on 20-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Simscript II.5

Building simulation model with SIMSCRIPT II.5

Page 2: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Simulation Model Structure

Each simulation model has the following 3 activities:

• A mechanism for representing arrivals of new object (constant delay between successive arrivals, uniform, exponential, etc).

• A representation of what happens to the object in the model (objects may compete for a service, they will be put in queue if the server is busy)

• A mechanism for terminating the simulation

Page 3: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Terminating the simulation

Two approaches for terminating simulation:

• The planned-termination-time method: The simulation stops immediately at the planned time regardless the unfinished processes.

• The second method allows everything in the model to be finished. However the door will be closed and no new arrivals are allowed.

Page 4: Simscript II.5 Building simulation model with SIMSCRIPT II.5

The Process Concept

• The dynamic parts in the model that are created

• They become either immediately after creation or will be activated after some specific time.

• The description of its activity in the model is given by a process routine.

Page 5: Simscript II.5 Building simulation model with SIMSCRIPT II.5

The Resource Concept

• A resource is used to model an object that is needed by process objects.

• If the resource is not available (occupied by another process object) the process object will be placed in a waiting line.

Page 6: Simscript II.5 Building simulation model with SIMSCRIPT II.5

SIMSCRIPT II.5 Program Structure

A SIMSCRIPT II.5 program consists of three modeling elements:

1. A preamble

2. A main program

3. A process routine for each process declared in the preamble

Page 7: Simscript II.5 Building simulation model with SIMSCRIPT II.5

1 .Preamble

The first part of each SIMSCRIPT II.5 program is the preamble.

• preamble is a declarative and does not include any executable statements.

• It declares all modeling elements including – processes and resources in the program.

• It describes their static feature but does not describe how and why they interact.

Page 8: Simscript II.5 Building simulation model with SIMSCRIPT II.5

2 .Main

• It contains executable statements.• Execution begins with the first statement in the

Main program.• Resources must be created and initialized • A simulation begins when the statement

Start simulation is executed.

Page 9: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Timing Routine

• All processes will be in the pending list. • The timing routine check if there is a process in

the pending list and select the one that has the earliest activation time.

• Then advance the simulation clock to this time• Then determine the process type • Remove this process from the pending list• Execute the process routine.

Page 10: Simscript II.5 Building simulation model with SIMSCRIPT II.5

3 .Process Routines

• Process (entity): is a dynamic object and the sequence of actions that experience through its life in the model.

• A process is created and becomes active immediately or later at some activation time.

• Processes interact either implicitly or explicitly through executing the statements: activate, interrupt, or resume.

• Process routine: is a subroutine, which corresponds to a particular process.

• Process notice: this record contains information, which characterizes the particular realization.

Page 11: Simscript II.5 Building simulation model with SIMSCRIPT II.5

A Detailed Discussion of Processes and Resources

• 1- Processes: • Each type of process used in a SIMSCRIPT

simulation model must be defined in the preamble,

•  Processes include ARRIVAL.GENERATOR and CUSTOMER

• Where ARRIVAL.GENERATOR and CUSTOMER are two processes.

• Processes can also have characterizing attributes, In our example, suppose that each CUSTOMER process entity has an associated age attribute called CU.AGE.

Page 12: Simscript II.5 Building simulation model with SIMSCRIPT II.5

process commands

We now explain each of the process commands •   Activate statement : The activate statement is

used to create a process notice for a particular process and then immediately place the notice in the event list.

• The reference variable for this type of process points to the notice.

Page 13: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Activate a CUSTOMER in 10 minutes

This statement means that we create a new CUSTOMER process notice with an activation time, which is 10 minutes larger than the current value of the simulation clock, and then place this notice in the event list.

Page 14: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Request/relinquish statement

• The request statement is used by a particular process entity (or process notice) in its process routine to request a certain number of units of a resource of a specified type.

request 1 unit of SERVER(l)or

request 1 unit of SERVER(l) with priority 5 Note: the one with the highest priority is served

next

Page 15: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Request/relinquish continue

• If no priority is specified (the usual case), then a priority of 0 is assumed.

• The relinquish statement is used by a particular process entity (or process notice) to relinquish (release) a certain number of units of a resource of a specified type.

relinquish 1 unit of SERVER(l)Note: “1 unit of” may be shortened to “1.”

Page 16: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Work/wait:

• The work/wait statements are used by a particular process entity, which is executing its process routine, to place its process notice back into the event list for a specified amount of time.

• A work statement represents "service" times and a wait statement represents "inter-event" (e.g., inter-arrival) times.

• After one of these statements is executed, control is immediately returned to the timing routine.

work 20 minutes

Page 17: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Suspend/reactivate

• The suspend statement is used by a particular process entity to stop its own execution of the corresponding process routine. (for example when a more priority customer arrives then the current executable customer will be suspended)

• This results in its process notice moving from the "executing" state to the "created" state.

• The notice will stay in this latter state until "awakened" by a reactivate "the" (or resume) statement in a process or normal routine.

reactivate the CUSTOMER now

Page 18: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Interrupt/resume• The interrupt statement is used in a process or

normal routine to remove a process notice from the event list. (for example when the time of closing is reached the interrupt statement is used to prevent new customers form entering the system)

• This results in the process notice moving from the "pending" state to the "created" state.

interrupt the CUSTOMER  resume the CUSTOMER

• Note: resume statement can be used to move a suspended process notice from the "created" state to the "pending" state.

Page 19: Simscript II.5 Building simulation model with SIMSCRIPT II.5

Create/destroy:

• The create statement is used to create a process notice for a particular type of process without placing it into the event list.

create a CUSTOMERlet CU.AGE (CUSTOMER) = 35 activate this CUSTOMER now

• The destroy statement is used to destroy (i.e., to make non existent) a process notice which is in the "created" state.  

destroy the CUSTOMER

Page 20: Simscript II.5 Building simulation model with SIMSCRIPT II.5

End/return

• The end, return statement is placed at the end of each process routine.

Page 21: Simscript II.5 Building simulation model with SIMSCRIPT II.5

2 -Resources

• A resource is an object such as a person or machine which provides service to a process entity.

• A resource may have characterizing attributes and is defined in the preamble resources

every WORK.STATION has a WS.NUM.MACHINES

• There are five system-defined variables, which are automatically associated with each defined resource.

Page 22: Simscript II.5 Building simulation model with SIMSCRIPT II.5

1. The variable N.WORK.STATION is the number of types of workstations desired (i.e., 5).

2. Q.WORK.STATION(I), The first set (or queue) contains those jobs waiting to be served by WORK.STATION type I, and the corresponding variable N.Q.WORK.STATION(I) is the number of jobs in the queue at a particular point in time.

3. X.WORK.STATION(I), the second set contains those jobs executing WORK.STATION type I, and the variable

type I at a particular point in time.

Page 23: Simscript II.5 Building simulation model with SIMSCRIPT II.5

N.X.WORK.STATION(I) is the number of jobs that are executing WORK.STATION

4. U.WORK.STATION(I) is the number of idle units or machines in WORK.STATION type I at a particular point in time.

5. the variable WORK.STATION (i.e., it has the same name as the resource itself) is an index variable which is equal to one of the WORK.STATION types (i.e., 1, 2, 3, 4, or 5).

Page 24: Simscript II.5 Building simulation model with SIMSCRIPT II.5

• In order to allocate storage for the resource WORK.STATION, we can execute the following create statement:

create every WORK.STATION(5)

(This statement implicitly sets the value of N.WORK.STATION to 5.)

• we can then specify how many units of each type are initially available.

Page 25: Simscript II.5 Building simulation model with SIMSCRIPT II.5

let U.WORK.STATION(l) = 3 let U.WORK.STATION(2) = 3let U.WORK.STATION(5) = 1

• The variable U.WORK.STATION(I) will decrease by one each time a machine of type I becomes busy; conversely, it will increase by one each time a machine of type I becomes idle.