entry

Class: matlab.DiscreteEventSystem
Package: matlab

Event action when entity enters storage element

Syntax

[entity,events]=entry(obj,storage,entity,source)
[entity,events,out1,...]=entry(obj,storage,entity,source,in1,...)

Description

[entity,events]=entry(obj,storage,entity,source) specifies event actions of the object when an entity enters storage.

[entity,events,out1,...]=entry(obj,storage,entity,source,in1,...) such event actions of the object when the block has one or more input signal ports and/or signal output ports.

Input Arguments

expand all

Discrete-event System object.

Index of the storage element.

Entity entering storage component. Entity has these fields:

  • sys (MATLAB structure) — It has these fields:

    • id (double) — Entity ID

    • priority (double) — Entity priority

  • data — Entity data

Source location of entity, such as an input port or a storage element. It has these fields:

  • type (character vector) — Specify input or storage

  • index (double) — Input or storage index

Any data inputs of the object. These input arguments exist only when the object has data inputs.

Output Arguments

expand all

Entity entering storage, possibly with changed data. See entity.

Events to be scheduled. Use matlab.DiscreteEventSystem class methods to create events. Each event has these fields:

  • type (character vector) — Type of the event

  • delay (double) — Delay before the event

  • priority (double) — Priority of the event

  • Storage (double) — Index of the storage element

  • tag (character vector) — Event tag

  • location (MATLAB structure) — Source or destination location of entity, see source

Data outputs of the object. You must specify these output arguments when the object has data outputs.

Examples

expand all

Event action for entity entry to storage.

function [entity,events] = entry(obj,storage,entity,src)
    % Specify event actions when entity entered storage.
    disp(['Entity of ID ' num2str(entity.sys.id) ...
          ' has entered storage element ' num2str(storage)]);
    switch src.type
        case 'input'
            disp(['Entity came from input port ' num2str(src.index)]);
        case 'storage'
            disp(['Entity came from storage element ' num2str(src.index)]);
    end
    events = [ ...
        obj.eventDestroy(), ...    % Destroy the newly entered entity
        obj.eventIterate(2, '')];  % Iterate entities in storage element 2
end

Introduced in R2016a