You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/model/patients.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -250,7 +250,7 @@ There are two arguments required by the initialiser: `param` and `run_number`.
250
250
251
251
The `param` argument accepts an instance of the `Parameters` object, which groups all necessary simulation values in one place. This minimises the number of arguments required by `Model`, as it only needs one input for parameters.
252
252
253
-
The `run_number` will be used when generating the random seeds. This is important when performing multiple replications, as it ensures each run gets a unique seed (see the [Replications](../output_analysis/n_reps.qmd) page for more details).
253
+
The `run_number` will be used when generating the random seeds. This is important when performing multiple replications, as it ensures each run gets a unique seed (see the [Replications](../output_analysis/replications.qmd) page for more details).
254
254
255
255
<br>
256
256
@@ -455,7 +455,7 @@ There are two arguments required by the function: `param` and `run_number`.
455
455
456
456
The `param` argument requires the named list of parameters from the `create_params()` function, which groups all necessary simulation values in one list. This minimise the number of arguments required by `model()`, as it only needs one input for parameters.
457
457
458
-
The `run_number` will be used when generating the random seeds. This is important when performing multiple replications, as it ensures each run gets a unique seed (see the [Replications](../output_analysis/n_reps.qmd) page for more details).
458
+
The `run_number` will be used when generating the random seeds. This is important when performing multiple replications, as it ensures each run gets a unique seed (see the [Replications](../output_analysis/replications.qmd) page for more details).
@@ -45,6 +45,7 @@ from sim_tools.distributions import Exponential
45
45
```{r}
46
46
#| output: false
47
47
library(dplyr)
48
+
library(knitr)
48
49
library(simmer)
49
50
library(tidyr)
50
51
```
@@ -147,7 +148,7 @@ We need to update the `Model` class so its `run` method returns a list of patien
147
148
148
149
### Runner class
149
150
150
-
We're also introducing a new `Runner` class, responsible for running simulations and performing results calculations. This keeps calculation logic separate from the core modelling code. Also, this class will be modified to perform multiple model runs on the [Replications](n_reps.qmd) page.
151
+
We're also introducing a new `Runner` class, responsible for running simulations and performing results calculations. This keeps calculation logic separate from the core modelling code. Also, this class will be modified to perform multiple model runs on the [Replications](replications.qmd) page.
151
152
152
153
The basic structure of `Runner` is as follows. It initialises with simulation parameters, runs the model for a single replication, and organises results into separate patient-level and run-level outputs.
153
154
@@ -175,7 +176,36 @@ No changes required.
175
176
176
177
```{r}
177
178
#| echo: false
178
-
{{< include outputs_resources/create_params.R >}}
179
+
#' Generate parameter list.
180
+
#'
181
+
#' @param interarrival_time Numeric. Time between arrivals (minutes).
182
+
#' @param consultation_time Numeric. Mean length of doctor's
183
+
#' consultation (minutes).
184
+
#' @param number_of_doctors Numeric. Number of doctors.
185
+
#' @param warm_up_period Numeric. Duration of the warm-up period (minutes).
186
+
#' @param data_collection_period Numeric. Duration of the data collection
187
+
#' period (minutes).
188
+
#' @param verbose Boolean. Whether to print messages as simulation runs.
189
+
#'
190
+
#' @return A named list of parameters.
191
+
192
+
create_params <- function(
193
+
interarrival_time = 5L,
194
+
consultation_time = 10L,
195
+
number_of_doctors = 3L,
196
+
warm_up_period = 30L,
197
+
data_collection_period = 40L,
198
+
verbose = FALSE
199
+
) {
200
+
list(
201
+
interarrival_time = interarrival_time,
202
+
consultation_time = consultation_time,
203
+
number_of_doctors = number_of_doctors,
204
+
warm_up_period = warm_up_period,
205
+
data_collection_period = data_collection_period,
206
+
verbose = verbose
207
+
)
208
+
}
179
209
```
180
210
181
211
### Warm-up function
@@ -184,7 +214,55 @@ No changes required.
184
214
185
215
```{r}
186
216
#| echo: false
187
-
{{< include outputs_resources/filter_warmup.R >}}
217
+
#' Filters arrivals and resources to remove warm-up results.
218
+
#'
219
+
#' @param result Named list with two tables: monitored arrivals & resources.
220
+
#' @param warm_up_period Length of warm-up period.
221
+
#'
222
+
#' @importFrom dplyr ungroup arrange slice n filter
223
+
#'
224
+
#' @return The name list `result`, but with the tables (`arrivals` and
225
+
#' `resources`) filtered to remove warm-up results.
0 commit comments