aivika-6.1.1: A multi-method simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Arrival

Description

Tested with: GHC 8.0.1

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.

Synopsis

Documentation

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.

Constructors

Arrival 

Fields

Instances

Instances details
Show a => Show (Arrival a) Source # 
Instance details

Defined in Simulation.Aivika.Internal.Arrival

Methods

showsPrec :: Int -> Arrival a -> ShowS #

show :: Arrival a -> String #

showList :: [Arrival a] -> ShowS #

Eq a => Eq (Arrival a) Source # 
Instance details

Defined in Simulation.Aivika.Internal.Arrival

Methods

(==) :: Arrival a -> Arrival a -> Bool #

(/=) :: Arrival a -> Arrival a -> Bool #

Ord a => Ord (Arrival a) Source # 
Instance details

Defined in Simulation.Aivika.Internal.Arrival

Methods

compare :: Arrival a -> Arrival a -> Ordering #

(<) :: Arrival a -> Arrival a -> Bool #

(<=) :: Arrival a -> Arrival a -> Bool #

(>) :: Arrival a -> Arrival a -> Bool #

(>=) :: Arrival a -> Arrival a -> Bool #

max :: Arrival a -> Arrival a -> Arrival a #

min :: Arrival a -> Arrival a -> 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.

arrivalTimerSignal :: ArrivalTimer -> Signal (Arrival a) -> Signal (Arrival a) Source #

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

Note that the statistics is counted each time you subscribe to the output signal. For example, if you subscribe twice then the statistics counting is duplicated. Ideally, you should subscribe to the output signal only once.

arrivalTimerChannel :: ArrivalTimer -> Channel (Arrival a) (Arrival a) Source #

Like arrivalTimerSignal but measures how much time has passed from the time of arriving the events in the channel.

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

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

arrivalProcessingTimeChanged :: ArrivalTimer -> Signal (SamplingStats Double) Source #

Return a signal raised when the the processing time statistics changes.

arrivalProcessingTimeChanged_ :: ArrivalTimer -> Signal () Source #

Return a signal raised when the the processing time statistics changes.

resetArrivalTimer :: ArrivalTimer -> Event () Source #

Reset the statistics.