Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit 4 Simulation software. Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages:

Similar presentations


Presentation on theme: "Unit 4 Simulation software. Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages:"— Presentation transcript:

1 Unit 4 Simulation software

2 Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages: Fortran, C and C++. – Simulation programming languages: GPSS/H and SIMAN V. – Simulation packages 2

3 History of Simulation Software 1955-60: the period of search 1961-65: the advent 1966-70: the formative period 1971-78: the expansion period 1979-86: the period of consolidation and regeneration 1987- : the period of integrated environments 3

4 History of Simulation Software The period of search: – Simulation was conducted in fortran – Much effort was expended in the search for unifying concepts and the development of reusable routines to facilitate simulation. The advent: – Simulation programming languages (SPL)appeared in this period eg, GPSS, Simscript and GASP( General Activity Simulation Program) – GPSS developed by Gordon was the first process-interaction SPL. – Initial versions of Simscript were influenced by Fortran and were based on event scheduling – GASP originally based on ALGOL and later fortran. – Simula and Control and Simulation language(CSL) among others The formative period: 4

5 Concepts in Discrete Event simulation Lists are also called as sets, queues or chains. Lists are used to hold both entities and event notices. Events on the list are always ordered by some rule. Event notices on the list are always ranked by the event time. An activity’s duration may be specified in a number of ways: – Deterministic: for eg, always 5 minutes – Statistical: for eg, as a random draw from among 2,5,7 with equal probabilities. – A function depending on system variables : for eg, loading time for iron ore ship as a function of the ship’s allowed cargo weight and the loading rate. Its duration is not affected by the occurrence of other events. 5

6 Concepts in Discrete Event simulation In contrast to an activity, a delay’s duration is not specified ahead of time, but rather determined by system conditions. A delay ends when some set of logical conditions become true or one or more other events occur. For eg, a customer’s delay in a waiting line may be dependent on the number and duration of service of other customers ahead in line as well as the availability of servers. A delay is sometimes called conditional wait, an activity an unconditional wait. The completion of an activity is an event (primary event), that is managed by placing an event notice on the FEL. The completion of a delay is sometimes called a conditional or secondary event and are not represented by event notices. 6

7 Example: Able-Baker carhop problem System state: – LQ(t), the no. of callers waiting to be served at time t. – LA(t), 0 or 1to indicate Able being idle or busy at time t. – LB(t), 0 or 1to indicate Baker being idle or busy at time t. Entities: neither the customers nor the servers need to be explicitly represented. Events: – Arrival event – Service completion by Able – Service completion by Baker Activities: – Inter arrival time – Service time by Able – Service time by Baker Delay: customer’s wait in queue until Able or Baker becomes free. 7

8 Example: Able-Baker carhop problem 8 Clock System state Entities and attributesSet 1Set 2... Future Event List(FEL) Cumulative statistics and counters t(x,y,z,..) (3,t1)- type 3 vent to occur at time t1 (1,t2)- type 1 event to occur at time t2...... Fig. Prototype system snapshot at simulation time t Discrete event simulation proceeds by producing a sequence of system snapshots that represent the evolution of the system through time.

9 The Event Scheduling/ Time advance algorithm The mechanism for advancing simulation time and guaranteeing that all events occur in correct chronological order is based on the FEL. Scheduling a future event means that at the instant an activity begins, its duration is computed and the end-of-activity event, together with its event time is placed on the FEL. At any given time t, the FEL contains all previously scheduled future events and their associated event times. t<t1<=t2<=t3<=…..<=tn Here, time t is the value of CLOCK, the current value of simulated time. The event associated with time t1 is called the imminent event ( the next event that will occur). 9

10 The Event Scheduling/ Time advance algorithm After the system snapshot at simulation time CLOCK = t has been updated, the CLOCK is advanced to simulation time CLOCK = t1, and the imminent event notice is removed from the FEL and the event executed. Execution of imminent event means that a new system snapshot for time t1 is created based on the old snapshot at time t and the nature of the imminent event. This process repeats until the simulation is over. The sequence of actions which a simulator must perform to advance the clock and build a new system snapshot is called the event-scheduling/ time- advance algorithm. 10

11 The Event Scheduling/ Time advance algorithm 11 Clock System state...Future Event List(FEL) Cumulativ e statistics and counters t(5,1,6) (3,t1)- type 3 vent to occur at time t1 (1,t2)- type 1 event to occur at time t2. (1,t3)- type 1 event to occur at time t3.. Step 1: Remove the event notice for the imminent event (event 3, time t1) from FEL Step 2: Advance CLOCK to imminent event time (advance CLOCK from t to t1) Step 3: Execute imminent event: update system state. Change entity attributes and set membership as needed. Step 4: Generate future events( if necessary) and place their event notices on FEL ranked by event time. Step 5: Update cumulative statistics and counters. Old system snapshot at time t

12 The Event Scheduling/ Time advance algorithm 12 Clock System state...Future Event List(FEL) Cumulativ e statistics and counters t1(5,1,5) (1,t2)- type 1 event to occur at time t2 (1,t3)- type 1 event to occur at time t3. -.. New System Snapshot at time t1 Fig. Advancing simulation time and updating system image

13 The Event Scheduling/ Time advance algorithm The management of list is called list processing. The major operations involved in FEL are removal of imminent event, addition of a new event to the list and removal of event occasionally. How are future events generated? The system state at time 0 is defined by the initial conditions and the generated of so-called exogenous events.eg. Arrival At time 0, the first arrival event is generated and is scheduled on the FEL. First, an interarrival time is generated, a*; it is added to the current time, CLOCK=t; the resulting event time, t+a* = t*, is used to position the new arrival event notice on FEL. This method of generating an external arrival stream is called bootstrapping. 13

14 The Event Scheduling/ Time advance algorithm Consider service-completion event. When one customer completes service at current time CLOCK=t, if the next customer is present, then a new service time s*, will be generated for the next customer. The next service completion event will be scheduled to occur at future time t*=t+s*. 14

15 The Event Scheduling/ Time advance algorithm Every simulation must have a stopping event, called E, which defines how long the simulation will run. There are 2 ways to stop a simulation: 1. At time 0, schedule a stop simulation event at a specified future time TE. Example: simulate a grocery shop for TE= 1 hour 2. Run length TE is determined by the simulation itself. Example: TE is the time of the 100 th service completion at a service center, TE is the time at which a distribution center ships the last carton in a day’s orders. 15

16 World Views When using a simulation package, a modeler adopts a world view or orientation for developing a model. There are 3 forms: – Event-scheduling world view – Process interaction world view – Activity scanning world view Event-scheduling world view: Analyst concentrates on events and their effect on system state Process interaction world view : – Analyst defines the simulation model in terms of entities / objects and their life cycle as they flow through the system, demanding resources and queueing to wait for resources. – A process is the life cycle of one entity which may contain various activities and events. 16

17 World Views A process is a time-sequenced list of events, activities and delays, including demands for resources, that define the life cycle of one entity as it moves through a system. 17 Arrival event Begin service End Service event Activity Delay Time Arrival event Delay Begin service Activity End Service event Interaction Customer n+1 Customer n Fig. Two interacting customer processes in a single-server queue

18 World Views The earlier two approaches use a variable time advance, when all events and system state changes have occurred at one instant of simulated time, the simulation clock is advanced to the time of the next imminent event. The third approach uses a fixed time increment and a rule-based approach to decide whether any activities can begin at each point in simulated time. At each clock advance, the conditions for each activity are checked and if the conditions are true, then the corresponding activity begins. Though this approach is simple in concept, the repeated scanning to determine whether an activity can begin results I slow run time on computers. Hence, modification of this approach is called the three-phase approach, which combines the features of event scheduling with activity scanning 18

19 World Views Here, activities are divided into two categories, called B and C. B activities: activities bound to occur; all primary events and unconditional activities. C activities: activities or events that are conditional upon certain conditions being true. The simulation proceeds with repeated execution of the three phases until it is completed: Phase A: Remove the imminent event from the FEL and advance the clock to its event time. Remove any other events from the FEL that have the same time. Phase B: Execute all B-type events that were removed from the FEL Phase C: Scan the conditions that trigger each C-type activity and activate any whose conditions are met. Rescan until no additional C-type activities can begin or events occur. 19

20 Manual Simulation Using Event Scheduling 20


Download ppt "Unit 4 Simulation software. Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages:"

Similar presentations


Ads by Google