simmer: Create a Simulator

View source: R/simmer-methods.R

simmerR Documentation

Create a Simulator

Description

This method initialises a simulation environment.

Usage

simmer(name = "anonymous", verbose = FALSE, mon = monitor_mem(),
  log_level = 0)

Arguments

name

the name of the simulator.

verbose

enable showing activity information.

mon

monitor (in memory by default); see monitor for other options.

log_level

debugging level (see log_).

Value

Returns a simulation environment.

See Also

Available methods by category:

  • Simulation control: stepn, run, now, peek, reset

  • Resources: add_resource, get_resources, get_capacity, get_capacity_selected, get_queue_size, get_queue_size_selected, get_server_count, get_server_count_selected, get_queue_count, get_queue_count_selected, get_seized, get_seized_selected, get_activity_time, get_activity_time_selected, get_selected

  • Sources: add_generator, add_dataframe, get_sources, get_n_generated, get_trajectory

  • Arrivals: get_name, get_start_time, get_attribute, get_prioritization, get_batch_size

  • Globals: add_global, get_global

  • Data retrieval: get_mon_arrivals, get_mon_attributes, get_mon_resources

Examples

## a simple trajectory that prints a message
t0 <- trajectory("my trajectory") %>%
  log_("arrival generated")

## create an empty simulation environment
env <- simmer("SuperDuperSim")
env

## add a generator and attach it to the trajectory above
env %>% add_generator("dummy", t0, function() 1)

## run for some time
env %>% run(until=4.5)
env %>% now()           # current simulation time
env %>% peek()          # time for the next event
env %>% stepn()         # execute next event


Bart6114/simmer documentation built on Oct. 2, 2024, 4:52 p.m.