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.

Class TorqueScheduler#

class TorqueScheduler : public SysModel#

Top level structure for the sub-module routines.

Public Functions

void reset(uint64_t callTime) override#

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:

callTime – [ns] time the method is called

Returns:

void

void updateState(uint64_t callTime) override#

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

Parameters:

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

Returns:

void

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

ReadFunctor<ArrayMotorTorqueMsgPayload> motorTorque1InMsg#

input motor torque message #1

ReadFunctor<ArrayMotorTorqueMsgPayload> motorTorque2InMsg#

input motor torque message #1

Message<ArrayMotorTorqueMsgPayload> motorTorqueOutMsg#

output msg containing the motor torque to the array drive

Message<ArrayEffectorLockMsgPayload> effectorLockOutMsg#

output msg containing the flag to actuate or lock the motor

BSKLogger bskLogger = {}#

BSK Logging.