-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat(fm): new flight model #379
base: flight-model
Are you sure you want to change the base?
Conversation
/*calculateAlt(p) { | ||
//const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(this.p0 / p) * this.mToFeet; | ||
const altH = this.h1 - ((this.r * this.t1) / (this.g0 * this.mm)) * Math.log(p / this.p1); | ||
SimVar.SetSimVarValue ("L:74S_ADC_ALTH", "feet", altH); | ||
const altL = this.h0 + ((p / this.p0) ** ((-this.r * this.l0) / (this.g0 * this.mm)) - 1) * (this.t0 / this.l0); | ||
SimVar.SetSimVarValue("L:74S_ADC_ALTL", "feet", altL); | ||
const alt = 15000; | ||
if (!this.altSample) { | ||
this.alt0 = alt; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = alt; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (alt < -1000 || alt > 50000) { | ||
return this.ncd; | ||
} | ||
if (p >= 22632) { | ||
if (!this.altSample) { | ||
this.alt0 = altL; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = altL; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (altL < -1000 || altL > 50000) { | ||
return this.ncd; | ||
} | ||
//SimVar.SetSimVarValue("L:74S_ADC_ALTL", "feet", altL); | ||
const alt = altL; | ||
return alt; | ||
} | ||
else { | ||
if (!this.altSample) { | ||
this.alt0 = altH; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = altH; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (altH < -1000 || altH > 50000) { | ||
return this.ncd; | ||
} | ||
//SimVar.SetSimVarValue("L:74S_ADC_ALTH", "feet", altH); | ||
const alt = altH; | ||
return alt; | ||
} | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/*calculateAlt(p) { | |
//const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(this.p0 / p) * this.mToFeet; | |
const altH = this.h1 - ((this.r * this.t1) / (this.g0 * this.mm)) * Math.log(p / this.p1); | |
SimVar.SetSimVarValue ("L:74S_ADC_ALTH", "feet", altH); | |
const altL = this.h0 + ((p / this.p0) ** ((-this.r * this.l0) / (this.g0 * this.mm)) - 1) * (this.t0 / this.l0); | |
SimVar.SetSimVarValue("L:74S_ADC_ALTL", "feet", altL); | |
const alt = 15000; | |
if (!this.altSample) { | |
this.alt0 = alt; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = alt; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (alt < -1000 || alt > 50000) { | |
return this.ncd; | |
} | |
if (p >= 22632) { | |
if (!this.altSample) { | |
this.alt0 = altL; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altL; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altL < -1000 || altL > 50000) { | |
return this.ncd; | |
} | |
//SimVar.SetSimVarValue("L:74S_ADC_ALTL", "feet", altL); | |
const alt = altL; | |
return alt; | |
} | |
else { | |
if (!this.altSample) { | |
this.alt0 = altH; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altH; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altH < -1000 || altH > 50000) { | |
return this.ncd; | |
} | |
//SimVar.SetSimVarValue("L:74S_ADC_ALTH", "feet", altH); | |
const alt = altH; | |
return alt; | |
} | |
}*/ |
calculateAlt(p) { | ||
//const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(this.p0 / p) * this.mToFeet; | ||
const altH = (this.h1 - ((this.r * this.temp1) / (this.g * this.mm)) * Math.log(p / this.p1)) * this.mToFeet; | ||
const altL = (this.h0 + ((p / this.p0) ** ((-this.r * this.l0) / (this.g * this.mm)) - 1) * (this.temp0 / this.l0)) * this.mToFeet; | ||
/*if (!this.altSample) { | ||
this.alt0 = alt; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = alt; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (alt < -1000 || alt > 50000) { | ||
return this.ncd; | ||
}*/ | ||
if (p >= 22632) { | ||
if (!this.altSample) { | ||
this.alt0 = altL; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = altL; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (altL < -1000 || altL > 50000) { | ||
return this.ncd; | ||
} | ||
const alt = altL; | ||
return alt; | ||
} | ||
else { | ||
if (!this.altSample) { | ||
this.alt0 = altH; | ||
this.t0 = performance.now(); | ||
this.altSample = true; | ||
} | ||
else { | ||
this.alt1 = altH; | ||
this.t1 = performance.now(); | ||
this.altSample = false; | ||
} | ||
if (altH < -1000 || altH > 50000) { | ||
return this.ncd; | ||
} | ||
const alt = altH; | ||
return alt; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculateAlt(p) { | |
//const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(this.p0 / p) * this.mToFeet; | |
const altH = (this.h1 - ((this.r * this.temp1) / (this.g * this.mm)) * Math.log(p / this.p1)) * this.mToFeet; | |
const altL = (this.h0 + ((p / this.p0) ** ((-this.r * this.l0) / (this.g * this.mm)) - 1) * (this.temp0 / this.l0)) * this.mToFeet; | |
/*if (!this.altSample) { | |
this.alt0 = alt; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = alt; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (alt < -1000 || alt > 50000) { | |
return this.ncd; | |
}*/ | |
if (p >= 22632) { | |
if (!this.altSample) { | |
this.alt0 = altL; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altL; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altL < -1000 || altL > 50000) { | |
return this.ncd; | |
} | |
const alt = altL; | |
return alt; | |
} | |
else { | |
if (!this.altSample) { | |
this.alt0 = altH; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altH; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altH < -1000 || altH > 50000) { | |
return this.ncd; | |
} | |
const alt = altH; | |
return alt; | |
} | |
} | |
calculateAlt(p) { | |
const altH = (this.h1 - ((this.r * this.temp1) / (this.g * this.mm)) * Math.log(p / this.p1)) * this.mToFeet; | |
const altL = (this.h0 + ((p / this.p0) ** ((-this.r * this.l0) / (this.g * this.mm)) - 1) * (this.temp0 / this.l0)) * this.mToFeet; | |
if (p >= 22632) { | |
if (!this.altSample) { | |
this.alt0 = altL; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altL; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altL < -1000 || altL > 50000) { | |
return this.ncd; | |
} | |
const alt = altL; | |
return alt; | |
} | |
else { | |
if (!this.altSample) { | |
this.alt0 = altH; | |
this.t0 = performance.now(); | |
this.altSample = true; | |
} | |
else { | |
this.alt1 = altH; | |
this.t1 = performance.now(); | |
this.altSample = false; | |
} | |
if (altH < -1000 || altH > 50000) { | |
return this.ncd; | |
} | |
const alt = altH; | |
return alt; | |
} | |
} |
/*calculateBaroCorrAlt(sat, p, baroSetting) { | ||
const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(baroSetting / p) * this.mToFeet; | ||
if (alt < -1000 || alt > 50000) { | ||
return this.ncd; | ||
} | ||
return alt; | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/*calculateBaroCorrAlt(sat, p, baroSetting) { | |
const alt = ((this.r * sat) / (this.g * this.mm)) * Math.log(baroSetting / p) * this.mToFeet; | |
if (alt < -1000 || alt > 50000) { | |
return this.ncd; | |
} | |
return alt; | |
}*/ |
@@ -3,15 +3,27 @@ class SaltyBase { | |||
this.irs = new SaltyIRS(); | |||
this.pilots = new SaltyPilots(); | |||
this.jettison = new SaltyJettison(); | |||
this.airground = new SaltyAirGroundLogic(); | |||
//this.flightphase = new SaltyFlightPhaseLogic(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//this.flightphase = new SaltyFlightPhaseLogic(); |
this.airground = new SaltyAirGroundLogic(); | ||
//this.flightphase = new SaltyFlightPhaseLogic(); | ||
this.adc = new SaltyADC(); | ||
//this.fadec = new SaltyFADEC(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//this.fadec = new SaltyFADEC(); |
update() { | ||
|
||
for (let i = 1; i < 5; i++){ | ||
let index = i; | ||
/*RegisterViewListener("JS_LISTENER_KEYEVENT"); | ||
this.keyListener = RegisterViewListener('JS_LISTENER_KEYEVENT', () => { | ||
Coherent.call('INTERCEPT_KEY_EVENT', 'INCREASE_THROTTLE', 0); | ||
Coherent.call('INTERCEPT_KEY_EVENT', 'DECREASE_THROTTLE', 0); | ||
Coherent.call('INTERCEPT_KEY_EVENT', 'THROTTLE_CUT', 0); | ||
this.keyListener.on('keyIntercepted', keyEventName => { | ||
if (keyEventName === 'THROTTLE_CUT') { | ||
if (SimVar.GetSimVarValue("GPS OBS ACTIVE", "boolean")) { | ||
SimVar.SetSimVarValue("K:GPS_OBS_SET", "degrees", SimVar.GetSimVarValue("NAV OBS:1", "degree")); | ||
} | ||
console.log('THROTTLE CUT INTERCEPTED'); | ||
SimVar.SetSimVarValue("K:AXIS_THROTTLE_SET", "position 16K", 5995); | ||
} | ||
if (keyEventName === 'VOR1_OBI_DEC') { | ||
if (SimVar.GetSimVarValue("GPS OBS ACTIVE", "boolean")) { | ||
SimVar.SetSimVarValue("K:GPS_OBS_SET", "degrees", SimVar.GetSimVarValue("NAV OBS:1", "degree")); | ||
} | ||
} | ||
}); | ||
|
||
});*/ | ||
//this.getEAI(index); | ||
//this.getBleed(index); | ||
//this.getAlternate(index); | ||
//this.getTLA(index); | ||
//this.getIdleN1(index); | ||
//this.getMaxN1(index); | ||
this.setCommandedN1(index); | ||
} | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update() { | |
for (let i = 1; i < 5; i++){ | |
let index = i; | |
/*RegisterViewListener("JS_LISTENER_KEYEVENT"); | |
this.keyListener = RegisterViewListener('JS_LISTENER_KEYEVENT', () => { | |
Coherent.call('INTERCEPT_KEY_EVENT', 'INCREASE_THROTTLE', 0); | |
Coherent.call('INTERCEPT_KEY_EVENT', 'DECREASE_THROTTLE', 0); | |
Coherent.call('INTERCEPT_KEY_EVENT', 'THROTTLE_CUT', 0); | |
this.keyListener.on('keyIntercepted', keyEventName => { | |
if (keyEventName === 'THROTTLE_CUT') { | |
if (SimVar.GetSimVarValue("GPS OBS ACTIVE", "boolean")) { | |
SimVar.SetSimVarValue("K:GPS_OBS_SET", "degrees", SimVar.GetSimVarValue("NAV OBS:1", "degree")); | |
} | |
console.log('THROTTLE CUT INTERCEPTED'); | |
SimVar.SetSimVarValue("K:AXIS_THROTTLE_SET", "position 16K", 5995); | |
} | |
if (keyEventName === 'VOR1_OBI_DEC') { | |
if (SimVar.GetSimVarValue("GPS OBS ACTIVE", "boolean")) { | |
SimVar.SetSimVarValue("K:GPS_OBS_SET", "degrees", SimVar.GetSimVarValue("NAV OBS:1", "degree")); | |
} | |
} | |
}); | |
});*/ | |
//this.getEAI(index); | |
//this.getBleed(index); | |
//this.getAlternate(index); | |
//this.getTLA(index); | |
//this.getIdleN1(index); | |
//this.getMaxN1(index); | |
this.setCommandedN1(index); | |
} | |
return; | |
} | |
update() { | |
for (let i = 1; i < 5; i++){ | |
let index = i; | |
this.setCommandedN1(index); | |
} | |
return; | |
} |
@@ -1606,7 +1606,7 @@ | |||
return; | |||
} | |||
this.currentAutoThrottleStatus = AutoThrottleModeState.THR; | |||
SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 80); | |||
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 80); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 80); |
@@ -1652,7 +1652,7 @@ | |||
activateThrustRefMode() { | |||
this.currentAutoThrottleStatus = AutoThrottleModeState.THRREF; | |||
Coherent.call("GENERAL_ENG_THROTTLE_MANAGED_MODE_SET", ThrottleMode.CLIMB); | |||
SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 90); | |||
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 90); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 90); |
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 23.2); | ||
//SimVar.SetSimVarValue("K:AP_N1_HOLD", "bool", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//SimVar.SetSimVarValue("K:AP_N1_REF_SET", "number", 23.2); | |
//SimVar.SetSimVarValue("K:AP_N1_HOLD", "bool", 1); |
<!-- <script type="text/html" import-script="/Pages/Salty/SaltyFlightPhaseLogic.js"></script> --> | ||
<script type="text/html" import-script="/Pages/Salty/SaltyADC.js"></script> | ||
<!-- <script type="text/html" import-script="/Pages/Salty/SaltyFADEC.js"></script> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<!-- <script type="text/html" import-script="/Pages/Salty/SaltyFlightPhaseLogic.js"></script> --> | |
<script type="text/html" import-script="/Pages/Salty/SaltyADC.js"></script> | |
<!-- <script type="text/html" import-script="/Pages/Salty/SaltyFADEC.js"></script> --> | |
<script type="text/html" import-script="/Pages/Salty/SaltyADC.js"></script> |
No description provided.