Documente Academic
Documente Profesional
Documente Cultură
https://engineering.purdue.edu/~engelb/abe565/week13.htm
Week 13 - Simulation
Assignment:
Review this document. Find and review a journal article that describes the development of a simulation and its application. Provide a brief written review (due Mon Dec 1).
Introduction to Simulation
Simulation is a tool that has been commonly used to assist with systems analysis. Simulation is still widely used and is often use in combination with other techniques that we have examined - including linear programming, expert systems, and neural networks. In its broadest sense, computer simulation is the process of designing a mathematical-logical model of a real system and experimenting with this model on a computer. Thus simulation encompasses a model building process as well as the design and implementation of an appropriate experiment involving that model. These experiments or simulations, permit inferences to be drawn about systems: Without building them, if they are only prototyped systems Without disturbing them, if they are operating systems that are costly or unsafe to experiment with Without destroying them, if the object of an experiment is to determine their limits of stress In this way, simulation models can be used for design, procedural analysis, and performance assessment. Simulation modeling assumes that we can describe a system in terms acceptable to a computing system. In this regard, a key concept is that of a system state description. If a system can be characterized by a set of variables, with each combination of variable values representing a unique state or condition of the system, then manipulation of the variable values simulates movement of the system from state to state. A simulation experiment involves observing the dynamic behavior of a model by moving from state to state in accordance with well-defined operating rules designed into the model. Changes in the state of a system can occur continuously over time or at discrete instants in time. The discrete instants can be established deterministically or stochastically depending on the nature of model inputs. Although the procedures for describing the dynamic behavior of discrete and continuous change models differ, the basic concept of simulating a system by portraying the changes in the state of the system over time remains the same.
1 of 8
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
4 5 6 7 8 9 10
Since the simulation is the dynamic portrayal of the changes in the state of a system over time, the states of the system must be defined. For this example, they can be defined by the status of the teller (busy or idle) and by the number of customers at the bank. The state of the system is changed by a customer arriving to the bank, and the completion of service by the teller and subsequent departure of the customer. To illustrate a simulation, we will determine the state of the system over time by processing the events corresponding to the arrival and departure of customers in a time-ordered sequence. The manual simulation of this example corresponding to the values in the above table is summarized in the table below by customer number. It is assumed that initially there are no customers in the system, the teller is idle, and the first customer is to arrive at time 3.2.
Customer Number (1) Arrival Time (2) Start Departure Time in Time in Service Time Queue Bank Time (3) (4) (5)=(3)-(2) (6)=(4)-(2)
1 2 3 4 5 6 7 8 9 10
3.2 10.9 13.2 14.8 17.7 19.8 21.5 26.3 32.1 36.6
3.2 10.9 14.4 18.6 21.7 24.1 28.4 31.1 33.2 36.6
7.0 14.4 18.6 21.7 24.1 28.4 31.1 33.2 35.7 40.0
0.0 0.0 1.2 3.8 4.0 4.3 6.9 4.8 1.1 0.0
3.8 3.5 5.4 6.9 6.4 8.6 9.6 6.9 3.6 3.4
In the above table, columns (1) and (2) are taken from the first table. The start of service time given in column (3) depends on whether the preceding customer has departed the bank. It is taken as the larger value of the arrival time of the customer and the departure time of the previous customer. Column (4), the departure time, is the sum of the column (3) value and the service time for the customer given in the first table. Values for time in queue and time in bank for each customer are computed as shown in the above table. Average values per customer for these variables are 2.61 minutes and 5.81 minutes, respectively. The above table presents a good summary of information concerning the customer but does not provide information about the teller and the queue size for the teller. To portray such information, it is convenient to examine the events associated with the situation. The logic associated with processing the arrival and departure events depends on the state of the system at the time of the event. In the case of the arrival event, the disposition of the arriving customer is based on the status of the teller. If the teller is idle, the status of the teller is changed to busy and the departure event is scheduled for the customer by adding his service time to the current time. However, if the teller is busy at the time of an arrival, the customer cannot begin service at the current time and, therefore, he enters the queue (the queue length is increased by one). For the departure event, the logic associated with processing the event is based on queue length. If a customer is waiting in the queue, the teller status remains busy, the queue length is reduced by one, and the departure event for the first waiting customer is scheduled. However, if the queue is empty, the status of the teller is set to idle. An event-oriented description of the bank teller status and the number of customers at the bank is given in the table below. The events are listed in chronological order. The results indicate that the average number of customers at the bank in the first 40 minutes is 1.4525 and that the teller is idle 20 percent of the time.
Event Customer Event Number Number Teller Teller
2 of 8
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
Time
Number
Type
in Queue
in Bank
Status
Idle Time
0.0 3.2 7.0 10.9 13.2 14.4 14.8 17.7 18.6 19.8 21.5 21.7 24.1 26.3 28.4 31.1 32.1 33.2 35.7 36.6 40.0
1 1 2 3 2 4 5 3 6 7 4 5 8 6 7 9 8 9 10 10
Start Arrival Departure Arrival Arrival Departure Arrival Arrival Departure Arrival Arrival Departure Departure Arrival Departure Departure Arrival Departure Departure Arrival Departure
0 0 0 0 1 0 1 2 1 2 3 2 1 2 1 0 1 0 0 0 0
0 1 0 1 2 1 2 3 2 3 4 3 2 3 2 1 2 1 0 1 0
Idle Busy Idle Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Busy Idle Busy Idle
3.2 3.9
0.9
To place the arrival and departure events in their proper chronological order, it is necessary to maintain a record calendar of future events to be processed. This is done by maintaining the times of the next arrival event and the next departure event. The next event to be processed is then selected by comparing these event times. For situations with many events, an ordered list of events would be maintained which is referred to as an event file or event calendar. There are several important concepts illustrated by the above example. We observe that at any instant in simulated time, the model is in a particular state. As events occur, the state of the model may change as prescribed by the logical-mathematical relationships associated with the events. Thus, the events define the dynamic structure of the model. Given the starting state, the logic for processing each event, and a method for specifying sample values, our problem is largely one of bookkeeping. An essential element in our bookkeeping scheme is an event calendar which provides a mechanism for recording and sequencing future events. Another point is that we can view the state changes from two perspectives: the process that the customer encounters as he seeks service (the customer's view), or the events that caused the state of the teller to change (the teller's or bank's view).
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
The simulation approach can be used to alleviate these difficulties. Simulation is often used at one of four levels: Exploratory devices to define a system or problem Analysis vehicles to determine critical elements, components and issues Design assessors to synthesize and evaluate proposed solutions Predictors to forecast and aid in planning future developments
Types of Simulation
Simulation can be categorized into the following types: discrete - with this approach, the parameter or parameters of interest change discretely (suddenly, in step-like fashion) with respect to time or distance (usually time). The graphic below shows a possible plot of a parameter of interest with respect to time from a discrete simulation. This approach might be used to model the processing of parts in a factory.
continuous - In continuous simulation, the parameter or parameters of interest change continuously with respect to time. An example plot of such a parameter from a continuous simulation is plotted with respect to time in the graphic below. This approach might be used to model the biomass available within a field.
4 of 8
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
combined - In combined simulation, parameters change both continuously and discretely combining discrete and continuous simulation. An example is shown in the figure below. This approach might be used to simulate the biomass in a field with the discrete changes representing harvesting.
The above classification is based on the shape of the curve that results by plotting the item of interest with respect to time. Object-oriented simulation is another classification that is sometimes used to further
5 of 8
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
describe simulation approaches that utilize object-oriented programming techniques. Object-oriented languages such as COOL (CLIPS Object Oriented Language - available within CLIPS) are often used for implementation of object-oriented simulations. Due to time constraints, we will not be examining objectoriented simulation in any additional detail.
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
the system. LVF - Low value first. Entities are removed from the queue based on the lowest value of one of an entity's attributes. Events are triggered by actions that happen to an entity. Occurrence of events is often used to collect statistics about an entity (e.g. time spent being serviced) and to schedule subsequent events. A discrete simulation might be developed to model inventory levels which would be used to develop rules for managing the inventory. The objective is to minimize the inventory without penalizing sales. Using the simulation, rules can be developed for reorder, shipment time, and penalties for not satisfying the customer (lost sales).
Next-Event Scheduling
Most simulation tools that support discrete simulation use next-event scheduling as described in the banking example previously. The following example illustrates this approach and some of its advantages. Consider a simulation in which 1000 entities will be run through the system. One approach that could be used would be to determine all arrival times and service times before running the simulation. The major disadvantage of this approach is that it is wasteful of computer time and space. For large applications, CPU time and space may not be sufficient to use this approach. In next-event scheduling, as each event is set up, it creates (schedules) the next procedure (event). Each event schedules the next event, allowing time to advance to the next scheduled event rather than advancing by some fixed time step. An event calendar is used to manage the scheduling of events. All events are scheduled and time at which they will occur is placed on the calendar. Next-event scheduling works well when one is not concerned about what happens outside of the system.
7 of 8
8/24/2013 11:44 AM
Week 13 - Simulation
https://engineering.purdue.edu/~engelb/abe565/week13.htm
can't generally be added linearly and thus the use of the distributions in the simulation is used to obtain the resulting distribution.
8 of 8
8/24/2013 11:44 AM