Module: rwMotorVoltage

Executive Summary

This module computes the RW motor voltage from the command torque.

The module PDF Description. contains further information on this module’s function, how to run it, as well as testing.

Message Connection Descriptions

The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.

Module I/O Messages

Msg Variable Name

Msg Type

Description

voltageOutMsg

ArrayMotorVoltageMsgPayload

RW motor voltage output message

torqueInMsg

ArrayMotorTorqueMsgPayload

commanded RW motor torque input message

rwParamsInMsg

RWArrayConfigMsgPayload

RW array configuration input message

rwAvailInMsg

RWAvailabilityMsgPayload

(optional) RW device availability message

rwSpeedInMsg

RWSpeedMsgPayload

(optional) RW device speed message


Functions

void SelfInit_rwMotorVoltage(rwMotorVoltageConfig *configData, int64_t moduleID)

This method initializes the configData for this module. It creates the output message.

Parameters
  • configData – The configuration data associated with this module

  • moduleID – The ID associated with the configData

Returns

void

void Update_rwMotorVoltage(rwMotorVoltageConfig *configData, uint64_t callTime, int64_t moduleID)

Update performs the torque to voltage conversion. If a wheel speed message was provided, it also does closed loop control of the voltage sent. It then writes the voltage message.

Parameters
  • configData – The configuration data associated with the module

  • callTime – The clock time at which the function was called (nanoseconds)

  • moduleID – The ID associated with the configData

Returns

void

void Reset_rwMotorVoltage(rwMotorVoltageConfig *configData, uint64_t callTime, int64_t moduleID)

This method performs a reset of the module as far as closed loop control is concerned. Local module variables that retain time varying states between function calls are reset to their default values.

Parameters
  • configData – The configuration data associated with the module

  • callTime – Sim time in nanos

  • moduleID – The ID associated with the configData

Returns

void

struct rwMotorVoltageConfig
#include <rwMotorVoltage.h>

module configuration message

Public Members

double VMin

[V] minimum voltage below which the torque is zero

double VMax

[V] maximum output voltage

double K

[V/Nm] torque tracking gain for closed loop control.

double rwSpeedOld[MAX_EFF_CNT]

[r/s] the RW spin rates from the prior control step

uint64_t priorTime

[ns] Last time the module control was called

int resetFlag

[] Flag indicating that a module reset occured

ArrayMotorVoltageMsg_C voltageOutMsg

voltage output message

ArrayMotorTorqueMsg_C torqueInMsg

Input torque message

RWArrayConfigMsg_C rwParamsInMsg

RW array input message

RWSpeedMsg_C rwSpeedInMsg

[] The name for the reaction wheel speeds message. Must be provided to enable speed tracking loop

RWAvailabilityMsg_C rwAvailInMsg

[-] The name of the RWs availability message

RWArrayConfigMsgPayload rwConfigParams

[-] struct to store message containing RW config parameters in body B frame

BSKLogger *bskLogger

BSK Logging.