Module: torqueScheduler

Executive Summary

This module schedules two control torques such that they can be applied simultaneously, one at the time, or neither is applied, and combines them into one output msg. This is useful in the case of a system with two coupled degrees of freedom, where the changes in one controlled variable can affect the other controlled variable and thus cause the system to not converge.

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

motorTorqueOutMsg

ArrayMotorTorqueMsgPayload

Output Array Motor Torque Message.

effectorLockOutMsg

ArrayEffectorLockMsgPayload

Output Array Motor Torque Message.

motorTorque1InMsg

ArrayMotorTorqueMsgPayload

#1 Input Array Motor Torque Message.

motorTorque2InMsg

ArrayMotorTorqueMsgPayload

#2 Input Array Motor Torque Message.

Module Assumptions and Limitations

The two input torques are always read and combined into a single motorTorqueOutMsg. The logic to enable locking the effector or, on the contrary, reading the torque and applying it, is contained into the effectorLockOutMsg.

Detailed Module Description

This module receives a lockFlag and a a tSwitch parameter from the user. The first is used to decide how the input torques should be passed to the output torque message. If a torque is to be applied, its corresponding effectorLockOutMsg.effectorLockFlag is set to zero. If not, its corresponding effectorLockOutMsg.effectorLockFlag is set to 1. The following cases are possible:

  • lockFlag = 0: both motor torques are applied simultaneously;

  • lockFlag = 1: first motor torque is applied for t < tSwitch, second motor torque is applied for t > tSwitch;

  • lockFlag = 2: second motor torque is applied for t < tSwitch, first motor torque is applied for t > tSwitch;

  • lockFlag = 3: neither of the motor torques are applied.

User Guide

The required module configuration is:

scheduler = torqueScheduler.torqueScheduler()
scheduler.ModelTag = "torqueScheduler"
scheduler.lockFlag = lockFlag
scheduler.tSwitch = tSwitch
unitTestSim.AddModelToTask(unitTaskName, scheduler)

The module is configurable with the following parameters:

Module Parameters

Parameter

Description

lockFlag

flag to choose the logic according to which the motor torques are applied. If not provided, it defaults to zero.

tSwitch

time at which the torque is switched from input 1 to input 2. If not provided it defaults to zero, therefore only input torque is passed.


Functions

void SelfInit_torqueScheduler(torqueSchedulerConfig *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 Reset_torqueScheduler(torqueSchedulerConfig *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.

Parameters
  • configData – The configuration data associated with the module

  • callTime – [ns] time the method is called

  • moduleID – The module identifier

Returns

void

void Update_torqueScheduler(torqueSchedulerConfig *configData, uint64_t callTime, int64_t moduleID)

This method computes the control torque to the solar array drive based on a PD control law

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

struct torqueSchedulerConfig
#include <torqueScheduler.h>

Top level structure for the sub-module routines.

Public Members

int lockFlag

flag to control the scheduler logic

double tSwitch

[s] time span after t0 at which controller switches to second angle

uint64_t t0

[ns] epoch time where module is reset

ArrayMotorTorqueMsg_C motorTorque1InMsg

input motor torque message #1

ArrayMotorTorqueMsg_C motorTorque2InMsg

input motor torque message #1

ArrayMotorTorqueMsg_C motorTorqueOutMsg

output msg containing the motor torque to the array drive

ArrayEffectorLockMsg_C effectorLockOutMsg

output msg containing the flag to actuate or lock the motor

BSKLogger *bskLogger

BSK Logging.