Discrete event simulation (DES) is the basis of the simulations used in the ecological simulation testbed. We will therefore spend more time discussing the details of this technique.
The DES view of time is not as a constant flow, rather it is what happens between significant events. This gives DES a unique advantage over discrete time or continuous simulation. The only thing a model developer, using DES, focuses on are the events that affect the modeled system. These events can be physical events, like movement, or queries, like what is the current temperature. Events can even be time steps, as in a discrete time simulation, to indicate a change in season for example. The key to creating a discrete event simulation is understanding what the significant events are in the system being modeled.
Once we know the events necessary for our model, we need to determine the affect of an event on the entities involved. Each entity has a set of state variables--commonly called the state--that represent the condition of the entity. In the case of an animal, we might want to know its location, age, some measure of its health and its current nutritional state. With these variables defined, the affect of an event on the entity can be modeled by a "state transition function."
In a DES each, invokes one transition function. This function examines the current state of the entity and computes some change in the entity's state. If we consider an animal at a particular location receiving a move event message. The state transition function will generate some direction and distance for the animal, then change the animal's location state variable, so the animal moves.
Once the state transition is accomplished, the function may need to generate another event. Again consider an animal's movement. After the move is made, the animal will probably rest for a time, then decide to move again. The time the animal rests is dependent on the animal's current state so it is natural to forecast the animal's rest period and generate another move event with the appropriate timestamp. NOTE: this is just one possible model for movement, do not assume that there are not other ways to accomplish the same behavior.
With the backdrop of what the modeler must do, it is worthwhile considering what the engine must do. DES is divided into three steps: 1) event generation, 2) event scheduling, and 3) event processing. Whan an entity generates an event, the event is passed to the simulation engine. The engine enters the event into a list of future events, maintaining the proper time sequence, then removes the event in the front of the list and processes that event (i.e. it invokes the appropriate transition function). Once the event is processed, any generated events are passed to the engine and the process repeats.
As a final observation, the time stamp on the event currently being processed is the simulation time.
The simulation below demonstrates the action of discrete event simulation.