Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|

License | BSD3 |

Maintainer | David Sorokin <david.sorokin@gmail.com> |

Stability | experimental |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- data Operation a b
- newOperation :: (a -> Process b) -> Event (Operation a b)
- newPreemptibleOperation :: Bool -> (a -> Process b) -> Event (Operation a b)
- operationProcess :: Operation a b -> a -> Process b
- operationTotalUtilisationTime :: Operation a b -> Event Double
- operationTotalPreemptionTime :: Operation a b -> Event Double
- operationUtilisationTime :: Operation a b -> Event (SamplingStats Double)
- operationPreemptionTime :: Operation a b -> Event (SamplingStats Double)
- operationUtilisationFactor :: Operation a b -> Event Double
- operationPreemptionFactor :: Operation a b -> Event Double
- resetOperation :: Operation a b -> Event ()
- operationSummary :: Operation a b -> Int -> Event ShowS
- operationTotalUtilisationTimeChanged :: Operation a b -> Signal Double
- operationTotalUtilisationTimeChanged_ :: Operation a b -> Signal ()
- operationTotalPreemptionTimeChanged :: Operation a b -> Signal Double
- operationTotalPreemptionTimeChanged_ :: Operation a b -> Signal ()
- operationUtilisationTimeChanged :: Operation a b -> Signal (SamplingStats Double)
- operationUtilisationTimeChanged_ :: Operation a b -> Signal ()
- operationPreemptionTimeChanged :: Operation a b -> Signal (SamplingStats Double)
- operationPreemptionTimeChanged_ :: Operation a b -> Signal ()
- operationUtilisationFactorChanged :: Operation a b -> Signal Double
- operationUtilisationFactorChanged_ :: Operation a b -> Signal ()
- operationPreemptionFactorChanged :: Operation a b -> Signal Double
- operationPreemptionFactorChanged_ :: Operation a b -> Signal ()
- operationUtilising :: Operation a b -> Signal a
- operationUtilised :: Operation a b -> Signal (a, b)
- operationPreemptionBeginning :: Operation a b -> Signal a
- operationPreemptionEnding :: Operation a b -> Signal a
- operationChanged_ :: Operation a b -> Signal ()

# Operation

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.

## Instances

ResultProvider (Operation a b) Source # | |

Defined in Simulation.Aivika.Results resultSource :: ResultName -> ResultDescription -> Operation a b -> ResultSource Source # resultSource3 :: ResultName -> ResultDescription -> ResultDescription -> Operation a b -> ResultSource Source # resultSource' :: ResultName -> [ResultName] -> ResultId -> [ResultId] -> Operation a b -> ResultSource Source # |

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 #

:: Bool | whether the activity can be preempted |

-> (a -> Process b) | provide an output by the specified input |

-> Event (Operation a b) |

Create a new operation that can provide output `b`

by input `a`

.

# Processing

operationProcess :: Operation a b -> a -> Process 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 :: Operation a b -> Event 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 :: Operation a b -> Event 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 :: Operation a b -> Event (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 :: Operation a b -> Event (SamplingStats Double) Source #

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

See also `operationPreemptionTimeChanged`

and `operationPreemptionTimeChanged_`

.

operationUtilisationFactor :: Operation a b -> Event 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.

See also `operationUtilisationFactorChanged`

and `operationUtilisationFactorChanged_`

.

operationPreemptionFactor :: Operation a b -> Event 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.

See also `operationPreemptionFactorChanged`

and `operationPreemptionFactorChanged_`

.

# Statistics Reset

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

Reset the statistics.

# Summary

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

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

# Derived Signals for Properties

operationTotalUtilisationTimeChanged :: Operation a b -> Signal Double Source #

Signal when the `operationTotalUtilisationTime`

property value has changed.

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

Signal when the `operationTotalUtilisationTime`

property value has changed.

operationTotalPreemptionTimeChanged :: Operation a b -> Signal Double Source #

Signal when the `operationTotalPreemptionTime`

property value has changed.

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

Signal when the `operationTotalPreemptionTime`

property value has changed.

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

Signal when the `operationUtilisationTime`

property value has changed.

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

Signal when the `operationUtilisationTime`

property value has changed.

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

Signal when the `operationPreemptionTime`

property value has changed.

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

Signal when the `operationPreemptionTime`

property value has changed.

operationUtilisationFactorChanged :: Operation a b -> Signal Double Source #

Signal when the `operationUtilisationFactor`

property value has changed.

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

Signal when the `operationUtilisationFactor`

property value has changed.

operationPreemptionFactorChanged :: Operation a b -> Signal Double Source #

Signal when the `operationPreemptionFactor`

property value has changed.

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

Signal when the `operationPreemptionFactor`

property value has changed.

# Basic Signals

operationUtilising :: Operation a b -> Signal a Source #

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

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

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

operationPreemptionBeginning :: Operation a b -> Signal a Source #

Raised when the operation activity utilisation was preempted.

operationPreemptionEnding :: Operation a b -> Signal a Source #

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

# Overall Signal

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

Signal whenever any property of the operation changes.