Module: hingedRigidBodyPIDMotor
Executive Summary
This module implements a simple Proportional-Integral-Derivative (PID) control law to provide the commanded torque to a Module: 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.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
motorTorqueOutMsg |
Output Spinning Body Reference Message. |
|
hingedRigidBodyInMsg |
Input Spinning Body Message Message. |
|
hingedRigidBodyRefInMsg |
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 Module: spinningBodyOneDOFStateEffector. The control torque is obtained as follows:
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:
Parameter |
Description |
---|---|
|
proportional gain; defaults to 0 if not provided |
|
derivative gain; defaults to 0 if not provided |
|
integral gain; defaults to 0 if not provided |
Functions
-
void SelfInit_hingedRigidBodyPIDMotor(hingedRigidBodyPIDMotorConfig *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_hingedRigidBodyPIDMotor(hingedRigidBodyPIDMotorConfig *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_hingedRigidBodyPIDMotor(hingedRigidBodyPIDMotorConfig *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 hingedRigidBodyPIDMotorConfig
- #include <hingedRigidBodyPIDMotor.h>
Top level structure for the sub-module routines.
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
-
HingedRigidBodyMsg_C hingedRigidBodyInMsg
input spinning body message
-
HingedRigidBodyMsg_C hingedRigidBodyRefInMsg
output msg containing spinning body target angle and angle rate
-
ArrayMotorTorqueMsg_C motorTorqueOutMsg
output msg containing the motor torque to the array drive
-
BSKLogger *bskLogger
BSK Logging.
-
double K