starling_sim.basemodel.output.output_factory

Module Contents

Classes

OutputFactory

Describes an output generation method

class starling_sim.basemodel.output.output_factory.OutputFactory

Describes an output generation method

This class should be extended to give a concrete implementation of the output generator e.g. writing a json containing all the simulation data

GENERATION_ERROR_FORMAT = 'Error while generating {} output: {}'
setup(simulation_model)

Setup method called during simulation setup.

Set values of the output factory attributes.

Parameters:

simulation_model

setup_kpi_output()

Set the kpi_outputs attribute as a list of KpiOutput objects.

By default, no KPIs are set

setup_geojson_output()

Set the geojson_output attribute as a GeojsonOutput object.

new_output_file(filepath: str, mimetype: str, compressed_mimetype: str = None, content: str = None, subject: str = None)

Add a new file and its information to the output dict.

This method should be called after generating an output file.

Parameters:
  • filepath – output file path

  • mimetype – file mimetype

  • compressed_mimetype – compressed mimetype (defaults to file mimetype)

  • content – content metadata (mandatory)

  • subject – subject

extract_simulation(simulation_model)

This method will be called for the output generation.

It must be extended to generate the output using specific methods.

generate_geojson_output(simulation_model)

Call the generation method of the geojson output attribute

Parameters:

simulation_model

generate_kpi_output(simulation_model)

Call the generation method of all the kpi outputs

Parameters:

simulation_model

generate_trace_output(simulation_model)

Generate a text file containing the event traces of the agents.

Parameters:

simulation_model

generate_run_summary(simulation_scenario)

Generate a summary file of the simulation run.

Parameters:

simulation_scenario – SimulationScenario object