Table of Contents

Class OperationComputer

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

The operation computer is a high level computer that can communicate with all of the systems onboard a spacecraft. It is able to interface with the EPS, TT&C and Attitude systems and produce commands that the Guidance Computer can used.

public class OperationComputer : GuidanceComputer, IGroundStationAttachment
Inheritance
OperationComputer
Implements
Inherited Members

Constructors

OperationComputer()

Construct a flight computer

public OperationComputer()

Fields

BatteryRechargedFraction

[-] When the battery has been depleted below the minimum battery fraction, the guidance can be resumed only when the battery reaches this point.

[EditableVariable("-", 0, 1, false, "", "")]
public double BatteryRechargedFraction

Field Value

double

MessageWritePeriod

[s] A timestamp that is used for determining how often messages should be stored in a storage system.

[EditableVariable("s", 0, false, "", "")]
public double MessageWritePeriod

Field Value

double

MinimumBatteryFraction

[-] When the battery goes below this fraction, the guidance message will go to sun pointing mode.

[EditableVariable("-", 0, 1, false, "", "")]
public double MinimumBatteryFraction

Field Value

double

Out_SoftwareChainMsg

The outputted attitude control message that will control the guidance computer.

public SoftwareChainMessage Out_SoftwareChainMsg

Field Value

SoftwareChainMessage

PrivateKey

The private key for handling authentication of the command

[EditableVariable("-", 0, false, "", "")]
public int PrivateKey

Field Value

int

SafeModeFraction

[-] When the battery has been depleted below this level, the operation computer will switch to a safe mode, stopping important actions.

[EditableVariable("-", 0, 1, false, "", "")]
public double SafeModeFraction

Field Value

double

UseChargeLimiting

A flag whether to use charge limiting on the battery to switch to Sun pointing mode when below a threshold.

protected bool UseChargeLimiting

Field Value

bool

Properties

RecentCommandJSON

Message data from the most recent custom message that was received. This will be cleared when read from

protected string RecentCommandJSON { get; }

Property Value

string

Methods

ConfigureDictionary()

Configures the dictionary with a series of actions so that the operation computer is able to compute a particular action.

protected virtual void ConfigureDictionary()

CreateStorage(string)

Creates a new partitioned data storage system with a particular name and some default parameters and returns the storage system.

protected PartitionedDataStorage? CreateStorage(string name)

Parameters

name string

The name of the storage system

Returns

PartitionedDataStorage

The storage system created

ExecuteCommand(ComputerCmdMessage)

Executes a particular command that is passed in and returns whether the command was correctly executed or not.

public bool ExecuteCommand(ComputerCmdMessage command)

Parameters

command ComputerCmdMessage

The command configuration that is passed in

Returns

bool

An execution flag

FindMessageInSpacecraft(string, string?, string)

Attempts to find a message with a message name on all components on the spacecraft and will return the first message instance that is found. The message name is case-sensitive.

public Message? FindMessageInSpacecraft(string messageName, string? parameter = null, string parameterValue = "")

Parameters

messageName string

The name of the message

parameter string

A parameter to search for

parameterValue string

A matching value to use

Returns

Message

A reference to a message that is found.

GetLoadedCommands()

Returns a list of loaded commands in a JSON format.

public string[] GetLoadedCommands()

Returns

string[]

An array of loaded commands in JSON format

IsChildTypeSupported(Type)

Returns true if 'Component' type is a supported child

protected override bool IsChildTypeSupported(Type type)

Parameters

type Type

a 'Component' type

Returns

bool

OnBegin(double)

Called when the 'Component' is beginning

protected override void OnBegin(double time)

Parameters

time double

current time (seconds)

OnCameraCommand(string)

Handles the camera capturing or parameters update for the camera to configure taking images.

protected virtual void OnCameraCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnCommandReceived(string, string)

Handles the custom command that is stored within the message and is able to handle with a base class.

protected virtual void OnCommandReceived(string command, string parameters)

Parameters

command string

The name of the command that is to be executed

parameters string

A set of arguments passed as JSON data

OnDecodeMetadata(JObject)

Called after the "Component" was loaded to handle additional metadata.

protected override void OnDecodeMetadata(JObject metadata)

Parameters

metadata JObject

OnDeleteCommand(string)

Handles the deletion of a particular data storage unit which clears all of the data within the unit.

protected virtual void OnDeleteCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnDownlinkCommand(string)

Handles the downlinking of state data that is stored within the database to a nearby ground station that is listening to the data.

protected virtual void OnDownlinkCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnEncodeMetadata(JObject)

Called while the "Component" is being saved to save additional metadata.

protected override JObject OnEncodeMetadata(JObject metadata)

Parameters

metadata JObject

Returns

JObject

OnGuidanceCommand(string)

Handles the attitude guidance changes for the operation computer and configures the direction that the computer should be oriented.

protected virtual void OnGuidanceCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnKeyCommand(string)

Handles the configuration of the private key that will ensure that the key can be changed via a command.

protected virtual void OnKeyCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnPingCommand(string)

Handles a pinging command that requests the computer to ping its current timestamp on the computer as a message to the transmitter.

protected virtual void OnPingCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnPublishString(string)

Called when the action to publish a string of data is being executed.

protected virtual void OnPublishString(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnRegisterCommand(string)

Handles the registering of a new message to a particular storage system and enables the storing of some data.

protected virtual void OnRegisterCommand(string parameters)

Parameters

parameters string

A set of arguments passed as JSON data

OnReset(double)

Called when the 'Component' is reset from a simulation

protected override void OnReset(double time)

Parameters

time double

reset time (seconds)

OnSafeModeEntered()

Event that is called when the safe mode is entered for the first time and is triggered.

protected virtual void OnSafeModeEntered()

OnUpdate(double, double)

Called when the 'Component' should update

protected override void OnUpdate(double time, double step)

Parameters

time double

current time (seconds)

step double

the time step (seconds)

ReadParameter(string, string, string)

Decodes the JSON data and is able to return the value of a parameter if it exists.

protected string ReadParameter(string json, string parameter, string defaultValue = "")

Parameters

json string

The raw JSON data

parameter string

The parameter to read from

defaultValue string

The default value to use as an override

Returns

string

The argument of the parameter

SafeMode()

Set the computer into a safe mode - ensuring that only the most important systems are running and the rest are in safety.

public override void SafeMode()

ScheduleCommand(double, ComputerCmdMessage)

Schedules a command to occur at a particular point in time by adding it to the data storage system connected to the command time.

public bool ScheduleCommand(double time, ComputerCmdMessage command)

Parameters

time double

[s] The time the command should be executed at

command ComputerCmdMessage

The command that will be executed

Returns

bool

A correct execution flag

Shutdown()

Shut the computer down safely. Disable all software and set the status to SHUTDOWN.

public override void Shutdown()

Startup()

Start the computer safely. Enable all software and set the status to RUNNING.

public override void Startup()