Drag with SGP4¶
Atmospheric drag gradually removes orbital energy. This example compares two SGP4 trajectories from the same initial state: one with an estimated drag term and one with that term set to zero. The difference in semi-major axis grows over two days.
The B* term¶
SGP4 stores its drag term \(B^*\) in line 1 of the two-line element set (TLE). Its usual relation to the ballistic coefficient is
where \(C_D\) is drag coefficient, \(A\) is effective area, and \(m\) is spacecraft mass. \(\rho_0\) is SGP4’s reference-density constant, so \(B^*\) has units of inverse Earth radii. See CelesTrak’s TLE format guide for the TLE field and its units.
The script starts a 4 kg, 3U spacecraft in an inclined orbit at 300 km. It
uses the spacecraft geometry to estimate \(B^*\), then propagates a second
orbit with bstar=0 for comparison.
"""Compare SGP4 orbits with geometry-derived B* and zero B*."""
import matplotlib.pyplot as plt
import numpy as np
import ADCS
from ADCS.orbits.sgp4_orbit import SGP4Orbit
from ADCS.orbits.universal_constants import EarthConstants, TimeConstants
size = np.array([0.1, 0.3, 0.1]) # 3U spacecraft, metres
faces = [
ADCS.disturbances.GeometryFace(
area=np.prod(np.delete(size, axis)),
centroid=0.5 * size[axis] * sign * np.eye(3)[axis],
normal=sign * np.eye(3)[axis], CD=2.2,
)
for axis in range(3) for sign in (-1.0, 1.0)
]
drag = ADCS.disturbances.Drag_Disturbance(
ADCS.disturbances.GeometryConfig(faces)
)
satellite = ADCS.Satellite(
mass=4.0, J_0=np.diag([0.0333, 0.00667, 0.0333]),
disturbances=[drag],
)
radius = EarthConstants.R_e + 300.0
speed = np.sqrt(EarthConstants.mu_e / radius)
orbit_start = ADCS.Orbital_State(
ephem=ADCS.Ephemeris(), J2000=0.22,
R=np.array([radius, 0.0, 0.0]),
V=np.array([0.0, speed * np.cos(np.deg2rad(50)),
speed * np.sin(np.deg2rad(50))]),
)
end_time = orbit_start.J2000 + 2 * 86400 * TimeConstants.sec2cent
with_drag = SGP4Orbit(orbit_start, end_time=end_time, dt=60.0,
satellite=satellite, verbose=False)
without_drag = SGP4Orbit(orbit_start, end_time=end_time, dt=60.0,
bstar=0.0, verbose=False)
print(f"Estimated B*: {with_drag.bstar:.4g} / Earth radius")
print(with_drag.tle[0]) # TLE line 1 contains the B* field
run = ADCS.RunResults(satellite=satellite, os_hist=list(with_drag.states.values()))
ADCS.plot(run, ADCS.plots.OrbitPlot(), layout=(1, 1), title="SGP4 orbit with drag")
days = (with_drag.times - with_drag.times[0]) * TimeConstants.cent2sec / 86400
a_drag = np.array([state.to_keplerian()[0] for state in with_drag.states.values()])
a_zero = np.array([state.to_keplerian()[0] for state in without_drag.states.values()])
plt.figure()
plt.plot(days, a_drag - a_zero)
plt.xlabel("Time [days]")
plt.ylabel("Semi-major axis difference [km]")
plt.title("Effect of SGP4 B* relative to B* = 0")
plt.grid(alpha=0.3)
plt.tight_layout()
plt.show()
How SGP4Orbit calculates B*
When bstar is omitted, SGP4Orbit uses the first
Drag_Disturbance on the satellite and averages its face areas over all
flight directions:
It writes this value into the fitted TLE and holds it fixed during SGP4
propagation. Pass bstar= to set it explicitly; without a drag
disturbance, the default is zero. ADCS.simulate(...,
orbit_integrator=SGP4Orbit) passes its satellite to the propagator.
Orbit view¶
The same example also renders the drag trajectory in an Earth-centred inertial frame.