eventTimer

Class: matlab.DiscreteEventSystem
Package: matlab

Create entity timer event

Syntax

event=eventTimer(tag,delay)

Description

event=eventTimer(tag,delay) creates an event to delay an entity for a period of time. You can then schedule the timer by returning it as the output argument when implementing an event action method, such as entry.

Input Arguments

expand all

Custom tag of this entity timer event.

Time delay between current simulation time and the time that this timer event will be executed.

Output Arguments

expand all

Event that delays the entity in current event action context for a period of time.

Examples

expand all

Define a timer event.

function [entity,event] = entry(obj,storage,entity,src)        
    % Define a timer event
    % - The event is regarding the entity in current event action context
    % - The event has a custom tag 'timeout'
    % - The event will be executed 3.0 seconds later
    event = obj.eventTimer('timeout', 3.0);     
end

Introduced in R2016a