Activity for inserting delays and execute user-defined tasks.

timeout(.trj, task)

timeout_from_attribute(.trj, key)

timeout_from_global(.trj, key)

Arguments

.trj

the trajectory object.

task

the timeout duration supplied by either passing a numeric or a callable object (a function) which must return a numeric (negative values are automatically coerced to positive).

key

the attribute name, or a callable object (a function) which must return the attribute name.

Value

Returns the trajectory object.

See also

Examples

env <- simmer() traj <- trajectory() %>% # static delay timeout(3) %>% # dynamic, exponential delay timeout(function() rexp(1, 10)) %>% # dependent on an attribute set_attribute("delay", 2) %>% set_global("other", function() rexp(1, 2)) %>% timeout_from_attribute("delay") %>% timeout_from_global("other") env %>% add_generator("dummy", traj, at(0)) %>% run() %>% get_mon_arrivals()
#> name start_time end_time activity_time finished replication #> 1 dummy0 0 7.215232 7.215232 TRUE 1