aivika-0.6: A multi-paradigm simulation library

Stabilityexperimental
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Safe HaskellSafe-Inferred

Simulation.Aivika.Dynamics.EventQueue

Description

Tested with: GHC 7.6.3

The module introduces the event queue. Any event is the Dynamics computation, or, saying differently, a dynamic process that has a single purpose to perform some side effect at the desired time. To pass the message, we actually use a closure.

Synopsis

Documentation

data EventQueue Source

The EventQueue type represents the event queue.

newQueue :: Simulation EventQueueSource

Create a new event queue.

enqueue :: EventQueue -> Double -> Dynamics () -> Dynamics ()Source

Enqueue the event which must be actuated at the specified time.

enqueueWithTimes :: EventQueue -> [Double] -> Dynamics () -> Dynamics ()Source

Actuate the event handler in the specified time points.

enqueueWithIntegTimes :: EventQueue -> Dynamics () -> Dynamics ()Source

Actuate the event handler in the integration time points.

enqueueWithStartTime :: EventQueue -> Dynamics () -> Dynamics ()Source

Actuate the event handler in the start time.

enqueueWithStopTime :: EventQueue -> Dynamics () -> Dynamics ()Source

Actuate the event handler in the stop time.

enqueueWithCurrentTime :: EventQueue -> Dynamics () -> Dynamics ()Source

Actuate the event handler in the current time but through the event queue, which allows continuing the current tasks and then calling the handler after the tasks are finished. The simulation time will be the same.

runQueue :: EventQueue -> Dynamics ()Source

Run the event queue processing its events.

runQueueSync :: EventQueue -> Dynamics ()Source

Run the event queue synchronously, i.e. without past.

queueCount :: EventQueue -> Dynamics IntSource

Return the number of pending events that should be yet actuated.