aivika-1.2: A multi-paradigm simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <>
MaintainerDavid Sorokin <>
Safe HaskellSafe-Inferred



Tested with: GHC 7.6.3

This module defines the types and functions for working with the events that can represent something that arrive from outside the model, or represent other things which computation is delayed and hence is not synchronized.

Therefore, the additional information is provided about the time and delay of arrival.



data Arrival a Source

It defines when an event has arrived, usually generated by some random stream.

Such events should arrive one by one without time lag in the following sense that the model should start awaiting the next event exactly in that time when the previous event has arrived.

Another use case is a situation when the actual event is not synchronized with the Event computation, being synchronized with the event queue, nevertheless. Then the arrival is used for providing the additional information about the time at which the event had been actually arrived.




arrivalValue :: a

the data we received with the event

arrivalTime :: Double

the simulation time at which the event has arrived

arrivalDelay :: Double

the delay time which has passed from the time of arriving the previous event


Eq a => Eq (Arrival a) 
Ord a => Ord (Arrival a) 
Show a => Show (Arrival a) 

data ArrivalTimer Source

Accumulates the statistics about that how long the arrived events are processed.

newArrivalTimer :: Simulation ArrivalTimer Source

Create a new timer that measures how long the arrived events are processed.

arrivalTimerProcessor :: ArrivalTimer -> Processor (Arrival a) (Arrival a) Source

Return a processor that actually measures how much time has passed from the time of arriving the events.

arrivalProcessingTime :: ArrivalTimer -> Event (SamplingStats Double) Source

Return the statistics about that how long the arrived events were processed.