Merge pull request #1030 from FlightControl-Master/FF/Develop

Added wind to AoA
This commit is contained in:
Frank 2018-10-13 23:27:12 +02:00 committed by GitHub
commit 09c46595e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -767,6 +767,24 @@ do -- COORDINATE
-- Return wind direction and strength km/h. -- Return wind direction and strength km/h.
return direction, strength return direction, strength
end 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}. --- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}.

View File

@ -671,8 +671,16 @@ function POSITIONABLE:GetAoA()
if unitvel and UTILS.VecNorm(unitvel)~=0 then 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. -- Unit velocity transformed into aircraft axes directions.
local AxialVel = {} local AxialVel = {}
-- Transform velocity components in direction of aircraft axes. -- Transform velocity components in direction of aircraft axes.
AxialVel.x = UTILS.VecDot(unitpos.x, unitvel) AxialVel.x = UTILS.VecDot(unitpos.x, unitvel)