triage <- trajectory("Patient's path") %>%
log_("arrive at queue") %>%
batch(10000, timeout=(function() rgamma(1, shape = 2, rate = 0.1))) %>%
log_("triage") %>%
seize("triage_doctor", 1) %>%
timeout(function() rgamma(1, shape = 2, rate = 0.8)) %>%
release("triage_doctor", 1) %>%
separate() %>%
seize("administrative_empl",1) %>%
log_("patient is being called") %>%
timeout(0.1) %>%
log_("Appointment is made") %>%
release("administrative_empl", 1)
env <- simmer() %>%
add_resource("triage_doctor", capacity = 1) %>%
add_resource("administrative_empl", capacity = 1) %>%
add_generator("person", triage, function() rpois(1, 2)) %>%
run(800)
Hi Dominique,
You have a couple of options. Both of them involve the definition of a secondary trajectory for managing the mailbox. Given your description, and assuming that, whenever it is checked, the mailbox is emptied completely, I would use trap-wait-send as follows:
triage <- trajectory("Patient's path") %>%
log_("arrive at queue"
) %>%
trap("check mailbox") %>%
wait() %>%
log_("triage")
# etc.
mailbox <- trajectory() %>%
timeout(function() rgamma(1, shape = 2, rate = 0.1)) %>%
send("check mailbox") %>%
rollback(2, Inf)
env <- simmer() %>%
add_resource("triage_doctor", capacity = 1) %>%
add_resource("administrative_empl", capacity = 1) %>%
add_generator("person", triage, function() rpois(1, 2)) %>%
add_generator("mailbox", mailbox, at(0)) %>%
run(800)
If at some point you need a finer-grained control of the number of letters read at a time, then I would define a new resource for the mailbox with capacity=0
. Then, the trap-wait would be replaced by a seize-set_capacity(0) of that resource, and the send activity, by a set_capacity(n), where n is the required number of letters.
Regards,
Iñaki
--
You received this message because you are subscribed to the Google Groups "simmer-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel+unsubscribe@googlegroups.com.
To post to this group, send email to simmer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/dc9f7114-432e-4e6d-bcab-f0adf1f7c5ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
To post to this group, send email to simmer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/dc9f7114-432e-4e6d-bcab-f0adf1f7c5ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BTW, I’ve implemented this enhancement. Therefore, with the next release, you’ll be able to do this:
triage <- trajectory("Patient's path") %>%
log_("arrive at queue"
) %>%
batch(Inf, timeout=function() rgamma(1, shape = 2, rate = 0.1)) %>%
separate() %>%
log_("triage")
# etc.
env <- simmer() %>%
add_generator("person", triage, function() rpois(1, 2)) %>%
run(25)
Regards,
Iñaki
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel+unsubscribe@googlegroups.com.
To post to this group, send email to simmer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/a0e53e0f-57bd-4a0e-a124-536d6b94f2a5%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/a0e53e0f-57bd-4a0e-a124-536d6b94f2a5%40googlegroups.com.