Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- data Arrival a = Arrival {
- arrivalValue :: a
- arrivalTime :: Double
- arrivalDelay :: Maybe Double
- data ArrivalTimer m
- newArrivalTimer :: MonadDES m => Simulation m (ArrivalTimer m)
- arrivalTimerProcessor :: MonadDES m => ArrivalTimer m -> Processor m (Arrival a) (Arrival a)
- arrivalTimerSignal :: MonadDES m => ArrivalTimer m -> Signal m (Arrival a) -> Signal m (Arrival a)
- arrivalTimerChannel :: MonadDES m => ArrivalTimer m -> Channel m (Arrival a) (Arrival a)
- arrivalProcessingTime :: MonadDES m => ArrivalTimer m -> Event m (SamplingStats Double)
- arrivalProcessingTimeChanged :: MonadDES m => ArrivalTimer m -> Signal m (SamplingStats Double)
- arrivalProcessingTimeChanged_ :: MonadDES m => ArrivalTimer m -> Signal m ()
- resetArrivalTimer :: MonadDES m => ArrivalTimer m -> Event m ()
Documentation
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.
Arrival | |
|
data ArrivalTimer m Source #
Accumulates the statistics about that how long the arrived events are processed.
Instances
MonadDES m => ResultProvider (ArrivalTimer m) m Source # | |
Defined in Simulation.Aivika.Trans.Results resultSource :: ResultName -> ResultDescription -> ArrivalTimer m -> ResultSource m Source # resultSource3 :: ResultName -> ResultDescription -> ResultDescription -> ArrivalTimer m -> ResultSource m Source # resultSource' :: ResultName -> [ResultName] -> ResultId -> [ResultId] -> ArrivalTimer m -> ResultSource m Source # |
newArrivalTimer :: MonadDES m => Simulation m (ArrivalTimer m) Source #
Create a new timer that measures how long the arrived events are processed.
arrivalTimerProcessor :: MonadDES m => ArrivalTimer m -> Processor m (Arrival a) (Arrival a) Source #
Return a processor that actually measures how much time has passed from the time of arriving the events.
arrivalTimerSignal :: MonadDES m => ArrivalTimer m -> Signal m (Arrival a) -> Signal m (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 :: MonadDES m => ArrivalTimer m -> Channel m (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 :: MonadDES m => ArrivalTimer m -> Event m (SamplingStats Double) Source #
Return the statistics about that how long the arrived events were processed.
arrivalProcessingTimeChanged :: MonadDES m => ArrivalTimer m -> Signal m (SamplingStats Double) Source #
Return a signal raised when the the processing time statistics changes.
arrivalProcessingTimeChanged_ :: MonadDES m => ArrivalTimer m -> Signal m () Source #
Return a signal raised when the the processing time statistics changes.
resetArrivalTimer :: MonadDES m => ArrivalTimer m -> Event m () Source #
Reset the statistics.