Reporters

Classes:

EventLogReporter(filename[, timeunit, ...])

A reporter that heavily depends on the process prototypes (task, start_event, intermediate_event, end_event) to report on what happens.

ProcessReporter([warmup_time])

A reporter that heavily depends on the process prototypes (task, start_event, intermediate_event, end_event) to report on what happens.

Reporter()

A reporter can be passed to the simpn.simulator.SimProblem.simulate function to report on what happens during the simulator.

SimpleReporter()

A simple reporter that just prints the occurring events to the standard output.

TimeUnit(value[, names, module, qualname, ...])

An enumeration for the unit in which simulation time is measured.

WarmupReporter()

A reporter that reports on the warmup period of a simulation by computing the average cycle times over time.

class simpn.reporters.EventLogReporter(filename, timeunit=TimeUnit.MINUTES, initial_time=datetime.datetime(2020, 1, 1, 0, 0), time_format='%Y-%m-%d %H:%M:%S.%f', separator=',')

A reporter that heavily depends on the process prototypes (task, start_event, intermediate_event, end_event) to report on what happens. It stores the events that happen in an event log that can be mined with some process mining tool. As simulation time is a numerical value, some processing is done to convert simulation time into a time format that can be read and interpreted by a process mining tool. To that end, the timeunit in which simulation time is measured must be passed as well as the initial_time moment in calendar time from which the simulation time will be measured. A particular simulation_time moment will then be stored in the log as: initial_time + simulation_time timeunits. Data can also be reported on by specifying the corresponding data fields. The names of these data fields must correspond to names of data fields as they appear in the problem.

Parameters:
  • filename – the name of the file in which the event log must be stored.

  • timeunit – the TimeUnit of simulation time.

  • initial_time – a datetime value.

  • time_format – a datetime formatting string.

  • data_fields – the data fields to report in the log.

  • separator – the separator to use in the log.

Methods:

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened.

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened. It receives a timed_binding, which is a triple (binding, time, event): - binding = [(v1: SimVar, t1: SimToken), (v2: SimVar, t2: SimToken), …] of the variable values that caused the event. - time is the simulation time at which the event happened. - event: SimEvent is the event that happened.

Parameters:

timed_binding – the triple (binding, time, event) that described the event that happened with its variable values and the time at which it happened.

class simpn.reporters.ProcessReporter(warmup_time=0)

A reporter that heavily depends on the process prototypes (task, start_event, intermediate_event, end_event) to report on what happens. It assumes tasks are executed for cases that arrive via start_events and complete at end_events. It measures: - nr_started: the number of cases that started. - nr_completed: the number of cases that completed. - total_wait_time: the sum of waiting times of completed cases. - total_proc_time: the sum of processing times of completed cases. - total_cycle_time: the sum of cycle times of completed cases. - resource_busy_times: a mapping of resource_id -> the time the resource was busy during simulation.

Methods:

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened.

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened. It receives a timed_binding, which is a triple (binding, time, event): - binding = [(v1: SimVar, t1: SimToken), (v2: SimVar, t2: SimToken), …] of the variable values that caused the event. - time is the simulation time at which the event happened. - event: SimEvent is the event that happened.

Parameters:

timed_binding – the triple (binding, time, event) that described the event that happened with its variable values and the time at which it happened.

class simpn.reporters.Reporter

A reporter can be passed to the simpn.simulator.SimProblem.simulate function to report on what happens during the simulator. To this end, a reported must implement the callback function.

Methods:

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened.

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened. It receives a timed_binding, which is a triple (binding, time, event): - binding = [(v1: SimVar, t1: SimToken), (v2: SimVar, t2: SimToken), …] of the variable values that caused the event. - time is the simulation time at which the event happened. - event: SimEvent is the event that happened.

Parameters:

timed_binding – the triple (binding, time, event) that described the event that happened with its variable values and the time at which it happened.

class simpn.reporters.SimpleReporter

A simple reporter that just prints the occurring events to the standard output.

Methods:

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened.

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened. It receives a timed_binding, which is a triple (binding, time, event): - binding = [(v1: SimVar, t1: SimToken), (v2: SimVar, t2: SimToken), …] of the variable values that caused the event. - time is the simulation time at which the event happened. - event: SimEvent is the event that happened.

Parameters:

timed_binding – the triple (binding, time, event) that described the event that happened with its variable values and the time at which it happened.

class simpn.reporters.TimeUnit(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

An enumeration for the unit in which simulation time is measured.

Attributes:

DAYS

int([x]) -> integer int(x, base=10) -> integer

HOURS

int([x]) -> integer int(x, base=10) -> integer

MINUTES

int([x]) -> integer int(x, base=10) -> integer

SECONDS

int([x]) -> integer int(x, base=10) -> integer

DAYS = 4

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4 The type of the None singleton.

HOURS = 3

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4 The type of the None singleton.

MINUTES = 2

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4 The type of the None singleton.

SECONDS = 1

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4 The type of the None singleton.

class simpn.reporters.WarmupReporter

A reporter that reports on the warmup period of a simulation by computing the average cycle times over time. It assumes tasks are executed for cases that arrive via start_events and complete at end_events.

Methods:

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened.

callback(timed_binding)

A function that is invoked by a simpn.simulator.SimProblem each time a event happened. It receives a timed_binding, which is a triple (binding, time, event): - binding = [(v1: SimVar, t1: SimToken), (v2: SimVar, t2: SimToken), …] of the variable values that caused the event. - time is the simulation time at which the event happened. - event: SimEvent is the event that happened.

Parameters:

timed_binding – the triple (binding, time, event) that described the event that happened with its variable values and the time at which it happened.