SpaDES packageBug reports:
Module repository:
Wiki:
simInit Initialize a new simulation
spades Run a discrete event simulation
experiment Run multiple spades calls
}
scheduleEvent Schedule a simulation event
removeEvent Remove an event from the simulation queue (not yet implemented)
}
simList object are summarized further below.params slot and its elements.Commonly used:
globals List of global simulation parameters.
objs List of objects referenced by the simulation environment.
params Nested list of all simulation parameter.
}
Advanced use:
checkpointFile .checkpoint Name of the checkpoint file. (advanced)
checkpointInterval .checkpoint The simulation checkpoint interval. (advanced)
outputPath NA Global simulation output path. (advanced)
inputPath NA Global simulation input path. (advanced)
modulePath NA Global module path. (advanced)
paths NA Show all paths (input, output, module). (advanced)
progressType .progress Type of graphical progress bar used. (advanced)
progressInterval .progress Interval for the progress bar. (advanced)
}
simtimes slot and its elements.time Current simulation time, in units of longest module.
start Simulation start time, in units of longest module.
end Simulation end time, in units of longest module.
times List of all simulation times (current, start, end), in units of longest module..
}
events and completed slots.
By default, the event lists are shown when the simList object is printed,
thus most users will not require direct use of these methods.events Scheduled simulation events (the event queue). (advanced)
current Currently executing event. (advanced)
completed Completed simulation events. (advanced)
}
depends, modules,
and .loadOrder slots.
These are included for advanced users.depends List of simulation module dependencies. (advanced)
modules List of simulation modules to be loaded. (advanced)
inputs List of loaded objects used in simulation. (advanced)
outputs List of objects to save during simulation. (advanced)
}
simList has a slot with all objects, called ".envir". This is an
environment. In R, environments use pass-by-reference semantics, which means that
copying an simList object using normal R assignment operation, e.g., sim2 <- sim1,
will not copy the objects contained within the .envir slot. The two objects sim1 and
sim2 will shared identical objects within that slot. Sometimes, this not desired, and
a true copy is required.copy Deep copy of a simList. (advanced)
}
SpaDES.
These are generally created and stored locally, or are downloaded from remote repositories,
including our
downloadModule Open all modules nested within a base directory
getModuleVersion Get the latest module version # from module repository
newModule Create new module from template
newModuleDocumentation Create empty documentation for a new module
openModules Open all modules nested within a base directory
moduleMetadata Shows the default values for a module
zipModule Zip a module and its associated files
}
depsEdgeList Build edge list for module dependency graph
depsGraph Build a module dependency graph using igraph
}
simList The 'simList' class
}------------------------------------------------------------------------------------------
.R file.defineModule Define the module metadata
defineParameter Specify a parameter's name, value and set a default
}
SpaDES functions assist
with these:spread Contagious cellular automata
adj An optimized (i.e., faster) version of adjacent
cir Identify pixels in a circle around a SpatialPoints* object
}
crw Simple correlated random walk function
heading Determines the heading between SpatialPoints*
makeLines Makes SpatialLines object for, e.g., drawing arrows
move A meta function that can currently only take "crw"
specificNumPerPatch Initiate a specific number of agents per patch
}
sp, raster, maps, maptools
and many others), we provide the following GIS-related functions:
equalExtent Assess whether a list of extents are all equal
}rasterizeReduced Convert reduced representation to full raster
}Raster* objects:
setColors Set colours for plotting Raster* objects
getColors Get colours in a Raster* objects
}gaussMap Creates a random map using gaussian random fields
randomPolygons Creates a random polygon with specified number of classes
}
SpaDES modules will often require the existence of objects in the simList.
These are helpers for assessing this:checkObject Check for a existence of an object within a simList
checkPath Checks the specified filepath for formatting consistencies
}
agentLocation Agent location
initiateAgents Initiate agents into a SpatialPointsDataFrame
numAgents Number of agents
probInit Probability of intiating an agent or event
transitions Transition probability
}SpaDES context
inRange Test whether a number lies within range [a,b]
layerNames Get layer names for numerous object classes
loadPackages Simple wrapper for loading packages
nlayers Return number of layers
paddedFloatToChar Wrapper for padding (e.g., zeros) floating numbers to character
updateList Update values in a named list
}------------------------------------------------------------------------------------------
Commonly used:
Plot The workhorse plotting function
}
Simulation diagrams:
eventDiagram Gantt chart representing the events in a completed simulation.
moduleDiagram Network diagram of simplified module (object) dependencies.
objectDiagram Sequence diagram of detailed object dependencies.
}
Other useful plotting functions:
clearPlot Helpful for resolving many errors
clickValues Extract values from a raster object at the mouse click location(s)
clickExtent Zoom into a raster or polygon map that was plotted with Plot
clickCoordinates Get the coordinates, in map units, under mouse click
dev Specify which device to plot on, making a non-RStudio one as default
newPlot Open a new default plotting device
rePlot Replots all elements of device for refreshing or moving plot
}
------------------------------------------------------------------------------------------
getFileName Get the name of current file
loadFiles Load simulation objects according to a filelist
rasterToMemory Read a raster from file to RAM
saveFiles Save simulation objects according to outputs and params
}
------------------------------------------------------------------------------------------
SpaDES packagespadesMaps Help showing included maps
}file.path(find.package("SpaDES"), "sampleModules")
randomLandscapes Imports, updates, and plots several raster map layers
caribouMovement A simple agent-based (a.k.a., individual-based) model
fireSpread A simple model of a spatial spread process
}