top of page
Search

Week 5: So Many Warnings

  • Writer: Trevor Pierre
    Trevor Pierre
  • Jun 21, 2022
  • 3 min read


Last week I dealt with mostly converting my main flight blueprints to C++ as well as bug fixing, and getting started on the UI. This week though I was able to make some good progress on implementing some new features.


My plan for this week was to implement:

  • Implement Spoilers/Flaps in C++

  • Stalling/Stall Waring

  • Overspeed Warnings

  • Terrain Awareness and Warning System

  • Start the Traffic Collision Avoidance System


Thankfully I was able to complete or at least make a good amount of progress on most of these. Starting at the top and least complicated, was implementing the spoilers and flaps in C++. This wasn’t super complicated, and nothing really noteworthy happened. I just thought I should mention it because I talked about working on the implementation on last week’s post.





After that I worked on implementing stalling and stall warnings. A Stall is when a planes angle of attack is too high, which prevents the wings from generating enough lift to keep the plane flying.





There were a few issues I have to tackle with implementing this. The biggest being how I would modify the Lift Coefficient. As far as I know there’s no real way to calculate the Lift Coefficient when the plane is at a stall angle. An easy way out would be setting the Coefficient to 0 when I pass into a stall angle, but that really doesn't work:



This is due to the way that I apply Lift to the plane’s mesh (Add Force), meaning that to simulate a stall properly, I can’t just slowly decrease the Coefficient over time or set it to 0, I have to set it to a strong negative force. It’s not perfect, but right now when the plane Angle of Attack passes 15 degrees the Lift Coefficient is inverted, and a warning is printed to the screen





Next was the overspeed warning, this was pretty simple, a warning message just prints out if you go passed a certain speed.


After taking care of those relatively simple tasks came the hard parts. The Terrain Awareness and Warning System(TAWS) and Traffic Collision Avoidance System (TCAS). Both of these are used as a way to avoid collisions with the ground as well as other planes. TWAS usually comprised of a Ground Proximity Warning System that has a few different modes. Below are the three that I implemented this week:


  • Excessive Descent – If the plane is descending into the ground

  • Excessive Terrain Closure – If the plane is about to hit terrain in front of it

  • Steep Bank Angle – If the plane is going past the programmed bank angle


I first started with excessive descent, I accomplished this by doing a sphere trace to the ground and checking to see once the plane reached an altitude threshold it would start to measure if the plane was rapidly descending or not. If so, this would cause a warning message to be displayed.




The Excessive Terrain Closure was tackled in a bit of a different way. I needed to measure how much time till impact there was with an object in front of the plane. I did this by using the formula: Time = Distance/Velocity, and then checking to see if the time was in range to display a warning.





The Bank angle warning was the easiest to implement, I added some more controls to input what the max angle should be before printing the warning, and just checked to make sure the if the plane was surpassing it of either roll, to display a warning. The expectation to this is Zero and high rotations like 180+ degrees.





Moving on to TCAS, this is a system that was designed to avoid mid air collisions. Basically a warning is provided when two airplanes enter each other’s airspace at a similar altitude. And if they get closer together, a resolution is given to each plane on whether to climb or to descend. I'm not finished yet, but here's what I have so far:









That’s all for this week. Even though there wasn’t a whole lot of time in-between last week’s post and this one, I still feel like I was able to add in a good amount of features. Next week I plan on sitting down and refining/finishing up some of them and possibly start implementing other planes flying around on their own!!


 
 
 

Comments


bottom of page