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

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

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

every

repeat with this time cycle.

Value

Returns a generator function.

See also

add_generator.

Examples

t0 <- trajectory() %>% timeout(0) # from 8 to 16 h every 24 h: simmer() %>% add_generator("dummy", t0, from_to(8, 16, function() runif(1, 1, 2), every=24)) %>% run(48) %>% get_mon_arrivals()
#> name start_time end_time activity_time finished replication #> 1 dummy0 8.00000 8.00000 0 TRUE 1 #> 2 dummy1 9.08075 9.08075 0 TRUE 1 #> 3 dummy2 10.91508 10.91508 0 TRUE 1 #> 4 dummy3 12.51584 12.51584 0 TRUE 1 #> 5 dummy4 13.67305 13.67305 0 TRUE 1 #> 6 dummy5 14.68045 14.68045 0 TRUE 1 #> 7 dummy6 32.00000 32.00000 0 TRUE 1 #> 8 dummy7 33.49778 33.49778 0 TRUE 1 #> 9 dummy8 34.78754 34.78754 0 TRUE 1 #> 10 dummy9 36.52043 36.52043 0 TRUE 1 #> 11 dummy10 38.29295 38.29295 0 TRUE 1