Main Content

MATLAB Discrete-Event System

MATLAB discrete-event system

  • MATLAB Discrete-Event System block

Libraries:
SimEvents

Description

The MATLAB Discrete-Event System block allows you to create and author custom discrete-event systems. With this block, you can author an event-driven entity-flow system using MATLAB®, and use it in your Simulink® model. For more information about implementing matlab.DiscreteEventSystem class with MATLAB Discrete-Event System block, see Create Custom Blocks Using MATLAB Discrete-Event System Block.

Below, there are six examples to help you learn how to create custom blocks using the MATLAB Discrete-Event System block.

Parameters

expand all

Specify the full name of the user-defined discrete-event System object class without the file extension. This entry is case sensitive. The class name must exist on the MATLAB path.

You can specify a discrete-event System object name in one of these ways:

  • Enter the name in the text box.

  • Click the list arrow attached to the text box. If valid System objects exist in the current folder, the names appear in the list. Select a System object from this list.

  • Browse to a folder that contains a valid discrete-event System object. If the folder is not on your MATLAB path, the software prompts you to add it.

If you need to create a discrete-event System object, you can create one from a template by clicking New.

After you save the SimEvents® System object, the name appears in the System object name text box.

Use the full name of the user-defined discrete-event System object class name. The block does not accept a MATLAB variable that you have assigned to a discrete-event System object class name.

Programmatic Use

Block Parameter: System
Type: character vector
Values: '<Enter System Class Name>' | character vector
Default: '<Enter System Class Name>'

Click this button to create a SimEvents System object from a template.

Select one of these options.

  • Basic

    Starts MATLAB Editor and displays a template for a simple discrete-event System object using the fewest System object methods.

After you save the SimEvents System object, you can enter the name in the System object name text box.

Specify the simulation mode as Code generation or Interpreted execution.

  • Interpreted execution

    This mode simulates the System object based on the interpreted MATLAB language with debuggers enabled.

  • Code generation

    This code generation mode reduces simulation time of SimEvents models. On the first model run, the MATLAB Discrete-Event System block simulates and generates code using only MATLAB functions supported for code generation. If the System object code and the block parameters do not change, subsequent model runs do not regenerate the code. MATLAB Discrete-Event System blocks also support code reuse for models that have multiple MATLAB Discrete-Event System blocks using the same System object source file. For more information, see Generate Code for MATLAB Discrete-Event System Blocks.

Programmatic Use

Block Parameter: SimulateUsing
Type: character vector
Values: 'Code generation' | Interpreted execution
Default: 'Code generation'

Version History

Introduced in R2016a