Solar Power

class missiontools.AbstractSolarConfig(efficiency)[source]

Bases: ABC

Base class for solar power configurations.

A solar config models the power generation of a spacecraft’s solar arrays. It must be attached to a Spacecraft via add_solar_config() before calling methods that require orbital state.

Parameters:

efficiency (float) – Solar-to-DC conversion efficiency, in (0, 1].

Parameters:

efficiency (float)

property efficiency: float

Solar-to-DC conversion efficiency.

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:

dictt : (N,) datetime64[us] — sample timestamps.

power : (N,) float — instantaneous power (W).

Parameters:
Return type:

dict

abstractmethod optimal_angle(rotation_axis)[source]

Return the body-frame rotation angle that maximises projected area.

Parameters:

rotation_axis (array_like, shape (3,)) – Rotation axis in the spacecraft body frame.

Returns:

float – Optimal angle (rad) measured from a deterministic reference direction in the plane perpendicular to rotation_axis.

Parameters:

rotation_axis (ArrayLike)

Return type:

float

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:

float

class missiontools.NormalVectorSolarConfig(normal_vecs, areas, efficiency)[source]

Bases: AbstractSolarConfig

Solar 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).

property areas: ndarray[tuple[Any, ...], dtype[floating]]

Panel areas (m²), shape (M,).

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:
Return type:

dict

optimal_angle(rotation_axis)[source]

Return the rotation angle that maximises total projected panel area.

Searches 360 equally-spaced candidate orientations about rotation_axis and 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 direction u = \mathrm{axis} \times e_{\min} where \(e_{\min}\) is the cardinal axis least aligned with rotation_axis.

Parameters:

rotation_axis (ArrayLike)

Return type:

float

oap(start_time=None)[source]

Orbit-average power over one orbital period.

Propagates the orbit for exactly one Keplerian period starting from start_time and returns the time-mean of the instantaneous power computed by generation().

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:

float