starling_sim.basemodel.trace.trace

This module contains the classes dedicated to trace agent activities during the simulation. Events describes different kind of traced activities and are generated during the simulation.

/!It is should be mentioned that the event objects store in the trace point to objects that may be modified by the end of the simulation. For instance, given a GenerationEvent, display the ‘position’ attribute of the generated agent at the end of the simulation will output its final position in the simulation, and not its origin.

Module Contents

Classes

Trace

This class represents the trace of a simulation element

Traced

This class represents a traced element of the simulation

Functions

trace_simulation_end(simulation_model)

Adds a LeaveSimulationEvent with cause end of simulation to

class starling_sim.basemodel.trace.trace.Trace

This class represents the trace of a simulation element

It contains events that describe their states and actions

add_event(event)
Parameters:

event – Event object, describing the traced event

Returns:

class starling_sim.basemodel.trace.trace.Traced(element_id)

This class represents a traced element of the simulation

Other classes may extend it to be able to trace their actions

__str__()

Give a string display to the simulation element

__repr__()

Give a string display to the simulation element

trace_event(event)

Adds a Event to the trace, with the current timestamp :param event: Traced event :return:

log_message(message, lvl=AGENT_LEVEL)

Logs the message in the logger using the class data

Parameters:
  • message – Message displayed in agent log

  • lvl – level value, default is AGENT_LEVEL

starling_sim.basemodel.trace.trace.trace_simulation_end(simulation_model)

Adds a LeaveSimulationEvent with cause end of simulation to all agents that didn’t leave during the simulation.