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

# 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

MonadDES m => ResultProvider (Operation m a b) m Source # | |

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

:: 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 #

:: 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.

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.

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.

See also `operationPreemptionFactorChanged`

and `operationPreemptionFactorChanged_`

.

# Statistics Reset

# 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.