-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some work on terminology vignette > moved vignette demos to demo/ folder
- Loading branch information
Showing
3 changed files
with
42 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vignette-terminology-example an example to accompany the 'Terminology' vignette |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## ---- create-trajectory | ||
|
||
library(simmer) | ||
|
||
# create a trajectory "my_trajectory" | ||
# this trajectory consists of 3 activities, a seize, timeout and release activity. | ||
t0<- | ||
create_trajectory("my_trajectory") %>% | ||
# seize one unit of the resource called "operator" | ||
seize("operator", 1) %>% | ||
# spend some (stochastic) time holding that resource | ||
timeout(function() rpois(1,50)) %>% | ||
# release the previously seized unit of "operator" | ||
release("operator", 1) | ||
|
||
## ---- setup-simmer | ||
|
||
env<-simmer() %>% | ||
# a resource called "operator"" is created with a capacity of 1 and an infinite queue size | ||
add_resource("operator", 1, Inf) %>% | ||
# this generator will create arrivals at each interval rpois(1,40) during | ||
# the simulation lifetime (while "dist" returns positive time values) | ||
# the arrivals will follow the trajectory specified in t0 | ||
add_generator("my_generator", | ||
trajectory = t0, | ||
dist = function() rpois(1, 40)) %>% | ||
run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters