1 / 24

ATILIM UNIVERSITY IE 504 SYSTEM SIMULATION

ATILIM UNIVERSITY IE 504 SYSTEM SIMULATION . A GENTLE INTRODUCTION TO SIMULATION MODELING Gizem ALAGOZ. BACKGROUND & TERMINOLOGY.

chana
Télécharger la présentation

ATILIM UNIVERSITY IE 504 SYSTEM SIMULATION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ATILIM UNIVERSITYIE 504 SYSTEM SIMULATION A GENTLE INTRODUCTION TO SIMULATION MODELING Gizem ALAGOZ

  2. BACKGROUND & TERMINOLOGY We use models in an attempt to gain understanding and insights about some aspect of the real world. Attempts to model reality assume a priori the existence of some type of “ground truth,” which impartial and omniscient observers would agree upon.

  3. BACKGROUND & TERMINOLOGY (Cont’d) • We define a system to be a set of elements which interact or interrelate in some fashion. • The elements that make up the system are often referred to as entities. • A model is a system which we use as a surrogate for another system. • A computer simulation is a model which happens to be a computer program.

  4. AN OVERVIEW OF THE MODELING PROCESS • In stage 1 of the modeling process we should try to identify what is meant by the system of interest. • In stage 2, we try to rigorously describe the behaviors and interactions of all of the entities which comprise the system.

  5. AN OVERVIEW OF THE MODELING PROCESS (Cont’d)

  6. AN OVERVIEW OF THE MODELING PROCESS (Cont’d) • Feedback enters the modeling process in the form of verification and validation. • Verification constitutes a feedback loop between the computer model and the formal model. “does my computer program do what I meant it to do?” • Validation constitutes a feedback loop between the computer model and reality. “does my computer program mimic reality adequately?”

  7. AN OVERVIEW OF THE MODELING PROCESS (Cont’d) Using this approach you are more likely to achieve a functioning model. • Start small • Improve incrementally • Test frequently • Do not be afraid to backtrack or simplify

  8. DISCRETE EVENT SYSTEMS • There are many classifications of systems available. The Winter Simulation Conference tends to focus on Discrete Event Systems. These are systems where the state changes occur at a discrete set of points along the time axis, rather than continuously.Discrete Event Simulation (DES) models can be built with any of several world views. • Schruben (1983) created event graph notationso that simulation modelers could focus on the model-specific logic of the system to be studied.

  9. DISCRETE EVENT SYSTEMS (Con’t’d) • Another type of error that modelers can make is a concept, called a Type III error by Mitroff and Featheringham (1974). • Simulation languages are an example of what computer scientists call Domain Specific Languages (DSLs).The alternative to DSLs is General-Purpose Programming Languages (GPPLs).

  10. REVIEW OF EVENT GRAPHS • Event graphs are a pictorial representation of event-based discrete event models. • Each event in the system is represented by a vertex in the graph. State transitions can be specified below the vertex or separately, labeled by the vertex’s label. Scheduling relationships between events are depicted using directed edges with attributes annotated on the edges to indicate the delay (if any) between the events and the conditions under which the scheduling should occur.

  11. REVIEW OF EVENT GRAPHS (Cont’d) A and B are events, t is a delay (which coul be constant, random, or some function of the state), and c is a boolean function of the state.

  12. REVIEW OF EVENT GRAPHS (Cont’d)

  13. DESIGN CONSIDERATIONS To implement the model as a computer program, we need three things: • A method for each event in the event graph model that updates the model state as specified, schedules further events as appropriate, and then terminates. • An executive loop that determines the order in which event methods should be invoked. • A schedule capability that provides the mechanism by which event methods notify the executive loop about events that are candidates for invocation.

  14. DESIGN CONSIDERATIONS (Cont’d) • The simulation program needs to store notices of pending events in a container of some sort. (Let P be the pending events set) • If P is implemented as a priority queue, clock is the simulation clock, and current is an event notice reference with associated method and time attributes, the following block of pseudo-code describes the structural form of the executive loop.

  15. IMPLEMENTATION The Model Interface Every SIMpleKit model must implement the Model interface. In Java an interface mandates class elements that must be present, but does not provide any implementation for those elements. In other words, a SIMpleKit Model must have a method initialize() which takes no arguments and returns nothing.

  16. IMPLEMENTATION (Cont’d) The EventNoticeClass The EventNotice class is a helper class for storing and retrieving event notices. It should never be used directly by users, so all methods and constructors are declared protected, meaning they are not available outside of the SIMpleKitpackage hierarchy. Event notices are immutable.

  17. IMPLEMENTATION (Cont’d) The Simulation Class Class Simulation provides the core functionality of SIMpleKit. It maintains a priority queue of EventNotice’s called eventList, a reference of type Model to your model object called model, and the current simulated time in a variable called modelTime.

  18. THE M/M/k QUEUE IN SIMpleKit • We demonstrate usage of SIMpleKit by implementing an M/M/k queueing system. • SIMpleKit does not provide a library of distributions—techniques for random variategeneration are widely available in the simulation literature.

  19. THE M/M/k QUEUE IN SIMpleKit (Cont’d) • Execution of the model is handled via a method called run(), • EventNotice variable to keep track of the current event, • initialize() method whose existence is guaranteed by the Modelinterface proceeds with an execution loop which determines the next event to be performed by polling the event list, sets the simulation clock to the time of that event, and invokes the event method.

  20. THE M/M/k QUEUE IN SIMpleKit (Cont’d) Event Methods Each event has a corresponding event method in the model class. The event graph provides a roadmap of how to write the event methods. First, perform all state transitions. Then schedule events corresponding to each departing edge if the edge conditions are true, with suitable delays.

  21. THE M/M/k QUEUE IN SIMpleKit (Cont’d) • The halt event invokes Simulation.halt(), which empties the event list to guarantee termination of the model as described earlier.

  22. THE M/M/k QUEUE IN SIMpleKit (Cont’d) The other event methods are sufficiently straightforward that we present the implementations without further comment other than to note that ++ and -- are Java operators for increment and decrement, respectively.

  23. THE M/M/k QUEUE IN SIMpleKit (Cont’d) Running the Model The model has to be started somehow. This is accomplished by creating a Java “main” method which creates an instance of the model and passes it to the Simulation class to be run.

  24. FINAL COMMENTS ABOUT SIMPLEKIT • SIMpleKit provides a simple and transparent mechanism to illustrate how discrete event models can be implemented. Event Graphs map very directly into SIMpleKitprograms, and run very efficiently. • SIMpleKit has been used to implement some quite sophisticated models, including an analysis of joint problem solving in edge vs. hierarchical organizations and an implementation of Dijkstra’s algorithm for determining shortest paths in a graph.

More Related