6
$\begingroup$

I am currently learning C++ on my own in my spare time. I am writing a little application that will help me while at work. I have come across a situation where I have some given values, but im not sure of the formula to use in order to render the end answer I am looking for.

Basically, I have the following parameters available to me:

  • Desired Track
  • Current Heading
  • Ground Speed
  • True Airspeed

I am interested in finding the wind speed and wind direction.

I have googled and googled for hours. Obviously most people use the old aviation E6B. However, that obviously doesn't work for programming. I was wondering if anyone happened to know, or know how I can find that formula.

$\endgroup$
  • $\begingroup$ I don't see any formulas on that website. I did see some formulas on the wind triangle wiki page, but they are very vague and don't explain in detail what is going on. Seems to be kind of difficult to explain mathematically. $\endgroup$ – Justin Sellers Feb 10 '17 at 11:19
  • $\begingroup$ There is a nice page of aviation formulas, that include wind triangles, here: edwilliams.org/avform.htm $\endgroup$ – Adam Feb 11 '17 at 18:55
6
$\begingroup$

With the set of parameters available to you, you cannot do this.

If you have the actual track instead of the desired track, you will be able to calculate the wind.

The simplest way to do this is using vector math.

There are three vectors to consider:

  • ground speed vector $\vec{V_{gs}}$
  • air speed vector $\vec{V_{as}} $
  • wind speed vector $\vec{V_{ws}} $

enter image description here

$\vec{V_{gs}} =\vec{V_{as}} + \vec{V_{ws}} $

$\vec{V_{ws}} = \vec{V_{gs}} - \vec{V_{as}} $

I assume the actual track angle ($\phi$) and heading ($\psi$) are with respect to the true North.

The north component of your air speed is then: $V_{as} \cdot \cos(\psi)$ and the east component of your air speed is: $V_{as} \cdot \sin(\psi)$

For ground speed the decomposition is: north: $V_{gs} \cdot \cos(\phi)$ and the east component of your ground speed is: $V_{gs} \cdot \sin(\phi)$

$$\begin{bmatrix} V_{ws,north}\\ V_{ws,east} \end{bmatrix} = \begin{bmatrix} V_{gs} \cdot \cos(\phi) - V_{as} \cdot \cos(\psi) \\ V_{gs} \cdot \sin(\phi) - V_{as} \cdot \sin(\psi) \end{bmatrix}$$

You now have the north and east component of the wind vector. This you can change to a speed and direction, but I leave that last part up to you. Don't forget that wind direction is usually reported as the direction from which the wind is coming.


To find the wind speed from the North and East components use the root of the sum of the squares:

$V_{ws}=\sqrt{V_{ws,north}^2 + V_{ws,east} ^2}$

The wind direction can be found by

$\tan^{-1} (\frac {V_{ws,north}}{V_{ws,east} }) $

Note that this will give a division by 0 for winds exactly from north or south.

To implement it in a computer language the atan2 function can be used. This prevents division by zero and also returns the direction of the full range of the circle instead of semi-circular

wind_dir = atan2(-wind_north, -wind_east)

This should give the direction from which the wind is coming in radians.

$\endgroup$
  • $\begingroup$ Thanks DeltaLima. I actually have an available parameter of North and East wind component in the data. Just had no clue about the reference. Now I think I can figure it out. $\endgroup$ – Justin Sellers Feb 10 '17 at 18:38
  • $\begingroup$ For those of you in the future that may be wondering. $\endgroup$ – Justin Sellers Feb 10 '17 at 21:55
  • $\begingroup$ To find the wind speed = apply this formula WS=SQRT((x^2)+(y^2)) If it is in Meters per Second, be sure to convert to Knots if needed. To find the wind direction = apply this formula WD=ATAN2(y,x) where Y == to North/South vector and the X == the East/West vector. Once you run this formula, you will be presented with a degree in radian format. Convert the Radian to degrees with this formula Degree= (Radian*180)/Pi Finally, our last step is to take it from a Wind TO direction to a wind FROM direction (which is what aviation uses) to do that, simply add 180 degrees. $\endgroup$ – Justin Sellers Feb 10 '17 at 22:02
  • $\begingroup$ Hi Justin, great to see that you figured it out. Feel free to edit my answer to add your findings. $\endgroup$ – DeltaLima Feb 10 '17 at 22:08
  • $\begingroup$ Just realised that you may not have enough reputation to edit my text. I'll add it myself. Welcome to the site! $\endgroup$ – DeltaLima Feb 10 '17 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.