hbp_nrp_backend.simulation_control.simulation module

This module contains the simulation class

class hbp_nrp_backend.simulation_control.simulation.Simulation(sim_id: int, experiment_id: str, owner: str, experiment_configuration: str = 'simulation_config.json', main_script: str = 'main_script.py', state: str = 'created', private: bool = True, ctx_id: Optional[str] = None, token: Optional[str] = None)[source]

Bases: object

The class modelling simulations

DEFAULT_EXP_CONF: str = 'simulation_config.json'
DEFAULT_MAIN_SCRIPT: str = 'main_script.py'
DEFAULT_PRIVATE: bool = True
DEFAULT_STATE: str = 'created'
property creation_date

The creation date of this simulation

Returns

The creation date

property creation_datetime

The creation datetime of this simulation

Returns

The creation datetime

property ctx_id
Returns

the context ID of the simulation (collab)

property experiment_configuration

The name of the experiment configuration file of the simulation

Returns

The name of the experiment configuration file of the simulation

property experiment_id
Returns

The experiment ID used to create the experiment

property lifecycle

Gets the lifecycle of this simulation

Returns

The lifecycle instance

property main_script
Returns

The simulation main script

property mqtt_topics_prefix

Gets the prefix to any MQTT topic name of this simulation

Returns

the prefix to any MQTT topic name of this simulation

property owner

The owner of this simulation

Returns

The owner name

property private

Defines whether the simulation is based on a private experiment

Returns

A boolean defining whether the sim is private

required = ['state', 'experimentConfiguration', 'owner', 'experimentID']
required_request_fields = ['experimentID']
resource_fields = {'MQTTPrefix': <flask_restful.fields.String object>, 'creationDate': <flask_restful.fields.String object>, 'ctxId': <flask_restful.fields.String object>, 'experimentConfiguration': <flask_restful.fields.String object>, 'experimentID': <flask_restful.fields.String object>, 'mainScript': <flask_restful.fields.String object>, 'owner': <flask_restful.fields.String object>, 'simulationID': <flask_restful.fields.Integer object>, 'state': <flask_restful.fields.String object>}
property sim_id

Gets the simulation ID

property simulation_server
Returns

The simulation server instance. Might be None if Simulation hasn’t been initialized

property state

Gets the state of the simulation

Returns

The state of the simulation as a string

property token
Returns

the authorization token