Merge pull request #1581 from FlightControl-Master/Applevangelist-patch-1

Update ATIS.lua
This commit is contained in:
Applevangelist 2021-07-24 15:57:15 +02:00 committed by GitHub
commit b52272e18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -383,13 +383,13 @@ ATIS.Alphabet = {
--- Runway correction for converting true to magnetic heading. --- Runway correction for converting true to magnetic heading.
-- @type ATIS.RunwayM2T -- @type ATIS.RunwayM2T
-- @field #number Caucasus 0° (East). -- @field #number Caucasus 0° (East).
-- @field #number Nevada +12° (East). -- @field #number Nevada +12° (East).
-- @field #number Normandy -10° (West). -- @field #number Normandy -10° (West).
-- @field #number PersianGulf +2° (East). -- @field #number PersianGulf +2° (East).
-- @field #number TheChannel -10° (West). -- @field #number TheChannel -10° (West).
-- @field #number Syria +5° (East). -- @field #number Syria +5° (East).
-- @field #number MarianaIslands +2° (East). -- @field #number MarianaIslands +2° (East).
ATIS.RunwayM2T={ ATIS.RunwayM2T={
Caucasus=0, Caucasus=0,
Nevada=12, Nevada=12,
@ -839,9 +839,9 @@ function ATIS:SetMapMarks(switch)
return self return self
end end
--- Set magnetic runway headings as depicted on the runway, *e.g.* "13" for 130° or "25L" for the left runway with magnetic heading 250°. --- Set magnetic runway headings as depicted on the runway, *e.g.* "13" for 130° or "25L" for the left runway with magnetic heading 250°.
-- @param #ATIS self -- @param #ATIS self
-- @param #table headings Magnetic headings. Inverse (-180°) headings are added automatically. You only need to specify one heading per runway direction. "L"eft and "R" right can also be appended. -- @param #table headings Magnetic headings. Inverse (-180°) headings are added automatically. You only need to specify one heading per runway direction. "L"eft and "R" right can also be appended.
-- @return #ATIS self -- @return #ATIS self
function ATIS:SetRunwayHeadingsMagnetic(headings) function ATIS:SetRunwayHeadingsMagnetic(headings)
@ -974,12 +974,12 @@ end
-- --
-- To get *true* from *magnetic* heading one has to add easterly or substract westerly variation, e.g -- To get *true* from *magnetic* heading one has to add easterly or substract westerly variation, e.g
-- --
-- A magnetic heading of 180° corresponds to a true heading of -- A magnetic heading of 180° corresponds to a true heading of
-- --
-- * 186° on the Caucaus map -- * 186° on the Caucaus map
-- * 192° on the Nevada map -- * 192° on the Nevada map
-- * 170° on the Normany map -- * 170° on the Normany map
-- * 182° on the Persian Gulf map -- * 182° on the Persian Gulf map
-- --
-- Likewise, to convert *true* into *magnetic* heading, one has to substract easterly and add westerly variation. -- Likewise, to convert *true* into *magnetic* heading, one has to substract easterly and add westerly variation.
-- --
@ -1314,7 +1314,7 @@ function ATIS:onafterBroadcast(From, Event, To)
local g= 9.80665 --[m/s^2] local g= 9.80665 --[m/s^2]
local M= 0.0289644 --[kg/mol] local M= 0.0289644 --[kg/mol]
local T0=coord:GetTemperature(0)+273.15 --[K] Temp at sea level. local T0=coord:GetTemperature(0)+273.15 --[K] Temp at sea level.
local TS=288.15 -- Standard Temperature assumed by Altimeter is 15°C local TS=288.15 -- Standard Temperature assumed by Altimeter is 15°C
local q=qnh*100 local q=qnh*100
-- Calculate Pressure. -- Calculate Pressure.
@ -1451,13 +1451,13 @@ function ATIS:onafterBroadcast(From, Event, To)
--- Temperature and Dew Point --- --- Temperature and Dew Point ---
--------------------------------- ---------------------------------
-- Temperature in °C. -- Temperature in °C.
local temperature=coord:GetTemperature(height+5) local temperature=coord:GetTemperature(height+5)
-- Dew point in °C. -- Dew point in °C.
local dewpoint=temperature-(100-self.relHumidity)/5 local dewpoint=temperature-(100-self.relHumidity)/5
-- Convert to °F. -- Convert to °F.
if self.TDegF then if self.TDegF then
temperature=UTILS.CelciusToFarenheit(temperature) temperature=UTILS.CelciusToFarenheit(temperature)
dewpoint=UTILS.CelciusToFarenheit(dewpoint) dewpoint=UTILS.CelciusToFarenheit(dewpoint)
@ -1901,15 +1901,15 @@ function ATIS:onafterBroadcast(From, Event, To)
-- Temperature -- Temperature
if self.TDegF then if self.TDegF then
if temperature<0 then if temperature<0 then
subtitle=string.format("Temperature -%s °F", TEMPERATURE) subtitle=string.format("Temperature -%s °F", TEMPERATURE)
else else
subtitle=string.format("Temperature %s °F", TEMPERATURE) subtitle=string.format("Temperature %s °F", TEMPERATURE)
end end
else else
if temperature<0 then if temperature<0 then
subtitle=string.format("Temperature -%s °C", TEMPERATURE) subtitle=string.format("Temperature -%s °C", TEMPERATURE)
else else
subtitle=string.format("Temperature %s °C", TEMPERATURE) subtitle=string.format("Temperature %s °C", TEMPERATURE)
end end
end end
local _TEMPERATURE=subtitle local _TEMPERATURE=subtitle
@ -1930,15 +1930,15 @@ function ATIS:onafterBroadcast(From, Event, To)
-- Dew point -- Dew point
if self.TDegF then if self.TDegF then
if dewpoint<0 then if dewpoint<0 then
subtitle=string.format("Dew point -%s °F", DEWPOINT) subtitle=string.format("Dew point -%s °F", DEWPOINT)
else else
subtitle=string.format("Dew point %s °F", DEWPOINT) subtitle=string.format("Dew point %s °F", DEWPOINT)
end end
else else
if dewpoint<0 then if dewpoint<0 then
subtitle=string.format("Dew point -%s °C", DEWPOINT) subtitle=string.format("Dew point -%s °C", DEWPOINT)
else else
subtitle=string.format("Dew point %s °C", DEWPOINT) subtitle=string.format("Dew point %s °C", DEWPOINT)
end end
end end
local _DEWPOINT=subtitle local _DEWPOINT=subtitle
@ -2276,8 +2276,8 @@ function ATIS:onafterReport(From, Event, To, Text)
-- Replace other stuff. -- Replace other stuff.
local text=string.gsub(text, "SM", "statute miles") local text=string.gsub(text, "SM", "statute miles")
local text=string.gsub(text, "°C", "degrees Celsius") local text=string.gsub(text, "°C", "degrees Celsius")
local text=string.gsub(text, "°F", "degrees Fahrenheit") local text=string.gsub(text, "°F", "degrees Fahrenheit")
local text=string.gsub(text, "inHg", "inches of Mercury") local text=string.gsub(text, "inHg", "inches of Mercury")
local text=string.gsub(text, "mmHg", "millimeters of Mercury") local text=string.gsub(text, "mmHg", "millimeters of Mercury")
local text=string.gsub(text, "hPa", "hecto Pascals") local text=string.gsub(text, "hPa", "hecto Pascals")
@ -2397,7 +2397,7 @@ end
--- Get runway from user supplied magnetic heading. --- Get runway from user supplied magnetic heading.
-- @param #ATIS self -- @param #ATIS self
-- @param #number windfrom Wind direction (from) in degrees. -- @param #number windfrom Wind direction (from) in degrees.
-- @return #string Runway magnetic heading divided by ten (and rounded). Eg, "13" for 130°. -- @return #string Runway magnetic heading divided by ten (and rounded). Eg, "13" for 130°.
function ATIS:GetMagneticRunway(windfrom) function ATIS:GetMagneticRunway(windfrom)
local diffmin=nil local diffmin=nil
@ -2440,7 +2440,7 @@ function ATIS:GetNavPoint(navpoints, runway, left)
local navL=self:GetRunwayLR(nav.runway) local navL=self:GetRunwayLR(nav.runway)
local hdgD=UTILS.HdgDiff(navy,rwyy) local hdgD=UTILS.HdgDiff(navy,rwyy)
if hdgD<=15 then --We allow an error of +-15° here. if hdgD<=15 then --We allow an error of +-15° here.
if navL==nil or (navL==true and left==true) or (navL==false and left==false) then if navL==nil or (navL==true and left==true) or (navL==false and left==false) then
return nav return nav
end end