scenarioBskSimAttFeedbackMC
Monte Carlo Simulation for Attitude Feedback Scenario
This script demonstrates how to set up and run Monte Carlo simulations using the Basilisk framework. It uses the attitude feedback scenario as a base and applies various dispersions to create multiple simulation runs.
Key Features:
Monte Carlo Controller Setup: Uses the Controller class from Basilisk’s Monte Carlo utilities.
Dispersion Application: Applies statistical dispersions to initial parameters.
Retention Policy: Defines which data should be retained from each simulation run.
Data Analysis: Includes a callback function for plotting retained data.
How to Use:
Ensure you have Basilisk installed with all required dependencies.
Run this script directly to execute the Monte Carlo simulations:
python scenarioBskSimAttFeedbackMC.py
The script will run 4 Monte Carlo simulations by default.
Results will be saved in the ‘scenarioBskSimAttFeedbackMC’ directory within the script’s location.
Monte Carlo Configuration:
Simulation Function: Uses
scenario_AttFeedback.scenario_AttFeedback
to set up the base scenario.Execution Function: Uses
scenario_AttFeedback.runScenario
to run each simulation.Execution Count: Set to 4 simulations.
Archive Directory: Results are saved in
scenarioBskSimAttFeedbackMC
.Seed Dispersion: Enabled to randomize the seed for each module.
Variable Casting: Downcasts retained numbers to float32 to save storage space.
Dispersion Magnitude File: Produces a
.txt
file showing dispersion in standard deviation units.
Applied Dispersions:
MRP Initial Condition: Uniform Euler Angle MRP Dispersion
Angular Velocity Initial Condition: Normal Vector Cartesian Dispersion
Hub Mass: Uniform Dispersion
Center of Mass Offset: Normal Vector Cartesian Dispersion
Hub Inertia: (Dispersion defined but not explicitly added in the provided code)
Retention Policy:
Logs
r_BN_N
fromsNavTransMsg
Logs
sigma_BR
andomega_BR_B
fromattGuidMsg
Uses a callback function
displayPlots
for data visualization
Output:
The script generates plots of the retained data if run directly.
Plots show the evolution of attitude error (sigma_BR) over time for all simulation runs.
Note:
This script serves as a template for setting up Monte Carlo simulations in Basilisk. Users can modify the dispersions, retention policy, and analysis methods to suit their specific simulation needs.