eventForward

Class: matlab.DiscreteEventSystem
Package: matlab

Create entity forward event

Syntax

event=eventForward(locationType,locationIndex,delay)

Description

event=eventForward(locationType,locationIndex,delay) creates an event to forward an entity from the current location to a new location. You can then schedule this event by returning it as the output argument when implementing an event action method, such as entry.

Input Arguments

expand all

Type of the new location. Specify 'storage' if the new location is a storage element of the discrete-event system. Specify 'output' if you want the entity to exit from an output port of the discrete-event system.

Index of the new location. If location type is 'storage', it indicates the index of a storage element. If location type is 'output', it indicates the index of an output port.

Time delay between current simulation time and the time the entity will be forwarded.

Output Arguments

expand all

Event that forwards the entity in current event action context to a new location.

Examples

expand all

Define an event that forwards the current entity to storage.

function [entity,events] = entry(obj,storage,entity,src)  
      
    % Define an event that forwards the current entity to storage
    % element 2. Event shall be scheduled to execute 0.8 second later.
    event1 = obj.eventForward('storage', 2, 0.8);
 
    % Define an event that forwards the current entity to output port 1.
    % Event shall be scheduled to execute at current simulation clock time. 
    event2 = obj.eventForward('output', 1, 0);

    % Define events as event1 and event2
    events = [event1, event2];
end

Introduced in R2016a