Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRS realistic alignment time #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions salty-747/html_ui/Pages/Salty/SaltyIRS.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class SaltyIRS {
var deltaTime = timeNow - this.lastTime;
this.lastTime = timeNow;

var latitude = Math.abs(SimVar.GetSimVarValue("PLANE LATITUDE", "radians") * 180 / Math.PI);
var latitudeFactor = Math.cos(Math.abs(SimVar.GetSimVarValue("PLANE LATITUDE", "radians")));
var IRSState = SimVar.GetSimVarValue("L:SALTY_IRS_STATE", "Enum");
var isIRSOn = ((SimVar.GetSimVarValue("L:747_IRS_KNOB_1", "Enum") >= 1) && (SimVar.GetSimVarValue("L:747_IRS_KNOB_2", "Enum") >= 1) && (SimVar.GetSimVarValue("L:747_IRS_KNOB_3", "Enum") >= 1));
var isSomeIRSOn = ((SimVar.GetSimVarValue("L:747_IRS_KNOB_1", "Enum") >= 1) || (SimVar.GetSimVarValue("L:747_IRS_KNOB_2", "Enum") >= 1) || (SimVar.GetSimVarValue("L:747_IRS_KNOB_3", "Enum") >= 1));
Expand All @@ -25,9 +27,15 @@ class SaltyIRS {
if (isIRSOn && IRSState == 0) {
SimVar.SetSimVarValue("L:SALTY_IRS_STATE", "Enum", 1);
IRSState = 1;

// irs "TIME TO ALIGN" in seconds, default = 7 * 60 ... reduce this to a lower number whilst debugging to protect sanity.
this.irsTimer = 7 * 60;
if (latitude < 70.2) {
this.irsTimer = 600;
}
else if (latitude >= 70.2 && latitude < 78.2) {
this.irsTimer = 1020;
}
else {
this.irsTimer = 1020 * (1 + (1 / latitudeFactor));
}
}

if (IRSState == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class B747_8_FMC_MainDisplay extends Boeing_FMC {
this.updateAutopilot();
this.updateVREF25();
this.updateVREF30();
this.saltyBase.update();
this.SaltyBase.update();
if (SaltyDataStore.get("OPTIONS_UNITS", "KG") == "KG") {
this.units = true;
this.useLbs = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class B747_8_MFD_MainPage extends NavSystemPage {
this.updateAltitudeRangeArc(_deltaTime);

const IRSState = SimVar.GetSimVarValue("L:SALTY_IRS_STATE", "Enum");
const IRSMinutesLeft = Math.floor(SimVar.GetSimVarValue("L:SALTY_IRS_TIME_LEFT", "Enum") / 60);
const IRSMinutesLeft = Math.ceil(SimVar.GetSimVarValue("L:SALTY_IRS_TIME_LEFT", "Enum") / 60); //Math.floor(SimVar.GetSimVarValue("L:SALTY_IRS_TIME_LEFT", "Enum") / 60);

if (IRSState == 0) {
this.mapBox.style.display = "";
Expand Down