From 1de166a8df63b74058c44c4374147e1cca77fa73 Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Wed, 19 Jan 2022 19:53:42 -0500 Subject: [PATCH] FADEC: Do not flex if flextemp <= TAT --- Nasal/Libraries/property-tree-setup.nas | 2 +- Nasal/Systems/fadec-common.nas | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 80af694c..f49a7e09 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -99,7 +99,7 @@ var Engines = { var Environment = { magVar: props.globals.getNode("/environment/magnetic-variation-deg"), - tempDegC: props.globals.getNode("/environment/temperature-degc"), + temperatureDegC: props.globals.getNode("/environment/temperature-degc"), windFromHdg: props.globals.getNode("/environment/wind-from-heading-deg"), windSpeedKt: props.globals.getNode("/environment/wind-speed-kt"), }; diff --git a/Nasal/Systems/fadec-common.nas b/Nasal/Systems/fadec-common.nas index 9e4c0eb2..1bd98e0b 100644 --- a/Nasal/Systems/fadec-common.nas +++ b/Nasal/Systems/fadec-common.nas @@ -25,6 +25,7 @@ var FADEC = { activeN1: props.globals.getNode("/fdm/jsbsim/fadec/limit/active-n1"), flexActive: props.globals.getNode("/fdm/jsbsim/fadec/limit/flex-active"), flexActiveCmd: props.globals.getNode("/fdm/jsbsim/fadec/limit/flex-active-cmd"), + flexAllowed: 0, flexTemp: props.globals.getNode("/fdm/jsbsim/fadec/limit/flex-temp"), }, lvrClb: props.globals.getNode("/fdm/jsbsim/fadec/lvrclb"), @@ -119,12 +120,13 @@ var FADEC = { pts.Engines.Engine.stateTemp[1] = pts.Engines.Engine.state[1].getValue(); pts.Gear.wowTemp[1] = pts.Gear.wow[1].getValue(); pts.Gear.wowTemp[2] = pts.Gear.wow[2].getValue(); + me.Limit.flexAllowed = pts.Velocities.groundspeedKt.getValue() < 40 and me.Limit.flexTemp.getValue() > math.round(pts.Environment.temperatureDegC.getValue()); - if (me.Limit.flexActiveCmd.getBoolValue() and me.n1Mode[0].getValue() == 0 and me.n1Mode[1].getValue() == 0 and pts.Gear.wowTemp[1] and pts.Gear.wowTemp[2] and pts.Velocities.groundspeedKt.getValue() < 40) { + if (me.Limit.flexActiveCmd.getBoolValue() and me.n1Mode[0].getValue() == 0 and me.n1Mode[1].getValue() == 0 and pts.Gear.wowTemp[1] and pts.Gear.wowTemp[2] and me.Limit.flexAllowed) { if (!me.Limit.flexActive.getBoolValue()) { me.Limit.flexActive.setBoolValue(1); } - } else if (!me.Limit.flexActiveCmd.getBoolValue()) { + } else if (!me.Limit.flexActiveCmd.getBoolValue() or !me.Limit.flexAllowed) { if (me.Limit.flexActive.getBoolValue()) { me.Limit.flexActive.setBoolValue(0); }