File: Globals.py

package info (click to toggle)
python-simpy 2.3.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,864 kB
  • sloc: python: 11,171; makefile: 143
file content (59 lines) | stat: -rw-r--r-- 1,748 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# coding=utf-8
"""
This file provides a global Simulation object and the global simulation methods
used by SimPy up to version 1.9.1.

"""
global sim
sim = None

def initialize():
    sim.initialize()

def now():
    return sim.now()

def stopSimulation():
    """Application function to stop simulation run"""
    sim.stopSimulation()

def allEventNotices():
    """Returns string with eventlist as;
            t1: processname, processname2
            t2: processname4, processname5, . . .
                . . .  .
        """
    return sim.allEventNotices()

def allEventTimes():
    """Returns list of all times for which events are scheduled.
    """
    return sim.allEventTimes()

def startCollection(when = 0.0, monitors = None, tallies = None):
    """Starts data collection of all designated Monitor and Tally objects
    (default = all) at time 'when'.
    """
    sim.startCollection( when = when, monitors = monitors, tallies = tallies)

def _startWUStepping():
    """Application function to start stepping through simulation for waituntil
    construct."""
    sim._startWUStepping()

def _stopWUStepping():
    """Application function to stop stepping through simulation."""
    sim._stopWUStepping()

def activate(obj, process, at = 'undefined', delay = 'undefined',
              prior = False):
    """Application function to activate passive process."""
    sim.activate(obj, process, at = at, delay = delay, prior = prior)

def reactivate(obj, at = 'undefined', delay = 'undefined', prior = False):
    """Application function to reactivate a process which is active,
    suspended or passive."""
    sim.reactivate(obj, at = at, delay = delay, prior = prior)

def simulate(until = 0):
    return sim.simulate(until = until)