I did not have access to the X-Plane flight simulator, so I wrote my own, to adjust all the parameters of the spacecraft properly, and to further develop the on-board software.
Right now the simulator does not support the aerodynamic data, and there is only a basic drag model. This works fine for a shuttle launch like this though, because the orbiter leaves the atmosphere pretty quickly. It is a very simple simulator, and there’s nothing much more than just linear and angular moments here. I’ve attached the source code to this post.
I will try to describe how it works though. First of all, this is what is defined as input parameters:
- Spacecraft fuel tanks and fuel weights (no center of gravity shift yet)
- Spacecraft moments of inertia (calculated as moments of inertia for a cube)
- Empty and cargo weight
- Location and direction/magnitude of all the forces that act on the body (engines and control surfaces)
- Thrust deflection angles (for some of the forces that relate to the engines)
First of all, there are two coordinate systems: the global coordinate system, with point of origin in center of the earth, the Z axis going up through the north pole, and the X axis going to the point of 0 latitude, 0 longitude. The local vehicle coordinate system center is in the vehicle center of mass (center of mass of the primary vehicle body). The positive X axis goes to the nose of the plane, the positive Z axis goes up, following the vertical tail, and the positive Y axis goes to the right wing.
For every force that acts on the spacecraft the change in linear and angular moments are calculated:
(linear moment, only affected by direction of the force)
(where
is a point in the local vehicle coordinates where the force is applied to – angular moment, affected by direction and position where the force is applied).
The vector of momentum changes are then rotated into the global coordinate system, and the state of the vehicle is updated accordingly. That’s all for now – it doesn’t calculate center of gravity change yet, but there is all the code you need to do so.
This is the screenshot of how it looks like (pretty boring):

Here’s the sourcecode (had to attach it as a text file, did not want to get into the post for some reason):
Continue reading ‘SV-201 Flight Simulator’
Recent comments