View source: R/simmer-methods.R
| simmer | R Documentation |
This method initialises a simulation environment.
simmer(name = "anonymous", verbose = FALSE, mon = monitor_mem(),
log_level = 0)
name |
the name of the simulator. |
verbose |
enable showing activity information. |
mon |
monitor (in memory by default); see |
log_level |
debugging level (see |
Returns a simulation environment.
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
## 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.