Skip to content

Commit

Permalink
Fix QFE calculation: fix lapse rate and rounding (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinshannon authored Jan 16, 2025
1 parent c928e3c commit 10b1d8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vATIS.Desktop/Atis/Nodes/AltimeterSettingNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public override string ParseVoiceVariables(Value node, string? format)

private static int CalculateQfe(double qnh, double elevationFeet)
{
// Pressure lapse rate: approximately 1 hPa per 30 feet
const double pressureLapseRateFeet = 30.0;
// Pressure lapse rate: approximately 1 hPa per 27.3 feet
const double pressureLapseRateFeet = 27.3;

// Calculate the QFE
var qfe = qnh - (elevationFeet / pressureLapseRateFeet);
return (int)qfe;
return (int)Math.Ceiling(qfe);
}

private async Task Parse(Pressure? pressure)
Expand Down

0 comments on commit 10b1d8f

Please sign in to comment.