From the series: Understanding Discrete-Event Simulation
Learn the basics of discrete-event simulation, and explore how you can use it to build a process model in this MATLAB® Tech Talk by Will Campbell. Discrete-event simulation is a simple, yet versatile, way of describing a dynamic system. It uses a series of instantaneous occurrences, or discrete events. Using basic concepts like entities, queues, gates, and servers, you can build complex models to explore fundamental questions such as latency, utilization, and bottlenecks.
Today we’re going to talk about discrete-event simulation, a simple yet versatile way of describing a dynamic system. Simulations rely on a model of a real-world process to imitate time-dependent behavior. The discrete-event approach models a process as a series of instantaneous occurrences, or discrete events. In between these events, the system is approximated as fixed and unchanging.
We can illustrate this concept by developing a model of an elevator. An elevator consists of a shaft, a hoisting mechanism, and a car…each with its own set of sub components. We have to decide which of these details to include in our model. Is it important to know how pushing a button on the car’s control panel affects things like current in the circuit, rotation of the motor, and displacement of the door? Do we need to understand these details millisecond by millisecond? Maybe. Such information would be important if you were using the simulation to design the elevator’s microcontroller software. But if the task at hand were different, if instead we wanted to determine the elevator’s ability to accommodate passenger traffic, then modeling millisecond-level behavior probably isn’t necessary.
So instead, let’s focus on the series of events that describe the elevator’s behavior. We’ll start with the door opening. Once that task completes, passengers enter the elevator and push a button. After that, the doors begin to close, and the elevator starts to move. The car then stops at the desired floor, the doors open, passengers get out, and the door closes again. In between these events, things are continuously changing in the real world. However, a discrete-event simulation would ignore those dynamics and approximate the passengers as being in a fixed state when not experiencing an event. Anything between events is inconsequential, which keeps the model simple and enables us to focus on the information that matters to us: things like transit time, elevator utilization, and passenger throughput.
We can contrast a continuous dynamic simulation with a discrete-event simulation by plotting a hypothetical set of outputs for both. Here we have three lines that represent the positions of the doors and the car’s center of gravity. Any value on the Y axis is acceptable in a continuous representation. But with a discrete-event approach, the Y axis would be comprised of discrete states, and state changes would correspond to discrete events. In this case, the events all occur at different points in time, but there’s nothing precluding multiple events from happening at a single instance. The simulation is really just a schedule of events executed one after the other, and time is only an artifact being tracked behind the scenes. Another way to think about this is to arrange everything onto an event calendar. Some dates will have multiple events while others will have no activity at all.
So here we have but one of many methods for visually expressing a discrete-event simulation of an elevator, one that centers on the passengers’ experience. Passengers are modeled as individual units, or entities, moving through the elevator system. Passengers waiting for the elevator are modeled as entities sitting in queues, a model component that holds the entities until an event permits their departure. In this case, the arrival of the elevator signals that the passengers can move to the next step by opening a gate in the model. Once on the elevator, transit is modeled with what’s known as a server.
The server holds the entities for a prescribed amount of time, which in our case is the time it takes to get to the desired floor.
So with basic concepts like entities, queues, gates, and servers, discrete-event simulations enable us explore fundamental questions about a process. In our case, we can use the simulation to answer how long passengers spend in the elevator, how often the elevator is idle, and which floors demand the most usage. But questions regarding system latency, resource utilization, and bottleneck identification are so ubiquitous that you find discrete-event simulation applied to problems as diverse as bank teller services and communication network traffic. We can delve into such topics another time, but for now, you’ve got the big picture.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.