Package SimPy :: Module Globals

[hide private]
[frames] | no frames]

# Source Code for Module SimPy.Globals

     1  # coding=utf-8
     2  """
     3  This file provides a global Simulation object and the global simulation methods
     4  used by SimPy up to version 1.9.1.
     5  """
     6  # $Revision: 504 $ $Date: 2010-05-11 08:29:10 +0200 (Tue, 11 May 2010) $
     7  # SimPy version: 2.1.0
     8
     9  global sim
    10  sim = None
    11
    12 -def initialize():
    13      sim.initialize()
    14
    15 -def now():
    16      return sim.now()
    17
    18 -def stopSimulation():
    19      """Application function to stop simulation run"""
    20      sim.stopSimulation()
    21
    22 -def allEventNotices():
    23      """Returns string with eventlist as;
    24              t1: processname, processname2
    25              t2: processname4, processname5, . . .
    26                  . . .  .
    27          """
    28      return sim.allEventNotices()
    29
    30 -def allEventTimes():
    31      """Returns list of all times for which events are scheduled.
    32      """
    33      return sim.allEventTimes()
    34
    35 -def startCollection(when = 0.0, monitors = None, tallies = None):
    36      """Starts data collection of all designated Monitor and Tally objects
    37      (default = all) at time 'when'.
    38      """
    39      sim.startCollection( when = when, monitors = monitors, tallies = tallies)
    40
    41 -def _startWUStepping():
    42      """Application function to start stepping through simulation for waituntil
    43      construct."""
    44      sim._startWUStepping()
    45
    46 -def _stopWUStepping():
    47      """Application function to stop stepping through simulation."""
    48      sim._stopWUStepping()
    49
    50 -def activate(obj, process, at = 'undefined', delay = 'undefined',
    51                prior = False):
    52      """Application function to activate passive process."""
    53      sim.activate(obj, process, at = at, delay = delay, prior = prior)
    54
    55 -def reactivate(obj, at = 'undefined', delay = 'undefined', prior = False):
    56      """Application function to reactivate a process which is active,
    57      suspended or passive."""
    58      sim.reactivate(obj, at = at, delay = delay, prior = prior)
    59
    60 -def simulate(until = 0):
    61      return sim.simulate(until = until)
    62