# Module: mtbMomentumManagementSimple¶

## Executive Summary¶

This module computes the desired Body frame torque to dump the momentum in the reaction wheels.

## 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

rwParamsInMsg

input message for RW parameters

rwSpeedsInMsg

input message for RW speeds

tauMtbRequestOutMsg

output message containing control torque in the Body frame

## Detailed Module Description¶

The following presents the mathematics for computing the torque to be requested by the magnetic torque rods to drive the net momentum of the reaction wheels to zero.

Assume the spacecraft contains $$N_{\text{RW}}$$ RWs. The net RW angular momentum is given by

${}^{\cal B} {\bf h}_{\text{wheels}} = \sum_{i=1}^{N_{\text{RW}}} \hat{\bf g}_{s_i} J_{s_i} \Omega_i$

where $$\hat{\bf g}_{s_i}$$ is the RW spin axis in the Body frame $$\cal B$$, $$J_{s_i}$$ is the spin axis RW inertia and $$\Omega_i$$ is the RW speed rate about this axis. The desired torque to be produced by the torque rods to drive the wheel momentum to zero is then given by the proportional control law

${}^{\cal B} {\pmb\tau}_{\text{desired}} = - K_p \ {}^{\cal B} {\bf h}_{\text{wheels}}$

where $$K_p$$ is the proportional feedback gain with units of 1/s.

## User Guide¶

See the example script scenarioMtbMomentumManagementSimple for an illustration on how to use this module. Note that the user must set the momentum dumping gain value Kp to a postive value and GsMatrix_B must be specified in column major format.

Functions

void SelfInit_mtbMomentumManagementSimple(mtbMomentumManagementSimpleConfig *configData, int64_t moduleID)

This method initializes the output messages for this module.

Parameters
• configData – The configuration data associated with this module

• moduleID – The module identifier

Returns

void

void Update_mtbMomentumManagementSimple(mtbMomentumManagementSimpleConfig *configData, uint64_t callTime, int64_t moduleID)

This routine calculate the current desired torque in the Body frame to meet the momentum target.

Parameters
• configData – The configuration data associated with the module

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

• moduleID – The module identifier

Returns

void

void Reset_mtbMomentumManagementSimple(mtbMomentumManagementSimpleConfig *configData, uint64_t callTime, int64_t moduleID)

This method performs a complete reset of the module. Local module variables that retain time varying states between function calls are reset to their default values. Check if required input messages are connected.

Parameters
• configData – The configuration data associated with the module

• callTime – [ns] time the method is called

• moduleID – The module identifier

Returns

void

struct mtbMomentumManagementSimpleConfig
#include <mtbMomentumManagementSimple.h>

Top level structure for the sub-module routines.

Public Members

double Kp

[1/s] momentum feedback gain

RWArrayConfigMsg_C rwParamsInMsg

input message containing RW parameters

RWSpeedMsg_C rwSpeedsInMsg

input message containingRW speeds

CmdTorqueBodyMsg_C tauMtbRequestOutMsg

output message containing control torque in the Body frame