scenarioMonteCarloAttRW

Overview

Demonstrates how to run basic Monte-Carlo (MC) RW-based attitude simulations. This script duplicates the scenario in scenarioAttitudeFeedbackRW where a 6-DOF spacecraft is orbiting the Earth. Here some simulation parameters are dispersed randomly using a multi threaded Monte-Carlo setup. Reaction Wheel (RW) state effector are added to the rigid spacecraft() hub, and what flight algorithm module is used to control these RWs. The scenario is run in a single configuration: by not using the Jitter model and by using the RW Voltage IO. Given this scenario we can add dispersions to the variables in between each MC run.

The script is found in the folder basilisk/examples and executed by using:

python3 scenarioMonteCarloAttRW.py

For more information on the Attitude Feedback Simulation with RW, please see the documentation on the scenarioAttitudeFeedbackRW file.

Enable Terminal Bar to Show Simulation Progress

To enable progress bar, one need to set showProgressBar data member of class SimulationParameters to true.

monteCarlo = Controller()
monteCarlo.setShowProgressBar(True)

Method setShowProgressBar should be used to set variable showProgressBar as True with the above statement. After enabling the progress bar, all the simulation run by monteCarlo.ExecuteSimulation() and montoCarlo.runInitialConditions will show the progress bar in the terminal.

Setup Changes for Monte-Carlo Runs

In order to set up the multi-threaded MC simulation, the user must first instantiate the Controller class. The function that is being simulated is the set in this class (in this case, it’s defined in the same file as the MC scenario). The user can then set other variables such as the number of runs, the dispersion seeds, and number of cores.

The next important step to setting up the MC runs is to disperse the necessary variables. The dispersions that are set are listed in the following table:

Input

Description of Element

Distribution

Inertial attitude

Using Modified Rodrigues Parameters

Uniform for all 3 rotations between [0, 2 pi]

Inertial rotation rate

Using omega vector

Normal dispersions for each of the rotation components, each of mean 0 and standard deviation 0.25 deg/s

Mass of the hub

Total Mass of the spacecraft

Uniform around +/-5% of expected values. Bounds are [712.5, 787.5]

Center of Mass Offset

Position vector offset on the actual center of mass, and its theoretical position

Normally around a mean [0, 0, 1], with standard deviations of [0.05/3, 0.05/3, 0.1/3]

Inertia Tensor

3x3 inertia tensor. Dispersed by 3 rotations

Normally about mean value of diag(900, 800, 600). Each of the 3 rotations are normally distributed with angles of mean 0 and standard deviation 0.1 deg.

RW axes

The rotation axis for each of the 3 wheels

Normally around a respective means [1,0,0], [0,1,0], and [0,0,1] with respective standard deviations [0.01/3, 0.005/3, 0.005/3], [0.005/3, 0.01/3, 0.005/3], and [0.005/3, 0.005/3, 0.01/3].

RW speeds

The rotation speed for each of the 3 wheels

Uniform around +/-5% of expected values. Bounds are [95, 105], [190, 210], and [285, 315]

Voltage to Torque Gain

The gain between the commanded torque and the actual voltage

Uniform around +/-5% of expected values. Bounds are [0.019, 0.021]

Next a retention policy is used to log the desired data. The simulation can now be run. It returns the failed jobs, which should not occur. When the MC have been executed, the data can be accessed and tested in different ways. This is explained in the example python code comments.

Note

In these Monte Carlo simulations the retained data is stored as the data array with the time information added as the first column. This is the same retained data format as used with BSK 1.x.

Illustration of Simulation Results

saveFigures = False, case = 1, show_plots = True, useDatashader = False
../_images/scenarioMonteCarloAttRW_AttitudeError.svg../_images/scenarioMonteCarloAttRW_RateTrackingError.svg../_images/scenarioMonteCarloAttRW_RWMotorTorque.svg../_images/scenarioMonteCarloAttRW_RWSpeed.svg../_images/scenarioMonteCarloAttRW_RWVoltage.svg
scenarioMonteCarloAttRW.run(saveFigures, case, show_plots)[source]

The scenarios can be run with the followings setups parameters:

Parameters
  • saveFigures (bool) – flag if the scenario figures should be saved for html documentation

  • case (int) – Case 1 is normal MC, case 2 is initial condition run

  • show_plots (bool) – Determines if the script should display plots