The current iteration of the simulator is written in Python and organised as follows:
Data flow within the program
The main parts of the program which require extra information are explained more in-depth below, with derivations and resources for understanding specific parts of the code also given.
Wind and IFFT
ESDU is the best lol
The model works as follows:
The two most complex parts of the program - the state derivative calculation and the numerical integration - are explained below:
The state vector of the rocket consists of 5 quantities:
where represents the rocket’s position (and its time derivative); the quaternion representing the transformation between the earth frame and body frame; the angular velocity vector, and the current mass of the rocket. This is then enough information to recalculate the subsequent value of the state vector given the extra information provided such as rocket geometry and atmospheric conditions. Now we will proceed with calculating the derivative of each of these quantities in turn.
This is already a state input so there’s no calculation to do here. If you really want an equation,
Incredible.
This is very similar to the procedure in simulators with lower degrees of freedom, and the forces are simply added to obtain the acceleration.
The two main things here which cause some difficulty is determining the value of (from the aerodynamics model) and the conversion in axis systems required to add the forces - for example, is most easily obtained in the earth frame of reference, but is from the body frame, and is most simple in the inertial frame. This is handled with quaternions for computational efficiency, explained in the next section.
This is probably the hardest thing to understand in this code, so if you want to just trust the equations then fair enough. Here’s a brief explanation of what is going on:
using quaternion multiplication. The derivation of this is quite involved, details can be found here.
The way in which is obtained is very similar to the translational dynamics - but instead of summing forces, the resultant moment is found.