Solar Power¶
- class missiontools.AbstractSolarConfig(efficiency)[source]¶
Bases:
ABCBase class for solar power configurations.
A solar config models the power generation of a spacecraft’s solar arrays. It must be attached to a
Spacecraftviaadd_solar_config()before calling methods that require orbital state.- Parameters:
efficiency (
float) – Solar-to-DC conversion efficiency, in (0, 1].- Parameters:
efficiency (float)
- property spacecraft¶
Spacecraft this config is attached to, or
None.
- abstractmethod generation(t_start, t_end, step, irradiance=1366.0)[source]¶
Compute instantaneous solar power generation.
- Parameters:
t_start (
datetime64) – Start of the time window.t_end (
datetime64) – End of the time window (inclusive).step (
timedelta64) – Time step between samples.irradiance (
float, optional) – Solar irradiance (W m⁻²). Defaults to AM0 constant, 1366 W m⁻².
- Returns:
dict–t:(N,)datetime64[us]— sample timestamps.power:(N,)float — instantaneous power (W).- Parameters:
t_start (datetime64)
t_end (datetime64)
step (timedelta64)
irradiance (float)
- Return type:
- abstractmethod optimal_angle(rotation_axis)[source]¶
Return the body-frame rotation angle that maximises projected area.
- abstractmethod oap(start_time=None)[source]¶
Orbit-average power over one orbital period.
- Parameters:
start_time (
datetime64, optional) – Start of the averaging window. Defaults to the spacecraft epoch.- Returns:
float– Mean power (W) over one orbit.- Parameters:
start_time (datetime64 | None)
- Return type:
- class missiontools.NormalVectorSolarConfig(normal_vecs, areas, efficiency)[source]¶
Bases:
AbstractSolarConfigSolar config defined by panel normal vectors and areas.
Power for each panel is
irradiance * area * efficiency * max(n̂_eci · ŝ_eci, 0)where n̂_eci is the panel outward normal rotated into ECI via the spacecraft attitude law and ŝ_eci is the unit vector toward the Sun. No self-shadowing is modelled.- Parameters:
normal_vecs (
array_like,shape (M,3)) – Outward-facing normal vectors of each panel in the spacecraft body frame. They are normalised internally.areas (
array_like,shape (M,)) – Panel areas (m²).efficiency (
float) – Solar-to-DC conversion efficiency, in (0, 1].
- Parameters:
normal_vecs (npt.ArrayLike)
areas (npt.ArrayLike)
efficiency (float)
- property normals: ndarray[tuple[Any, ...], dtype[floating]]¶
Panel unit normals in the body frame, shape
(M, 3).
- generation(t_start, t_end, step, irradiance=1366.0)[source]¶
Compute instantaneous solar power generation.
Instantaneous power from panel k is
\[P_k = I \cdot A_k \cdot \eta \cdot \max(\hat{n}_{k,\mathrm{ECI}} \cdot \hat{s}_{\mathrm{ECI}},\; 0)\]where \(I\) is the solar irradiance, \(A_k\) is the panel area, \(\eta\) is the conversion efficiency, \(\hat{n}_{k,\mathrm{ECI}}\) is the panel outward normal rotated into ECI via the spacecraft attitude law, and \(\hat{s}_{\mathrm{ECI}}\) is the unit vector toward the Sun. Power is set to zero in eclipse.
- Parameters:
t_start (
np.datetime64) – Start of the time window.t_end (
np.datetime64) – End of the time window (inclusive).step (
np.timedelta64) – Time step between samples.irradiance (
float, optional) – Solar irradiance (W m⁻²). Defaults to the AM0 solar constant, 1366 W m⁻².
- Returns:
dict–'t':(N,)datetime64[us]— sample timestamps.'power':(N,)float — instantaneous total power (W).- Raises:
RuntimeError – If the config has not been attached to a spacecraft via
add_solar_config().- Parameters:
t_start (datetime64)
t_end (datetime64)
step (timedelta64)
irradiance (float)
- Return type:
- optimal_angle(rotation_axis)[source]¶
Return the rotation angle that maximises total projected panel area.
Searches 360 equally-spaced candidate orientations about
rotation_axisand returns the angle \(\theta\) (measured from a deterministic reference direction in the perpendicular plane) at which the sum of area-weighted \(\max(\hat{n}_k \cdot \hat{s}, 0)\) over all panels is greatest.- Parameters:
rotation_axis (
array_like,shape (3,)) – Rotation axis in the spacecraft body frame (need not be a unit vector).- Returns:
float– Optimal angle (rad) in \([0, 2\pi)\) measured from the reference directionu = \mathrm{axis} \times e_{\min}where \(e_{\min}\) is the cardinal axis least aligned withrotation_axis.- Parameters:
rotation_axis (ArrayLike)
- Return type:
- oap(start_time=None)[source]¶
Orbit-average power over one orbital period.
Propagates the orbit for exactly one Keplerian period starting from
start_timeand returns the time-mean of the instantaneous power computed bygeneration().- Parameters:
start_time (
np.datetime64, optional) – Start of the averaging window. Defaults to the spacecraft epoch.- Returns:
float– Mean power (W) over one orbit.- Raises:
RuntimeError – If the config has not been attached to a spacecraft via
add_solar_config().- Parameters:
start_time (datetime64 | None)
- Return type: