Learn R Programming

SpaDES (version 1.0.1)

spades: Run a spatial discrete event simulation

Description

Based on code from chapter 7.8.3 of Matloff (2011): "Discrete event simulation". Here, we implement a simulation in a more modular fashion so it's easier to add submodules to the simulation. We use S4 classes and methods, and use `data.table` instead of `data.frame` to implement the event queue (because it is much faster).

Usage

spades(sim, debug)

## S3 method for class 'simList,logical':
spades(sim, debug)

## S3 method for class 'simList,missing':
spades(sim)

Arguments

sim
Character string for the simList simulation object.
debug
Optional logical flag determines whether sim debug info will be printed (default is debug=FALSE).

Value

  • Invisibly returns the modified simList object.

References

Matloff, N. (2011). The Art of R Programming (ch. 7.8.3). San Fransisco, CA: No Starch Press, Inc.. Retrieved from http://www.nostarch.com/artofr.htm

See Also

simInit, SpaDES

Examples

Run this code
mySim <- simInit(
   times=list(start=0.0, end=2.0, timeunit="year"),
   params=list(.globals=list(stackName="landscape", burnStats="nPixelsBurned")),
   modules=list("randomLandscapes", "fireSpread", "caribouMovement"),
   paths=list(modulePath=system.file("sampleModules", package="SpaDES"))
 )
 spades(mySim)

Run the code above in your browser using DataLab