sim: Simulation of 'simObj' model objects

Description Usage Arguments Details Value Methods Examples

Description

This function provides the core functionality of the ‘simecol’ package. Several methods depending on the class of the model are available.

Usage

1
2
  sim(obj, initialize=TRUE, ...)
  # sim(obj, animation=FALSE, delay=0, ...)

Arguments

obj

an object of class simObj or one of its subclasses.

initialize

re-initialize the object if the object contains a user-defined initializing function (initfunc). Setting initialize to FALSE can be useful to avoid time-consuming computations during initialization or to reproduce simulations of models which assign random values during the initialization process.

animation

logical value to switch animation on (for classes gridModel and rwalkModel.

delay

delay (in ms and in addition to the time needed for the simulation) between consecutive images (for gridModels) or xy-plots (for rwalkModels).

...

optional parameters passed to the solver function (e.g. hmax for lsoda).

Details

sim re-initializes the model object (if initialize==TRUE and calls the appropriate solver, specified in the solver-slot. Objects of class rwalkModel and indbasedModel are simulated by the default simObj method. If you derive own sublasses from simObj it may be neccessary to write an appropriate sim method and/or solver function.

Value

The function returns the complete simObj instance with the simulation results in the out slot.

Methods

obj = "simObj"

simulates the respective model object with optional animation.

obj = "odeModel"

simulates the respective model object.

obj = "indbasedModel"

simulates the respective model object with optional animation.

obj = "gridModel"

simulates the respective model object with optional animation.

Examples

1
2
3
4
5
6
7
data(lv)
plot(sim(lv))

lv2 <- lv
parms(lv2)["k1"] <- 0.5
lv2 <- sim(lv2)
plot(out(lv2))

Example output

Loading required package: deSolve

simecol documentation built on May 9, 2018, 1:05 a.m.