SimEvents® integrates discrete-event system modeling into the Simulink® time-based framework. In time-based systems, a signal changes value in response to the simulation clock, and state updates occur synchronously with time. By contrast, in discrete-event or event-based systems state transitions depend on asynchronous discrete incidents called events.
Suppose that you want to measure how long the average car waits in a queue for its turn to fill its tank at a busy gas station. Suppose that you also want to model the motion of the car by solving differential equations. You can use a combination of time-based simulation and discrete-event simulation, where:
The time-based aspect controls the details of the car's trajectory
The discrete-event aspect controls the queuing behavior
In a Simulink model, you typically construct a discrete-event system by adding various blocks, such as generators, queues, and servers, from the SimEvents block library. These blocks are suitable for producing and processing entities, which are abstractions of discrete items of interest. Examples of entities are vehicles arriving at a gas station, packets within a communication network, planes on a runway, or trains within a signaling system. Asynchronous events correspond to motion and changes in entity attributes through the system model, and they update the states of the underlying system. Examples of states are lengths of queues or service time for an entity in a server.
This SimEvents model represents a simple queuing system that generates entities of interest and queues them in a specified order, services them to change their attributes, and terminates them to represent their departure from the line. To learn how to build this model, see Create a Discrete-Event Model.
The Entity Generator block is used to generate entities with a fixed or randomized intergeneration time. The Entity Queue block queues the entities based on a specified order. The Entity Server block services entities for a length of time. The entities depart the line through the Entity Terminator block.
The Effects of Communication Delays on an ABS Control System example provides a scenario for investigating the communication delay in a car anti-lock braking system (ABS). The system uses control area network (CAN) communications between components. The model illustrates a heavily loaded network of a distributed system.
The model investigates the delay of communication between the ABS controller and the vehicle in ideal conditions and in the presence of noise.
The CAN ID:5 subsystem consists of SimEvents library blocks that model a buffer in transmission, message queues, and replicated messages for communication.
The model is used to analyze the effect of communication delay on the slip value
with the passage of time. The slip value is
0 when the wheel
speed and the vehicle speed are equal. The slip value is
the wheels are completely locked. The desirable slip value is
The plot on the left represents the slip in ideal conditions and on the right is the slip in the presence of noise. The decrease in slip performance is detected in the model and resolved with reprioritization of CAN messages.
For more information about the model, see Effects of Communication Delays on an ABS Control System.
One or more discrete-event systems can coexist with time-based systems in a Simulink model. This coexistence facilitates the simulation of sophisticated hybrid systems. You can pass signals from time-based components/systems to and from discrete-event components/systems modeled with SimEvents blocks. The combination of time- and event-based modeling facilitates the simulation of large-scale systems that incorporate smaller subsystems from multiple environments. An example of a large-scale system has physical modeling for continuous-time systems, such as electrical systems, which communicate via a channel modeled as a discrete-event system. A Simulink model can also contain a purely discrete-event system with no time-based components when modeling event-based processes. These systems are common in models that represent logistic and manufacturing systems.
The seExampleTankFilling model incorporates both time-based and event-based modeling to represent vehicles queuing up to fill their tanks in a gas station.
The SimEvents part is an extension of the model presented in A Simple Queuing System and it models the flow of the vehicle tanks. The tanks are generated, queued, and serviced to be filled. The Simulink part models the logic to fill the tanks. When a tank is filled to capacity, the completion of the tank filling process is detected and a message is sent to the SimEvents part to open the gate for releasing the tank. For more information, see Modeling Hybrid Systems - Tank Filling.