Learn R Programming

cvasi (version 1.4.0)

sequence: Sequence of scenarios

Description

A sequence of scenarios is treated as a single scenario and each scenario is simulated one after the other. If scenario n in a sequence was simulated, scenario n+1 will start off in the model state where n has ended. Scenario sequences can be used to e.g. implement changes in model parameters over time.

Usage

sequence(seq, breaks = NULL)

Value

an S4 object of type ScenarioSequence

Arguments

seq

list of scenario objects

breaks

optional vector of numerics, scenarios' output times will be modified so that one scenario ends at the break and the next one begins

Details

Requirements

All scenarios in a sequence must fulfill the following requirements:

  • All scenarios must have identical state variables

  • The output times of all scenarios must represent a continuous time series without gaps or overlaps

Using the breaks parameter, the function can split up the scenarios' output times at the given break points. The break points must be within the interval defined by the superset of all output times in the sequence.

Limitations

Only simulation of sequences are supported, at the moment. Effects and effect profiles (EPx values) cannot be derived, yet.

Examples

Run this code
# Create a scenario with background mortality only
scen1 <- minnow_it %>%
  set_noexposure() %>%
  set_times(0:10)
# Modify a scenario parameter, e.g. set background mortality to zero
scen2 <- scen1 %>% set_param(c(hb=0))

# Create a sequence of scenarios, scenario #1 will be simulated for the
# time period [0, 4], and #2 for [4, 10]
sq <- sequence(list(scen1, scen2), breaks=c(4))

# Simulate the sequence: the mortality stops after t=4.0, due to scenario #2
# being simulated after t=4.0, which disabled the background mortality
simulate(sq)

Run the code above in your browser using DataLab