iteration {simecol}R Documentation

Discrete Simulation

Description

Solver function to simulate discrete ecological (or other) dynamic models. It is normally called indirectly from sim.

Usage

  iteration(y, times=FALSE, func=FALSE, parms=FALSE, animate = FALSE, ...)

Arguments

y The simObj object to be iterated.
times Placeholder for compatibility with the odesolve package.
func Placeholder for compatibility with the odesolve package.
parms Placeholder for compatibility with the odesolve package.
animate Animation during the simulation (if available for the specified class.
... Optional arguments passed to the plot function if animate=TRUE.

Details

The solver method iteration is used to simulate discrete event models. It creates a local environment in a way that parameters, inputs and equations are visible within the main function of the simObj.

In contrast to the ODE solvers, the main function of the model must not return the first derivative but instead of this the new state at the specified times explicitly.

The actual value of time is available in the main function as time and the current increment as parms$DELTAT or parms["DELTAT"] depending on the data type of parms.

Normally, this function is run indirectly from sim.

Value

A list of the model outputs (states ...) for each timestep.

See Also

sim, parms, lsoda, rk4, euler.

Examples

    data(conway)
    ## plot after simulation:
    plot(sim(conway), delay=100)

    ## plot during simulation
    sim(conway, animate=TRUE, delay=100)

[Package simecol version 0.4-2 Index]