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.
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 system
getEntityStorageImpl
— Define entity storage elements
of discrete-event system
getEntityTypesImpl
— 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 fails
destroy
— Event
action upon entity destruction
entry
— Event
action when entity enters storage element
exit
— Event
action before entity exit from storage
generate
— Event
action upon entity creation
iterate
— Event
action when entity iterates
modified
— Event action upon entity modification by
the Entity Find block
resourceAcquired
— Specify event actions upon
successful resource acquisition.
resourceReleased
— Specify event actions upon
successful resource release.
testEntry
— Event action to accept or refuse
entity
timer
— 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 storage
queueLIFO
— Define
last-in last-out (LIFO) queue storage
queuePriority
—
Define priority queue storage
queueSysPriority
—
Define system priority queue storage
Create events
eventGenerate
—
Create entity generate event
eventIterate
—
Create entity iterate event
eventTimer
—
Create entity timer event
eventForward
—
Create entity forward event
eventDestroy
—
Create entity destroy event
eventTestEntry
— Create an event to indicate that the
acceptance policy for the storage has changed and the storage
retests arriving entities
eventAcquireResource
— Create a resource-acquiring
event
eventReleaseResource
— 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 event
cancelForward
—
Cancel entity forward event
cancelGenerate
—
Cancel previously scheduled entity generation event
cancelIterate
—
Cancel previously scheduled iterate event
cancelTimer
—
Cancel previously scheduled timer event
cancelAcquireResource
— Cancel previously scheduled
resource acquisition event
Resource Management
getResourceNamesImpl
— Define resource pools from
which the discrete-event system acquires the resources
resourceType
— Specify an entity type and the name of
the resources to be acquired by the specified entity
eventAcquireResource
— Create a resource-acquiring
event
eventReleaseResource
— 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
cancelAcquireResource
— Cancel previously scheduled
resource acquisition event
resourceSpecification
— Specify the type and amount of
resources for eventAcquireResource
or
eventReleaseResource
requests
initResourceArray
— Initialize a
resourceSpecification
array, required for code
generation
resourceAcquired
— Specify event actions upon
successful resource acquisition
resourceReleased
— Specify event actions upon
successful resource release
matlab.System
ClassInheriting 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.
When referencing entity attributes or system properties in a discrete-event System object, use these formats:
Attribute or Property | Format | Access |
---|---|---|
attribute |
| Read/write |
priority property |
| Read/write |
ID property |
| Read-only |
If an entity that is a part of a MATLAB Discrete-Event
System block is requested for extraction, the exit
method of the block is triggered. When the
exit
method is called, its
destination argument is set to
extract
. See modified
for entity modification.
matlab.DiscreteEventSystem
| matlab.System