Introduction • A computer simulation language describes the operation of a simulation on a computer. • There are two major types of simulation: – Continuous and – discrete • Most languages also have a graphical interface and at least simple statistical gathering capability for the analysis of the results. • An important part of discrete event languages is the ability to generate pseudo-random numbers and variates from different probability distributions. Discrete System Simulation • A common exercise in learning how to build discrete-event simulations is to model a queue, such as customers arriving at a bank to be served by a teller. • In this example, the system entities are CUSTOMER- QUEUE and TELLERS. • The system events are CUSTOMER-ARRIVAL and CUSTOMER-DEPARTURE. (The event of TELLER- BEGINS-SERVICE can be part of the logic of the arrival and departure events.) • The system states, which are changed by these events, are NUMBER-OF-CUSTOMERS-IN-THE-QUEUE (an integer from 0 to n) and TELLER-STATUS (busy or idle). • The random variables that need to be characterized to model this system stochastically are CUSTOMER- INTERARRIVAL-TIME and TELLER-SERVICE-TIME. Components of a Discrete-event Simulation • Clock: The simulation must keep track of the current simulation time, in whatever measurement units are suitable for the system being modelled. • Events List: The simulation maintains at least one list of simulation events. An event is described by the time at which it occurs and a type, indicating the code that will be used to simulate that event. • The simulation needs to generate random variables of various kinds, depending on the system model. • Statistics: The simulation typically keeps track of the system’s statistics, which quantify the aspects of interest. In the bank example, it is of interest to track the mean service times. • Ending Condition: the simulation designer must decide when the simulation will end. Typical choices are at time ‘t’ or “after processing n number of events” or, more generally, “when statistical measure X reaches the value x”. Simulation Engine Logic • The main loop of a discrete-event simulation is something like this: • Start – Initialize Ending Condition to FALSE. – Initialize system state variables. – Initialize Clock (usually starts at simulation time zero). – Schedule an initial event (i.e., put some initial event into the Events List). • “Do loop” or “While loop” While (Ending Condition is FALSE) then do the following: – Set clock to next event time. – Do next event and remove from the Events List. – Update statistics. – End – Generate statistical report. Stages used in Discrete Event Simulation Object Oriented Simulation
• The main difference between traditional program
development and Object Oriented techniques is the way in which the data and the program code are stored and manipulated. • In traditional software, the data and the program code are intermingled throughout the program, making data security and integrity difficult to achieve. • However, in Object Oriented simulation software all data and procedures relating to a single entity (object) are encapsulated within an object, with the object controlling its own interaction and data integrity permissions with other objects. Continuous Simulation Languages • Continuous system simulation languages are very high level programming languages which assist modelling and simulation of systems characterized by ordinary and partial differential equations. • Continuous Simulation refers to a computer model of a physical system that incessantly tracks system response over time according to a set of above specified equations Block-structured Continuous Simulation Languages • Block oriented simulation languages are based on the method of analogue computers. • The system must be expressed as a block diagram that defines the interconnection of functional units and their quantitative parameters. • “Programming” means entering the interconnection of the blocks and their description. • Then the user adds statements and/or directives that control the simulation. • If the system is described as a set of equations, they must be converted to a block diagram. Example: GPSS Simulation Languages • General purpose languages Eg. C++, C, FORTRAN, Java etc… • Special purpose languages Eg. SIMSCRIPT, GPSS, COMNET, OPNET, SimPack, etc. Q&A