Model of a tank filling station that combines discrete-event dynamics and continuous system dynamics.

Discrete-Event Simulation in Simulink

SimEvents® provides a discrete-event simulation engine that manages and processes sequences of asynchronous events. These events can help model mode changes and trigger state transitions within time-based systems in Simulink®.

Entities, Events, and Resources

With SimEvents you can create entities to represent discrete items of interest, such as packets in a communication system or airplanes in an airport taxiway. The generation, movement, and processing of entities in the system causes events, such as the arrival of a packet or the departure of an airplane. In turn, these events modify the states in the system to affect system behavior. You can characterize your entities with attributes, such as a destination address, processing time, or server delay. Entities can also acquire and release resources, which can represent supplies, machines, or even people that entities use to complete a task or event. SimEvents distinguishes between entity lines, which represent entity movement between blocks and event-signal lines, which denote corresponding event-based computations, via unique port styles.

Programmatic Control of Event Actions and Entities

You can programmatically control event actions and entities in the following ways:

You can write MATLAB code for entity events that occur in different blocks, such as the Generator, Queue, and Server blocks. These event actions enable you to manipulate entity attributes and priority.

Within the event actions, you can invoke Simulink functions that can modify entities and start conventional time-driven execution.

Add system simulation or environment modeling to your algorithm modeling and graphical programming using SimEvents .

SimEvents Blocks and Design Patterns

SimEvents provides blocks that enable you to create, process, store, and move entities and their resources in a system. You can model both simple and complex networks of queues and servers. By connecting gate and switching blocks, you can establish paths on which entities travel in response to events. These paths can include delays and selective switching criteria. Many parameters within SimEvents can be programmatically determined to model probabilistic variations in the system. You can also build your own domain-specific blocks by using a Stateflow Discrete-Event Chart or MATLAB Discrete-Event System block. Further, you can use Simulink capabilities, such as masking subsystems and creating libraries, to build up SimEvents subsystems into component blocks that can be shared and reused by others.

The SimEvents Design Patterns library contains predefined blocks for common design patterns, such as time stamping entities upon generation or extracting attributes of entities as signals in Simulink.

Explore gallery (2 images)

Analysis and Visualization of Results

You can gain insight into the behavior of your model by:

Animating

Using statistics and scopes

Debugging

Animation

You can observe entity movement in your model through built-in entity animation. You can also build your own MATLAB animations via custom observers that you create for the entities and events in your model.

Statistics and Scopes

Most SimEvents blocks produce statistics that let you monitor aggregate measures, such as average service times, queue lengths, and server utilization. Custom scopes enable you to visualize these signals using familiar staircase and stem plots.

SimEvents Debugger

The SimEvents debugger is a standalone tool that you can use to debug your model by pausing a simulation at each step or setting a breakpoint to query simulation behavior. The debugger also creates a simulation log with detailed information about what is about to happen or what has just happened in the simulation. You can debug both discrete-event and hybrid simulations by inspecting this log.

SimEvents Debugger showing breakpoints set to enable inspection of events at different times during the simulation in various blocks.

Select Your Country

Choose your country to get translated content where available and see local events and
offers. Based on
your location, we recommend that you select: .