Main Content

getEntityStorageImpl

Class: matlab.DiscreteEventSystem
Namespace: matlab

Define entity storage elements of discrete-event system

Syntax

[storageSpecs,I,O]=getEntityStorageImpl(obj)

Description

[storageSpecs,I,O]=getEntityStorageImpl(obj) defines entity storage elements of a discrete-event system.

Input Arguments

expand all

Discrete-event System object.

Output Arguments

expand all

Entity storage specifications of a discrete-event system, specified as a vector of MATLAB structures with its length indicating number of entity storage elements of the discrete-event system. The Nth element of the vector defines an entity storage element with index N. Use utility methods such as queueFIFO to create such definition as a MATLAB structure.

Define connections between input ports and entity storage elements as a cell array. The length of the cell array must match the number of input ports of this discrete-event system. The Nth element of the cell array defines the connection between the Nth input port and any entity storage element. If the input port is an entity port, a valid entity storage index must be specified. If the input port is a signal port, the element takes a value of zero.

You can connect multiple entity input ports to a common storage element.

Define connections between output ports and entity storage elements as a cell array. The length of the cell array must match the number of output ports of this discrete-event system. The Mth element of the cell array defines the connections between the Mth output port and any entity storage elements. If the output port is an entity port, specify one of these:

  • A scalar indicating a single connection from a storage element to the output port.

  • A vector indicating multiple connections from multiple storage elements to the output port.

If the output port is a signal port, the element takes a value of zero.

You can connect multiple entity output ports to a common storage element.

Examples

expand all

Specify entity storage elements and connections between entity input ports and storage elements for the discrete-event system object.

function [storageSpecs, I] = getEntityStorageImpl(obj)
    % Specify entity storage elements and connections between
    % entity input ports and storage elements.
    %
    % The implementation specifies two storage elements for the
    % discrete-event system:
    % 1. A priority queue
    %   - Stores entities of type 'student'
    %   - Has maximal capacity of 25
    %   - Sort entities by an attribute named 'age', in ascending
    %     direction
    % 2. A FIFO queue
    %   - Stores entities of type 'student'
    %   - Has maximal capacity of 10
    %   - Sort entities in a First-In-First-Out order
    %
    % The implementation also specifies that the entity input port
    % of the discrete-event system is connected to the 2nd storage
    % element.            
    %
    % Other methods of the discrete-event system must have defined:
    % - An entity type named 'student' (by method 'getEntityTypesImpl')
    % - An entity input port (by method 'getEntityPortsImpl')
    % 
    storageSpecs = [...
        obj.queuePriority('student', 25, 'age', 'ascending'), ...
        obj.queueFIFO('student', 10)];
    I = 2;
end        

Version History

Introduced in R2016a