+ All Categories
Home > Documents > Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The...

Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The...

Date post: 08-May-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
44
Subject Name: System Modeling & Simulation Subject Code: 10CS82 Prepared By : Ms. Pramela Devi( ASCP) Department : Computer Science & Engineering Date : 12-02-2015 3/4/2015
Transcript
Page 1: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Subject Name: System Modeling & Simulation

Subject Code: 10CS82

Prepared By : Ms. Pramela Devi( ASCP)

Department : Computer Science & Engineering

Date : 12-02-2015

3/4/2015

Page 2: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

UNIT 2

General Principles and

Simulation Software

Client

So & So Software

Pvt. Ltd

Date

dd.mm.y

y

Descriptor

Lorem Ipsum Dolor Sit

Amet, Consectetuer

Adipiscing

Engineered for

Tomorrow

Page 3: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Topic Details

1) Concepts in Discrete-Event Simulation:

2) The Event-Scheduling / Time-Advance Algorithm,

3) World Views,

4) Manual simulation Using Event Scheduling;

5) List processing.

6) Simulation in Java;

7) Simulation in GPSS.

8) Self check Exercise

9) Summary

3/4/2015

Page 4: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Learning Outcome:

Students will understand:-

The basic concepts in Discrete-Event Simulation

The detailed description on the Event-Scheduling / Time-Advance

Algorithm

Basics of World Views

How to perform manual simulation Using Event Scheduling

Definition of list processing.

How to perform simulation in Java

How to perform Simulation in GPSS

3/4/2015

Page 5: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

w

1.Concepts in Discrete Event Simulation

System - a collection of entities that act and interact toward the accomplishment of some logical end

Model – An abstract representation of a system , contains structural, logical and mathematical relationship and describe a system in term of state, entities, attributes, sets, process, events , activities and delays

System State- A collection of variable describe a system over a time

Entity- Object or component in the system that requires explicit representation

Attribute – Properties of a given entity

List – Collection of entities ordered in some logical fashion

Event – An instantaneous occurrence that change the state of a system

Event Notice – A record of an event to occur at random time

Event List – A list of event notices for future events known as FEL

Page 6: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

1.Concepts in Discrete Event Simulation Continued

Activity – A duration of time of specified length , example service time or inter arrival time

Delay – A duration of time of unspecified indefinite length, which is not known until it ends (e.g. a customer’s delay in a last-in-first-out waiting line which, when it begins, depends on future arrivals).

Clock- Variable representing simulated time

Deterministic Model - a deterministic simulation model is one that contains no random variables. All variables are known with certainty, or in other words, no probability is associated with them.

Page 7: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

1.Concepts in Discrete Event Simulation Continued

Stochastic Model - a stochastic simulation model contains random variables

Static Model - a static simulation model is a representation of a system at a particular point in time.

Dynamic Model - a dynamic simulation is a representation of a system as it evolves over time.

Page 8: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Event Scheduling/Time Advance Algorithm

Future Event List FEL: contains all the notices for events scheduled to occur at a future time

At any given time (t), the FEL contains all previously scheduled future events and their associated event times, e.g.: t1, t2, t3, …, etc. See Fig.

The FEL is ordered by event time, i.e. events are arranged chronologically so that the event time satisfies

t ≤ t1 ≤ t2 ≤ … ≤ tn

At time (t), i.e. CLOCK = t, the event associated with t1 is called the imminent event. That is, the event that will occur

Page 9: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Advancing Simulation Time and Updating System Image

Prototype System Snapshot at simulation time t

• Clock t

System state

Entities and Attribute

Set1 Set 2 …… Future Event List FEL

Cumulative statistics and Counters

t

(x,y,z,….)

(3,t1 ) – Type 3 event to occur at time t1

(1,t2 ) – Type 1 event to occur at time t2

Page 10: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Advancing Simulation Time and Updating System Image

Old System Snapshot at simulation time t

• Clock t System state

…… Future Event List FEL

….

t

(5,1,6) (3,t1 ) – Type 3 event 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

…………… (1,t3 ) – Type 2 event to occur at time tn

Page 11: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Event Scheduling / time advance algorithm

Step 1. Remove the event notice for the imminent event (event 3,

time t1) from the FEL

Step 2. Advance CLOCK to imminent event time (i.e. 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 the FEL, ranked by event time, e.g. event 4 to

occur at time t*, where t1 < t*< t1

Step 5. Update cumulative statistics and counters

Page 12: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Advancing Simulation Time and Updating System Image

New System Snapshot at simulation time t

• Clock t System state

…… Future Event List FEL

….

t

(5,1,5) (1,t2 ) – Type 1 event to occur at time t2

(4,t* ) – Type 4 event to occur at time t*

(1,t3 ) – Type 1 event to occur at time t3

…………… (2,tn ) – Type 2 event to occur at time tn

Page 13: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Generation of External

Arrival Stream by Bootsrapping

1 2 3 n n+1

3.7

4.1

7.4

t t*

…. ….

CLOCK =

a*

Between successive arrival

events, other types of events may

occur, causing system state to

change

0

Arrival

Time

Arrival

Time

At simulated time t, assumed to be the

instant of the nth arrival, generate

interarrival time a*, compute t*= t + a*

and schedule future arrival on FEL to

occur at future time t*

Page 14: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Stopping a Simulation

At time 0, schedule a stop simulation event at a specified future time TE. The simulation will run over the time interval [0, TE]

Example: Simulate a shop for 8 hours

Run length TE is determined by the simulation itself. TE is the time of occurrence of some event E.

- Example: TE = time of the 100th service completion

Page 15: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3 World Views

• When using a simulation package or even when doing hand simulation, a modeler adopts a world view or orientation for developing a model.

• The most prevalent world views are

1. the event-scheduling world view

2. the process-interaction world view

3. the activity-scanning world view.

• Particular simulation packages (e.g. Arena) usually support one of these world views.

Page 16: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Engineered for

Tomorrow

Event Scheduling World Views

Concentrates on events and their effects on system state

It makes use of the Future Event List and variable time increments

This is the approach we have just discussed

It is a very flexible approach using which any system can be simulated

It requires lots of mechanisms (e.g. FEL handling) to be coded, which may slow down the development of the simulation model for very simple systems.

This is the world view that is usually used when the simulation program is directly coded on a general-purpose programming language such as Java.

Page 17: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Engineered for

Tomorrow

Process Interaction World View

• Models the system in terms of processes

• Concentrates on entities, and their life cycles as they flow through the system, demanding resources and queueing to wait for resources.

• A process is a time-sequenced list of events, activities and delays that define the life cycle of one entity as it moves through a system.

• Some activities might require resources that are limited, which may cause delays in the process

Page 18: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

En for Tomorrow

Process Interaction World View

• This approach is easier for the modeler since people usually perceive the systems in terms of the processes the entities experience

• But this approach is usually harder to implement directly, especially when the systems to be simulated are complex

• Thus, many simulation packages (including ARENA) use this view for the modeler to describe the system (user-interface), but an event-scheduling approach is used operationally to perform the simulation run, hidden from the user.

Page 19: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Activity Scanning World View

Concentrates on activities and conditions that allow them to begin

It uses fixed time increments

At each clock advance, the conditions for each activity are checked, and if the conditions hold, then the corresponding activity starts.

The (M,N) inventory system simulation we used last week used activity-scanning approach. The time increment used was a day.

Simple in concept and leads to modular models that are easier to maintain, understand and modify.

The repeated scanning (at each time increment) results in slow runtime on computers

Page 20: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (1)

Entities : The server and customers Events : Arrival (A), Departure (D)

Stopping event (E), scheduled to occur at time 60.

System state (LQ(t), LS(t)) :

LQ(t) is the number of customers in the waiting line

LS(t) is the number being served (0 or 1) at time t

(A, t ), representing an arrival event to occur at future time t

(D, t ), representing a customer departure at future time t

(E, 60), representing the simulation-stop event at future time 60.

Activities : Interarrival time Service time

Delay : Customer time spent in waiting line.

Page 21: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come
Page 22: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come
Page 23: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Manual Simulation Using Event Scheduling

The interarrival times and service

Initial conditions

The system snapshot at time zero (CLOCK = 0)

LQ(0) = 0, LS(0) = 1

both a departure event and arrival event on the FEL.

The simulation is scheduled to stop at time 60.

Server utilization : total server busy time (B) / total time (TE).

a* : the generated interarrival time

s* : the generated service times

Page 24: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (4)

Page 25: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Manual Simulation Using Event Scheduling

• Example 3.5 (The Dump Truck Problem)

Traveling

Loading

Scale Weighing

queue

Loader

queue

First-Come

First-Served

First-Come

First-Served

The distributions of loading time, weighing time, and travel time are given in

Tables

The purpose of the simulation is to estimate the loader and scale utilizations

(percentage of time busy).

Page 26: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (9)

– The activity times are taken from the following list as needed:

Page 27: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (10)

System state [LQ(t), L(t), WQ(t), W(t)]

LQ(t) = number of trucks in loader queue

L(t) = number of trucks (0, 1, or 2) being loaded

WQ(t) = number of trucks in weigh queue

W(t) = number of trucks (0 or 1) being weighed, all at simulation time t

Event notices :(ALQ, t, DTi ), dump truck i arrives at loader queue (ALQ) at time t

(EL, t, DTi), dump truck i ends loading (EL) at time t

(EW, t, DTi), dump truck i ends weighing (EW) at time t

Entities : The six dump trucks (DT 1, … , DT 6)

Page 28: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (11)

Loader queue : all trucks waiting to begin loading, ordered on

a first come, first served basis

Weigh queue : all trucks waiting to be weighed, ordered on a first come, first served basis

Activities : Loading time, weighing time, and travel time

Delays : Delay at loader queue, and delay at scale

It has been assumed that five of the trucks are at the loaders and one is at the scale at time 0.

Page 29: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come
Page 30: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come
Page 31: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.1.3. Manual Simulation Using Event Scheduling (13)

The utilizations are estimated as follows:

32.076

2/49

average loader utilization

00.176

76 average scale utilization

These estimates cannot be regarded as accurate estimates of the long-run “steady-state” utilizations of the loader and scale.

Page 32: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.2 List Processing

• List : a set of ordered or ranked records.

• Record : one entity or one event notice.

3.2.1 List : Basic Properties and Operations (1)

Event type

Event time

Any data

Next pointer

Event type

Event time

Any data

Next pointer

Event type

Event time

Any data

Next pointer

Head Pointer

Tail Pointer

Event type

Event time

Any data

Next pointer

Record Record Record

Field : an entity identifier and its attributes

: the event type, event time, and any other event

related data

Page 33: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

How to store record in a physical location in computer memory in arrays : successive records in contiguous locations by pointers to a record : structures in C, classes in C++

The main operations on a list :

Removing a record from the top of the list.

when time is advanced and the imminent event is due to be executed.

by adjusting the head pointer on the FEL by removing the event at the top of the FEL.

Removing a record from any location on the list.

3.2.1 List : Basic Properties and

Operations (2)

Page 34: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

The main operations on a list (Cont.)

Adding an entity record to the top or bottom of the list.

when an entity joins the back of a first-in first-out queue.

by adjusting the tail pointer on the FEL by adding an entity to the bottom of the FEL

Adding a record to an arbitrary position on the list, determined by the ranking rule.

if a queue has a ranking rule of earliest due date first (EDF).

by making a partial search through the list.

The goal of list-processing techniques

: to make second and fourth operations efficient

3.2.1 List : Basic Properties and Operations (3)

Page 35: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

The notation R(i) : the ith record in the array

Advantage Any specified record, say the ith, can be retrieved quickly without searching, merely by referencing R(i ).

Disadvantage

When items are added to the middle of a list or the list must be rearranged.

Arrays typically have a fixed size, determined at compile time or upon initial allocation when a program first begins to execute.In simulation, the maximum number of records for any list may be difficult or impossible to determine ahead of time, while the current number in a list may vary widely over the course of the simulation run.

3.2.2 Using Arrays for List Processing (1)

Page 36: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.2.2 Using Arrays for List Processing (2)

• Two methods for keeping track of the ranking of records in a list

• to store the first record in R(1), the second in R(2), and so on, and the last in R(tailptr), where tailptr is used to refer to the last item in the list.

• a variable called a head pointer, with name headptr, points to the record at the top of the list.

2 1 3 4 5 8 7 9 10

100 101 102 103 104 105 106 107 108 109 110 Memory address

2 1 3 4 5 8 7 9 10

100 101 102 103 104 105 106 107 108 109 110

6

6 adding

move move move move

Page 37: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

3.2.3 Using Dynamic Allocation and Linked Lists (1)

• In procedural languages such as C and C++, and in most simulation languages, entity records are dynamically created when an entity is created and event notice records are dynamically created whenever an event is scheduled on the future event list.

• The languages themselves, or the operating systems on which they are running, maintain a linked list of free chunks of computer memory and allocate a chunk of desired size upon request to running programs.

• With dynamic allocation, a record is referenced by a pointer instead of an array index. A pointer to a record can be thought of as the physical or logical address in computer memory of the record.

Page 38: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Simulation in Java Single Channel Queue

Page 39: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Simulation in Java continued…

Page 40: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Self Check Exercise

Engineered for

Tomorrow

Page 41: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

• What is discrete event simulation? Explain event scheduling algorithm by

generating system snapshots at clock time T and clock time T1 with

diagrams.

• Explain the concepts of discrete event simulation.

• Six dump trucks are used to have coal from entrance of a mine to a rail

road. Each truck is loaded by one of the two loaders. After loading, a truck

immediately moves to the scale, to be weighed as soon as possible. Both

loader and scale have first come first served waiting line for trucks. Travel

time from loader to scale is considered negligible. After being weighed, a

truck begins travel time and then afterwards returns to loader queue. The

activities of loading, weighing and travel time are given in below table:

Page 42: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

End of simulation is 40 minutes of completion of weighing from scale. Depict

simulation table and estimate loader and scale utilizations. Assume that 5

trucks are at loaders and one truck is at scale at time 0.

• Draw the flowchart of the execution of the arrival event & departure event

for a single channel queue using event scheduling.

• What do you mean by world view? Briefly explain different types of

world view.

• Explain in detail about List Processing.

• Explain about simulation in GPSS.

• Explain in detail about the concepts of discrete event simulation

• Simulate the grocery counter problem using manual simulation using event

scheduling with the following data.

Page 43: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

Summary

Engineered for

Tomorrow

Page 44: Subject Name: System Modeling & Simulation Subject Code: … · 2016-02-05 · • Example 3.5 (The Dump Truck Problem) Traveling Loading Scale Weighing queue Loader queue First-Come

The concepts in simulation are System, Model System state, Entity Attribute, List, Event, Event Notice etc.

Different types of simulation models are :

Stochastic Model - a stochastic simulation model contains random variables

Static Model - a static simulation model is a representation of a system at a particular point in time.

Dynamic Model - a dynamic simulation is a representation of a system as it evolves over time.

Future Event List FEL: contains all the notices for events scheduled to occur at a future time

At any given time (t), the FEL contains all previously scheduled future events and their associated event times, e.g.: t1, t2, t3, …, etc. See Fig.

The FEL is ordered by event time, i.e. events are arranged chronologically so that the event time satisfies


Recommended