opengnc.environment package
Submodules
opengnc.environment.density module
Atmospheric density models (Exponential, Harris-Priester, NRLMSISE-00, JB2008).
- class opengnc.environment.density.CIRA72[source]
Bases:
objectCOSPAR International Reference Atmosphere (CIRA) 1972 simplified version.
- class opengnc.environment.density.Exponential(rho0: float = 1.225, h0: float = 0.0, h_scale: float | None = None, **kwargs: Any)[source]
Bases:
objectExponential Atmospheric Density.
Model: $rho = rho_0 expleft(-frac{h - h_0}{H}right)$
- Parameters:
rho0 (float, optional) – Base density at $h_0$ (kg/m^3).
h0 (float, optional) – Reference altitude (km).
h_scale (float, optional) – Scale height $H$ (km).
- class opengnc.environment.density.HarrisPriester(lag_deg: float = 30.0)[source]
Bases:
objectHarris-Priester Diurnal Bulge Model.
Equation: $rho = rho_{min} + (rho_{max} - rho_{min}) cos^n(frac{psi}{2})$
- Parameters:
lag_deg (float, optional) – Solar lag angle (degrees). Default 30.0.
- class opengnc.environment.density.JB2008(space_weather: Any | None = None)[source]
Bases:
objectSimplified Jacchia-Bowman 2008 (JB2008) Atmosphere Model.
A high-accuracy model based on Jacchia’s diffusion equations, driven by solar indices (F10.7, S10, M10, etc).
- Parameters:
space_weather (Optional[Any], optional) – SpaceWeather model for fetching real-time indices.
- class opengnc.environment.density.NRLMSISE00[source]
Bases:
objectNRLMSISE-00 high-fidelity atmospheric density model.
The standard empirical model of the Earth’s atmosphere from ground to space. Accounts for solar activity, geomagnetic storms, and seasonal variations.
Notes
Requires the pymsis package.
opengnc.environment.mag_field module
Earth magnetic field models (IGRF, WMM, Tilted Dipole).
- opengnc.environment.mag_field.igrf_field(lat: float, lon: float, alt: float, time: datetime | float) ndarray[source]
Get the International Geomagnetic Reference Field (IGRF) vector.
- Parameters:
lat (float) – Geodetic latitude (deg).
lon (float) – Geodetic longitude (deg).
alt (float) – Altitude above the WGS84 ellipsoid (km).
time (datetime.datetime or float) – Time for IGRF calculation. Decimal year preferred for float.
- Returns:
Magnetic field vector $[B_{North}, B_{East}, B_{Down}]$ (nT).
- Return type:
np.ndarray
- Raises:
ImportError – If ppigrf dependency is not installed.
- opengnc.environment.mag_field.tilted_dipole_field(r_ecef: ndarray) ndarray[source]
Tilted Dipole Geomagnetic Approximation.
A simplified model useful for fast orbit propagation. Approximates Earth’s field as a dipole tilted relative to the geographic poles.
Equation: $mathbf{B} = frac{mu_0}{4pi} frac{1}{r^3} [3(mathbf{m} cdot hat{mathbf{r}})hat{mathbf{r}} - mathbf{m}]$
- Parameters:
r_ecef (np.ndarray) – Position vector in ECEF frame (m).
- Returns:
Magnetic field vector in ECEF frame (T).
- Return type:
np.ndarray
- opengnc.environment.mag_field.wmm_field(lat: float, lon: float, alt: float, date: datetime | float) ndarray[source]
Get the World Magnetic Model (WMM) field vector.
Proxied via IGRF in this implementation for GNC simulation balance.
- Parameters:
lat (float) – Geodetic latitude (deg).
lon (float) – Geodetic longitude (deg).
alt (float) – Altitude (km).
date (datetime.datetime or float) – Date for model calculation.
- Returns:
Magnetic field vector $[B_{North}, B_{East}, B_{Down}]$ (nT).
- Return type:
np.ndarray
opengnc.environment.moon module
Simplified Lunar Ephemeris Model for position calculation.
- class opengnc.environment.moon.Moon[source]
Bases:
objectLunar Ephemeris Model (Vallado 3.5).
Provides the Moon’s position vector in the Earth-Centered Inertial (ECI) frame.
Calculation (Fundamental Arguments): $L$ = Mean longitude, $M’$ = Moon mean anomaly, $M$ = Sun mean anomaly, $D$ = Mean elongation, $u$ = Mean latitude.
- Parameters:
None
opengnc.environment.multibody_dynamics module
Circular Restricted Three-Body Problem (CR3BP) dynamics.
- class opengnc.environment.multibody_dynamics.CR3BP(mu: float)[source]
Bases:
objectCircular Restricted Three-Body Problem Dynamics.
Models the motion of a negligible mass under the influence of two massive bodies (primaries) in a circular orbit about their barycenter.
- Parameters:
mu (float) – Mass parameter $mu = m_2 / (m_1 + m_2)$.
- calculate_jacobi_constant(state: ndarray) float[source]
Calculate the Jacobi constant (Integral of motion).
$C = (x^2 + y^2) + 2frac{1-mu}{r_1} + 2frac{mu}{r_2} - (vx^2 + vy^2 + vz^2)$
- Parameters:
state (np.ndarray) – Current state.
- Returns:
Jacobi constant value.
- Return type:
float
- get_dynamics(t: float, state: ndarray) ndarray[source]
Calculate state derivatives in the rotating frame.
- Parameters:
t (float) – Time (normalized).
state (np.ndarray) – Current state $[x, y, z, vx, vy, vz]$.
- Returns:
Derivative vector $[dot{x}, dot{y}, dot{z}, dot{vx}, dot{vy}, dot{vz}]$.
- Return type:
np.ndarray
opengnc.environment.radiation module
Radiation environment models for TID and SEU rates estimation.
- class opengnc.environment.radiation.RadiationModel[source]
Bases:
objectParametric Space Radiation Environment Models.
Estimates Total Ionizing Dose (TID) and Single Event Upset (SEU) rates for spacecraft electronic components in Low Earth Orbit (LEO).
- estimate_seu_rate(altitude_km: float, device_cross_section: float = 1e-12) float[source]
Estimate Single Event Upset (SEU) rate from proton flux.
- Parameters:
altitude_km (float) – Orbit altitude (km).
device_cross_section (float, optional) – Device sensitive area ($cm^2/bit$). Default 1e-12.
- Returns:
Estimated SEUs per bit-day.
- Return type:
float
- estimate_tid(altitude_km: float, inclination_deg: float, duration_days: float) float[source]
Estimate cumulative Total Ionizing Dose (TID).
Uses a parametric fit for LEO orbits assuming 2.5 mm Aluminum shielding.
- Parameters:
altitude_km (float) – Orbit altitude (km).
inclination_deg (float) – Orbit inclination (deg).
duration_days (float) – Mission duration (days).
- Returns:
Estimated TID in kRad(Si).
- Return type:
float
opengnc.environment.solar module
Solar position models based on Julian Date.
- class opengnc.environment.solar.Sun[source]
Bases:
objectSolar Position Model (Astronomical Almanac).
Provides the Sun’s position vector in the Earth-Centered Inertial (ECI) frame (J2000).
Calculation: $lambda_{ecl} = q + 1.915 sin(g) + 0.020 sin(2g)$ where $q$ is mean longitude and $g$ is mean anomaly.
- Parameters:
None
opengnc.environment.space_weather module
Space weather index management (F10.7, Ap, Kp) for disturbance models.
- class opengnc.environment.space_weather.SpaceWeather(f107: float = 150.0, f107_avg: float = 150.0, ap: float = 15.0)[source]
Bases:
objectSolar and Geomagnetic Activity Indices Manager.
Coordinates F10.7 (solar flux) and Ap/Kp (geomagnetic) indices used by thermospheric and radiation models.
- Parameters:
f107 (float, optional) – Daily solar flux index at 10.7cm (sfu). Default 150.0.
f107_avg (float, optional) – 81-day centered mean solar flux (sfu). Default 150.0.
ap (float, optional) – Planetary equivalent amplitude index (geomagnetic). Default 15.0.
opengnc.environment.thermal module
Spacecraft thermal environment flux models (Solar, Albedo, Earth IR).
- class opengnc.environment.thermal.ThermalEnvironment(albedo_coeff: float = 0.3, earth_ir: float = 230.0)[source]
Bases:
objectSpacecraft External Thermal Environment Models.
Calculates heat fluxes from direct solar radiation, planetary albedo, and outgoing longwave radiation (Earth IR).
- Parameters:
albedo_coeff (float, optional) – Planetary mean spherical albedo [0, 1]. Default 0.3.
earth_ir (float, optional) – Mean outgoing longwave radiation (W/m^2). Default 230.0.
- get_albedo_flux(r_sat: ndarray, r_sun: ndarray) float[source]
Calculate planet-reflected solar flux (Albedo).
Uses a Lambertian reflection model.
- Parameters:
r_sat (np.ndarray) – Satellite ECI position (m).
r_sun (np.ndarray) – Sun ECI position (m).
- Returns:
Albedo flux on a nadir-facing surface ($W/m^2$).
- Return type:
float
opengnc.environment.wind module
Atmospheric wind and earth co-rotation modeling.
- class opengnc.environment.wind.AtmosphereCoRotation(omega_e: float = 7.2921151467e-05)[source]
Bases:
objectAtmospheric Wind Model (Strict Co-Rotation).
Assumes that the atmosphere rotates perfectly in sync with the planet’s Earth-Centered Earth-Fixed (ECEF) frame.
- Parameters:
omega_e (float, optional) – Planetary angular rate (rad/s). Default Earth WGS84 rate.
- get_relative_velocity(r_eci: ndarray, v_eci: ndarray, jd: float) ndarray[source]
Calculate spacecraft velocity relative to the atmosphere (Airspeed).
Equation: $mathbf{v}_{rel} = mathbf{v}_{sc} - mathbf{v}_w$
- Parameters:
r_eci (np.ndarray) – ECI position (m).
v_eci (np.ndarray) – ECI spacecraft velocity (m/s).
jd (float) – Julian Date.
- Returns:
Relative velocity vector (m/s).
- Return type:
np.ndarray
- get_wind_velocity(r_eci: ndarray, jd: float) ndarray[source]
Calculate local wind velocity vector in ECI.
Equation: $mathbf{v}_w = boldsymbol{omega}_E times mathbf{r}_{eci}$
- Parameters:
r_eci (np.ndarray) – ECI position vector (m).
jd (float) – Julian Date.
- Returns:
Wind velocity vector (m/s).
- Return type:
np.ndarray