aivika-transformers-6.1.1: Transformers for the Aivika 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.Trans.Operation

Description

Tested with: GHC 8.0.1

It defines a stateless activity, some simplification of Server and Activity.

Synopsis

Operation

data Operation m a b Source #

Like Server it models an activity that takes a and provides b. But unlike the former this kind of activity has no state. Also it is destined to be used within Process computations.

newOperation Source #

Arguments

:: MonadDES m 
=> (a -> Process m b)

provide an output by the specified input

-> Event m (Operation m a b) 

Create a new operation that can provide output b by input a.

By default, it is assumed that the activity utilisation cannot be preempted, because the handling of possible task preemption is rather costly operation.

newPreemptibleOperation Source #

Arguments

:: MonadDES m 
=> Bool

whether the activity can be preempted

-> (a -> Process m b)

provide an output by the specified input

-> Event m (Operation m a b) 

Create a new operation that can provide output b by input a.

Processing

operationProcess :: MonadDES m => Operation m a b -> a -> Process m b Source #

Return a computation for the specified operation. It updates internal counters.

The computation can be used only within one process at any time.

Operation Properties

operationTotalUtilisationTime :: MonadDES m => Operation m a b -> Event m Double Source #

Return the counted total time when the operation activity was utilised.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationTotalUtilisationTimeChanged and operationTotalUtilisationTimeChanged_.

operationTotalPreemptionTime :: MonadDES m => Operation m a b -> Event m Double Source #

Return the counted total time when the operation activity was preemted waiting for the further proceeding.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationTotalPreemptionTimeChanged and operationTotalPreemptionTimeChanged_.

operationUtilisationTime :: MonadDES m => Operation m a b -> Event m (SamplingStats Double) Source #

Return the statistics for the time when the operation activity was utilised.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationUtilisationTimeChanged and operationUtilisationTimeChanged_.

operationPreemptionTime :: MonadDES m => Operation m a b -> Event m (SamplingStats Double) Source #

Return the statistics for the time when the operation activity was preempted waiting for the further proceeding.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationPreemptionTimeChanged and operationPreemptionTimeChanged_.

operationUtilisationFactor :: MonadDES m => Operation m a b -> Event m Double Source #

It returns the factor changing from 0 to 1, which estimates how often the operation activity was utilised since the time of creating the operation.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationUtilisationFactorChanged and operationUtilisationFactorChanged_.

operationPreemptionFactor :: MonadDES m => Operation m a b -> Event m Double Source #

It returns the factor changing from 0 to 1, which estimates how often the operation activity was preempted waiting for the further proceeding since the time of creating the operation.

The value returned changes discretely and it is usually delayed relative to the current simulation time.

See also operationPreemptionFactorChanged and operationPreemptionFactorChanged_.

Statistics Reset

resetOperation :: MonadDES m => Operation m a b -> Event m () Source #

Reset the statistics.

Summary

operationSummary :: MonadDES m => Operation m a b -> Int -> Event m ShowS Source #

Return the summary for the operation with desciption of its properties using the specified indent.

Derived Signals for Properties

operationTotalUtilisationTimeChanged :: MonadDES m => Operation m a b -> Signal m Double Source #

Signal when the operationTotalUtilisationTime property value has changed.

operationTotalUtilisationTimeChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationTotalUtilisationTime property value has changed.

operationTotalPreemptionTimeChanged :: MonadDES m => Operation m a b -> Signal m Double Source #

Signal when the operationTotalPreemptionTime property value has changed.

operationTotalPreemptionTimeChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationTotalPreemptionTime property value has changed.

operationUtilisationTimeChanged :: MonadDES m => Operation m a b -> Signal m (SamplingStats Double) Source #

Signal when the operationUtilisationTime property value has changed.

operationUtilisationTimeChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationUtilisationTime property value has changed.

operationPreemptionTimeChanged :: MonadDES m => Operation m a b -> Signal m (SamplingStats Double) Source #

Signal when the operationPreemptionTime property value has changed.

operationPreemptionTimeChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationPreemptionTime property value has changed.

operationUtilisationFactorChanged :: MonadDES m => Operation m a b -> Signal m Double Source #

Signal when the operationUtilisationFactor property value has changed.

operationUtilisationFactorChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationUtilisationFactor property value has changed.

operationPreemptionFactorChanged :: MonadDES m => Operation m a b -> Signal m Double Source #

Signal when the operationPreemptionFactor property value has changed.

operationPreemptionFactorChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal when the operationPreemptionFactor property value has changed.

Basic Signals

operationUtilising :: MonadDES m => Operation m a b -> Signal m a Source #

Raised when starting to utilise the operation activity after a new input task is received.

operationUtilised :: MonadDES m => Operation m a b -> Signal m (a, b) Source #

Raised when the operation activity has been utilised after the current task is processed.

operationPreemptionBeginning :: MonadDES m => Operation m a b -> Signal m a Source #

Raised when the operation activity utilisation was preempted.

operationPreemptionEnding :: MonadDES m => Operation m a b -> Signal m a Source #

Raised when the operation activity utilisation was proceeded after it had been preempted earlier.

Overall Signal

operationChanged_ :: MonadDES m => Operation m a b -> Signal m () Source #

Signal whenever any property of the operation changes.