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.

You can optionally inherit a subset of methods from the matlab.system.mixin package by inheriting matlab.System.mixin.Propagates, matlab.System.mixin.CustomIcon, or matlab.System.mixin.SampleTime classes. This diagram shows the relationships between the classes in the creation of a discrete-event System object.


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.


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

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

Inherited Methods from matlab.system.mixin Package

You can inherit other methods that require the inheritance of additional classes from the matlab.system.mixin package. For example, to specify a discrete state by using getDiscreteStateSpecificationImpl, inherit the matlab.system.mixin.Propagates class. For an example of inheriting this class, see Selection Server - Select Specific Entities from Server.

Inherited Methods from matlab.System.mixin.Propagates Class

To use the methods inherited from matlab.System.mixin.Propagates class, you must subclass from this class in addition to the matlab.DiscreteEventSystem base class. Type the following syntax as the first line of your class definition file, where ObjectName is the name of your object.

classdef ObjectName < matlab.DiscreteEventSystem & matlab.system.mixin.Propagates

This list contains the methods inherited from matlab.system.mixin.Propagates class.


Sizes of output ports


Data types of output ports


Complexity of output ports


Discrete state size, data type, and complexity

Inherited Methods from matlab.System.mixin.CustomIcon Class

To inherit methods from the matlab.System.mixin.CustomIcon class, type the following syntax as the first line of your class definition file.

classdef ObjectName < matlab.DiscreteEventSystem & matlab.system.mixin.CustomIcon


Name to display as block icon

Inherited Methods from matlab.System.mixin.SampleTime Class

To inherit methods from the matlab.System.mixin.SampleTime class, type the following syntax as the first line of your class definition file.

classdef ObjectName < matlab.DiscreteEventSystem & matlab.system.mixin.SampleTime


Query sample time

Reference and Extract Entities

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

    Attribute or PropertyFormatAccess



    priority property



    ID property


  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