pythonVariableLogger

class pythonVariableLogger.PythonVariableLogger(*a, **kw)[source]

Bases: SysModel

This a Python Module that will call one or multiple functions and store their results. After the simulation is over, these values can be retrieved.

This object is built with a dictionary of functions, and the results can be retrieved from the object using the keys of this dictionary:

log = VariableLogger({
    "a": lambda CurrentSimNanos: CurrentSimNanos**2,
    "b": lambda CurrentSimNanos: CurrentSimNanos**3,
})

# Run simulation

times        = log.times()
timesSquared = log.a
timesCubed   = log.b
clear()[source]

Called to clear the internal data storages

times()[source]

Retrieve the times when the data was logged