scheduleEvent

0th

Percentile

Schedule a simulation event

Adds a new event to the simulation's event queue, updating the simulation object.

Usage
scheduleEvent(sim, eventTime, moduleName, eventType, eventPriority)
"scheduleEvent"(sim, eventTime, moduleName, eventType, eventPriority)
"scheduleEvent"(sim, eventTime, moduleName, eventType, eventPriority)
"scheduleEvent"(sim, eventTime, moduleName, eventType, eventPriority)
Arguments
sim
A simList simulation object.
eventTime
A numeric specifying the time of the next event.
moduleName
A character string specifying the module from which to call the event.
eventType
A character string specifying the type of event from within the module.
eventPriority
A numeric specifying the priority of the event. Lower number means higher priority.
Details

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).

Value

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 https://www.nostarch.com/artofr.htm

Aliases
  • scheduleEvent
  • scheduleEvent,simList,NULL,character,character,numeric-method
  • scheduleEvent,simList,numeric,character,character,missing-method
  • scheduleEvent,simList,numeric,character,character,numeric-method
Examples
## Not run: 
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn") # default priority
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn", .normal()) # default priority
# 
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn", .normal()-1) # higher priority
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn", .normal()+1) # lower priority
# 
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn", .highest()) # highest priority
#  scheduleEvent(x, time(sim) + 1.0, "firemodule", "burn", .lowest()) # lowest priority
# ## End(Not run)
Documentation reproduced from package SpaDES, version 1.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.