OSVE Python Wrapper APIs

Module contents

osve.osve class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

This module contains the OSVE class that handles the simulation through AGM and EPSng.

class osve.osve.osve(if_shared_lib_path=None)[source]

Bases: object

The OSVE class intended to handle the simulation

close()[source]

Release resources used by OSVE.

This method will release and free the resources used by OSVE when using step by step execution. Returns 0 if successfull.

Return type

int

execute(root_scenario_path, session_file_path)[source]

Runs the full simulation.

This method will run the simulation with the inputs specified on the session file. All simulation steps performed in one call. Return 0 if the execution has been successful, other int otherwise. (This doesn’t mean that there are no constraints violations)

Parameters
  • root_scenario_path (str) – Provide the top level path of the scenario file_path to be used to resolve the relative paths.

  • session_file_path (str) – Provide the location and name of the session file containing all the scenarios files.

Return type

int

execute_step()[source]

Runs the simulation previously initialised.

This method will run the simulation previously initialised with the init_step method. Returns a Json string with the execution results.

Return type

str

externalConstraints = {}
get_agm_version()[source]

Returns the AGM module version.

This method will return null terminated characters string containing the version of the AGM module contained into OSVE.

Return type

str

get_app_version()[source]

Returns the OSVE Application version.

This method will return null terminated characters string containing the version of the OSVE Application version. This version is updated any time the core of the module is updated.

Return type

str

get_eps_version()[source]

Returns the EPS module version.

This method will return null terminated characters string containing the version of the EPS module contained into OSVE.

Return type

str

init_step(root_scenario_path, session_file_path)[source]

Initialise the simulation.

This method will initialise the OSVE environment for performing the simulation step by step. Returns a Json string with the initialisation results.

Parameters
  • root_scenario_path (str) – Provide the top level path of the scenario file_path to be used to resolve the relative paths.

  • session_file_path (str) – Provide the location and name of the session file containing all the scenarios files.

Return type

str

loggers = {}
register_external_constraint(ext_constraint)[source]

Registers an OSVE External Constraint

This method will include an External Constraint to the list of OSVE/AGM External Constrainst to be checked during simulation.

The ext_constraint shall be an object inheriting the ExternalConstraintAbstract class.

The external constrains are intended to incorporate customised attitude or environmental contraints to the AGM contraints checks chain performed during the simulation and slew estimation process.

Parameters

ext_constraint (An object inheriting the ExternalConstraintAbstract class.) – The OSVE/AGM External Constraint to register.

register_logger(logger)[source]

Registers an OSVE Logger object.

This method will register a logger to the list of registered loggers in OSVE.

The logger shall be an object inheriting the OsveLoggerAbstract class.

The OSVE loggers allows you to define your custom Python logging implementations by using callbacks.

Parameters

logger (An object inheriting the OsveLoggerAbstract class.) – The OSVE logger to register.

register_subscriber(subscriber)[source]

Registers an OSVE Subscriber

This method will include a Subscriber to the list of OSVE Subscribers to be notified during simulation.

The subscriber shall be an object inheriting the OsveSubscriberAbstract class.

The subscribers are intended to handle simulation status and data at simulation runtime directly from the Python code invoking the OSVE simulation.

Parameters

subscriber (An object inheriting the OsveSubscriberAbstract class.) – The OSVE Subscriber to register.

subscribers = {}
write_files(segment_timeline_json_path, segment_timeline_txt_path)[source]

Writes generated outputs.

This method will write the outputs generated by the execute_step method call. Returns a Json string with the write results.

Parameters
  • segment_timeline_json_path (str) – The file path to write the timeline in JSON format.

  • segment_timeline_txt_path (str) – The file path to write the timeline in text format.

Return type

str

write_json_log(json_log_file_path)[source]

Writes the execution log.

This method will write the execution log in JSON format, this call will clear the log buffer. Returns 0 if success.

Parameters

json_log_file_path (str) – The file path to write the log in JSON format.

Return type

int

osve.osve_cmd module

Created on September, 2023

@author: Ricardo Valles Blanco (ESAC)

This module allows to call OSVE using a command line.

osve.osve_cmd.debug()[source]

Debug: Print exception and stack trace.

osve.osve_cmd.func_signal_handler(signal, frame)[source]

Signal handler for the program.

This function handles the SIGINT signal, providing a clean exit message and information about cleanup (not yet implemented).

Parameters
  • signal (int) – The signal number.

  • frame (frame) – The current stack frame.

osve.osve_cmd.main()[source]

Entry point for processing.

This function sets up the signal handler, parses command line options, and performs the necessary operations based on the provided arguments.

osve.osve_cmd.parse_options()[source]

Parse command line options. This function allows retrieving the command line input parameters:

root_scenario_path: Provide the top level path of the scenario file_path to be used to resolve the relative paths. session_file_path: Provide the location and name of the session file containing all the scenarios files.

Returns

Argument or parameter list passed by command line.

Return type

argparse.Namespace

osve.osve_subscriber module [DEPRECATED]

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

[DEPRECATED] The OsveSubscriber class intended to provide on the fly simulation status and data to the main OSVE caller program.

class osve.osve_subscriber.Callback[source]

Bases: Structure

jsonStr

Structure/Union member

class osve.osve_subscriber.ExternalConstraintAbstract(id)[source]

Bases: object

[DEPRECATED] The ExternalConstraintAbstract class intended to provide control over the attitude checking processes performed by AGM. The class ExternalConstraintAbstract is deprecated, use osve.subscribers.ExternalConstraintAbstract instead.

abstract cleanup()[source]

This callback function is called by AGM to notify external constraints that all computed and temporary data shall be cleaned up.

abstract configureConstraintChecks() int[source]
This callback function is called by AGM to notify external constraints

to load and validate it’s specific configuration. To abort execution return an integer smaller than zero.

Return type

int

abstract getInError(skipChecks, showMessages, checkConstraints, breakFound) int[source]
This callback function is called by AGM at the end of every timestep to

check if any constraint has been violated. In this case this external constrain shall returns an integer greater than 0 then OSVE will consider that this external constrain has violations, otherwise not.

Parameters
  • skipChecks (bool) – Indicates if constraint checks shall be skipped or not, depends on the simulation stage.

  • showMessages (bool) – Indicates if the external constaints shall do logging or not, depends on the simulation stage.

  • checkConstraints (int) – Defines the way constraints are checked during the update of the timeline at each current time. 0 => NONE: No constraints are checked at all. 1 => ALWAYS: Constraints are checked for every call as if it was the first time (no memory). 2 => CONTINUOUS: Constraints are checked assuming the calls are continuous in time (with memory).

  • breakFound (bool) – Indicates if the external constaints if there are any contraint violated at current time.

Return type

int

id = ''
abstract notifyEnvironmentInitialised() int[source]
This callback function is called by AGM to notify external constraints

to that everything looks ready to start simulation. To abort execution return an integer smaller than zero.

Return type

int

abstract resetConstraintFlags()[source]

This callback function is called by AGM to notify external constraints that all the flagged constraints shall be resetted.

step = 'UNKNOWN'
abstract update(time, sc_quats) int[source]
This callback function is called by AGM to notify external constraints

that spacecraft attitude data has been updated and constraints shall be reevaluated. To abort execution return an integer smaller than zero.

Parameters
  • time (str) – The current time in format: YYYY-MM-DDTHH:mm:SSZ

  • sc_quats (list of double) – The spacecracft quaternions relative to J2000

Return type

int

class osve.osve_subscriber.OsveEventSubscriber(id, onEventStateChangedFn)[source]

Bases: OsveSubscriberAbstract

[DEPRECATED] The OsveEventSubscriber class is an implementation of the OsveSubscriberAbstract intended to let the developer an easy handling of the OSVE Events. The developer just needs to specify the datapack Id and a callback function to be called everytime an event is risen. See OsveEventSubscriber.__init__() documentation for more details. The class OsveEventSubscriber is deprecated, use osve.subscribers.OsveEventSubscriber instead.

onEventStateChanged(data) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the event properties.

Return type

int

onEventStateChangedFn = None
class osve.osve_subscriber.OsveLoggerAbstract(id)[source]

Bases: object

[DEPRECATED] The OsveLoggerAbstract class intended to provide runtime access to logging messages reported by OSVE. The class OsveLoggerAbstract is deprecated, use osve.subscribers.OsveLoggerAbstract instead.

id = ''
abstract onMsgReceived(severity, module, time, text)[source]
class osve.osve_subscriber.OsvePtrAbstract(id)[source]

Bases: OsveSubscriberAbstract, OsveLoggerAbstract

[DEPRECATED] The OsvePtrAbstract class intended to provide on the fly simulation status and data to the main OSVE caller program but in this case the data will be provided grouped by PTR Block, and reported every time a block ends. This class shall be inherited by a child class tht must implement/override the OsvePtrAbstract abstract methods. The class OsvePtrAbstract is deprecated, use osve.subscribers.OsvePtrAbstract instead.

block_events = []
block_logs = []
block_steps = []
current_block = ''
onEventStateChanged(data) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

eventData (dict) – Dictionary that contains the event properties.

Return type

int

onMsgReceived(severity, module, time, text)[source]
abstract onPtrBlockEnd(blockData) int[source]
This callback function is called every time a PTR block execution is

finished. It provides as an argument a dictionary with the every timestep data, risen events and logs. If returned int is smaller than 0 then simulation is aborted.

Parameters

blockData (dict) – Dictionary that contains the produced block data.

Return type

int

abstract onPtrBlockStart(blockData) int[source]
This callback function is called every time a PTR block execution is

started. It provides as an argument a dictionary with the every timestep data, risen events and logs. If returned int is smaller than 0 then simulation is aborted.

Parameters

blockData (dict) – Dictionary that contains the some block data.

Return type

int

onSimulationEnd(data) int[source]
This callback function is called every time that a simulation finishes.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the simulation end time.

Return type

int

onSimulationPtrBlockEnd(data) int[source]
This callback function is called every time a PTR block execution is

finished. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the block start date of the finished block.

Return type

int

onSimulationPtrBlockStart(data) int[source]
This callback function is called every time a PTR block execution is

started. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains some block data of the started block.

Return type

int

onSimulationStart(data) int[source]
This callback function is called every time a simulation started.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and unit’s.

Return type

int

onSimulationTimeStep(data) int[source]
This callback function is called every time a time step has been simulated.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and values.

Return type

int

on_simulation = False
reset()[source]
class osve.osve_subscriber.OsveSubscriberAbstract(id)[source]

Bases: object

[DEPRECATED] The OsveSubscriberAbstract class intended to provide on the fly simulation status and data to the main OSVE caller program. This class shall be inherited by a child class tht must implement/override the OsveSubscriberAbstract abstract methods. The class OsveSubscriberAbstract is deprecated, use osve.subscribers.OsveSubscriberAbstract instead.

id = ''
abstract onEventStateChanged(eventData) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

eventData (dict) – Dictionary that contains the event properties.

Return type

int

abstract onSimulationEnd(data) int[source]
This callback function is called every time that a simulation finishes.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the simulation end time.

Return type

int

abstract onSimulationPtrBlockEnd(data) int[source]
This callback function is called every time a PTR block execution is

finished. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the block start date of the finished block.

Return type

int

abstract onSimulationPtrBlockStart(data) int[source]
This callback function is called every time a PTR block execution is

started. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains some block data of the started block.

Return type

int

abstract onSimulationStart(data) int[source]
This callback function is called every time a simulation started.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and unit’s.

Return type

int

abstract onSimulationTimeStep(data) int[source]
This callback function is called every time a time step has been simulated.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and values.

Return type

int

osve.utils module

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

This module contains different utility functions for OSVE.

osve.utils.build_lib_path()[source]

Returns the path of the OSVE library included in the OSVE Python package depending on the OS platform.

Returns

The path of the OSVE library.

Return type

str

osve.utils.get_platform()[source]

Returns a string with the current platform (system and machine architecture).

This function attempts to improve upon sysconfig.get_platform by fixing some issues when running a Python interpreter with a different architecture than that of the system (e.g., 32-bit on 64-bit system or a multiarch build), which should return the machine architecture of the currently running interpreter rather than that of the system (which didn’t seem to work properly). The reported machine architectures follow platform-specific naming conventions (e.g., “x86_64” on Linux, but “x64” on Windows).

Example output strings for common platforms:

darwin_(ppc|ppc64|i368|x86_64|arm64) linux_(i686|x86_64|armv7l|aarch64) windows_(x86|x64|arm32|arm64)

Returns

The platform string.

Return type

str

osve.utils.get_version(version_file, version_key)[source]

Returns the version string referenced by a version_key contained in a version_file.

Parameters
  • version_file (str) – The file containing version information.

  • version_key (str) – The key to identify the version.

Returns

The version string.

Return type

str

osve.eps_utils module

Created on June, 2025

@author: Ricardo Valles Blanco (ESAC)

This module contains some functions to handle EPS input or output files.

OSVE_OVERLAYS: Constant with predefined overlay sets for fast OSVE datapack creation

All overlays are implemented as lists of overlay maps. This allows developers to extend the current datapack fields list directly with one line of code.

Supported overlay sets: POWER, ATT_QUAT, BODY_RATE, WMM_WHL_TORQUE.

Example

datapack = create_empty_datapack("blabla.csv", timeStep=10, precision=7)
datapack["fields"].extend(OSVE_OVERLAYS["ATT_QUAT"])
datapack["fields"].extend(OSVE_OVERLAYS["BODY_RATE"])
datapack["fields"].extend(OSVE_OVERLAYS["WMM_WHL_TORQUE"])

local_session_file_path = "ABSOLUTE PATH TO YOUR LOCAL OSVE SESSION FILE"
session = load_session_file(local_session_file_path)
session["sessionConfiguration"]["outputFiles"]["dataPacks"].append(datapack)
save_session_file(local_session_file_path, session)
osve.eps_utils.create_empty_callback_datapack(id, timeStep=30, precision=1)[source]

Returns an empty datapack object of type CALLBACK.

Parameters
  • id (str) – String with the Id of the CALLBACK datapack.

  • timeStep (int) – Time resolution of the datapack in seconds.

  • precision (int) – Default datapack numeric representation precission.

Returns

Returns an empty datapack with the specified parameters.

Return type

dict

osve.eps_utils.create_empty_datapack(file_path, timeStep=30, precision=1)[source]

Returns an empty datapack object.

Parameters
  • file_path (str) – File path where to store the datapack.

  • timeStep (int) – Time resolution of the datapack in seconds.

  • precision (int) – Default datapack numeric representation precission.

Returns

Returns an empty datapack with the specified parameters.

Return type

dict

osve.eps_utils.extract_files(file_path, basepath, is_recursive=False)[source]

Returns a JSON with the whole files hierarchy including the ones referenced by “Include_file:” keyword in the EDFs or ITLs

Parameters
  • file_path (str) – Path to EDF or ITL file.

  • basepath (str) – Base path of the ITL or EDF file.

  • is_recursive (bool) – Flag to detect if comes from recursion or not. By default is False.

Returns

Returns a dict with a tree structure with the files hierarchy.

Return type

dict

osve.eps_utils.extract_modelling(edf_path, basepath)[source]

Returns a JSON detailing the EPS Experiments model from an EDF file

Parameters
  • edf_path (str) – Path to EDF file.

  • basepath (str) – Base path of the EDF file.

Returns

Returns a JSON detailing the EPS Experiments model from an EDF file

Return type

dict

osve.eps_utils.get_exp_power_overlays(eps_modelling)[source]

Given an eps_modelling object obtained with eps_utils.extract_modelling(), returns a list with all the experiment’s power overlays.

Parameters

eps_modelling (dict) – eps_modelling object returned by eps_utils.extract_modelling().

Returns

Returns a list with all the experiment’s power overlays.

Return type

list

osve.eps_utils.get_experiment_module_power_overlay(experiment_name, module_name)[source]

Returns the experiment’s module’s power consumption overlay.

Parameters

experiment_name (str) – The EPS experiment’s name.

Returns

Returns the experiment’s module’s power consumption overlay.

Return type

dict

osve.eps_utils.get_experiment_overlay(experiment_name, overlay_id)[source]

Returns an overlay given an experiment’s name and an overlay id.

Parameters
  • experiment_name (str) – The EPS experiment’s name.

  • overlay_id (str) – A supported OSVE Overlay Id.

Returns

Returns an overlay with requested values.

Return type

dict

osve.eps_utils.get_experiment_power_overlay(experiment_name)[source]

Returns the experiment’s power consumption overlay.

Parameters

experiment_name (str) – The EPS experiment’s name.

Returns

Returns the experiment’s power consumption overlay.

Return type

dict

osve.eps_utils.print_files_map(files_map, indent='   ', carry_indent='')[source]

Prints in a formated way the files map returned by extract_files()

Parameters
  • files_map – Dict with the data returned by eps_utils.extract_files()

  • indent (str) – String with the indentation characters offset.

  • carry_indent (str) – String with the indentation characters offset accumulated at this level.

osve.eps_utils.read_all_files(file_path, basepath)[source]

Returns a string with the contents of all the files including the ones referenced by “Include_file:” keyword in the EDFs or ITLs

Parameters
  • file_path (str) – Path to EDF or ITL file.

  • basepath (str) – Base path of the ITL or EDF file.

Returns

Returns a string with the appended contents of all referenced files.

Return type

dict

osve.session_file module

Created on June, 2025

@author: Ricardo Valles Blanco (ESAC)

This module contains some functions to handle OSVE Session files

osve.session_file.get_base_path(rel_path, root_path)[source]

Returns a the absolute path of an OSVE relative path with a given root path.

Parameters
  • rel_path (str) – Absolute or relative path to a scenario path.

  • root_path (str) – OSVE scenario root path.

Returns

Returns the absolute path of a given scenario relative path.

Return type

str

osve.session_file.get_datapacks_from_session_file(session_file_path)[source]

Returns the list of datapack objects defined in a session file.

Parameters

session_file_path (str) – Relative or absolute path of session file to load.

Returns

List of datapack objects defined in the session file.

Return type

list

osve.session_file.get_kernels_to_load(session_file_path, root_scenario_path)[source]

Returns a list of absolute paths with the SPICE kernels to be loaded from a session file.

Parameters
  • session_file_path (str) – Relative or absolute path of session file to take kernels to load.

  • root_scenario_path (str) – Relative or absolute path of the root folder of the scenario.

Returns

List of absolute paths with the SPICE kernels to be loaded.

Return type

list

osve.session_file.get_path_from_session_file(file_key, session_file_path, root_scenario_path)[source]

Returns the absolute path of any file specified in session file.

Parameters
  • file_key (str) – File key as specified in the session file, for example: “ageConfigFileName”, “xmlPtrPath”, “edfFileName”, “mgaDataFilePath”..

  • session_file_path (str) – Relative or absolute path of session file to take the file path.

  • root_scenario_path (str) – Relative or absolute path of the root folder of the scenario.

Returns

Tuple [str, str], The file absolute path and the base path in case of file_key is found, None if not found.

Return type

list

osve.session_file.load_session_file(session_file_path)[source]

Loads a session file from a given path.

Parameters

session_file_path (str) – Relative or absolute path of session file to load.

Returns

Returns a dictionay with the loaded session file data.

Return type

dict

osve.session_file.remove_local_session_file(local_session_file)[source]

Removes a “local” session file.

Parameters

local_session_file (str) – Path of the “local” session file to be removed.

osve.session_file.save_datapack_in_session_file(session_file_path, datapack)[source]

Saves a datapack object in the datapacks list of a session file.

A Datapack object is basically a dict object with specified keys and proper values as specified in Session File’s datapacks declaration documentation.

Parameters
  • session_file_path (str) – Relative or absolute path of session where to save the datapack.

  • datapack (dict) – Datapack object to be saved.

osve.session_file.save_session_file(session_file_path, session)[source]

Saves dictionay with the session file data into a given session file path.

Parameters
  • session_file_path (str) – Relative or absolute path where to save the session file data.

  • session (dict) – Dictionay with the session file data to be saved.

osve.session_file.show_report(session_file_path, root_scenario_path)[source]

Prints a report with the details of the session file configuration settings.

Parameters
  • session_file_path (str) – Relative or absolute path of session file to load.

  • root_scenario_path (str) – Relative or absolute path of the root folder of the scenario.

osve.session_file.write_local_mk(mk_path, kernels_path)[source]

[DEPRECATED] Use JUICE SPICE Git Hooks instead. See: https://s2e2.cosmos.esa.int/bitbucket/projects/SPICE_KERNELS/repos/juice/browse/misc/git_hooks/skd_post_merge

Writes a local SPICE Meta-Kernel by copying and replacing (..) with a given kernels_path.

Parameters
  • mk_path (str) – Path to the Meta-kernel to copy from.

  • kernels_path (str) – Absolute path to the “kernels” path of the SPICE Kernels Dataset.

Returns

Tuple [bool, str], the creation success status flag and the path to the local Meta-Kernel.

Return type

list

osve.session_file.write_local_session_file(relative_session_file, JUICE_REPO, KERNELS_JUICE)[source]

Creates a “local” session file, with all the “path variables” replaced by the local user paths.

Parameters
  • relative_session_file (str) – Relative of generic session file. So the one with variables to replace in it’s contents.

  • JUICE_REPO (str) – Absolute path to the JUICE scenarios repository, such us JUICE_OPS, JUICE_PREOPS or JUICE_VV absolute paths.

  • KERNELS_JUICE (str) – Absolute path to the ‘kernels’ folder of the JUICE SPICE Kernel Dataset.

Returns

Returns the path of the created local session file.

Return type

str

OSVE Simulation Subscribers

osve.subscribers.external_constraint_abstract class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

The ExternalConstraintAbstract class intended to provide control over the attitude checking processes performed by AGM

class osve.subscribers.external_constraint_abstract.ExternalConstraintAbstract(id)[source]

Bases: object

The ExternalConstraintAbstract class intended to provide control over the attitude checking processes performed by AGM

abstract cleanup()[source]

This callback function is called by AGM to notify external constraints that all computed and temporary data shall be cleaned up.

abstract configureConstraintChecks() int[source]
This callback function is called by AGM to notify external constraints

to load and validate it’s specific configuration. To abort execution return an integer smaller than zero.

Returns

Returns an integer with the callback handling status: (ret >= 0) -> Continue, (ret < 0) -> Abort simulation.

Return type

int

abstract getInError(skipChecks, showMessages, checkConstraints, breakFound) int[source]
This callback function is called by AGM at the end of every timestep to

check if any constraint has been violated. In this case this external constrain shall returns an integer greater than 0 then OSVE will consider that this external constrain has violations, otherwise not.

Parameters
  • skipChecks (bool) – Indicates if constraint checks shall be skipped or not, depends on the simulation stage.

  • showMessages (bool) – Indicates if the external constaints shall do logging or not, depends on the simulation stage.

  • checkConstraints (int) – Defines the way constraints are checked during the update of the timeline at each current time. 0 => NONE: No constraints are checked at all. 1 => ALWAYS: Constraints are checked for every call as if it was the first time (no memory). 2 => CONTINUOUS: Constraints are checked assuming the calls are continuous in time (with memory).

  • breakFound (bool) – Indicates if the external constaints if there are any contraint violated at current time.

Returns

Returns an integer with the callback handling status: (ret > 0) -> Contraint Violation, (ret <= 0) -> Continue.

Return type

int

id = ''
abstract notifyEnvironmentInitialised() int[source]
This callback function is called by AGM to notify external constraints

to that everything looks ready to start simulation. To abort execution return an integer smaller than zero.

Returns

Returns an integer with the callback handling status: (ret >= 0) -> Continue, (ret < 0) -> Abort simulation.

Return type

int

abstract resetConstraintFlags()[source]

This callback function is called by AGM to notify external constraints that all the flagged constraints shall be resetted.

step = 'UNKNOWN'
abstract update(time, sc_quats) int[source]
This callback function is called by AGM to notify external constraints

that spacecraft attitude data has been updated and constraints shall be reevaluated. To abort execution return an integer smaller than zero.

Parameters
  • time (str) – The current time in format: YYYY-MM-DDTHH:mm:SSZ

  • sc_quats (list of double) – The spacecracft quaternions relative to J2000

Returns

Returns an integer with the callback handling status: (ret >= 0) -> Continue, (ret < 0) -> Abort simulation.

Return type

int

osve.subscribers.osve_datapack class

osve.subscribers.osve_event_subscriber class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

The OsveEventSubscriber class is an implementation of the OsveSubscriberAbstract intended to let the developer an easy handling of the OSVE Events

class osve.subscribers.osve_event_subscriber.OsveEventSubscriber(id, onEventStateChangedFn)[source]

Bases: OsveSubscriberAbstract

The OsveEventSubscriber class is an implementation of the OsveSubscriberAbstract intended to let the developer an easy handling of the OSVE Events. The developer just needs to specify the datapack Id and a callback function to be called everytime an event is risen. See OsveEventSubscriber.__init__() documentation for more details.

onEventStateChanged(data) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the event properties.

Return type

int

onEventStateChangedFn = None

osve.subscribers.osve_idle_subscriber class

Created on June, 2025

@author: Ricardo Valles Blanco (ESAC)

The OsveIdleSubscriber class intended to provide a way to IGNORE callbacks from OSVE when running a session_file with CALLBACKS datapacks but the user wants to avoid their implementation.

class osve.subscribers.osve_idle_subscriber.OsveIdleSubscriber(id)[source]

Bases: OsveSubscriberAbstract

The OsveIdleSubscriber class intended to provide a way to IGNORE callbacks from OSVE when running a session_file with CALLBACKS datapacks but the user wants to avoid their implementation.

id = ''
onEventStateChanged(data) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

eventData (dict) – Dictionary that contains the event properties.

Return type

int

onMsgReceived(severity, module, time, text)[source]
onSimulationEnd(data) int[source]
This callback function is called every time that a simulation finishes.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the simulation end time.

Return type

int

onSimulationPtrBlockEnd(data) int[source]
This callback function is called every time a PTR block execution is

finished. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the block start date of the finished block.

Return type

int

onSimulationPtrBlockStart(data) int[source]
This callback function is called every time a PTR block execution is

started. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains some block data of the started block.

Return type

int

onSimulationStart(data) int[source]
This callback function is called every time a simulation started.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and unit’s.

Return type

int

onSimulationTimeStep(data) int[source]
This callback function is called every time a time step has been simulated.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and values.

Return type

int

osve.subscribers.osve_logger_abstract class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

The OsveLoggerAbstract class intended to provide runtime access to logging messages reported by OSVE

class osve.subscribers.osve_logger_abstract.OsveLoggerAbstract(id)[source]

Bases: object

The OsveLoggerAbstract class intended to provide runtime access to logging messages reported by OSVE

id = ''
abstract onMsgReceived(severity, module, time, text)[source]

Abstract method onMsgReceived() to be implemented by child class to handle the message to log.

Parameters
  • severity (str) – Message severity.

  • module (str) – The OSVE Module that produces the message.

  • time (str) – Sting with a formated date.

  • text (str) – Message text to log.

Returns

Returns 0

Return type

int

osve.subscribers.osve_ptr_abstract class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

The OsveSubscriber class intended to provide on the fly simulation status and data to the main OSVE caller program.

class osve.subscribers.osve_ptr_abstract.OsvePtrAbstract(id)[source]

Bases: OsveSubscriberAbstract, OsveLoggerAbstract

The OsvePtrAbstract class intended to provide on the fly simulation status and data to the main OSVE caller program but in this case the data will be provided grouped by PTR Block, and reported every time a block ends. This class shall be inherited by a child class tht must implement/override the OsvePtrAbstract abstract methods.

block_events = []
block_logs = []
block_steps = []
current_block = ''
onEventStateChanged(data) int[source]

Called every time an OSVE Event status has changed.

Parameters

data (dict) – Event data.

Returns

Returns 0.

Return type

int

onMsgReceived(severity, module, time, text)[source]

onMsgReceived() will handle the messages sent for logging.

Parameters
  • severity (str) – Message severity.

  • module (str) – The OSVE Module that produces the message.

  • time (str) – Sting with a formated date.

  • text (str) – Message text to log.

Returns

Returns 0

Return type

int

abstract onPtrBlockEnd(blockData) int[source]
This callback function is called every time a PTR block execution is

finished. It provides as an argument a dictionary with the every timestep data, risen events and logs. If returned int is smaller than 0 then simulation is aborted.

Parameters

blockData (dict) – Dictionary that contains the produced block data.

Returns

Returns 0

Return type

int

abstract onPtrBlockStart(blockData) int[source]
This callback function is called every time a PTR block execution is

started. It provides as an argument a dictionary with the every timestep data, risen events and logs. If returned int is smaller than 0 then simulation is aborted.

Parameters

blockData (dict) – Dictionary that contains the some block data.

Returns

Returns 0

Return type

int

onSimulationEnd(data) int[source]

Called once simulation is finished.

Parameters

data (dict) – Simulation finish event data.

Returns

Returns 0.

Return type

int

onSimulationPtrBlockEnd(data) int[source]
Called on every PTR Block end during simulation, this method will store the recollected block data and then

notify that the current PTR block has ended.

Parameters

data (dict) – Block end data.

Returns

Returns 0.

Return type

int

onSimulationPtrBlockStart(data) int[source]

Called on every PTR Block start during simulation, this method will notify that a new PTR block has started.

Parameters

data (dict) – Block start data.

Returns

Returns 0.

Return type

int

onSimulationStart(data) int[source]

Called once simulation is started.

Parameters

data (dict) – Simulation start event data.

Returns

Returns 0.

Return type

int

onSimulationTimeStep(data) int[source]

Called on every OSVE simulation time step, this method will store the requested OSVE simulation data into the block steps.

Parameters

data (dict) – Simulation step data.

Returns

Returns 0.

Return type

int

on_simulation = False
reset()[source]

This will clear all the status data of the OsvePtrAbstract object.

osve.subscribers.osve_ptr_logger class

Created on June, 2025

@author: Ricardo Valles Blanco (ESAC)

The OsvePtrLogger class intended to provide the OSVE logs grouped by PTR Block. Note it requires AGM/AGE simulation in order to work.

class osve.subscribers.osve_ptr_logger.OsvePtrLogger(id)[source]

Bases: OsvePtrAbstract

The OsvePtrLogger class intended to provide the OSVE logs grouped by PTR Block. Note it requires AGM/AGE simulation in order to work.

blocks_data = []
log(verbose=False)[source]

This function will produce an OSVE simulation log but in this case the logs will be grouped by PTR block designer.

Parameters

verbose (bool) – True for verbose output logs.

Returns

Returns a dictionary with the logs grouped by designer.

Return type

dict

onPtrBlockEnd(blockData) int[source]

This function will be called every PTR block end, and will store the blockData to the list of already stored blocks_data.

Parameters

blockData (dict) – Dictionary that contains the produced block data.

Returns

Returns 0

Return type

int

osve.subscribers.osve_subscriber_abstract class

Created on July, 2023

@author: Ricardo Valles Blanco (ESAC)

The OsveSubscriberAbstract class intended to provide on the fly simulation status and data to the main OSVE caller program.

class osve.subscribers.osve_subscriber_abstract.Callback[source]

Bases: Structure

jsonStr

Structure/Union member

class osve.subscribers.osve_subscriber_abstract.OsveSubscriberAbstract(id)[source]

Bases: object

The OsveSubscriberAbstract class intended to provide on the fly simulation status and data to the main OSVE caller program. This class shall be inherited by a child class tht must implement/override the OsveSubscriberAbstract abstract methods.

id = ''
abstract onEventStateChanged(eventData) int[source]
This callback function is called every time that an OSVE event is risen.

If returned int is smaller than 0 then simulation is aborted.

Parameters

eventData (dict) – Dictionary that contains the event properties.

Return type

int

abstract onSimulationEnd(data) int[source]
This callback function is called every time that a simulation finishes.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the simulation end time.

Return type

int

abstract onSimulationPtrBlockEnd(data) int[source]
This callback function is called every time a PTR block execution is

finished. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the block start date of the finished block.

Return type

int

abstract onSimulationPtrBlockStart(data) int[source]
This callback function is called every time a PTR block execution is

started. If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains some block data of the started block.

Return type

int

abstract onSimulationStart(data) int[source]
This callback function is called every time a simulation started.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and unit’s.

Return type

int

abstract onSimulationTimeStep(data) int[source]
This callback function is called every time a time step has been simulated.

If returned int is smaller than 0 then simulation is aborted.

Parameters

data (dict) – Dictionary that contains the selected ovelay name’s and values.

Return type

int