Download presentation
Presentation is loading. Please wait.
Published byHippolyte Jolicoeur Modified over 5 years ago
1
CSI4124/SYS5110– Foundations on Modeling and Simulation
Discrete Event Simulation Modelling: Event Scheduling Simulation Models Temps de présentation: Objectifs Sujets de discussion Préalables Texte Références Évaluation (3) Site Web du cours (2) Détails du corps enseignant _______________________________________________ 13 acétates – 20 minutes Organisation du cours (3) Histoire des télécommunications (2) Application d’affaires Application pour les domiciles (2) Implications sociales (2) _______________________________________________ 10 acétates – 20 minutes Modèle simple de communications Données vs information Modèle de communication Communication de données _______________________________________________ 4 acétates –10 minutes Les réseaux – quelques définitions (2) Réseaux locaux Réseaux à longue portée _______________________________________________ 4 acétates – 10 minutes Pourquoi une architecture ? Modèle OSI Les 7 couches (2) Organisation du cours Comités de normalisation
2
Topics of discussion Discrete Event Simulation Models – 3 World Views
Activity Scanning Event Scheduling Process-oriented Event Scheduling Simulation Models Principles of Event Scheduling Simulation Models Time Advance Algorithm Event Scheduling Simulation Models in Java Translating an ABCMod to an Java Event Scheduling Simulation Model Example – Kojo’s Kitchen
3
Simulation Model World Views
Activity Scanning ABCMod is base on this world view Implementation requires incrementing time in small steps, testing the pre-conditions of activities. Not efficient time advance algorithm Event Scheduling Expressed in terms of future events (events that follow some duration). Such future events include testing of the model state that triggers conditional events. Time is advanced when a future event is processed. Process-oriented Defines the processes (life-cycles) for entities (typically the consumer). ABCMod activities can be assembled into such processes. Time is advanced using scheduled events.
4
Activity Scanning – Department Store
5
Event Scheduling – Department Store
6
Process-oriented – Department Store
7
Relationship between World Views
Each world view is a perspective on the same set of discrete events Conditional and schedule events Relationships between events allow basis for translation from ABCMod to simulation models From ABCMod to event scheduling simulation Model Break down the Activity to events. Scheduled events become future events. Include conditional events as part of future events. From the ABCMod to a process-orient simulation model Build processes by assembling activities Requires an intermediate step – augment conceptual model to define processes from activities
8
Kojo’s Kitchen
9
Event Scheduling Simulation Model
Model behaviour Represented as a series of snapshots - change at discrete points in time, the future event. Snapshots contain: state of the model (entities and attributes), list of scheduled future events, the simulation clock. Concerned with processing future events Future event encompasses both notions of ABCMod scheduled and conditional events. Composed of sequence of actions that changes the “snapshot”. Begins with the schedule event. Checks on model state to process any triggered conditional events. Processing events can lead to scheduling additional future events. This view is fundamental to the translation of the ABCmod to an event scheduling simulation model.
10
Event Scheduling Simulation Model Programming Mechanisms
Scheduling Future Events Future Event List (FEL): composed of future event notices Future event notice Contains a time attribute: time at which the future event occurs Contains a future event name: primarily used to identify a future event routine (FER). May contain a reference to a model entity used by the FER. Future Event Routine (FER) Routine that carries out the actions associated to the future event. Can also schedule new future events by adding event notices on the FEL Bootstrapping: future event that reschedules itself Time advance algorithm Advances time and updates the model state Achieved by processing the event notices on the FEL
11
Time Advance Algorithm
Loops until stop event notice is encountered or stop condition becomes true. Stop event notice contains “Stop” future event name. Stop condition consists of evaluating the state of the model. Event notice provides: Time attribute to advance the model clock A future event name that can be associated to a FER The FER provides the necessary actions to be carried out for the event.
12
Bootstrapping Means of handling arrivals and input functions
Recall the input domain sequence. Future event that reschedules itself Example: Customer’s arrival in Kojo’s Kitchen First arrival is scheduled at start of simulation run by placing an event notice on the FEL, say with name WArrival, for arrival of a sandwich customer. When notice is processed, another will be scheduled as follows: Generate an inter-arrival time, say a*, using the data model associated with the timing map. Establish the next arrival time as, t* = t + a*, this will correspond to the next time in the domain sequence CSD[UW]. Insert into the FEL a new event notice with name WArrival and time attribute t*. Bootstrapping can also be used for supporting inputs Consider manufacturing machine that breaks down (cycles of breakdowns and uptime). Consider the arrival of storms in the port project.
13
FER Actions Carry out the changes to the model’s status associated with a scheduled event. Typically corresponds to SCS of Activity’s terminating event. Check the various preconditions to determine if any conditional events can be activated. Testing the preconditions for all Activities (more efficient approaches are possible). For each precondition that is found to be TRUE, the FER carries out state changes associated with that conditional event (i.e. the SCS’s of the corresponding Activity’s starting event) and schedules a future event derived from the corresponding Activity’s terminating event. Second step needs to be repeated until all preconditions are FALSE.
14
Example: EndServing Future Event
Consider the future event EndServing for Kojo’s Kitchen Scheduled when customer arrives at counter for service (occurs when service is completed). Up to 3 event notices can be schedule with event EndServing. EndServing FER does the following: Remove customer from counterGroup (note that reference to customer is necessary in event notice). Room at counter (counterGroup) has been freed. If a customer is present in the customer queue, then Remove customer entity from the head of the queue, and place it at the counter. Insert the customer waiting time into the PHI[WaitingTime] sample set. Schedule another EndServing future event
15
Event Scheduling with Java
Java Standard Objects Representing Entities The Java Collections Framework library provides many classes for creating queues and groups The Java Management Extensions (JMX) library provide classes for defining attribute-tuples. CERN Colt Java Library Provides a number of classes that implement stochastic data models Link: EVSched Simulation Package Abstract class for implementing simulation model Implements the FEL, time advance algorithm, event notices, adding event notices on the FEL, implementing FER’s, implementing Stop condition, simulation clock, attribute-tuples and output sets (trajectory sets and sample sets)
16
EvSched Abstract Class
17
Event Notice
18
// Run simuation public void runSimulation() { while(true) // set up loop { EventNotice nxtev = (EventNotice) fel.poll(); if(nxtev == null) { // This is a safety check System.out.println("FEL is empty - terminating"); break; } clock = nxtev.timeAttr; // update the clock if(nxtev.eventName == StopEvent) { // Check for a stop event System.out.println("Encountered stop event - terminating"); processEvent(nxtev.eventName, nxtev.obj); // Call FER if(implicitStopCondition()) { System.out.println("Implicit stop is true -terminating"); timef = clock;
19
ESAttributeList
20
ESOutputSet
21
Computing DSOVs in ESOutputSet
22
Translating ABCmod to EvSched Simulation Model
Translating Entities to Java Objects Use of Java Collections Library for groups and queues Use of ESAttribute Class for attribute-tuples (resources and consumer entities). Can also used Java Classes directly Translating Activities to FER’s Decomposing Activities to create futures events Example Kojo’s Kitchen
23
Relating ABCmod Components to an Event Scheduling Simulation Model
24
Representing Queue Entities in Java
25
Representing Group Entities in Java
26
Translating Activities to Future Event Routines
27
Steps to Translate an ABCmod to an Event Scheduling Simulation Model
Step 1 – Represent entities, constants, parameters, input variables, etc. using appropriate data structures. Step 2 – Implement appropriate data models and user defined modules specified in the conceptual model and an initialisation routine (EvSched constructor). Step 3 – Define a FER for each Activity within the ABCmod. For any particular Activity, implement the SCS’s in the Activity’s terminating event or its action event. (in the case of an action sequence). Call the precondition routine. In the case of action sequences implement the requirements of bootstrapping. Step 4 – Implement a precondition routine to start Activities when their precondition is TRUE. Step 5 – Develop the program code to generate the required output data.
28
Kojo Kitchen Simulation Model – Step 1
C.Customer ESAttributeList with attributes Type (Character object with values ‘W’ or ‘S’) TimeEnterQu (double value) A.CounterGroup HashSet object counterGroup. A.CustQue ConcurrentLinkedQueue object custQue.
29
Kojo Kitchen Simulation Model – Step 1 (continued)
Constants and Parameters WMean1, WMean2, WMean3, WMean4, WMean5 UMean1, UMean2, UMean3, UMean3, UMean5 STWMin, STWMax, STMin, STMax NumEmpReg (2 – regular number of employees), NumEmpBusy (3 – number of employees during the busy period) AECase1 (1 indicating base case for executing the model), AECase2 (2 indicating alternate case for executing the model). AddEmpCase – (parameter) An int variable set to AECase1 for the base case (only 2 employees serving at the counter) and AECase2 when an additional employee is added during busy periods. Input Variables EmpNum – (input variable) An integer variable that represents the number of employees at the Kojo’s Kitchen.
30
Kojo Kitchen Simulation Model – Step 2
Four objects serve as data models sanwichInterArrDist (Exponential object) sushiInterArrDist (Exponential object) coldCutSrvTm (Uniform object) sushiSrvTm (Uniform object) Three User Modules getMUw – implements M[UW](t) getMUu – implements M[UU](t) getMEmpNum – implements M[EmpNum](t) Initialisation Implemented in the KojoKitchen constructor
31
Kojo Kitchen Simulation Model – Step 3
Step 3 – Define the future events
32
Step 3 – processEvent method
36
Kojo Kitchen Simulation Model – Step 4
Define method preConditions to test all Activity preconditions All FER methods will call this method Checks the pre-conditions of the ServingW and ServingU activities
38
Implementing Other Functionality
Consider the Port Project studied previously Define the following future events
39
Implementing Triggered Activities
40
Implementing a User Defined Module
41
Recording Trajectory Set Data
42
Interrupts
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.