aivika-gpss-0.4: GPSS-like DSL for Aivika

CopyrightCopyright (c) 2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Simulation.Aivika.Trans.GPSS.Queue

Contents

Description

Tested with: GHC 8.0.2

This module defines a GPSS queue entity.

Synopsis

Queue Types

data Queue m Source #

Represents the queue entity.

Instances

MonadDES m => Eq (Queue m) Source # 

Methods

(==) :: Queue m -> Queue m -> Bool #

(/=) :: Queue m -> Queue m -> Bool #

Hashable (Queue m) Source # 

Methods

hashWithSalt :: Int -> Queue m -> Int #

hash :: Queue m -> Int #

data QueueEntry m Source #

The information about queue entry.

Constructors

QueueEntry 

Fields

Instances

MonadDES m => Eq (QueueEntry m) Source # 

Methods

(==) :: QueueEntry m -> QueueEntry m -> Bool #

(/=) :: QueueEntry m -> QueueEntry m -> Bool #

Creating Queue

newQueue :: MonadDES m => Event m (Queue m) Source #

Create a new queue.

Queue Properties and Activities

queueNull :: MonadDES m => Queue m -> Event m Bool Source #

Test whether the queue is empty.

See also queueNullChanged and queueNullChanged_.

queueContent :: MonadDES m => Queue m -> Event m Int Source #

Return the current queue content.

See also queueContentStats, queueContentChanged and queueContentChanged_.

queueContentStats :: MonadDES m => Queue m -> Event m (TimingStats Int) Source #

Return the queue content statistics.

enqueueCount :: MonadDES m => Queue m -> Event m Int Source #

Return the total number of input items that were enqueued.

See also enqueueCountChanged and enqueueCountChanged_.

enqueueZeroEntryCount :: MonadDES m => Queue m -> Event m Int Source #

Return the total number of zero entry items.

See also enqueueZeroEntryCountChanged and enqueueZeroEntryCountChanged_.

queueWaitTime :: MonadDES m => Queue m -> Event m (SamplingStats Double) Source #

Return the wait (or residence) time.

See also queueWaitTimeChanged and queueWaitTimeChanged_.

queueNonZeroEntryWaitTime :: MonadDES m => Queue m -> Event m (SamplingStats Double) Source #

Return the wait (or residence) time excluding zero entries.

See also queueNonZeroEntryWaitTimeChanged and queueNonZeroEntryWaitTimeChanged_.

queueRate :: MonadDES m => Queue m -> Event m Double Source #

Return a long-term average queue rate calculated as the average queue size divided by the average wait time.

See also queueRateChanged and queueRateChanged_.

Dequeuing and Enqueuing

enqueue Source #

Arguments

:: MonadDES m 
=> Queue m

the queue

-> Transact m a

the item to be enqueued

-> Int

the content increment

-> Event m () 

Enqueue the item.

dequeue Source #

Arguments

:: MonadDES m 
=> Queue m

the queue

-> Transact m a

the item to be dequeued

-> Int

the content decrement

-> Event m () 

Dequeue the item.

Statistics Reset

resetQueue :: MonadDES m => Queue m -> Event m () Source #

Reset the statistics.

Derived Signals for Properties

queueNullChanged :: MonadDES m => Queue m -> Signal m Bool Source #

Signal when the queueNull property value has changed.

queueNullChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the queueNull property value has changed.

queueContentChanged :: MonadDES m => Queue m -> Signal m Int Source #

Signal when the queueContent property value has changed.

queueContentChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the queueContent property value has changed.

enqueueCountChanged :: MonadDES m => Queue m -> Signal m Int Source #

Signal when the enqueueCount property value has changed.

enqueueCountChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the enqueueCount property value has changed.

enqueueZeroEntryCountChanged :: MonadDES m => Queue m -> Signal m Int Source #

Signal when the enqueueZeroEntryCount property value has changed.

enqueueZeroEntryCountChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the enqueueZeroEntryCount property value has changed.

queueWaitTimeChanged :: MonadDES m => Queue m -> Signal m (SamplingStats Double) Source #

Signal when the queueWaitTime property value has changed.

queueWaitTimeChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the queueWaitTime property value has changed.

queueNonZeroEntryWaitTimeChanged :: MonadDES m => Queue m -> Signal m (SamplingStats Double) Source #

Signal when the queueNonZeroEntryWaitTime property value has changed.

queueNonZeroEntryWaitTimeChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the queueNonZeroEntryWaitTime property value has changed.

queueRateChanged :: MonadDES m => Queue m -> Signal m Double Source #

Signal when the queueRate property value has changed.

queueRateChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal when the queueRate property value has changed.

Basic Signals

enqueued :: MonadDES m => Queue m -> Signal m () Source #

Return a signal that notifies when enqueuing an item.

dequeued :: MonadDES m => Queue m -> Signal m () Source #

Return a signal that notifies when the dequeuing the item.

Overall Signal

queueChanged_ :: MonadDES m => Queue m -> Signal m () Source #

Signal whenever any property of the queue changes.

The property must have the corresponded signal. There are also characteristics similar to the properties but that have no signals. As a rule, such characteristics already depend on the simulation time and therefore they may change at any time point.