CBD.tracers.baseTracer module¶
- class CBD.tracers.baseTracer.BaseTracer(uid=- 1, filename=None)[source]¶
Bases:
objectBase class for all tracers.
- Parameters
uid – A unique identifier for the tracer. Defaults to -1 (unset).
filename (str) – The name of the file to write to. When
None, the trace is written to the terminal/console. Defaults toNone.
Warning
This class contains virtual methods and should therefore only be subclassed; not instantiated.
- openFile(recover=False)[source]¶
Opens the file.
- Parameters
recover (bool) – When
True, the file needs to be recovered, i.e. it must be appended.
- startTracer(recover=False)[source]¶
Starts the tracer. The file should be opened in this function. Additionally, file headers can be written here.
- Parameters
recover (bool) – When
True, the file needs to be recovered, i.e. it must be appended.
See also
- traceNewIteration(curIt, time)[source]¶
Traces the start of a new iteration.
Note
This function must be implemented in the subclass(es)!
- Parameters
curIt (int) – The current iteration.
time (numeric) – The current simulation time.
- traceCompute(curIt, block)[source]¶
Traces the computation of a specific block.
Note
This function must be implemented in the subclass(es)!
- Parameters
curIt (int) – The current iteration.
block (CBD.Core.BaseBlock) – The block for which a compute just happened.
- trace(*text)[source]¶
Writes text to the trace file or the console. If a trace file was set, the coloring will be removed.
- Parameters
*text – The text(s) to write.
- traceln(*text)[source]¶
Writes text to the trace file, appended with a newline.
- Parameters
*text – The text(s) to write.