Copyright | Copyright (c) 2016-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Tested with: GHC 8.0.1
This module defines a soft real-time computation based on IO
.
- data RT m a
- data RTParams = RTParams {}
- data RTContext m
- data RTScaling
- = RTLinearScaling Double
- | RTLogScaling Double
- | RTScalingFunction (Double -> Double -> Double)
- runRT :: RT m a -> RTContext m -> m a
- defaultRTParams :: RTParams
- newRTContext :: RTParams -> IO (RTContext m)
- rtParams :: Monad m => RT m RTParams
- rtScale :: RTScaling -> Double -> Double -> Double
- applyEventRT :: MonadIO m => RTContext m -> Event (RT m) a -> m (Async a)
- applyEventRT_ :: MonadIO m => RTContext m -> Event (RT m) () -> m ()
- enqueueEventRT :: MonadIO m => RTContext m -> Double -> Event (RT m) a -> m (Async a)
- enqueueEventRT_ :: MonadIO m => RTContext m -> Double -> Event (RT m) () -> m ()
Soft real-time computation
The soft real-time computation based on IO
-derived computation m
.
Monad m => Monad (RT m) Source # | |
Functor m => Functor (RT m) Source # | |
Applicative m => Applicative (RT m) Source # | |
MonadException m => MonadException (RT m) Source # | |
MonadIO m => MonadIO (RT m) Source # | |
data Ref (RT m) # | |
data Ref (RT m) # | |
data EventQueue (RT m) # | |
data Generator (RT m) # | |
data StrategyQueue (RT m) SIRO # | |
data StrategyQueue (RT m) StaticPriorities # | |
data StrategyQueue (RT m) LCFS # | |
data StrategyQueue (RT m) FCFS # | |
The parameters for the RT
computation.
RTParams | |
|
How the modeling time is scaled to a real time.
RTLinearScaling Double | one unit of modeling time interval matches the specified amount of real seconds |
RTLogScaling Double | the logarithm of one unit of modeling time interval matches the specified amount of real seconds |
RTScalingFunction (Double -> Double -> Double) | we explicitly define how many real seconds will we receive for the interval specified by the provided start time and current modeling time |
defaultRTParams :: RTParams Source #
The default parameters for the RT
computation,
where one unit of modeling time matches one real second
and the real time interval is specified with precision of
one millisecond.
:: RTScaling | the scaling method |
-> Double | the start modeling time |
-> Double | the current modeling time |
-> Double | the real time interval |
Scale the modeling time to a real time.
Invoking actions within the simulation
applyEventRT :: MonadIO m => RTContext m -> Event (RT m) a -> m (Async a) Source #
Apply the Event
computation within the soft real-time simulation
with the specified context and return the result.
applyEventRT_ :: MonadIO m => RTContext m -> Event (RT m) () -> m () Source #
Apply the Event
computation within the soft real-time simulation
with the specified context.
enqueueEventRT :: MonadIO m => RTContext m -> Double -> Event (RT m) a -> m (Async a) Source #
Enqueue the Event
computation within the soft real-time simulation
with the specified context at the modeling time provided and
then return the result.
enqueueEventRT_ :: MonadIO m => RTContext m -> Double -> Event (RT m) () -> m () Source #
Enqueue the Event
computation within the soft real-time simulation
with the specified context at the modeling time provided.
Orphan instances
(Monad m, MonadIO m, MonadException m) => EventIOQueueing (RT m) Source # | An implementation of the |
(Monad m, MonadIO m, MonadException m, MonadComp m) => MonadDES (RT m) Source # | An implementation of the |