.simList-class

0th

Percentile

The simList class

Contains the minimum components of a SpaDES simulation. Various slot accessor methods (i.e., get and set functions) are provided (see 'Accessor Methods' below).

Details

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

Note

The simList class extends the .simList superclass by adding a slot .envir to store the simulation environment containing references to simulation objects. The simList_ class extends the .simList superclass, by adding a slot .list containing the simulation objects. Thus, simList is identical to simList_, except that the former uses an environment for objects and the latter uses a list. The class simList_ is only used internally.

Slots

modules
List of character names specifying which modules to load.
params
Named list of potentially other lists specifying simulation parameters.
events
The list of scheduled events (i.e., event queue), as a data.table. See 'Event Lists' for more information.
current
The current event, as a data.table. See 'Event Lists' for more information..
completed
The list of completed events, as a data.table. See 'Event Lists' for more information.
depends
A .simDeps list of .moduleDeps objects containing module object dependency information.
simtimes
List of numerical values describing the simulation start and end times; as well as the current simulation time.
inputs
A list of length 2, containing: 1) a data.frame or data.table of files and metadata, and 2) a list of optional arguments to pass to an import function.
outputs
A list of length 2 containing: 1) a data.frame or data.table of files and metadata, and 2) a list of optional arguments to pass to an export function.
paths
Named list of modulePath, inputPath, and outputPath paths. Partial matching is performed.
.envir
Environment referencing the objects used in the simulation. Several "shortcuts" to accessing objects referenced by this environment are provided, and can be used on the simList object directly instead of specifying the .envir slot: $, [[, ls, ls.str, objs. See examples.

Accessor Methods

Several slot (and sub-slot) accessor methods are provided for use, and categorized into separate help pages:

simList-accessors-envir
Simulation enviroment.
simList-accessors-events
Scheduled and completed events.
simList-accessors-inout
Passing data in to / out of simulations.
simList-accessors-modules
Modules loaded and used; module dependencies.
simList-accessors-objects
Accessing objects used in the simulation.
simList-accessors-params
Global and module-specific parameters.
simList-accessors-paths
File paths for modules, inputs, and outputs.
simList-accessors-times
Simulation times.

Event Lists

Event lists are sorted (keyed) first by time, second by priority. Each event is represented by a data.table row consisting of:

eventTime
The time the event is to occur.
moduleName
The module from which the event is taken.
eventType
A character string for the programmer-defined event type.
eventPriority
The priority given to the event.

References

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

Aliases
  • .simList
  • .simList-class
  • simList
  • simList-class
Documentation reproduced from package SpaDES, version 1.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.