Reference
Python / C++ API
The compiled module is imported as from arlamx_v2 import cpp (it wraps arlamx_cpp). Vectors are numpy arrays of length 3, and quaternions are scalar-first [q0, q1, q2, q3].
Simulator
p = cpp.SimParams(); p.gsi = "cll"; p.lunisolar = True
sim = cpp.Simulator(p)
sim.load_gravity(path) -> bool sim.load_wmm(path) -> bool sim.load_spice([kernels]) -> bool
sim.set_panels(n (N,3), A (N,), c (N,3))
sim.set_mass(m); sim.set_inertia_diag([Ix, Iy, Iz]); sim.set_inertia(I 3x3)
sim.set_atmosphere(rho, T, m_bar, chi=None) # chi: 7 mole fractions He,O,N2,O2,Ar,H,N
sim.set_atmosphere_end(rho, T, m_bar, chi=None) # linear interpolation over the next step
sim.set_mode("point" | "detumble" | "prescribed")
sim.set_cmd_frame("inertial" | "flow" | "flowB" | "flowS"); sim.set_nav(r, v); sim.clear_nav()
sim.set_srp_scale(s); sim.set_wind(w_N)
sim.set_controller(cpp.MRPFeedback); sim.set_quat_controller(cpp.QuaternionFeedback); sim.set_bdot(cpp.BDot())
sim.set_dipole_max(m_max); sim.set_rods(axis (N,3), dmax (N,)); sim.set_rod_gates([bool]*N)
st = sim.reset(r, v, sigma, omega) # dict r, v, sigma, omega, t
out = sim.step(q_cmd) # dict, see Architecture → StepOut
sim.get_state() # r, v, sigma, omega, t, C_BN, sun_N, eclipse, altitude_km
sim.params(); sim.gravity_loaded(); sim.wmm_loaded(); sim.dipole_max(); sim.rod_gates()
Force-model kernels
| Function | Returns |
sentman(theta, s, Tw_Ti, alpha_E=1) | (C_p, C_τ) for one plate |
cll(theta, s, Tw_Ti, alpha_n=1, alpha_t=1) | (C_p, C_τ), Walker atomic-O row |
spacecraft_aero(n, A, c, v_rel_B, rho, T, m_bar, T_w, alpha_E=1, one_sided_ref=True, gsi="sentman", alpha_n=1, alpha_t=1, chi=None) | dict F, tau, Cd, Cl, A_ref |
coefficients_only(...) | same, per unit q |
panel_srp_optical(n, A, c, sun_hat_B, ca, cs, cd, eclipse=1, pressure=0) | (F, τ). pressure 0 → P_SR. |
panel_srp_force_torque(n, A, c, sun_hat_B, eclipse=1, pressure=0, Cr=0) | (F, τ), cannonball |
earth_rad(n, A, c, nadir_B, r_m, cos_sun, p_sun, sol=(ca,cs,cd), ir=(ca,cs,cd)) | (F, τ) |
gg_torque(I_diag, r_B, mu) | τ_gg |
Orbit, frames, ephemeris
| Function | Notes |
accel_twobody(r, mu), accel_j2(r, mu, Re, J2), accel_j3(...) | closed forms |
GravityHarmonics().load_ggm(path, max_degree=20), .accel_ecef(r, deg), .mu(), .Re(), .J2() | SH model |
accel_third_body(r_sat, r_body, mu_body) | point-mass perturbation |
sun_unit_analytic(jd), sun_dist_au(jd), moon_analytic(jd) -> (r_hat, r_m) | analytic ephemerides |
eclipse_cylindrical(r, s_hat, Re), gmst_rad(jd), ecef_to_geodetic(r) -> (lat, lon, h), sma_from_rv(r, v, mu) | geometry helpers |
propagate_f32_samples(r0, v0, offsets_s, dt_s=30, bc_inv=0, rho0=3e-12, alt0_m=4e5, h_scale=6e4, a_srp=0, sun_hat=None) | onboard FP32 forecast |
Attitude and control
| Item | Notes |
mrp_to_dcm, mrp_shadow, mrp_rate, mrp_compose, mrp_error, mrp_angle | MRP algebra |
quat_mul, quat_conj, quat_unit, quat_normalize, slerp_clip, quat_to_mrp, mrp_to_quat, dcm_to_quat | quaternions (Hamilton, scalar first) |
MRPFeedback, QuaternionFeedback | kp, kd, max_body_rate, proper; set_inertia_diag, set_max_torque, compute(...) |
BDot | gain, dt, max_dipole, dipole(B), reset() |
apply_magnetorquer(tau, B, m_max), saturate_dipole, apply_rods(tau, B, axis, dmax, on), rods_allocate(m, axis, dmax, on) | magnetic allocation |
WMM().load(path), .field_ecef(r, year), dipole_field_ecef(r) | field models |
Constants
MU_WGS, RE_WGS, OMEGA_EARTH, J2_GGM, K_B, P_SRP_1AU
Main Python modules
| Module | Entry points |
env.py | ArlamxV2Env |
physics.py | load(name|path|dict, overrides), validate, apply_to_params(params, cfg, ...), msis_version |
atmosphere.py | query_msis(alt_km, lat, lon, dt, f107, ap, version, return_species), jd_to_datetime |
geometry.py | load_mesh, load_geom, write_geom, simplify_sides, projected_area |
sail_optics.py | PRESETS, apply_optics(params, name) |
session.py, train.py, train_v12.py, sweep.py | sessions, train_one, build_model, train_run |
decay_run.py | coe_to_rv, prescribed decay |
config.py | load, merge, load_reward, pin, snapshot |