hingedRigidBodyPIDMotor#

Executive Summary#

This module implements a simple Proportional-Integral-Derivative (PID) control law to provide the commanded torque to a spinningBodyOneDOFStateEffector.

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 Spinning Body Reference Message.

hingedRigidBodyInMsg

HingedRigidBodyMsgPayload

Input Spinning Body Message Message.

hingedRigidBodyRefInMsg

HingedRigidBodyMsgPayload

Input Spinning Body Reference Message Message.

Module Assumptions and Limitations#

This module is very simple and does not make any assumptions. The only limitations are those inherent to a PID type of control law, here implemented. The type of response (underdamped, overdamped, or critically damped) depends on the choice of gains provided as inputs to the module.

Detailed Module Description#

For this module to operate, the user needs to provide control gains K, P and I. Let’s define \(\theta_R\) and \(\dot{\theta}_R\) the reference angle and angle rate contained in the hingedRigidBodyRefInMsg, and \(\theta\) and \(\dot{\theta}\) the current solar array angle and angle rate contained in the hingedRigidBodyInMsg, which is provided as an output of the spinningBodyOneDOFStateEffector. The control torque is obtained as follows:

\[T = K (\theta_R - \theta) + P (\dot{\theta}_R - \dot{\theta}) + I \int_0^t (\theta_R - \theta) \text{d}\tau.\]

User Guide#

The required module configuration is:

motor = hingedRigidBodyPIDMotorConfig.hingedRigidBodyPIDMotorConfig()
motor.modelTag = "solarArrayPDController"
motor.K = K
motor.P = P
motor.P = I
unitTestSim.AddModelToTask(unitTaskName, motor)

The module is configurable with the following parameters:

Module Parameters#

Parameter

Description

K

proportional gain; defaults to 0 if not provided

P

derivative gain; defaults to 0 if not provided

I

integral gain; defaults to 0 if not provided

Class HingedRigidBodyPIDMotor#

class HingedRigidBodyPIDMotor : 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

double K#

proportional gain

declare these user-defined input parameters

double P#

derivative gain

double I#

integral gain

uint64_t priorTime#

prior function call time for trapezoid integration

declare these variables for internal computations

double priorThetaError#

theta error at prior function call

double intError#

integral error

ReadFunctor<HingedRigidBodyMsgPayload> hingedRigidBodyInMsg#

input spinning body message

ReadFunctor<HingedRigidBodyMsgPayload> hingedRigidBodyRefInMsg#

output msg containing spinning body target angle and angle rate

Message<ArrayMotorTorqueMsgPayload> motorTorqueOutMsg#

output msg containing the motor torque to the array drive

BSKLogger bskLogger = {}#

BSK Logging.