0
$\begingroup$

Working on programming my own E6B and am stuck trying to calculate the following problem from Sporty's E6B:

Given wind info and desired speed/course, what airspeed/heading should I have in order to maintain the desired speed/course mentioned?


Example:

Inputs:

  • Wind Direction = 60
  • Wind Speed = 14
  • Desired Course = 43
  • Desired Ground Speed = 100

Outputs:

  • True Airspeed required = 113.5
  • Heading required = 45

I have already solved the required Heading part by doing the below (this is JS code):

windAngleRad = toRadians(windDirection - course);

crosswind = windSpeed * Math.sin(windAngleRad);
headwind = windSpeed * Math.cos(windAngleRad);

tas = Math.sqrt(Math.pow(groundSpeed - headwind, 2) + Math.pow(crosswind, 2)); (THIS GIVES WRONG ANSWER)

driftAngleRad = Math.atan(crosswind / (groundSpeed - headwind));
heading = course + toDegrees(driftAngleRad);

toRadians/toDegrees do the obvious, Math.pow is exponent, Math.atan is arctan


I have seen images like the one below, which make it seem like I have everything I need, but I am not sure how to solve the theoretical missing side of this triangle (TAS & HDG).

Wind Triangle

Trigonometry is not my area of expertise, so I believe that is what I am missing here. The only reason I have the code above done is that I saw a breakdown of solving it online. People ask how to calculate GS from TAS but not the other way around... seems like required True Airspeed is not something people seem to be calculating very often.


With that being said, if anyone could help me understand how to solve this, I would greatly appreciate it.

$\endgroup$
3
  • $\begingroup$ Your TAS formula is taking GS (green leg) and subtracting the wind) and then adding the crosswind^2. It seems to me that it should be GS^2 + wind^2. sqrt((green leg)^2 + (red leg)^2 ) $\endgroup$
    – wbeard52
    Commented Apr 22, 2023 at 19:46
  • $\begingroup$ @wbeard52 Pythagorean Theorem then? That doesn't give me the expected results. Wouldnt the Direction have something to do with it as well? Because wind speed could be in any direction, with you or against you but the direction would give you that info of "Hey that 15kt wind is slowing you down, buddy." $\endgroup$ Commented Apr 22, 2023 at 20:13
  • $\begingroup$ The "brute force" approach would be to simply calculate (x,y) coordinates for the tip of the green arrow (ground speed) using sin and cos, go from there to the origin of the red arrow and then you found yourself at the tip of the blue arrow. Of course, you have to account for compass headings pointing up at 0° and increasing clockwise and mathematical angles pointing right at 0° and increasing counterclockwise. $\endgroup$ Commented Apr 22, 2023 at 21:28

1 Answer 1

2
$\begingroup$

I don't know if this will get you what you want. I programmed this a long time ago and don't remember why I did things the way I did and the code comments aren't very helpful now.

This image shows the inputs required to calculate various things involving wind triangles: enter image description here

This image is the result I get using your parameters:

enter image description here

This code snippet is C++/CLI, but I think/ hope that it can be deciphered. I don't know why I used the law of cosines in this calculation. The angles have been converted to radians.

        double angle = 0;
        angle = windDir - trueCrs;
        if (angle < Math::PI)
        {
            angle = Math::PI - angle;
        }
        //Law of cosines
        tas = Math::Round(Math::Sqrt(Math::Pow(windSpd, 2) + Math::Pow(gs, 2)
            - 2 * windSpd*gs*Math::Cos(((angle)))), 0);
$\endgroup$
2
  • $\begingroup$ I know C++ so yeah this is 100% readable. Also tested with numerous random inputs and they all match. Thank you very much! Also, I would be very interested in other aviation programming you did, it sounds awesome and more in-depth than what I was doing. $\endgroup$ Commented Apr 22, 2023 at 23:00
  • $\begingroup$ I'm glad I could help! In the case of the wind triangles, the program also draws them. The way I made the form, the drawing is quite small and depending on the parameters, the components can be hard to see, e.g., those in your question. There are a north arrow, wind vector arrow and course and heading lines shown in different colors. If you aren't aware of it, there is a website with formulas for calculating many things: edwilliams.org/index.htm The aviation formulary link is in the first sentence on that page. You might find something useful there. $\endgroup$
    – curious_1
    Commented Apr 23, 2023 at 2:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .