Module: solarFlux
Executive Summary
Takes in a spacecraft position message and sun position message and calculates the solar \(\text{W/m}^2\) at the spacecraft location. It also allows for an optional eclipse message to be considered in the solar flux calculation.
Module Assumptions and Limitations
This model uses the solar flux value,
SOLAR_FLUX_EARTH
, and astronomical unit, AU, values fromastroConstants.h
This model assumes constant solar flux and a perfect inverse square fall-off of flux as one moves further from the sun.
This model can take in one spacecraft position message and one sun position message. The eclipse message must correspond to the right spacecraft/planet pair.
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg variable name 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 |
---|---|---|
sunPositionInMsg |
sun state input message |
|
spacecraftStateInMsg |
spacecraft state input message |
|
eclipseInMsg |
(optional) eclipse input message |
|
solarFluxOutMsg |
solar flux output message |
Detailed Module Description
Many physical effects from sun sensor outputs to spacecraft heating depend on the solar flux incident on a spacecraft. This module provides that flux given the sun and spacecraft positions.
From the user perspective, this module should be instantiated when there is a desire to provide the solar flux at a spacecraft location.
From the developer perspective, the use of this module in conjunction with the developer’s other modules should be preferred over individual modules calculating the solar flux internally and applying it. Especially if eclipsing effects on the solar flux are desired, this module should be used rather than other modules implementing this calculation and applying eclipse themselves. This does a few things. First, it prevents code repetition. Second, it ensures consistency how solar flux values are calculated, avoiding multiple sources and hard-coding numbers. Third, it prevents other modules from needing to apply eclipse individually.
Design Philosophy
Overall, this module was created because many other modules need this information. The eclipse message is included as an optional message. It was decided to do this rather than have a separate module to apply the eclipse in order to reduce module count and maintain similar design philosophy throughout the framework.
Equations
The flux is calculated by scaling the flux at 1 AU and applying the EclipseMsgPayload shadowFactor
:
where \(r_{\mathrm{Sun}}\) is the distance between the spacecraft and the sun and \(f_s\) is the shadow factor.
User Guide
The user can only instantiate this module, change the i/o names, and add it to a task. The names below are only special in that they are useful defaults and are actually the defaults, with the exception of the eclipse message which is defaulted to an empty string
from Basilisk.simulation import solarFlux
from Basilisk.utilities import SimulationBaseClass()
sim = SimulationBaseClass.SimBaseClass()
proc = sim.CreateNewProcess("proc")
task = sim.CreateNewTask("task", int(1e9))
proc.addTask(task)
sf = solarFlux.SolarFlux()
sf.sunPositionInMsg.subscribeTo(sunMsg)
sf.spacecraftStateInMsg.subscribeTo(scMsg)
sf.eclipseInMsg.subscribeTo(eclMsg)
sim.AddModelToTask(task.Name, sf)
dataLog = sf.solarFluxOutMsg.recorder()
-
class SolarFlux : public SysModel
- #include <solarFlux.h>
solar flux class
Public Functions
-
inline SolarFlux()
-
inline ~SolarFlux()
-
void Reset(uint64_t CurrentSimNanos) override
This method is used to reset the module. Currently no tasks are required.
- Returns:
void
-
void UpdateState(uint64_t CurrentSimNanos) override
Read Messages and scale the solar flux then write it out
- Returns:
void
-
void writeMessages(uint64_t CurrentSimNanos)
This method is used to write the output flux message
- Returns:
void
-
void readMessages()
This method is used to read messages and save values to member attributes
- Returns:
void
Public Members
-
ReadFunctor<SpicePlanetStateMsgPayload> sunPositionInMsg
sun state input message
-
ReadFunctor<SCStatesMsgPayload> spacecraftStateInMsg
spacecraft state input message
-
Message<SolarFluxMsgPayload> solarFluxOutMsg
solar flux output message
-
ReadFunctor<EclipseMsgPayload> eclipseInMsg
(optional) eclipse input message
-
BSKLogger bskLogger
— BSK Logging
-
inline SolarFlux()