Contains the minimum components of a
Various slot accessor methods (i.e., get and set functions) are provided
(see 'Accessor Methods' below).
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
List of character names specifying which modules to load.
Named list of potentially other lists specifying simulation parameters.
The list of scheduled events (i.e., event queue), as a
data.table. See 'Event Lists' for more information.
The current event, as a
See 'Event Lists' for more information..
The list of completed events, as a
See 'Event Lists' for more information. It is kept
as a list of individual events for speed. The
method converts it to a sorted
.simDeps list of
containing module object dependency information.
List of numerical values describing the simulation start and end times; as well as the current simulation time.
data.table of files and
data.table of files and
Named list of
outputPath paths. Partial matching is performed.
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
objs. See examples.
simList class extends the
.simList superclass by adding
.envir to store the simulation environment containing references
to simulation objects.
simList_ class extends the
.simList superclass, by
adding a slot
.list containing the simulation objects.
simList is identical to
simList_, except that the former
uses an environment for objects and the latter uses a list.
simList_ is only used internally.
Several slot (and sub-slot) accessor methods are provided for use, and categorized into separate help pages:
|Scheduled and completed events.|
|Passing data in to / out of simulations.|
|Modules loaded and used; module dependencies.|
|Accessing objects used in the simulation.|
|Global and module-specific parameters.|
|File paths for modules, inputs, and outputs.|
The main event list is a sorted data.table (keyed) on eventTime, and eventPriority.
The completed event list is an ordered list in the exact order that the events
Each event is represented by a
data.table row consisting of:
|The time the event is to occur.|
|The module from which the event is taken.|
|A character string for the programmer-defined event type.|
|The priority given to the event.|
Matloff, N. (2011). The Art of R Programming (ch. 7.8.3). San Francisco, CA: No Starch Press, Inc.. Retrieved from https://www.nostarch.com/artofr.htm