RetentionPolicy

class RetentionPolicy.MessageRetentionParameters(name, retainedVars)[source]

Bases: object

Represents a message’s logging parameters. :param name: name of the message recorder :param retainedVars: the message variable to record

class RetentionPolicy.RetentionPolicy(rate=10000000000)[source]

Bases: object

This policy controls what simulation data is saved and how it is stored. Note that the simulation data array will have the message time prepended as the first column.

static addRetentionPoliciesToSim(simInstance, retentionPolicies)[source]

Adds logs for variables and messages to a simInstance :param simInstance: The simulation instance to add logs to. :param retentionPolicies: RetentionPolicy[] list that defines the data to log.

static getDataForRetention(simInstance, retentionPolicies)[source]

Returns the data that should be retained given a simInstance and the retentionPolicies

Parameters:
  • simInstance – The simulation instance to retrieve data from

  • retentionPolicies – A list of RetentionPolicy objects defining the data to retain

Returns:

Retained Data in the form of a dictionary with two sub-dictionaries for messages and variables:

{
    "messages": {
        "messageName": [value1,value2,value3]
    },
    "variables": {
        "variableName": [value1,value2,value3]
    }
}

class RetentionPolicy.VariableRetentionParameters(varName, varRate, startIndex=0, stopIndex=0, varType='double')[source]

Bases: object

Represents a variable’s logging parameters.