Main Content

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.

Graphical representation of a MATLAB Discrete-Event System with System Object name myDES inheriting from the matlab.DiscreteEventSystem class that, in turn, inherits from 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

  • Event initialization

  • 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:

Inherited Methods from matlab.System Class

Inheriting matlab.DiscreteEventSystem class also inherits a subset of the matlab.System class methods.

getHeaderImpl

Header for System object display

getPropertyGroupsImpl

Property groups for System object display

isInactivePropertyImpl

Inactive property status

validatePropertiesImpl

Validate property values

processTunedPropertiesImpl

Action when tunable properties change

getNumInputsImpl

Number of inputs to step method

getInputNamesImpl

Names of System block input ports

getNumOutputsImpl

Number of outputs from step method

getOutputNamesImpl

Names of System block output ports

getDiscreteStateImpl

Discrete state property values

setupImpl

Initialize System object

resetImpl

Reset System object states

releaseImpl

Release resources

loadObjectImpl

Load System object from MAT file

saveObjectImpl

 Save System object in MAT file

infoImpl

Information about System object

getOutputSizeImpl

Sizes of output ports

getOutputDataTypeImpl

Data types of output ports

isOutputComplexImpl

Complexity of output ports

getDiscreteStateSpecificationImpl

Discrete state size, data type, and complexity

getIconImpl

Name to display as block icon

getSampleTime

Query sample time

For more information about these methods, see Customize System Objects for Simulink.

Reference and Extract Entities

  1. When referencing entity attributes or system properties in a discrete-event System object, use these formats:

    Attribute or PropertyFormatAccess

    attribute

    entity.data.attribute_name

    Read/write

    priority property

    entity.sys.priority

    Read/write

    ID property

    entity.sys.id

    Read-only

  2. 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.

See Also

|

Related Topics