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 |

- data Activity m s a b
- newActivity :: MonadDES m => (a -> Process m b) -> Simulation m (Activity m () a b)
- newStateActivity :: MonadDES m => (s -> a -> Process m (s, b)) -> s -> Simulation m (Activity m s a b)
- newPreemptibleActivity :: MonadDES m => Bool -> (a -> Process m b) -> Simulation m (Activity m () a b)
- newPreemptibleStateActivity :: MonadDES m => Bool -> (s -> a -> Process m (s, b)) -> s -> Simulation m (Activity m s a b)
- activityNet :: MonadDES m => Activity m s a b -> Net m a b
- activityInitState :: Activity m s a b -> s
- activityState :: MonadDES m => Activity m s a b -> Event m s
- activityTotalUtilisationTime :: MonadDES m => Activity m s a b -> Event m Double
- activityTotalIdleTime :: MonadDES m => Activity m s a b -> Event m Double
- activityTotalPreemptionTime :: MonadDES m => Activity m s a b -> Event m Double
- activityUtilisationTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
- activityIdleTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
- activityPreemptionTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
- activityUtilisationFactor :: MonadDES m => Activity m s a b -> Event m Double
- activityIdleFactor :: MonadDES m => Activity m s a b -> Event m Double
- activityPreemptionFactor :: MonadDES m => Activity m s a b -> Event m Double
- resetActivity :: MonadDES m => Activity m s a b -> Event m ()
- activitySummary :: MonadDES m => Activity m s a b -> Int -> Event m ShowS
- activityStateChanged :: MonadDES m => Activity m s a b -> Signal m s
- activityStateChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityTotalUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityTotalUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityTotalIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityTotalIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityTotalPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityTotalPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
- activityUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
- activityIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
- activityPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityUtilisationFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityUtilisationFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityIdleFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityIdleFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityPreemptionFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
- activityPreemptionFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
- activityUtilising :: Activity m s a b -> Signal m a
- activityUtilised :: Activity m s a b -> Signal m (a, b)
- activityPreemptionBeginning :: Activity m s a b -> Signal m a
- activityPreemptionEnding :: Activity m s a b -> Signal m a
- activityChanged_ :: MonadDES m => Activity m s a b -> Signal m ()

# Activity

data Activity m s a b Source #

Like `Server`

it models an activity that takes `a`

and provides `b`

having state `s`

.
But unlike the former the activity is destined for simulation within `Net`

computation.

(MonadDES m, Show s, ResultItemable (ResultValue s)) => ResultProvider (Activity m s a b) m Source # | |

:: MonadDES m | |

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

-> Simulation m (Activity m () a b) |

Create a new activity 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.

:: MonadDES m | |

=> (s -> a -> Process m (s, b)) | provide a new state and output by the specified old state and input |

-> s | the initial state |

-> Simulation m (Activity m s a b) |

Create a new activity that can provide output `b`

by input `a`

starting from state `s`

.

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

newPreemptibleActivity Source #

:: MonadDES m | |

=> Bool | whether the activity can be preempted |

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

-> Simulation m (Activity m () a b) |

Create a new interruptible activity that can provide output `b`

by input `a`

.

newPreemptibleStateActivity Source #

:: MonadDES m | |

=> Bool | whether the activity can be preempted |

-> (s -> a -> Process m (s, b)) | provide a new state and output by the specified old state and input |

-> s | the initial state |

-> Simulation m (Activity m s a b) |

Create a new activity that can provide output `b`

by input `a`

starting from state `s`

.

# Processing

activityNet :: MonadDES m => Activity m s a b -> Net m a b Source #

Return a network computation for the specified activity.

The computation updates the internal state of the activity. The usual case is when the computation is applied only once in a chain of data processing. Otherwise; every time the computation is used, the state of the activity changes. Sometimes it can be indeed useful if you want to aggregate the statistics for different activities simultaneously, but it would be more preferable to avoid this.

If you connect different activity computations returned by this function in a chain
with help of `>>>`

or other category combinator then this chain will act as one
whole, where the first activity will take a new task only after the last activity
finishes its current task and requests for the next one from the previous activity
in the chain. This is not always that thing you might need.

# Activity Properties

activityInitState :: Activity m s a b -> s Source #

The initial state of the activity.

activityState :: MonadDES m => Activity m s a b -> Event m s Source #

Return the current state of the activity.

See also `activityStateChanged`

and `activityStateChanged_`

.

activityTotalUtilisationTime :: MonadDES m => Activity m s a b -> Event m Double Source #

Return the counted total time when the activity was utilised.

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

See also `activityTotalUtilisationTimeChanged`

and `activityTotalUtilisationTimeChanged_`

.

activityTotalIdleTime :: MonadDES m => Activity m s a b -> Event m Double Source #

Return the counted total time when the activity was idle.

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

See also `activityTotalIdleTimeChanged`

and `activityTotalIdleTimeChanged_`

.

activityTotalPreemptionTime :: MonadDES m => Activity m s a b -> Event m Double Source #

Return the counted total time when the 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 `activityTotalPreemptionTimeChanged`

and `activityTotalPreemptionTimeChanged_`

.

activityUtilisationTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double) Source #

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

See also `activityUtilisationTimeChanged`

and `activityUtilisationTimeChanged_`

.

activityIdleTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double) Source #

Return the statistics for the time when the activity was idle.

See also `activityIdleTimeChanged`

and `activityIdleTimeChanged_`

.

activityPreemptionTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double) Source #

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

See also `activityPreemptionTimeChanged`

and `activityPreemptionTimeChanged_`

.

activityUtilisationFactor :: MonadDES m => Activity m s a b -> Event m Double Source #

It returns the factor changing from 0 to 1, which estimates how often the activity was utilised.

This factor is calculated as

totalUtilisationTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)

As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.

See also `activityUtilisationFactorChanged`

and `activityUtilisationFactorChanged_`

.

activityIdleFactor :: MonadDES m => Activity m s a b -> Event m Double Source #

It returns the factor changing from 0 to 1, which estimates how often the activity was idle.

This factor is calculated as

totalIdleTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)

As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.

See also `activityIdleFactorChanged`

and `activityIdleFactorChanged_`

.

activityPreemptionFactor :: MonadDES m => Activity m s a b -> Event m Double Source #

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

This factor is calculated as

totalUtilisationTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)

As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.

See also `activityPreemptionFactorChanged`

and `activityPreemptionFactorChanged_`

.

# Statistics Reset

# Summary

activitySummary :: MonadDES m => Activity m s a b -> Int -> Event m ShowS Source #

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

# Derived Signals for Properties

activityStateChanged :: MonadDES m => Activity m s a b -> Signal m s Source #

Signal when the `activityState`

property value has changed.

activityStateChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityState`

property value has changed.

activityTotalUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityTotalUtilisationTime`

property value has changed.

activityTotalUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityTotalUtilisationTime`

property value has changed.

activityTotalIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityTotalIdleTime`

property value has changed.

activityTotalIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityTotalIdleTime`

property value has changed.

activityTotalPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityTotalPreemptionTime`

property value has changed.

activityTotalPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityTotalPreemptionTime`

property value has changed.

activityUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double) Source #

Signal when the `activityUtilisationTime`

property value has changed.

activityUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityUtilisationTime`

property value has changed.

activityIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double) Source #

Signal when the `activityIdleTime`

property value has changed.

activityIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityIdleTime`

property value has changed.

activityPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double) Source #

Signal when the `activityPreemptionTime`

property value has changed.

activityPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityPreemptionTime`

property value has changed.

activityUtilisationFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityUtilisationFactor`

property value has changed.

activityUtilisationFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityUtilisationFactor`

property value has changed.

activityIdleFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityIdleFactor`

property value has changed.

activityIdleFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityIdleFactor`

property value has changed.

activityPreemptionFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double Source #

Signal when the `activityPreemptionFactor`

property value has changed.

activityPreemptionFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m () Source #

Signal when the `activityPreemptionFactor`

property value has changed.

# Basic Signals

activityUtilising :: Activity m s a b -> Signal m a Source #

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

activityUtilised :: Activity m s a b -> Signal m (a, b) Source #

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

activityPreemptionBeginning :: Activity m s a b -> Signal m a Source #

Raised when the activity utilisation was preempted.

activityPreemptionEnding :: Activity m s a b -> Signal m a Source #

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