View source: R/trajectory-activities.R
set_capacity | R Documentation |
Activities for dynamically modifying a resource's server capacity or queue
size, by name or a previously selected one. Resources must be defined in the
simulation environment (see add_resource
).
set_capacity(.trj, resource, value, mod = c(NA, "+", "*"), ..., tag)
set_capacity_selected(.trj, value, id = 0, mod = c(NA, "+", "*"), ..., tag)
set_queue_size(.trj, resource, value, mod = c(NA, "+", "*"), ..., tag)
set_queue_size_selected(.trj, value, id = 0, mod = c(NA, "+", "*"), ...,
tag)
.trj |
the trajectory object. |
resource |
the name of the resource. |
value |
numeric value to set, or a callable object (a function) which must return a numeric value. |
mod |
if set, |
... |
unused. |
tag |
activity tag name to perform named rollbacks (see
|
id |
selection identifier for nested usage. |
Returns the trajectory object.
select
, seize
, release
,
seize_selected
, release_selected
,
get_capacity
, get_queue_size
## a resource with a queue size equal to the number of arrivals waiting
traj <- trajectory() %>%
set_queue_size("res", 1, mod="+") %>%
seize("res") %>%
set_queue_size("res", -1, mod="+") %>%
timeout(10) %>%
release("res")
simmer() %>%
add_resource("res", 1, 0) %>%
add_generator("dummy", traj, at(0:2)) %>%
run() %>%
get_mon_resources()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.