diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 4b2c592a1..528ac9a84 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -767,6 +767,24 @@ do -- COORDINATE -- Return wind direction and strength km/h. return direction, strength end + + --- Returns the wind direction (from) and strength. + -- @param #COORDINATE self + -- @param height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground. + -- @return Direction the wind is blowing from in degrees. + function COORDINATE:GetWindWithTurbulenceVec3(height) + + -- AGL height if + local landheight=self:GetLandHeight()+0.1 -- we at 0.1 meters to be sure to be above ground since wind is zero below ground level. + + -- Point at which the wind is evaluated. + local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z} + + -- Get wind velocity vector including turbulences. + local vec3 = atmosphere.getWindWithTurbulence(point) + + return vec3 + end --- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}. diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index ac64a90d6..fef546f38 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -671,8 +671,16 @@ function POSITIONABLE:GetAoA() if unitvel and UTILS.VecNorm(unitvel)~=0 then + -- Get wind vector including turbulences. + local wind=self:GetCoordinate():GetWindWithTurbulenceVec3() + + -- Include wind vector. + unitvel.x=unitvel.x-wind.x + unitvel.y=unitvel.y-wind.y + unitvel.z=unitvel.z-wind.z + -- Unit velocity transformed into aircraft axes directions. - local AxialVel = {} + local AxialVel = {} -- Transform velocity components in direction of aircraft axes. AxialVel.x = UTILS.VecDot(unitpos.x, unitvel)