Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Inside Simulink-Sim\Spike\SimulinkModel, is a file named Spike.slx. This file contains the Simulink model. open it with Matlab to see the block model. Here’s the summary of what’s going on:

  • Import Datcom file into the workspace

    • This is currently a manual process and needs to be done once everytime the model is opened. TO do it, cd into Simulink-Sim\Spike\SimulinkModel\Utilities from the matlab comand line, and run “aero = importAndFixDatcomData()”.

    • For curiosity’s sake, the “fix” part of the function is there because for some bizarre reason, Datcom fails to generate a very few number of coefficients. So what is done is the in those cases, the coefficients that fail to generate are replaced with the coefficient of the previous altitude.

  • Read ZeroPilot-SW commands

    • On the top left of the model, there are a series of blocks named read*. These blocks read the latest actuator and throttle commands that the autopilot produces and feed them into the model at every time step.

  • Figure out the appropriate coefficients.

    • You’ll notice that the read* blocks feed into a block named aerodynamic coefficients. If you double click it, you can take a look.The appropriate coefficients are determined by using the data about actuator position, altitude, mach number, etc, and performing a linear interpolation inside the datcom tables.

  • From those coefficients, determine the forces and moments

    • The coefficients that were just determined are fed into a block named aerodynamic forces and moments. This is a built in Simulink block. It doesent actually do anything special. Once you have the coefficients, getting the forces and moments is just a matter of multiplying each one with the wing area (or reference span or some other area) and the dynamic pressure. Now we know the 3D forces and moments that act on the aircraft as result of the actuators.

  • At the same time, the coefficients that occur as a result of non actuator related reasons are computed.

    • In the bottom left of the model, there’s a bunch more lookup tables that feed into another aerodynamic forces and moments block. This accounts for the forces that act on the aircraft that are not related to the actuators. Things like the lift produced by the wings and the drag force resulting from the aircraft flying through the air.

  • The actuator and non actuator forces and moments, aswell as the propulsion and gravity forces are summed together.

    • Couple notes here. The gravity vector needs to be converted from the inertial to the body reference frame, so it is multiplied by the appropriate direction cosine matrix. The throttle force always points “forward” as far as the aircraft is concerned so no adjustment is necessary. Also, since both the gravity and throttle vectors point through the center of gravity of the aircraft, neither force produces a moment.

  • The position, orientation, velocity vector, and all kinds of other stuff about the aircraft are computed.

    • The summed forces and moments are fed into the 6 dof block. This block is pretty magical. with all kinds of integration and other crap that doesent actually need to be known by the person using it, it figures out how that body behaves. THis block also contains the initial state of the body. Information like initial velocity, initial orientation, initial position, mass and moment of inertia tensor are specified here.

  • The information output by the 6 dof block is fed into the writeToFile block.

    • This block just writes all the important info that gets fed back into our ZeroPilot-SW to files.

  • Side note: there are a couple of blocks in the left middle of the model. They do very simple processing to calculate airspeed, mach number and dynamic pressure.

...