Package SimPy :: Module SimulationTrace
[hide private]
[frames] | no frames]

Module SimulationTrace

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)
  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.
  Trace
  Histogram
A histogram gathering and sampling class
  JobTO
Job class for testing timeout reneging
  JobEvt
Job class for testing event reneging
  JobEvtMulti
Job class for testing event reneging with multi-event lists
  FireEvent
Fires reneging event

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.
  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(until=0)
Schedules Processes/semi-coroutines until time 'until'
  test_demo()
  test_interrupt()
  testSimEvents()
  testwaituntil()
Demo of waitUntil capability.
  testNoTimeout()
Test that resource gets acquired without timeout
  testTimeout1()
Test that timeout occurs when resource busy
  testTimeout2()
Test that timeout occurs when resource has no capacity free
  testNoEvent()
Test that processes acquire resource normally if no event fires
  testWaitEvent1()
Test that signalled event leads to renege when resource busy
  testWaitEvent2()
Test that renege-triggering event can be one of an event list

Variables [hide private]
  __TESTING = False
  __version__ = '1.8 $Revision: 1.1.1.27 $ $Date: 2007/01/18 14:43:5...
  version = '1.8 $Revision: 1.1.1.27 $ $Date: 2007/01/18 14:43:5...
  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
  condQ = []
  allMonitors = []
  allTallies = []
  trace = <Instance of Trace, id 25030768: .tracego=1 .end=100...

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.

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(until=0)

source code 
Schedules Processes/semi-coroutines until time 'until'

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.

testNoTimeout()

source code 
Test that resource gets acquired without timeout

testTimeout1()

source code 
Test that timeout occurs when resource busy

testTimeout2()

source code 
Test that timeout occurs when resource has no capacity free

testNoEvent()

source code 
Test that processes acquire resource normally if no event fires

testWaitEvent1()

source code 
Test that signalled event leads to renege when resource busy

testWaitEvent2()

source code 
Test that renege-triggering event can be one of an event list

Variables Details [hide private]

__TESTING

None
Value:
False                                                                  
      

__version__

None
Value:
'1.8 $Revision: 1.1.1.27 $ $Date: 2007/01/18 14:43:59 $'               
      

version

None
Value:
'1.8 $Revision: 1.1.1.27 $ $Date: 2007/01/18 14:43:59 $'               
      

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                                                                     
      

condQ

None
Value:
[]                                                                     
      

allMonitors

None
Value:
[]                                                                     
      

allTallies

None
Value:
[]                                                                     
      

trace

None
Value:
<Instance of Trace, id 25030768:
	.tracego=1
	.end=10000000000
	.start=0
	.toTrace=['hold', 'activate', 'cancel', 'reactivate', 'passivate', 'r
equest', 'release', 'interrupt', 'terminated', 'waitevent', 'queueeven
t', 'signal', 'waituntil', 'put', 'get']
	.outfile=<epydoc.docintrospecter._DevNull instance at 0x00A515A8>
...