SimulationBaseClass

class SimulationBaseClass.EventHandlerClass(eventName, eventRate=1000000000, eventActive=False, conditionList=[], actionList=[])[source]

Bases: object

Event Handler Class

class SimulationBaseClass.LogBaseClass(ReplaceName, LogPeriod, RefFunction, DataCols=1)[source]

Bases: object

Logging Base class

class SimulationBaseClass.SimBaseClass[source]

Bases: object

Simulation Base Class

AddModelToTask(TaskName, NewModel, ModelData=None, ModelPriority=- 1)[source]

This function is responsible for passing on the logger to a module instance (model), adding the model to a particular task, and defining the order/priority that the model gets updated within the task.

Parameters
  • (str) (TaskName) – Name of the task

  • (obj) (NewModel) – Model to add to the task

  • ModelData – None or struct containing, only used for C BSK modules

  • (int) (ModelPriority) – Priority that determines when the model gets updated. (Higher number = Higher priority)

Returns

AddVariableForLogging(VarName, LogPeriod=0, StartIndex=0, StopIndex=0, VarType=None)[source]

Informs the sim to log a particular variable within a message

Parameters
  • VarName – must be module tag string + period + variable name

  • LogPeriod – update rate at which to record the variable [ns]

  • StartIndex – starting index if the variable is an array

  • StopIndex – end index if the variable is an idea

  • VarType

Returns

ConfigureStopTime(TimeStop)[source]

Set the simulation stop time in nano-seconds.

CreateNewProcess(procName, priority=- 1)[source]

Creates a process and adds it to the sim

Parameters
  • (str) (procName) – Name of process

  • (int) (priority) – Priority that determines when the model gets updated. (Higher number = Higher priority)

Returns

simulationArchTypes.ProcessBaseClass object

CreateNewPythonProcess(procName, priority=- 1)[source]

Creates the python analog of a sim-level process, that exists only on the python level in self.pyProcList

Parameters
  • (str) (procName) – Name of process

  • (int) (priority) – Priority that determines when the model gets updated. (Higher number = Higher priority)

Returns

simulationArchTypes.PythonProcessClass object

CreateNewTask(TaskName, TaskRate, InputDelay=0, FirstStart=0)[source]

Creates a simulation task on the C-level with a specific update-frequency (TaskRate), an optional delay, and an optional start time.

Parameters
  • (str) (TaskName) – Name of Task

  • (int) (FirstStart) – Number of nanoseconds to elapse before update() is called

  • (int) – Number of nanoseconds simulating a lag of the particular task# TODO: Check that this is [ns]

  • (int) – Number of nanoseconds to elapse before task is officially enabled

Returns

simulationArchTypes.TaskBaseClass object

ExecuteSimulation()[source]

run the simulation until the prescribed stop time.

GetLogVariableData(LogName)[source]

Pull the recorded module recorded variable. The first column is the variable recording time in nano-seconds, the additional column(s) are the message data columns.

InitializeSimulation()[source]

Initialize the BSK simulation. This runs the SelfInit() and Reset() methods on each module.

SetProgressBar(value)[source]

Shows a dynamic progress in the terminal while the simulation is executing.

ShowExecutionFigure(show_plots=False)[source]

Shows in what order the Basilisk processes, task lists and modules are executed

ShowExecutionOrder()[source]

Shows in what order the Basilisk processes, task lists and modules are executed

createNewEvent(eventName, eventRate=1000000000, eventActive=False, conditionList=[], actionList=[])[source]

Create an event sequence that contains a series of tasks to be executed.

disableTask(TaskName)[source]

Disable this particular task from being executed.

enableTask(TaskName)[source]

Enable this particular task to be executed.

setAllButCurrentEventActivity(currentEventName, activityCommand, useIndex=False)[source]

Set all event activity variables except for the currentEventName event. The useIndex flag can be used to prevent enabling or disabling every task, and instead only alter the ones that belong to the same group (for example, the same spacecraft). The distinction is made through an index set after the _ symbol in the event name. All events of the same group must have the same index.

setModelDataWrap(modelData)[source]

Takes a module and returns an object that provides access to said module’s SelfInit, Update, and Reset methods.

Takes the module instance, collects all SwigPyObjects generated from the .i file (SelfInit, Update and Reset), and attaches it to a alg_contain model instance so the modules standard functions can be run at the python level.

Parameters

modelData – model to gather functions for

Returns

An alg_contain model that provides access to the original model’s core functions

class SimulationBaseClass.StructDocData(strName)[source]

Bases: object

Structure data documentation class