Skip to content
Discussion options

You must be logged in to vote

If you are using the env in a trajectory, it is a good practice to define it in the first place to avoid referencing a non-existing object, or worse, a previous simulation (see this section of the vignettes). For example:

library(simmer)
set.seed(100)

env <- simmer()

patient <- trajectory() %>%
  seize("room", 1) %>% 
  branch( function() {get_attribute(env, "nurse_lgl")}, continue = c(TRUE),
          trajectory() %>% 
            seize("nurse", 1) %>%
            timeout_from_attribute("nursee") %>%
            release("nurse", 1) 
  ) %>%
  seize("doctor", 1) %>%
  timeout_from_attribute("doctor") %>%
  release("doctor", 1) %>%
  release("room", 1)

n <- 5 # number of patients
df <- d…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Enchufa2
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Enchufa2
Comment options

@Arash-72
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants