Skip to content

Commit

Permalink
fix: QFE text missing (#8514)
Browse files Browse the repository at this point in the history
  • Loading branch information
markszutor committed Feb 28, 2024
1 parent 487516a commit 4844268
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1384,20 +1384,20 @@ class A320_Neo_FCU_Pressure extends A320_Neo_FCU_Component {
this.currentValue = _value;
this.lightsTest = _lightsTest;
if (this.lightsTest) {
this.setElementVisibility(this.standardElem, false);
this.setElementVisibility(this.selectedElem, true);
this.setElementVisibility(this.standardElem, false)
this.setElementVisibility(this.selectedElem, true)
this.setTextElementActive(this.textQFE, true);
this.setTextElementActive(this.textQNH, true);
this.textValueContent = "88.88";
return;
}
if (this.currentMode == "STD") {
this.setElementVisibility(this.standardElem, true);
this.setElementVisibility(this.selectedElem, false);
this.setElementVisibility(this.standardElem, true)
this.setElementVisibility(this.selectedElem, false)
SimVar.SetSimVarValue("KOHLSMAN SETTING STD", "Bool", 1);
} else {
this.setElementVisibility(this.standardElem, false);
this.setElementVisibility(this.selectedElem, true);
this.setElementVisibility(this.standardElem, false)
this.setElementVisibility(this.selectedElem, true)
SimVar.SetSimVarValue("KOHLSMAN SETTING STD", "Bool", 0);
const isQFE = (this.currentMode == "QFE") ? true : false;
this.setTextElementActive(this.textQFE, isQFE);
Expand Down Expand Up @@ -1488,6 +1488,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// Earth-Sun distance, angular diameter of Sun
// p. L2: Greenwich mean sidereal time (ignoring T^2, T^3 terms)


// Authors: Dr. Joe Michalsky (joe@asrc.albany.edu)
// Dr. Lee Harrison (lee@asrc.albany.edu)
// Atmospheric Sciences Research Center
Expand All @@ -1499,6 +1500,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// Code 913
// Greenbelt, MD 20771


// WARNING: Do not use this routine outside the year range
// 1950-2050. The approximations become increasingly
// worse, and the calculation of Julian date becomes
Expand Down Expand Up @@ -1527,6 +1529,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// LONG longitude [degrees]
// (REAL; range -180.0 to 180.0; east is positive)


// Output:

// AZ solar azimuth angle (measured east from north,
Expand All @@ -1541,6 +1544,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// (1 AU = mean Earth-sun distance = 1.49597871E+11 m
// in IAU 1976 System of Astronomical Constants)


// Local Variables:

// DEC Declination (radians)
Expand Down Expand Up @@ -1649,7 +1653,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// current Julian date (actually add 2,400,000 for true JD); LEAP = leap days since 1949;
// 32916.5 is midnite 0 jan 1949 minus 2.4e6
const delta = year - 1949;
const delta = year - 1949;
const leap = delta / 4;
let jd = 32916.5 + (delta * 365 + leap + day) + hour / 24;

Expand All @@ -1663,7 +1667,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// ecliptic coordinates
// 51545.0 + 2.4e6 = noon 1 jan 2000
const time = jd - 51545.0;
const time = jd - 51545.0;

// force mean longitude between 0 and 360 degs
let meanLon = (280.460 + 0.9856474 * time) % 360;
Expand All @@ -1687,7 +1691,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}
ecLong = ecLong * rpd;

const obiquityEc = (23.439 - 0.0000004 * time) * rpd;
let obiquityEc = (23.439 - 0.0000004 * time) * rpd;

// right ascension
const NUM = Math.cos(obiquityEc) * Math.sin(ecLong);
Expand All @@ -1696,9 +1700,9 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// Force right ascension between 0 and 2*pi
if (DEN < 0.0) {
RA = RA + Math.PI;
RA = RA + Math.PI;
} else if (NUM < 0) {
RA = RA + Math.PI * 2;
RA = RA + Math.PI * 2;
}

// declination
Expand All @@ -1714,7 +1718,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}

// local mean sidereal time in radians
let LMST = (GMST + lon / 15) % 24;
let LMST = (GMST + lon / 15) % 24;
if (LMST < 0) {
LMST += 24;
}
Expand Down Expand Up @@ -1748,8 +1752,8 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}

// Convert elevation and azimuth to degrees
solarElevation /= rpd;
solarAzimuth /= rpd;
solarElevation /= rpd
solarAzimuth /= rpd

// ======== Refraction correction for U.S. Standard Atmos. ==========
// (assumes elevation in degs) (3.51823=1013.25 mb/288 K)
Expand All @@ -1761,7 +1765,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
(1. + solarElevation * (0.505 + 0.0845 * solarElevation));
}

solarElevation = solarElevation + REFRAC;
solarElevation = solarElevation + REFRAC
// ===================================================================
// distance to sun in A.U. & diameter in degs
const solarDistance = 1.00014 - 0.01671 * Math.cos(meanAnomaly) - 0.00014 * Math.cos(2 * meanAnomaly);
Expand Down Expand Up @@ -1842,7 +1846,7 @@ class Subject {
if (initialNotify) {
newSub.handler(this.value);
}
};
}
newSub.unsub = () => this.subs.splice(this.subs.indexOf(newSub), 1);

this.subs.push(newSub);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,20 +1384,20 @@ class A320_Neo_FCU_Pressure extends A320_Neo_FCU_Component {
this.currentValue = _value;
this.lightsTest = _lightsTest;
if (this.lightsTest) {
this.setElementVisibility(this.standardElem, false);
this.setElementVisibility(this.selectedElem, true);
this.setElementVisibility(this.standardElem, false)
this.setElementVisibility(this.selectedElem, true)
this.setTextElementActive(this.textQFE, true);
this.setTextElementActive(this.textQNH, true);
this.textValueContent = "88.88";
return;
}
if (this.currentMode == "STD") {
this.setElementVisibility(this.standardElem, true);
this.setElementVisibility(this.selectedElem, false);
this.setElementVisibility(this.standardElem, true)
this.setElementVisibility(this.selectedElem, false)
SimVar.SetSimVarValue("KOHLSMAN SETTING STD", "Bool", 1);
} else {
this.setElementVisibility(this.standardElem, false);
this.setElementVisibility(this.selectedElem, true);
this.setElementVisibility(this.standardElem, false)
this.setElementVisibility(this.selectedElem, true)
SimVar.SetSimVarValue("KOHLSMAN SETTING STD", "Bool", 0);
const isQFE = (this.currentMode == "QFE") ? true : false;
this.setTextElementActive(this.textQFE, isQFE);
Expand Down Expand Up @@ -1488,6 +1488,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// Earth-Sun distance, angular diameter of Sun
// p. L2: Greenwich mean sidereal time (ignoring T^2, T^3 terms)


// Authors: Dr. Joe Michalsky (joe@asrc.albany.edu)
// Dr. Lee Harrison (lee@asrc.albany.edu)
// Atmospheric Sciences Research Center
Expand All @@ -1499,6 +1500,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// Code 913
// Greenbelt, MD 20771


// WARNING: Do not use this routine outside the year range
// 1950-2050. The approximations become increasingly
// worse, and the calculation of Julian date becomes
Expand Down Expand Up @@ -1527,6 +1529,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// LONG longitude [degrees]
// (REAL; range -180.0 to 180.0; east is positive)


// Output:

// AZ solar azimuth angle (measured east from north,
Expand All @@ -1541,6 +1544,7 @@ class A320_Neo_FCU_SmallScreen extends NavSystemElement {
// (1 AU = mean Earth-sun distance = 1.49597871E+11 m
// in IAU 1976 System of Astronomical Constants)


// Local Variables:

// DEC Declination (radians)
Expand Down Expand Up @@ -1649,7 +1653,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// current Julian date (actually add 2,400,000 for true JD); LEAP = leap days since 1949;
// 32916.5 is midnite 0 jan 1949 minus 2.4e6
const delta = year - 1949;
const delta = year - 1949;
const leap = delta / 4;
let jd = 32916.5 + (delta * 365 + leap + day) + hour / 24;

Expand All @@ -1663,7 +1667,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// ecliptic coordinates
// 51545.0 + 2.4e6 = noon 1 jan 2000
const time = jd - 51545.0;
const time = jd - 51545.0;

// force mean longitude between 0 and 360 degs
let meanLon = (280.460 + 0.9856474 * time) % 360;
Expand All @@ -1687,7 +1691,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}
ecLong = ecLong * rpd;

const obiquityEc = (23.439 - 0.0000004 * time) * rpd;
let obiquityEc = (23.439 - 0.0000004 * time) * rpd;

// right ascension
const NUM = Math.cos(obiquityEc) * Math.sin(ecLong);
Expand All @@ -1696,9 +1700,9 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {

// Force right ascension between 0 and 2*pi
if (DEN < 0.0) {
RA = RA + Math.PI;
RA = RA + Math.PI;
} else if (NUM < 0) {
RA = RA + Math.PI * 2;
RA = RA + Math.PI * 2;
}

// declination
Expand All @@ -1714,7 +1718,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}

// local mean sidereal time in radians
let LMST = (GMST + lon / 15) % 24;
let LMST = (GMST + lon / 15) % 24;
if (LMST < 0) {
LMST += 24;
}
Expand Down Expand Up @@ -1748,8 +1752,8 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
}

// Convert elevation and azimuth to degrees
solarElevation /= rpd;
solarAzimuth /= rpd;
solarElevation /= rpd
solarAzimuth /= rpd

// ======== Refraction correction for U.S. Standard Atmos. ==========
// (assumes elevation in degs) (3.51823=1013.25 mb/288 K)
Expand All @@ -1761,7 +1765,7 @@ function calculateSunAzimuthElevation(utcTime, lat, lon, out = undefined) {
(1. + solarElevation * (0.505 + 0.0845 * solarElevation));
}

solarElevation = solarElevation + REFRAC;
solarElevation = solarElevation + REFRAC
// ===================================================================
// distance to sun in A.U. & diameter in degs
const solarDistance = 1.00014 - 0.01671 * Math.cos(meanAnomaly) - 0.00014 * Math.cos(2 * meanAnomaly);
Expand Down Expand Up @@ -1842,7 +1846,7 @@ class Subject {
if (initialNotify) {
newSub.handler(this.value);
}
};
}
newSub.unsub = () => this.subs.splice(this.subs.indexOf(newSub), 1);

this.subs.push(newSub);
Expand Down
Loading

0 comments on commit 4844268

Please sign in to comment.