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

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

t0 <- trajectory() %>% timeout(0) env <- simmer(verbose=TRUE) %>% add_generator("dummy", t0, from_to(5, 10, function() runif(1, 1, 2))) %>% run(100)
#> 0 | generator: dummy | new: dummy0 | 5 #> 5 | generator: dummy | new: dummy1 | 6.08075 #> 5 | arrival: dummy0 | activity: Timeout | 0 #> 6.08075 | generator: dummy | new: dummy2 | 7.91508 #> 6.08075 | arrival: dummy1 | activity: Timeout | 0 #> 7.91508 | generator: dummy | new: dummy3 | 9.51584 #> 7.91508 | arrival: dummy2 | activity: Timeout | 0 #> 9.51584 | arrival: dummy3 | activity: Timeout | 0