postprocessEnvs: postprocessEnvs

View source: R/postprocessEnvs.R

postprocessEnvsR Documentation

postprocessEnvs

Description

Postprocess results from several simmer results. Input: simmer simulation environment. The method get_mon_resources function is used to extract information from the babsim.hospital simulation.

Usage

postprocessEnvs(envs, StartDate = "2020-03-03")

Arguments

envs

simmer simulation environment. Result from babsim.hospital simulation runs, e.g., output from babsimHospital.

StartDate

Date[1:1], format: 'YYYY-MM-DD' First day of the simulation. Default: '2020-03-03'.

Details

get_mon_resources returns state changes in resources:

  • 'resource': resources name

  • 'time': time instant of the event that triggered the state change

  • 'server': server count

  • 'queue': queue count

  • 'capacity': capacity

  • 'queue_size': queue size

  • 'system': system count (server + queue). If no queues are used, system values equal server values.

  • 'system_limit': system limit (capacity + queue_size)

Value

This function returns an env data frame (tibble [nxm, 15] (S3: grouped_df/tbl_df/tbl/data.frame)) with the following entries:

resource (chr)

name of the seized resource: 'bed' 'bed' 'bed' 'bed' ...

time (num)

time step: 3 10 12 13 14 15 15 15 15 16 ...

server (int)

server: 1 2 3 2 3 4 3 4 5 6 ...

limit (num)

limit: Inf Inf Inf Inf Inf ...

replication (int)

replication: 1 1 1 1 1 1 1 1 1 1 ...

upper (int)

upper: 1 2 3 2 3 5 5 5 5 7 ...

lower (int)

lower: 1 2 3 2 3 3 3 3 3 5 ...

med (num)

med: 1 2 3 2 3 4 4 4 4 6 ...

date (POSIXct)

time, format: yyyy-mm-dd hh:mm.ss

rwdate (POSIXct)

format: '2020-03-01' '2020-03-08' '2020-03-15' '2020-03-15' ...

source (chr)

name of the simulation that was used: 'babsim' 'babsim' 'babsim' 'babsim' ...

plotPostprocessedEnvs

NA

Examples

set.seed(123)
# 1. Generate simulation data based on number of infected persons per day:
x <- dataCovidBeds20200624
StartDate <- x$Day[1]
EndDate <- x$Day[length(x$Day)]
arrivalTimes <- getArrivalTimes(x$Infected)
para <- babsimHospitalPara()
conf <- babsimToolsConf()
y <- babsimHospital(
  arrivalTimes = arrivalTimes,
  conf = conf,
  para = para
)

# 2. Postprocess simulation results:
res <- postprocessEnvs(envs = y)
# 3. Plot results
p <- plotPostprocessedEnvs(res)

babsim.hospital documentation built on May 30, 2022, 9:05 a.m.