Package SimPy :: Module Simulation :: Class Monitor
[hide private]
[frames] | no frames]

Class Monitor

source code

object --+    
         |    
      list --+
             |
            Monitor

Monitored variables

A Class for monitored variables, that is, variables that allow one to gather simple statistics. A Monitor is a subclass of list and list operations can be performed on it. An object is established using m= Monitor(name = '..'). It can be given a unique name for use in debugging and in tracing and ylab and tlab strings for labelling graphs.

Instance Methods [hide private]
  __init__(self, name='a_Monitor', ylab='y', tlab='t')
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  setHistogram(self, name='', low=0.0, high=100.0, nbins=10)
Sets histogram parameters.
  observe(self, y, t=None)
record y and t
  tally(self, y)
deprecated: tally for backward compatibility
  accum(self, y, t=None)
deprecated: accum for backward compatibility
  reset(self, t=None)
reset the sums and counts for the monitored variable
  tseries(self)
the series of measured times
  yseries(self)
the series of measured values
  count(self)
deprecated: the number of observations made
  total(self)
the sum of the y
  mean(self)
the simple average of the monitored variable
  var(self)
the sample variance of the monitored variable
  timeAverage(self, t=None)
the time-average of the monitored variable.
  histogram(self, low=0.0, high=100.0, nbins=10)
A histogram of the monitored y data values.
  getHistogram(self)
Returns a histogram based on the parameters provided in preceding call to setHistogram.
  printHistogram(self, fmt="%s")
Returns formatted frequency distribution table string from Monitor.

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __hash__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __rmul__, __setitem__, __setslice__, append, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, name='a_Monitor', ylab='y', tlab='t')
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: list.__init__
(inherited documentation)

setHistogram(self, name='', low=0.0, high=100.0, nbins=10)

source code 
Sets histogram parameters. Must be called before call to getHistogram

observe(self, y, t=None)

source code 
record y and t

tally(self, y)

source code 
deprecated: tally for backward compatibility

accum(self, y, t=None)

source code 
deprecated: accum for backward compatibility

reset(self, t=None)

source code 
reset the sums and counts for the monitored variable

tseries(self)

source code 
the series of measured times

yseries(self)

source code 
the series of measured values

count(self)

source code 
deprecated: the number of observations made
Returns:
integer

Overrides: list.count

total(self)

source code 
the sum of the y

mean(self)

source code 
the simple average of the monitored variable

var(self)

source code 
the sample variance of the monitored variable

timeAverage(self, t=None)

source code 

the time-average of the monitored variable.

If t is used it is assumed to be the current time, otherwise t = now()

histogram(self, low=0.0, high=100.0, nbins=10)

source code 
A histogram of the monitored y data values.

getHistogram(self)

source code 
Returns a histogram based on the parameters provided in preceding call to setHistogram.

printHistogram(self, fmt="%s")

source code 
Returns formatted frequency distribution table string from Monitor. Precondition: setHistogram must have been called. fmt==format of bin range values