Monte Carlo Setup

PyVista view of eight identical spacecraft at the same orbit position and attitude.

Vector colors

  • Yellow: Sun vector direction.

  • Purple: local magnetic field direction.

  • Blue: goal direction.

Start with eight copies of the same uncontrolled spacecraft. All runs use the same initial position, attitude, angular velocity, and fixed goal. With mc_config=None, the orbit paths and body axes overlap in the PyVista view. Running this script writes the screenshot above.

monte_carlo_setup.py
"""Run identical spacecraft cases to establish a Monte Carlo baseline."""

from pathlib import Path
import sys

sys.path.insert(0, str(Path(__file__).resolve().parents[3]))

import numpy as np
import ADCS

satellite = ADCS.Satellite(
    mass=4.0, J_0=np.diag([0.03, 0.04, 0.05]),
    boresight=np.array([0.0, 0.0, 1.0]),
)
initial_state = ADCS.State(
    w=np.zeros(3), q=np.array([1.0, 0.0, 0.0, 0.0])
)
orbit = ADCS.Orbital_State(
    ephem=ADCS.Ephemeris(), J2000=0.22,
    R=np.array([7000.0, 0.0, 0.0]),
    V=np.array([0.0, 7.5, 0.0]),
)
results = ADCS.simulate_mc(
    x=initial_state, satellite=satellite, os0=orbit,
    goal=ADCS.goals.ECI_Goal(eci_vector=np.array([0.0, 0.0, 1.0])),
    dt=2.0, tf=120.0, mc_config=None,
    num_runs=8, base_seed=42, max_workers=2,
)
ADCS.plot(results, ADCS.plots.AnimationPlot(), layout=(1, 1))

Running an ensemble

num_runs is the number of simulations. base_seed seeds the per-run random generators (run \(i\) uses base_seed + i), so a later sampler gives repeatable results. max_workers caps the number of parallel worker processes. Here the runs are identical because no sampling rules are supplied.

Next: Randomize Orbits.