set_capacity: Set Resource Parameters

View source: R/trajectory-activities.R

set_capacityR Documentation

Set Resource Parameters

Description

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).

Usage

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)

Arguments

.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, values modify the attributes rather than substituting them.

...

unused.

tag

activity tag name to perform named rollbacks (see rollback) or just to better identify your activities.

id

selection identifier for nested usage.

Value

Returns the trajectory object.

See Also

select, seize, release, seize_selected, release_selected, get_capacity, get_queue_size

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()


simmer documentation built on Sept. 28, 2024, 1:07 a.m.