Description Usage Arguments Value Examples
Merge a named list of sdScenarioClass
objects in to a unique
coupled scenario object with all the variables named with the prefix
'ModelId.' followed by the original variable name. The 'ModelId' is the name
of each element in the scenarios
list and must be the same name of the
component ID that will use it.
Use the arguments to define the coupled scenario simulation time sequence
(the arguments from
, to
and by
must be present to define
the time sequence) and the integrator method to be used in the simulations
(or the default 'lsoda' will be used).
1 2 3 4 5 | sdBuildCoupledScenario(coupledScenarioId = NULL, scenarios = NULL,
from = NULL, to = NULL, by = NULL, method = c("lsoda", "lsode",
"lsodes", "lsodar", "vode", "daspk", "euler", "rk4", "ode23", "ode45",
"radau", "bdf", "bdf_d", "adams", "impAdams", "impAdams_d"),
timeSeriesDirectory = "", varNames = FALSE)
|
coupledScenarioId |
A string with the coupled scenario ID. If missing a default timestamp ID will be created. |
scenarios |
A named list of not empty When passing a scenario in a EXCEL file it should follow the default format
described in the |
from |
The starting value of the time sequence. Numeric of length 1. |
to |
The end (maximal) value of the time sequence. Numeric of length 1. |
by |
number: increment of the time sequence. |
method |
The integrator to be used in the simulation, a string ("lsoda", "lsode", "lsodes","lsodar","vode", "daspk", "euler", "rk4", "ode23", "ode45", "radau", "bdf", "bdf_d", "adams", "impAdams" or "impAdams_d"). Default value is "lsoda". When running with support to events the given method must
be one of the following routines, which have root-finding capability:
See the |
timeSeriesDirectory |
The directory where time series inputs are stored (when passing the time series inputs via external text files). |
varNames |
logical: if |
Either the coupled scenario object with all variables named with
the prefix 'ModelId.' followed by the original variable name or, if
varNames
is TRUE
, a list with two
elements - the coupledScenario
containing the built coupled
scenario object and the varNames
containing a list of all the
scenarios
variables names.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ## Let's build a coupled scenario for the Lotka-Volterra example model
# presented in the help('sdCoupledModel')
# create the Prey model variables and scenario
stPrey <- list(P = 1)
parsPrey <- list(rG = 1.0,
K = 10)
inpPrey <- list(IngestC = 0)
preyScen <- sdScenario(scenarioId = "preyScen",
state = stPrey,
parameter = parsPrey,
input = inpPrey)
# create the Consumer model variables and scenario
stConsumer <- list(C = 2)
parsConsumer <- list(rI = 0.2,
rM = 0.2 ,
AE = 0.5)
inpConsumer <- list(P = 0)
consumerScen <- sdScenario(scenarioId = "consumerScen",
state = stConsumer,
parameter = parsConsumer,
input = inpConsumer)
## Create the coupled scenario and print it
coupledLvScen <- sdBuildCoupledScenario(
coupledScenarioId = "LVcoupled",
scenarios = c(Prey = preyScen,
Consumer = consumerScen),
method = "lsoda",
from = 0,
to = 200,
by = 1)
print(coupledLvScen)
## this scenario can be used to simulate the coupled Lotka-Volterra Model
# in a different environment by setting different values for the variables
# and passing it via the argument 'scenario' to the sdSimulate function
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.