Package SimPy :: Module SimulationStep

[hide private]
[frames] | no frames]

# Module SimulationStep

source code

Classes | [hide private]

`` | Simerror
`` | FatalSimerror
`` | Process Superclass of classes which may use generator functions
`` | __Evlist Defines event list and operations on it
`` | _Action Structure (who=process owner, generator=process)
`` | Histogram A histogram gathering and sampling class
`` | Monitor Monitored variables
`` | Tally
`` | Queue
`` | FIFO
`` | PriorityQ Queue is always ordered according to priority.
`` | Resource Models shared, limited capacity resources with queuing; FIFO is default queuing discipline.
`` | Buffer Abstract class for buffers Blocks a process when a put would cause buffer overflow or a get would cause buffer underflow.
`` | Level Models buffers for processes putting/getting un-distinguishable items.
`` | Store Models buffers for processes coupled by putting/getting distinguishable items.
`` | SimEvent Supports one-shot signalling between processes.

Functions | [hide private]

`` | initialize()
`` | now()
`` | stopSimulation() Application function to stop simulation run
`` | _startWUStepping() Application function to start stepping through simulation for waituntil construct.
`` | _stopWUStepping() Application function to stop stepping through simulation.
`` | startStepping() Application function to start stepping through simulation.
`` | stopStepping() Application function to stop stepping through simulation.
`` | allEventNotices() Returns string with eventlist as t1: [procname,procname2] t2: [procname4,procname5, .
`` | allEventTimes() Returns list of all times for which events are scheduled.
`` | activate(object, process, at="undefined", delay="undefined", prior=False) Application function to activate passive process.
`` | reactivate(obj, at="undefined", delay="undefined", prior=False) Application function to reactivate a process which is active, suspended or passive.
`` | startCollection(when=0.0, monitors=None, tallies=None) Starts data collection of all designated Monitor and Tally objects (default=all) at time 'when'.
`` | _test() Gets called by simulate after every event, as long as there are processes waiting in condQ for a condition to be satisfied.
`` | _waitUntilFunc(proc, cond)
`` | scheduler(till=0) Schedules Processes/semi-coroutines until time 'till'.
`` | holdfunc(a)
`` | requestfunc(a) Handles 'yield request,self,res' and 'yield (request,self,res),(<code>,self,par)'.
`` | releasefunc(a)
`` | passivatefunc(a)
`` | waitevfunc(a)
`` | queueevfunc(a)
`` | waituntilfunc(par)
`` | getfunc(a) Handles 'yield get,self,buffer,what,priority' and 'yield (get,self,buffer,what,priority),(<code>,self,par)'.
`` | putfunc(a) Handles 'yield put' (simple and compound hold/waitevent)
`` | simulate(callback=<function <lambda> at 0x017B1630>, until=0) Schedules Processes/semi-coroutines until time 'until'
`` | simulateStep(callback=<function <lambda> at 0x017B16B0>, until=0) Schedules Processes/semi-coroutines until next event
`` | askCancel()
`` | test_demo()
`` | test_interrupt()
`` | testSimEvents()
`` | testwaituntil() Demo of waitUntil capability.

Variables | [hide private]

`` | __TESTING = `False`
`` | __version__ = `'1.8 $Revision: 1.1.1.25 $ $Date: 2007/01/18 14:44:1...`
`` | version = `'1.8 $Revision: 1.1.1.25 $ $Date: 2007/01/18 14:44:1...`
`` | hold = `1`
`` | passivate = `2`
`` | request = `3`
`` | release = `4`
`` | waitevent = `5`
`` | queueevent = `6`
`` | waituntil = `7`
`` | get = `8`
`` | put = `9`
`` | _endtime = `0`
`` | _t = `0`
`` | _e = `None`
`` | _stop = `True`
`` | _wustep = `False`
`` | True = `1`
`` | False = `0`
`` | paused = `0`
`` | _step = `0`
`` | condQ = `[]`
`` | allMonitors = `[]`
`` | allTallies = `[]`

Function Details | [hide private]

### initialize()

source code

None

### now()

source code

None

### stopSimulation()

source code

Application function to stop simulation run

### _startWUStepping()

source code

Application function to start stepping through simulation for waituntil construct.

### _stopWUStepping()

source code

Application function to stop stepping through simulation.

### startStepping()

source code

Application function to start stepping through simulation.

### stopStepping()

source code

Application function to stop stepping through simulation.

### allEventNotices()

source code

Returns string with eventlist as t1: [procname,procname2] t2: [procname4,procname5, . . . ] . . . .

### allEventTimes()

source code

Returns list of all times for which events are scheduled.

### activate(object, process, at="undefined", delay="undefined", prior=False)

source code

Application function to activate passive process.

### reactivate(obj, at="undefined", delay="undefined", prior=False)

source code

Application function to reactivate a process which is active, suspended or passive.

### startCollection(when=0.0, monitors=None, tallies=None)

source code

Starts data collection of all designated Monitor and Tally objects (default=all) at time 'when'.

### _test()

source code

Gets called by simulate after every event, as long as there are processes waiting in condQ for a condition to be satisfied. Tests the conditions for all waiting processes. Where condition satisfied, reactivates that process immediately and removes it from queue.

### _waitUntilFunc(proc, cond)

source code

None

### scheduler(till=0)

source code

Schedules Processes/semi-coroutines until time 'till'. Deprecated since version 0.5.

### holdfunc(a)

source code

None

### requestfunc(a)

source code

Handles 'yield request,self,res' and 'yield (request,self,res),(<code>,self,par)'. <code> can be 'hold' or 'waitevent'.

### releasefunc(a)

source code

None

### passivatefunc(a)

source code

None

### waitevfunc(a)

source code

None

### queueevfunc(a)

source code

None

### waituntilfunc(par)

source code

None

### getfunc(a)

source code

Handles 'yield get,self,buffer,what,priority' and 'yield (get,self,buffer,what,priority),(<code>,self,par)'. <code> can be 'hold' or 'waitevent'.

### putfunc(a)

source code

Handles 'yield put' (simple and compound hold/waitevent)

### simulate(callback=<function <lambda> at 0x017B1630>, until=0)

source code

Schedules Processes/semi-coroutines until time 'until'

### simulateStep(callback=<function <lambda> at 0x017B16B0>, until=0)

source code

Schedules Processes/semi-coroutines until next event

### askCancel()

source code

None

### test_demo()

source code

None

### test_interrupt()

source code

None

### testSimEvents()

source code

None

### testwaituntil()

source code

Demo of waitUntil capability.

Scenario: Three workers require sets of tools to do their jobs. Tools are shared, scarce resources for which they compete.

Variables Details | [hide private]

### __TESTING

None

  Value:

        False

### __version__

None

  Value:

        '1.8 $Revision: 1.1.1.25 $ $Date: 2007/01/18 14:44:17 $'

### version

None

  Value:

        '1.8 $Revision: 1.1.1.25 $ $Date: 2007/01/18 14:44:17 $'

### hold

None

  Value:

        1

### passivate

None

  Value:

        2

### request

None

  Value:

        3

### release

None

  Value:

        4

### waitevent

None

  Value:

        5

### queueevent

None

  Value:

        6

### waituntil

None

  Value:

        7

### get

None

  Value:

        8

### put

None

  Value:

        9

### _endtime

None

  Value:

        0

### _t

None

  Value:

        0

### _e

None

  Value:

        None

### _stop

None

  Value:

        True

### _wustep

None

  Value:

        False

### True

None

  Value:

        1

### False

None

  Value:

        0

### paused

None

  Value:

        0

### _step

None

  Value:

        0

### condQ

None

  Value:

        []

### allMonitors

None

  Value:

        []

### allTallies

None

  Value:

        []