| renege_in {simmer} | R Documentation |
Activities for setting or unsetting a timer or a signal after which the arrival will abandon.
renege_in(.trj, t, out = NULL, keep_seized = FALSE) renege_if(.trj, signal, out = NULL, keep_seized = FALSE) renege_abort(.trj)
.trj |
the trajectory object. |
t |
timeout to trigger reneging, accepts either a numeric or a callable object (a function) which must return a numeric. |
out |
optional sub-trajectory in case of reneging. |
keep_seized |
whether to keep already seized resources. By default, all resources are released. |
signal |
signal to trigger reneging, accepts either a string or a callable object (a function) which must return a string. |
Note that renege_if works similarly to trap,
but in contrast to that, reneging is triggered even if the arrival is waiting
in a queue or is part of a non-permanent batch.
Returns the trajectory object.
bank <- trajectory() %>%
log_("here I am") %>%
# renege in 5 minutes
renege_in(
5,
out = trajectory() %>%
log_("lost my patience. Reneging...")) %>%
seize("clerk") %>%
# stay if I'm being attended within 5 minutes
renege_abort() %>%
log_("I'm being attended") %>%
timeout(10) %>%
release("clerk") %>%
log_("finished")
simmer() %>%
add_resource("clerk", 1) %>%
add_generator("customer", bank, at(0, 1)) %>%
run() %>% invisible