visit: Visit a Resource

View source: R/visit.R

visitR Documentation

Visit a Resource

Description

These bricks encapsulate a resource visit: seize, spend some time and release.

Usage

visit(.trj, resource, task, amount = 1)

visit_selected(.trj, task, amount = 1, id = 0)

Arguments

.trj

the trajectory object.

resource

the name of the resource.

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

amount

the amount to seize/release, accepts either a numeric or a callable object (a function) which must return a numeric.

id

selection identifier for nested usage.

Value

Returns the following chain of activities: seize > timeout > release (see examples below).

Examples

## These are equivalent:
trajectory() %>%
  visit("res", 5, 1)

trajectory() %>%
  seize("res", 1) %>%
  timeout(5) %>%
  release("res", 1)

## These are equivalent:
trajectory() %>%
  visit_selected(5, 1)

trajectory() %>%
  seize_selected(1) %>%
  timeout(5) %>%
  release_selected(1)


simmer.bricks documentation built on July 26, 2023, 5:41 p.m.