pypdevsbbl.tracers.StatisticsTracer module

This file contains the tracer for statistical data.

class pypdevsbbl.tracers.StatisticsTracer.StatisticsTracer(uid, server, filename, inports, outports)[source]

Bases: pypdevsbbl.tracers.BaseTracer

Gathers information about the messages in a (sub)model.

It can compute:
  • The average time of messages in the system.
  • The average amount of messages in the system for a certain time period.
  • The (amount of) messages that entered the system.
  • The (amount of) messages that left the system.
  • The (amount of) messages that were newly generated.
  • The (amount of) messages that were discarded or left behind.

The internal depiction of a message is a tiplet: (message, arrival time, departure time).

Note

The tracer makes use of the id() function to determine which message entered and left. When your messages may change order (when using a different queueing discipline or so), make sure the messages can be uniquely identified afterwards.

It would also be non-sensical to have a pypdevsbbl.generic.generators.ConstantGenerator generate a single value and change the order in which they arrive. All messages are the same, so how would you determine they have a different order of arrival?

Parameters:
  • uid – A unique identifier for distributed simulation. Will be set automatically.
  • server – The server that runs the distributed simulation. Will be set automatically.
  • filename (str) – The name of the file to write the results to. When None, all results will be written to the standard output.
  • inports (list) – A list of the input ports to listen on for events that enter the system. These may be ports of a coupled DEVS.
  • outports (list) – A list of the output ports to listen on for events that leave the system. These may be ports of a coupled DEVS.
startTracer(recover)[source]
stopTracer()[source]
traceExternal(aDEVS)[source]

Trace messages that enter the system.

traceInternal(aDEVS)[source]

Trace messages that leave the system.

summary(prefix='\t')[source]

Gets the current stats as a string.

average_time_in_system()[source]

Reports the average time a message remained in the system.

Note

This ignores all newly created and bequeathed messages.

average_num(dx=1.0, start=0, end=None)[source]

Reports the average amount of messages for a certain time period.

Note

This ignores all newly created and bequeathed messages.

Parameters:
  • dx (numeric) – The time period to look over. Defaults to 1.
  • start (numeric) – The point in time to start measuring from. When None, it will use the first seen arrival as a starting point. Defaults to 0 (= usually the start of the simulation).
  • end (numeric) – The point in time to end measuring at. When None, it will use the last seen departure as an end point. This point is inclusive in the range. Defaults to None.
entries()[source]

Reports all messages that entered the system.

n_entries()[source]

Reports the amount of messages that entered the system.

exits()[source]

Reports all messages that left the system.

n_exits()[source]

Reports the amount of messages that left the system.

passed()[source]

Reports all messages that passed through the system.

n_passed()[source]

Reports the amount of messages that passed through the system.

new()[source]

Reports all messages that were generated in the submodel.

n_new()[source]

Reports the amount of messages that were generated in the submodel.

bequeathed()[source]

Reports all messages that were dropped or left behind in the submodel.

n_bequeathed()[source]

Reports the amount of messages that were dropped or left behind in the submodel.

forgotten()

Alias for bequeathed(), because, although less accurate, it is easier to remember.

n_forgotten()

Alias for n_bequeathed(), because, although less accurate, it is easier to remember.