Create a Discrete-Event System Object
The MATLAB Discrete-Event System block
allows you to author a custom discrete-event System object™ and use it in SimEvents® models. To author event-driven entity-flow systems, the block uses
discrete-event System object with the matlab.DiscreteEventSystem class, which
inherits and extends the matlab.System class.

Methods
The matlab.DiscreteEventSystem class provides
methods that let you work with these elements of a discrete-event system:
Define properties of the object entity types, ports, and storage
getEntityPortsImpl— Define input ports and output ports of discrete-event systemgetEntityStorageImpl— Define entity storage elements of discrete-event systemgetEntityTypesImpl— Define entity types of discrete-event system
Event initialization
setupEvents— Initialize entity generation events
Runtime behavior of the object
blocked— Event action when entity forward failsdestroy— Event action upon entity destructionentry— Event action when entity enters storage elementexit— Event action before entity exit from storagegenerate— Event action upon entity creationiterate— Event action when entity iteratesmodified— Event action upon entity modification by the Entity Find blockresourceAcquired— Specify event actions upon successful resource acquisitionresourceReleased— Specify event actions upon successful resource releasetestEntry— Event action to accept or refuse entitytimer— Event action when timer completes
While implementing these methods, define entity type, entity storage, create, schedule, and cancel events. Use these functions:
Define entity type
entityType— Define entity type
Define entity storage
queueFIFO— Define first-in first-out (FIFO) queue storagequeueLIFO— Define last-in last-out (LIFO) queue storagequeuePriority— Define priority queue storagequeueSysPriority— Define system priority queue storage
Create events
eventGenerate— Create entity generate eventeventIterate— Create entity iterate eventeventTimer— Create entity timer eventeventForward— Create entity forward eventeventDestroy— Create entity destroy eventeventTestEntry— Create an event to indicate that the acceptance policy for the storage has changed and the storage retests arriving entitieseventAcquireResource— Create a resource-acquiring eventeventReleaseResource— Create an event to release previously acquired resources(This method allows for partial resource release)eventReleaseAllResources— Create an event to release all the resources acquired by an entity
Cancel events
cancelDestroy— Cancel previously scheduled entity destroy eventcancelForward— Cancel entity forward eventcancelGenerate— Cancel previously scheduled entity generation eventcancelIterate— Cancel previously scheduled iterate eventcancelTimer— Cancel previously scheduled timer eventcancelAcquireResource— Cancel previously scheduled resource acquisition event
Resource Management
getResourceNamesImpl— Define resource pools from which the discrete-event system acquires the resourcesresourceType— Specify an entity type and the name of the resources to be acquired by the specified entityeventAcquireResource— Create a resource-acquiring eventeventReleaseResource— Create an event to release previously acquired resources (This method allows for partial resource release)eventReleaseAllResources— Create an event to release all the resources acquired by an entitycancelAcquireResource— Cancel previously scheduled resource acquisition eventresourceSpecification— Specify the type and amount of resources foreventAcquireResourceoreventReleaseResourcerequestsinitResourceArray— Initialize aresourceSpecificationarray, required for code generationresourceAcquired— Specify event actions upon successful resource acquisitionresourceReleased— Specify event actions upon successful resource release
Inherited Methods from matlab.System Class
Inheriting matlab.DiscreteEventSystem class also
inherits a subset of the matlab.System class
methods.
Header for System object display | |
Property groups for System object display | |
Inactive property status | |
Validate property values | |
Action when tunable properties change | |
Number of inputs to step method | |
Names of System block input ports | |
Number of outputs from step method | |
Names of System block output ports | |
Discrete state property values | |
Initialize System object | |
Reset System object states | |
Release resources | |
Load System object from MAT file | |
Save System object in MAT file | |
Information about System object | |
Sizes of output ports | |
Data types of output ports | |
Complexity of output ports | |
Discrete state size, data type, and complexity | |
Name to display as block icon | |
Query sample time |
For more information about these methods, see Customize System Objects for Simulink.
Reference and Extract Entities
When referencing entity attributes or system properties in a discrete-event System object, use these formats:
Attribute or Property Format Access attribute
entity.data.attribute_nameRead/write
priority property
entity.sys.priorityRead/write
ID property
entity.sys.idRead-only
If an entity that is a part of a MATLAB Discrete-Event System block is requested for extraction, the
exitmethod of the block is triggered. When theexitmethod is called, its destination argument is set toextract. Seemodifiedfor entity modification.
See Also
matlab.DiscreteEventSystem | matlab.System