Module: coarse_sun_sensor¶
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
.
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
-
class
CoarseSunSensor
: public SysModel¶ 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
CrossInit
()¶ method for initializing cross dependencies
This method simply calls the LinkMessages method to ensure that input messages are matched correctly.
-
void
SelfInit
()¶ method for initializing own messages
This method performs all of the internal initialization for the model itself. Primarily that involves initializing the random number generator and creates the output message
-
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
[in] cssPhiPerturb
: [rad] css elevation angle, measured positive toward the body z axis from the x-y plane[in] cssThetaPerturb
: [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 +zpitch
: (radians) second axis rotation about interim frame +yroll
: (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
()¶
-
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
-
std::string
sunInMsgName
¶ [-] Message name for sun data
-
std::string
stateInMsgName
¶ [-] Message name for spacecraft state */
-
std::string
cssDataOutMsgName
¶ [-] Message name for CSS output data */
-
std::string
sunEclipseInMsgName
¶ [-] Message name for sun eclipse state 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 anhles for body to platform
-
double
directValue
¶ [-] direct solar irradiance measurement
-
double
albedoValue
¶ [-] 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
-
double
senBias
¶ [-] Sensor bias value
-
double
senNoiseStd
¶ [-] Sensor noise value
-
uint64_t
outputBufferCount
¶ [-] number of output msgs stored
-
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
Private Members
-
int64_t
sunInMsgID
¶ [-] Connect to input time message
-
int64_t
stateInMsgID
¶ [-] Connect to input time message
-
int64_t
cssDataOutMsgID
¶ [-] Connect to output CSS data
-
int64_t
sunEclipseInMsgId
¶ [-] Connect to input sun eclipse message
-
SpicePlanetStateSimMsg
sunData
¶ [-] Unused for now, but including it for future
-
SCPlusStatesSimMsg
stateCurrent
¶ [-] Current SSBI-relative state
-
EclipseSimMsg
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
-
-
class
CSSConstellation
: public SysModel¶ - #include <coarse_sun_sensor.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
CrossInit
()¶ [-] Method for initializing cross dependencies
This method loops through the sensor list and calls the CrossInit method for all of those sensors.
-
void
SelfInit
()¶ [-] Method for initializing own messages
This method loops through the sensor list and calls the self init method for all of them.
-
void
UpdateState
(uint64_t CurrentSimNanos)¶ [-] Main update method for CSS constellation
-
void
appendCSS
(CoarseSunSensor newSensor)¶ [-] Method for adding sensor to list
Public Members
-
uint64_t
outputBufferCount
¶ [-] Number of messages archived in output data
-
std::string
outputConstellationMessage
¶ [-] Message name for the outgoing message
-
int64_t
outputConstID
¶ [-] output ID for the outgoing message
-
std::vector<CoarseSunSensor>
sensorList
¶ [-] List of coarse sun sensors in constellation
Private Members
-
CSSArraySensorIntMsg
outputBuffer
¶ [-] buffer used to write output message
-