Learn R Programming

simmer (version 3.5.1)

from_to: Generate arrivals starting and stopping at specified times

Description

Generator convenience function to generate inter-arrivals with specified start and stop times.

Usage

from_to(start_time, stop_time, dist, arrive = TRUE)

Arguments

start_time
the time at which to launch the initial arrival.
stop_time
the time at which to stop the generator.
dist
a function modelling the interarrival times.
arrive
if set to TRUE (default) the first arrival will be generated at start_time and will follow dist from then on. If set to FALSE, will initiate dist at start_time (and the first arrival will most likely start at a time later than start_time).

Value

Returns a generator function.

See Also

add_generator.

Examples

Run this code
t0 <- create_trajectory() %>% timeout(0)
env <- simmer(verbose=TRUE) %>%
  add_generator("dummy", t0, from_to(5, 10, function() runif(1, 1, 2))) %>%
  run(100)

Run the code above in your browser using DataLab