aivika-transformers-4.3.5: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2015, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Simulation.Aivika.Trans.Internal.Types

Description

Tested with: GHC 7.10.1

It defines the implementation details of some types. You should never use it in ordinary simulation models. The module is destined for those who will extend the library.

Synopsis

Documentation

data Specs m Source

It defines the simulation specs.

Constructors

Specs 

Fields

spcStartTime :: Double

the start time

spcStopTime :: Double

the stop time

spcDT :: Double

the integration time step

spcMethod :: Method

the integration method

spcGeneratorType :: GeneratorType m

the type of random number generator

data Method Source

It defines the integration method.

Constructors

Euler

Euler's method

RungeKutta2

the 2nd order Runge-Kutta method

RungeKutta4

the 4th order Runge-Kutta method

data Run m Source

It indentifies the simulation run.

Constructors

Run 

Fields

runSpecs :: Specs m

the simulation specs

runIndex :: Int

the current simulation run index

runCount :: Int

the total number of runs within the experiment

runEventQueue :: EventQueue m

the event queue

runGenerator :: Generator m

the random number generator

data Point m Source

It defines the simulation point appended with the additional information.

Constructors

Point 

Fields

pointSpecs :: Specs m

the simulation specs

pointRun :: Run m

the simulation run

pointTime :: Double

the current time

pointIteration :: Int

the current iteration

pointPhase :: Int

the current phase

newtype Parameter m a Source

The Parameter monad that allows specifying the model parameters. For example, they can be used when running the Monte-Carlo simulation.

In general, this monad is very useful for representing a computation which is external relative to the model itself.

Constructors

Parameter (Run m -> m a) 

newtype Simulation m a Source

A value in the Simulation monad represents a computation within the simulation run.

Constructors

Simulation (Run m -> m a) 

newtype Dynamics m a Source

A value in the Dynamics monad represents a polymorphic time varying function defined in the whole spectrum of time values as a single entity. It is ideal for numerical approximating integrals.

Constructors

Dynamics (Point m -> m a) 

newtype Event m a Source

A value in the Event monad transformer represents a polymorphic time varying function which is strongly synchronized with the event queue.

Constructors

Event (Point m -> m a) 

data EventProcessing Source

Defines how the events are processed.

Constructors

CurrentEvents

either process all earlier and then current events, or raise an error if the current simulation time is less than the actual time of the event queue (safe within the Event computation as this is protected by the type system)

EarlierEvents

either process all earlier events not affecting the events at the current simulation time, or raise an error if the current simulation time is less than the actual time of the event queue (safe within the Event computation as this is protected by the type system)

CurrentEventsOrFromPast

either process all earlier and then current events, or do nothing if the current simulation time is less than the actual time of the event queue (do not use unless the documentation states the opposite)

EarlierEventsOrFromPast

either process all earlier events, or do nothing if the current simulation time is less than the actual time of the event queue (do not use unless the documentation states the opposite)

class EventQueueing m where Source

A type class of monads that allow enqueueing the events.

Associated Types

data EventQueue m :: * Source

It represents the event queue.

Methods

newEventQueue :: Specs m -> m (EventQueue m) Source

Create a new event queue by the specified specs with simulation session.

enqueueEvent :: Double -> Event m () -> Event m () Source

Enqueue the event which must be actuated at the specified time.

runEvent :: Event m a -> Dynamics m a Source

Run the EventT computation in the current simulation time within the DynamicsT computation involving all pending CurrentEvents in the processing too.

runEventWith :: EventProcessing -> Event m a -> Dynamics m a Source

Run the EventT computation in the current simulation time within the DynamicsT computation specifying what pending events should be involved in the processing.

eventQueueCount :: Event m Int Source

Return the number of pending events that should be yet actuated.

invokeParameter :: Run m -> Parameter m a -> m a Source

Invoke the Parameter computation.

invokeSimulation :: Run m -> Simulation m a -> m a Source

Invoke the Simulation computation.

invokeDynamics :: Point m -> Dynamics m a -> m a Source

Invoke the Dynamics computation.

invokeEvent :: Point m -> Event m a -> m a Source

Invoke the Event computation.