Module: coarseSunSensor¶
Executive Summary¶
This class is designed to model the state of a single coarse sun sensor attached to a spacecraft. It emulates the “counts” that will typically be output by the ADC on board of a spacecraft.
The module
PDF Description
contains further information on this module’s function,
how to run it, as well as testing.
The corruption types are outlined in this
PDF Description
.
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.
Figure 1: CoarseSunSensor()
Module I/O Illustration¶
Msg Variable Name |
Msg Type |
Description |
---|---|---|
sunInMsg |
input message for sun data |
|
stateInMsg |
input message for spacecraft state |
|
cssDataOutMsg |
output message for CSS output data |
|
cssConfigLogOutMsg |
output message for CSS configuration log data |
|
sunEclipseInMsg |
(optional) input message for sun eclipse state message |
|
albedoInMsg |
(optional) input message for albedo message |
Figure 2: CSSConstellation()
Module I/O Illustration¶
Msg Variable Name |
Msg Type |
Description |
---|---|---|
constellationOutMsg |
CSS constellation output message |
Enums
-
enum CSSFaultState_t¶
Values:
-
enumerator CSSFAULT_OFF¶
CSS measurement is set to 0 for all future time
-
enumerator CSSFAULT_STUCK_CURRENT¶
CSS measurement is set to current value for all future time
-
enumerator CSSFAULT_STUCK_MAX¶
CSS measurement is set to maximum value for all future time
-
enumerator CSSFAULT_STUCK_RAND¶
CSS measurement is set to randomly selected value for all future time
-
enumerator CSSFAULT_STUCK¶
CSS measurement is set to percent value for all future time
-
enumerator CSSFAULT_RAND¶
CSS measurement returns uniformly distributed random values between 0 and max
-
enumerator MAX_CSSFAULT¶
-
enumerator CSSFAULT_OFF¶
-
class CoarseSunSensor : public SysModel¶
- #include <coarseSunSensor.h>
coarse sun sensor class
Public Functions
-
CoarseSunSensor()¶
Initialize a bunch of defaults in the constructor. Is this the right thing to do?
-
~CoarseSunSensor()¶
There is nothing to do in the default destructor.
-
void Reset(uint64_t CurrentClock)¶
Method for reseting the module.
This method is used to reset the module.
- Parameters
CurrentSimNanos – The current simulation time from the architecture
- Returns
void
-
void UpdateState(uint64_t CurrentSimNanos)¶
method to update state for runtime
This method is called at a specified rate by the architecture. It makes the calls to compute the current sun information and write the output message for the rest of the model.
- Parameters
CurrentSimNanos – The current simulation time from the architecture
-
void setUnitDirectionVectorWithPerturbation(double cssThetaPerturb, double cssPhiPerturb)¶
utility method to perturb CSS unit vector
Set the unit direction vector (in the body frame) with applied azimuth and elevation angle perturbations.
- Parameters
cssPhiPerturb – [in] [rad] css elevation angle, measured positive toward the body z axis from the x-y plane
cssThetaPerturb – [in] [rad] css azimuth angle, measured positive from the body +x axis around the +z axis
-
void setBodyToPlatformDCM(double yaw, double pitch, double roll)¶
utility method to configure the platform DCM
Set the direction cosine matrix body to css platform tranformation with 3-2-1 angle set.
- Parameters
yaw – (radians) third axis rotation about body +z
pitch – (radians) second axis rotation about interim frame +y
roll – (radians) first axis rotation about platform frame +x
-
void readInputMessages()¶
method to read the input messages
-
void computeSunData()¶
method to get the sun vector information
This method computes the sun-vector heading information in the vehicle body frame.
-
void computeTrueOutput()¶
method to compute the true sun-fraction of CSS
This method computes the tru sensed values for the sensor
-
void applySensorErrors()¶
method to set the actual output of the sensor with scaling/kelly
This method takes the true observed cosine value (directValue) and converts it over to an errored value. It applies noise to the truth.
-
void scaleSensorValues()¶
scale the sensor values
-
void applySaturation()¶
apply saturation effects to sensed output (floor and ceiling)
-
void writeOutputMessages(uint64_t Clock)¶
method to write the output message to the system
This method writes the output message. The output message contains the current output of the CSS converted over to some discrete “counts” to emulate ADC conversion of S/C.
- Parameters
Clock – The current simulation time
Public Members
-
ReadFunctor<SpicePlanetStateMsgPayload> sunInMsg¶
[-] input message for sun data
-
ReadFunctor<SCStatesMsgPayload> stateInMsg¶
[-] input message for spacecraft state
-
Message<CSSRawDataMsgPayload> cssDataOutMsg¶
[-] output message for CSS output data
-
Message<CSSConfigLogMsgPayload> cssConfigLogOutMsg¶
[-] output message for CSS configuration log data
-
ReadFunctor<EclipseMsgPayload> sunEclipseInMsg¶
[-] (optional) input message for sun eclipse state message
-
ReadFunctor<AlbedoMsgPayload> albedoInMsg¶
[-] (optional) input message for albedo message
-
CSSFaultState_t faultState¶
[-] Specification used if state is set to COMPONENT_FAULT */
-
double theta¶
[rad] css azimuth angle, measured positive from the body +x axis around the +z axis
-
double phi¶
[rad] css elevation angle, measured positive toward the body +z axis from the x-y plane
-
double B2P321Angles[3]¶
[-] 321 Euler angles for body to platform
-
Eigen::Matrix3d dcm_PB¶
[-] DCM from platform frame P to body frame B
-
Eigen::Vector3d nHat_B¶
[-] css unit direction vector in body frame components
-
Eigen::Vector3d sHat_B¶
[-] unit vector to sun in B
-
double directValue¶
[-] direct solar irradiance measurement
-
double albedoValue = -1.0¶
[-] albedo irradiance measurement
-
double scaleFactor¶
[-] scale factor applied to sensor (common + individual multipliers)
-
double sensedValue¶
[-] total measurement including perturbations
-
double trueValue¶
[-] total measurement without perturbations
-
double kellyFactor¶
[-] Kelly curve fit for output cosine curve
-
double fov¶
[-] rad, field of view half angle
-
Eigen::Vector3d r_B¶
[m] position vector in body frame
-
Eigen::Vector3d r_PB_B¶
[m] misalignment of CSS platform wrt spacecraft body frame
-
double senBias¶
[-] Sensor bias value
-
double senNoiseStd¶
[-] Sensor noise value
-
double maxOutput¶
[-] maximum output (ceiling) for saturation application
-
double minOutput¶
[-] minimum output (floor) for saturation application
-
double walkBounds¶
[-] Gauss Markov walk bounds
-
double kPower¶
[-] Power factor for kelly curve
-
int CSSGroupID = -1¶
[-] (optional) CSS group id identifier, -1 means it is not set and default is used
-
BSKLogger bskLogger¶
BSK Logging
Private Members
-
SpicePlanetStateMsgPayload sunData¶
[-] Unused for now, but including it for future
-
SCStatesMsgPayload stateCurrent¶
[-] Current SSBI-relative state
-
EclipseMsgPayload sunVisibilityFactor¶
[-] scaling parameter from 0 (fully obscured) to 1 (fully visible)
-
double sunDistanceFactor¶
-
GaussMarkov noiseModel¶
[-] Factor to scale cosine curve magnitude based on solar flux at location
-
CoarseSunSensor()¶
-
class CSSConstellation : public SysModel¶
- #include <coarseSunSensor.h>
Constellation of coarse sun sensors for aggregating output information.
This class is a thin container on top of the above coarse-sun sensor class.
It is used to aggregate the output messages of the coarse sun-sensors into a a single output for use by downstream models.
Public Functions
-
CSSConstellation()¶
[-] Default constructor
The default constructor for the constellation really just clears the sensor list.
-
~CSSConstellation()¶
[-] Default Destructor
The default destructor for the constellation just clears the sensor list.
-
void Reset(uint64_t CurrentClock)¶
Method for reseting the module.
This method is used to reset the module.
- Parameters
CurrentSimNanos – The current simulation time from the architecture
- Returns
void
-
void UpdateState(uint64_t CurrentSimNanos)¶
[-] Main update method for CSS constellation
-
void appendCSS(CoarseSunSensor *newSensor)¶
[-] Method for adding sensor to list
Public Members
-
Message<CSSArraySensorMsgPayload> constellationOutMsg¶
[-] CSS constellation output message
-
std::vector<CoarseSunSensor> sensorList¶
[-] List of coarse sun sensors in constellation
Private Members
-
CSSArraySensorMsgPayload outputBuffer¶
[-] buffer used to write output message
-
CSSConstellation()¶