Wheel Momentum Accumulation

A three-wheel spacecraft holds nadir pointing while orbiting Earth.

Three orthogonal reaction wheels hold nadir pointing through drag, solar radiation pressure, gravity-gradient torque, and residual magnetic torque. The wheels accumulate momentum because this controller does not unload it.

ADCS.plot shows the three wheel momenta and their increasing combined magnitude.

The black line is the magnitude of the combined wheel momentum.

wheel_momentum_accumulation_godot.py
"""Track nadir with three wheels while environmental torques build momentum."""

import matplotlib.pyplot as plt
import numpy as np

import ADCS
from ADCS.helpers.animations import animate_orbit_godot
from ADCS.helpers.animations.godot.overlays import Arrow, TargetLine
from ADCS.helpers.math_helpers import rot_mat

environment = ADCS.Environment(
    atmosphere=ADCS.SMADAtmosphere(), magnetic_field=ADCS.IGRF14(),
)
size = np.array([0.1, 0.3, 0.1])
faces = []
for axis in range(3):
    for sign in (-1.0, 1.0):
        normal = sign * np.eye(3)[axis]
        faces.append(ADCS.disturbances.GeometryFace(
            area=np.prod(np.delete(size, axis)),
            centroid=0.5 * size[axis] * normal,
            normal=normal, CD=2.2,
            eta_s=0.3, eta_d=0.3, eta_a=0.4,
        ))
geometry = ADCS.disturbances.GeometryConfig(faces)
disturbances = [
    ADCS.disturbances.Drag_Disturbance(geometry),
    ADCS.disturbances.SRP_Disturbance(geometry),
    ADCS.disturbances.GG_Disturbance(),
    ADCS.disturbances.Dipole_Disturbance(np.array([0.01, 0.005, -0.007])),
]
wheels = [
    ADCS.RW(axis=axis, max_torque=1e-3, J=5e-6, h=0.0, h_max=0.02)
    for axis in np.eye(3)
]
magnetometers = [ADCS.MTM(axis=axis) for axis in np.eye(3)]
satellite = ADCS.Satellite(
    mass=4.0, COM=np.array([0.0, 0.02, 0.0]),
    J_0=np.diag([0.0333, 0.00667, 0.0333]),
    actuators=wheels, sensors=magnetometers, disturbances=disturbances,
)
radius = 6878.1363  # 500 km altitude
orbit = ADCS.Orbital_State(
    environment=environment, J2000=0.22,
    R=np.array([0.0, -radius, 0.0]),
    V=np.array([np.sqrt(398600.4415 / radius), 0.0, 0.0]),
)
goal = ADCS.goals.Nadir_Goal()
nadir_ref, target_rate_eci = goal.to_ref(orbit)
nadir_eci = nadir_ref[1:]
q_scalar = np.sqrt((1.0 + nadir_eci[2]) / 2.0)
q_vector = np.cross([0.0, 0.0, 1.0], nadir_eci) / (2.0 * q_scalar)
q0 = np.r_[q_scalar, q_vector]
initial_state = ADCS.State(
    w=rot_mat(q0).T @ target_rate_eci, q=q0, h=np.zeros(3),
)
controller = ADCS.controller.MTQ_w_RW(
    est_sat=satellite, p_gain=5e-5, d_gain=8e-4,
    c_gain=0.0, h_target=np.zeros(3),
)
results = ADCS.simulate(
    x=initial_state, satellite=satellite, os0=orbit,
    environment=environment, controller=controller, goal=goal,
    dt=5.0, tf=2400.0,
)
ADCS.plot(results, ADCS.plots.WheelMomentumPlot(),
          layout=(1, 1), figsize=(8, 4))

if __name__ == "__main__":
    animate_orbit_godot(
        results=results, graphics_quality="high",
        overlays=[
            Arrow("@boresight:default", label="Body boresight", color="#facc15",
                  scale="fixed_px", px=120, width_px=5),
            TargetLine(color="#22c55e", length_px=150, width_px=5),
        ],
        camera_distance_m=20.0, camera_pitch_deg=60.0,
    )