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, "+", "*"))

set_capacity_selected(.trj, value, id = 0, mod = c(NA, "+", "*"))

set_queue_size(.trj, resource, value, mod = c(NA, "+", "*"))

set_queue_size_selected(.trj, value, id = 0, mod = c(NA, "+", "*"))

Arguments

.trj

the trajectory object.

resource

the name of the resource.

value

new value to set.

mod

if set, values modify the attributes rather than substituting them.

id

selection identifier for nested usage.

Value

Returns the trajectory object.

See also

Examples

## 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()
#> resource time server queue capacity queue_size system limit replication #> 1 res 0 0 0 1 1 0 2 1 #> 2 res 0 1 0 1 1 1 2 1 #> 3 res 0 1 0 1 0 1 1 1 #> 4 res 1 1 0 1 1 1 2 1 #> 5 res 1 1 1 1 1 2 2 1 #> 6 res 2 1 1 1 2 2 3 1 #> 7 res 2 1 2 1 2 3 3 1 #> 8 res 10 1 1 1 2 2 3 1 #> 9 res 10 1 1 1 1 2 2 1 #> 10 res 20 1 0 1 1 1 2 1 #> 11 res 20 1 0 1 0 1 1 1 #> 12 res 30 0 0 1 0 0 1 1