Learn R Programming

simecol (version 0.3-11)

odeModel: The `generating-functions' (constructors) to create objects of classes odeModel, rwalkModel and gridModel.

Description

This function can be used to create simObj instances from scratch or from already existing objects of the same type.

Usage

odeModel(obj = NULL, main = NULL,
        equations = NULL, times = c(from = 0, to = 10, by = 1),
        init = numeric(0), parms = numeric(0),
        inputs = NULL, solver = "rk4", initialize = NULL)

gridModel(obj=NULL, main=NULL,
        equations=NULL, times=c(from=0, to=10, by=1),
        init=matrix(0), parms=list(),
        inputs=NULL, solver="iteration", initialize=NULL)

rwalkModel(obj=NULL, main=NULL, 
        equations=NULL, times=c(from=0, to=10, by=1),
        init=NULL, parms=list(),
        inputs=NULL, solver="iteration", initialize=NULL)

Arguments

obj
an already existing object of the respective class from which a modified version is to be created. If obj is omitted, the new object is created from scratch.
main
the main equations of the model.
equations
the sub-models (sub-equations and utility functions of the model).
times
a vector of time steps or a vector with three named values from, to, by specifying the simulation time steps. The from-to-by form can be edited with fixParms.
init
initial values (start values) of the state variable given as named vector.
parms
a vector or list (depending on the respective class) of constant parameters.
inputs
optional time-dependend input variables (matrix od data frame).
solver
the solver used to integrate the model.
initialize
the initialize function is called at creation time and allows direct access and manipulation of all slots of the object in creation

Value

  • The function returns an S4 object of type odeModel, rwalkModel, gridModel

Details

This function provides an alternative way to create simObj instances in addition to the standard S4 new mechanism. One of its advantages is the possibility to use a dedicated initialize function that allows computations using internal functions of the equations slot at creation time. See simecol-package and the examples for details about the slots.

See Also

simecol-package