You can extend the existing functionality of SimEvents® by authoring new blocks to model behaviors that are not provided with a SimEvents built-in solution. To create custom functionality in SimEvents models, you can use the MATLAB Discrete-Event System block that allows you to implement a discrete-event System object written in MATLAB® language.
To implement a custom discrete-event System
matlab.DiscreteEventSystem class. Link the System
object to a SimEvents model by using a MATLAB Discrete-Event
System block. The linked MATLAB Discrete-Event
System block exhibits the desired custom behavior during
|MATLAB Discrete-Event System||MATLAB discrete-event system|
|Base class for discrete-event system objects|
|Create a resource acquisition event|
|Create entity destroy event|
|Create entity forward event|
|Create entity generate event|
|Create entity iterate event|
|Create an event to release previously acquired resources|
|Create an event to release all resources acquired by an entity|
|Create an event to indicate that the acceptance policy for the storage has changed and the storage retests arriving entities|
|Create entity timer event|
|Initialize event array|
|Initialize a resource specification array|
|Event action when entity forward fails|
|Event action upon entity destruction|
|Event action when entity enters storage element|
|Event action before entity exit from storage|
|Event action upon entity creation|
|Event action when entity iterates|
|Event action upon entity modification by the Entity Find block|
|Event action upon successful resource acquisition|
|Event action upon successful resource release|
|Event action to accept or refuse entity|
|Event action when timer completes|
|Cancel previously scheduled resource acquisition event|
|Cancel previously scheduled entity destroy event|
|Cancel previously scheduled forward events|
|Cancel previously scheduled entity generation event|
|Cancel previously scheduled iterate event|
|Cancel previously scheduled timer event|
|Define entity type|
|Define input ports and output ports of discrete-event system|
|Define entity storage elements of discrete-event system|
|Define entity types of discrete-event system|
|Define resource pools from which to acquire resources|
|Define first-in first-out (FIFO) queue storage|
|Define last-in last-out (LIFO) queue storage|
|Define priority queue storage|
|Define system priority queue storage|
|Create specifications for a resource acquisition or a resource release event|
|Specify an entity type and the name of the resources to be acquired by the specified entity|
|Initialize entity generation events|
The SimEvents library provides design patterns that you can refer to while modeling.
Author discrete-event System object by defining entity types, ports, storage, and events.
matlab.DiscreteEventSystem class to
implement a discrete-event System
Configure MATLAB Discrete-Event System block.
Define and work with events in custom discrete-event systems.
Call Simulink® function from a MATLAB Discrete-Event System Block.
This example shows how to model resource scheduling using data exchange between the MATLAB Discrete-Event System block and the Data Store Memory block.