1
0
Fork 0

Merge branch 'dev' into mcdukgs

This commit is contained in:
legoboyvdlp R 2020-09-19 13:56:17 +01:00
commit 1240862693
37 changed files with 917 additions and 903 deletions

View file

@ -213,6 +213,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/> <system file="a320-adr"/>
<system file="a320-apu"/> <system file="a320-apu"/>
<system file="a320-fmgc"/> <system file="a320-fmgc"/>
<system file="a320-misc"/>
<flight_control name="none"/> <flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/> <aerodynamics file="Systems/a320-aerodynamics.xml"/>

View file

@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/> <system file="a320-adr"/>
<system file="a320-apu"/> <system file="a320-apu"/>
<system file="a320-fmgc"/> <system file="a320-fmgc"/>
<system file="a320-misc"/>
<flight_control name="none"/> <flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/> <aerodynamics file="Systems/a320-aerodynamics.xml"/>

View file

@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/> <system file="a320-adr"/>
<system file="a320-apu"/> <system file="a320-apu"/>
<system file="a320-fmgc"/> <system file="a320-fmgc"/>
<system file="a320-misc"/>
<flight_control name="none"/> <flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/> <aerodynamics file="Systems/a320-aerodynamics.xml"/>

View file

@ -5,7 +5,11 @@
<PropertyList include="Aircraft/Generic/Human/Include/walker-include.xml"> <PropertyList include="Aircraft/Generic/Human/Include/walker-include.xml">
<sim> <sim>
<animation>
<fire-services type="bool">0</fire-services>
</animation>
<author>Josh Davidson/Octal450 (Flight Dynamics, Systems, Displays), Jonathan Redpath/legoboyvdlp, merspieler, Matthew Maring/mattmaring (Systems, Displays), Thorsten Herrmann/TH-555, Semir Gebran/CaptB (3D, Textures)</author> <author>Josh Davidson/Octal450 (Flight Dynamics, Systems, Displays), Jonathan Redpath/legoboyvdlp, merspieler, Matthew Maring/mattmaring (Systems, Displays), Thorsten Herrmann/TH-555, Semir Gebran/CaptB (3D, Textures)</author>
<checklists include="A32X-Checklists.xml"/> <checklists include="A32X-Checklists.xml"/>
@ -719,6 +723,11 @@
<max-athr-thrust type="double">0.94</max-athr-thrust> <max-athr-thrust type="double">0.94</max-athr-thrust>
<throttle-output type="double">0</throttle-output> <throttle-output type="double">0</throttle-output>
<throttle-fdm type="double">0</throttle-fdm> <throttle-fdm type="double">0</throttle-fdm>
<throttle-rev type="double">0</throttle-rev>
<reverser type="double">0</reverser>
<igniter-a type="bool">0</igniter-a>
<igniter-b type="bool">0</igniter-b>
<last-igniter type="string">B</last-igniter>
</engine> </engine>
<engine n="1"> <engine n="1">
<cutoff type="bool">true</cutoff> <cutoff type="bool">true</cutoff>
@ -732,6 +741,11 @@
<max-athr-thrust type="double">0.94</max-athr-thrust> <max-athr-thrust type="double">0.94</max-athr-thrust>
<throttle-output type="double">0</throttle-output> <throttle-output type="double">0</throttle-output>
<throttle-fdm type="double">0</throttle-fdm> <throttle-fdm type="double">0</throttle-fdm>
<throttle-rev type="double">0</throttle-rev>
<reverser type="double">0</reverser>
<igniter-a type="bool">0</igniter-a>
<igniter-b type="bool">0</igniter-b>
<last-igniter type="string">B</last-igniter>
</engine> </engine>
<engine n="2"> <engine n="2">
<cutoff type="bool">true</cutoff> <cutoff type="bool">true</cutoff>
@ -789,6 +803,7 @@
</refuel> </refuel>
</fuel> </fuel>
<gear> <gear>
<brake-fans type="bool">0</brake-fans>
<brake-parking type="bool">0</brake-parking> <brake-parking type="bool">0</brake-parking>
<tiller-cmd-norm type="double">0</tiller-cmd-norm> <tiller-cmd-norm type="double">0</tiller-cmd-norm>
<tiller-enabled type="bool">0</tiller-enabled> <tiller-enabled type="bool">0</tiller-enabled>
@ -987,12 +1002,18 @@
<caster-angle-deg-damped type="double">0</caster-angle-deg-damped> <caster-angle-deg-damped type="double">0</caster-angle-deg-damped>
</gear> </gear>
<gear n="1"> <gear n="1">
<Lbrake-smoke type="double">0</Lbrake-smoke>
<L1brake-temp-degc type="double">15</L1brake-temp-degc>
<L2brake-temp-degc type="double">15</L2brake-temp-degc>
<tyre-smoke type="int">0</tyre-smoke> <tyre-smoke type="int">0</tyre-smoke>
<sprayspeed-ms type="double">0</sprayspeed-ms> <sprayspeed-ms type="double">0</sprayspeed-ms>
<spray-density type="double">0</spray-density> <spray-density type="double">0</spray-density>
<caster-angle-deg-damped type="double">0</caster-angle-deg-damped> <caster-angle-deg-damped type="double">0</caster-angle-deg-damped>
</gear> </gear>
<gear n="2"> <gear n="2">
<Rbrake-smoke type="double">0</Rbrake-smoke>
<R3brake-temp-degc type="double">15</R3brake-temp-degc>
<R4brake-temp-degc type="double">15</R4brake-temp-degc>
<tyre-smoke type="int">0</tyre-smoke> <tyre-smoke type="int">0</tyre-smoke>
<sprayspeed-ms type="double">0</sprayspeed-ms> <sprayspeed-ms type="double">0</sprayspeed-ms>
<spray-density type="double">0</spray-density> <spray-density type="double">0</spray-density>
@ -1254,6 +1275,8 @@
<valves> <valves>
<apu-lp-valve-cmd type="bool">0</apu-lp-valve-cmd> <apu-lp-valve-cmd type="bool">0</apu-lp-valve-cmd>
</valves> </valves>
<offset-left type="double">0</offset-left>
<offset-right type="double">0</offset-right>
<fuel-used-1 type="double">0</fuel-used-1> <fuel-used-1 type="double">0</fuel-used-1>
<fuel-used-2 type="double">0</fuel-used-2> <fuel-used-2 type="double">0</fuel-used-2>
<mode-fault type="bool">0</mode-fault> <mode-fault type="bool">0</mode-fault>

View file

@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/> <system file="a320-adr"/>
<system file="a320-apu"/> <system file="a320-apu"/>
<system file="a320-fmgc"/> <system file="a320-fmgc"/>
<system file="a320-misc"/>
<flight_control name="none"/> <flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/> <aerodynamics file="Systems/a320-aerodynamics.xml"/>

View file

@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/> <system file="a320-adr"/>
<system file="a320-apu"/> <system file="a320-apu"/>
<system file="a320-fmgc"/> <system file="a320-fmgc"/>
<system file="a320-misc"/>
<flight_control name="none"/> <flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/> <aerodynamics file="Systems/a320-aerodynamics.xml"/>

View file

@ -43,6 +43,7 @@ LBS2KGS = 0.4535924;
# Fetch Nodes # Fetch Nodes
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1);
var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1); var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1);
var rate = props.globals.getNode("/systems/acconfig/options/lecam-rate", 1);
var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1); var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1);
var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1); var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1);
@ -115,43 +116,6 @@ var cargobulk_pos = props.globals.getNode("/sim/model/door-positions/cargobulk/p
var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1); var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1);
var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1); var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1);
# Electrical nodes
var apu_volts = props.globals.getNode("/systems/electrical/sources/apu/output-volt", 1);
var apu_hz = props.globals.getNode("/systems/electrical/sources/apu/output-hertz", 1);
var gen_apu = props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos", 1);
var switch_bat1 = props.globals.getNode("/controls/electrical/switches/bat-1", 1);
var switch_bat2 = props.globals.getNode("/controls/electrical/switches/bat-2", 1);
var bat1_amps = props.globals.getNode("/systems/electrical/sources/bat-1/amps", 1);
var bat2_amps = props.globals.getNode("/systems/electrical/sources/bat-2/amps", 1);
var bat1_volts = props.globals.getNode("/systems/electrical/sources/bat-1/volt", 1);
var bat2_volts = props.globals.getNode("/systems/electrical/sources/bat-2/volt", 1);
var bat1_fault = props.globals.getNode("/systems/electrical/light/bat-1-fault", 1);
var bat2_fault = props.globals.getNode("/systems/electrical/light/bat-2-fault", 1);
var bat1_direction = props.globals.getNode("/systems/electrical/sources/bat-1/direction", 1);
var bat2_direction = props.globals.getNode("/systems/electrical/sources/bat-2/direction", 1);
var emerGenVolts = props.globals.getNode("/systems/electrical/relay/emer-glc/output", 1);
var emerGenHz = props.globals.getNode("/systems/electrical/sources/emer-gen/output-hertz", 1);
var tr1_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output", 1);
var tr2_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output", 1);
var tr1_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output-amp", 1);
var tr2_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output-amp", 1);
var switch_emer_gen = props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt", 1);
var switch_gen1 = props.globals.getNode("/controls/electrical/switches/gen-1", 1);
var switch_gen2 = props.globals.getNode("/controls/electrical/switches/gen-2", 1);
var gen1_volts = props.globals.getNode("/systems/electrical/sources/idg-1/output-volt", 1);
var gen2_volts = props.globals.getNode("/systems/electrical/sources/idg-2/output-volt", 1);
var gen1_hz = props.globals.getNode("/systems/electrical/sources/idg-1/output-hertz", 1);
var gen2_hz = props.globals.getNode("/systems/electrical/sources/idg-2/output-hertz", 1);
var ext_volts = props.globals.getNode("/systems/electrical/sources/ext/output-volt", 1);
var ext_hz = props.globals.getNode("/systems/electrical/sources/ext/output-hertz", 1);
var galleyshed = props.globals.getNode("/systems/electrical/some-electric-thingie/galley-shed", 1);
var switch_galley = props.globals.getNode("/controls/electrical/switches/galley", 1);
var switch_ac_ess_feed = props.globals.getNode("/controls/electrical/switches/ac-ess-feed", 1);
var tr1_fault = props.globals.getNode("/systems/failures/electrical/tr-1", 1);
var tr2_fault = props.globals.getNode("/systems/failures/electrical/tr-2", 1);
var essTrVolt = props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output", 1);
var essTrAmp = props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output-amp", 1);
# Hydraulic # Hydraulic
var blue_psi = 0; var blue_psi = 0;
var green_psi = 0; var green_psi = 0;
@ -211,6 +175,7 @@ var eng2_n1 = props.globals.getNode("/engines/engine[1]/n1-actual", 1);
var total_fuel_lbs = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1); var total_fuel_lbs = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1);
var fadec1 = props.globals.getNode("/systems/fadec/powered1", 1); var fadec1 = props.globals.getNode("/systems/fadec/powered1", 1);
var fadec2 = props.globals.getNode("/systems/fadec/powered2", 1); var fadec2 = props.globals.getNode("/systems/fadec/powered2", 1);
var fadecPowerUp = props.globals.getNode("/systems/fadec/powerup", 1);
var fuel_flow1 = props.globals.getNode("/engines/engine[0]/fuel-flow_actual", 1); var fuel_flow1 = props.globals.getNode("/engines/engine[0]/fuel-flow_actual", 1);
var fuel_flow2 = props.globals.getNode("/engines/engine[1]/fuel-flow_actual", 1); var fuel_flow2 = props.globals.getNode("/engines/engine[1]/fuel-flow_actual", 1);
var fuel_left_outer_temp = props.globals.getNode("/consumables/fuel/tank[0]/temperature_degC", 1); var fuel_left_outer_temp = props.globals.getNode("/consumables/fuel/tank[0]/temperature_degC", 1);
@ -265,12 +230,12 @@ var canvas_lowerECAM_base = {
if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (systems.ELEC.Bus.ac2.getValue() >= 110) {
if (du4_offtime.getValue() + 3 < elapsedtime) { if (du4_offtime.getValue() + 3 < elapsedtime) {
if (gear0_wow.getValue() == 1) { if (gear0_wow.getValue()) {
if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) { if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) {
du4_test.setValue(1); du4_test.setValue(1);
du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
du4_test_time.setValue(elapsedtime); du4_test_time.setValue(elapsedtime);
} else if (autoconfig_running.getValue() == 1 and du4_test.getValue() != 1) { } else if (autoconfig_running.getValue() and du4_test.getValue() != 1) {
du4_test.setValue(1); du4_test.setValue(1);
du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
du4_test_time.setValue(elapsedtime - 30); du4_test_time.setValue(elapsedtime - 30);
@ -555,7 +520,7 @@ var canvas_lowerECAM_base = {
me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCh"].setText(sprintf("%02d", hour.getValue()));
me["UTCm"].setText(sprintf("%02d", minute.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue()));
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100)))); me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100))));
me["GW-weight-unit"].setText("KG"); me["GW-weight-unit"].setText("KG");
} else { } else {
@ -578,7 +543,7 @@ var canvas_lowerECAM_apu = {
}, },
update: func() { update: func() {
# Avail and Flap Open # Avail and Flap Open
if (apu_flap.getValue() == 1) { if (apu_flap.getValue()) {
me["APUFlapOpen"].show(); me["APUFlapOpen"].show();
} else { } else {
me["APUFlapOpen"].hide(); me["APUFlapOpen"].hide();
@ -597,19 +562,19 @@ var canvas_lowerECAM_apu = {
} }
# APU Gen # APU Gen
if (apu_volts.getValue() >= 110) { if (systems.ELEC.Source.APU.volts.getValue() >= 110) {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941); me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["APUGenVolt"].setColor(0.7333,0.3803,0); me["APUGenVolt"].setColor(0.7333,0.3803,0);
} }
if (apu_hz.getValue() > 380) { if (systems.ELEC.Source.APU.hertz.getValue() > 380) {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941); me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["APUGenHz"].setColor(0.7333,0.3803,0); me["APUGenHz"].setColor(0.7333,0.3803,0);
} }
if (systems.APUNodes.Controls.master.getValue() == 1 or apu_rpm.getValue() >= 94.9) { if (systems.APUNodes.Controls.master.getValue() or apu_rpm.getValue() >= 94.9) {
me["APUGenbox"].show(); me["APUGenbox"].show();
me["APUGenHz"].show(); me["APUGenHz"].show();
me["APUGenVolt"].show(); me["APUGenVolt"].show();
@ -627,24 +592,24 @@ var canvas_lowerECAM_apu = {
me["text3732"].hide(); me["text3732"].hide();
} }
if ((apu_rpm.getValue() > 94.9) and (gen_apu.getValue() == 1)) { if ((apu_rpm.getValue() > 94.9) and (systems.ELEC.Source.APU.contact.getValue())) {
me["APUGenOnline"].show(); me["APUGenOnline"].show();
} else { } else {
me["APUGenOnline"].hide(); me["APUGenOnline"].hide();
} }
if ((systems.APUNodes.Controls.master.getValue() == 0) or ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 1) and (apu_rpm.getValue() > 94.9))) { if ((systems.APUNodes.Controls.master.getValue() == 0) or ((systems.APUNodes.Controls.master.getValue()) and (systems.ELEC.Source.APU.contact.getValue()) and (apu_rpm.getValue() > 94.9))) {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else if ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 0) and (apu_rpm.getValue() < 94.9)) { } else if ((systems.APUNodes.Controls.master.getValue()) and (systems.ELEC.Source.APU.contact.getValue() == 0) and (apu_rpm.getValue() < 94.9)) {
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
} }
me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue()))); me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue())));
me["APUGenVolt"].setText(sprintf("%s", math.round(apu_volts.getValue()))); me["APUGenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.volts.getValue())));
me["APUGenHz"].setText(sprintf("%s", math.round(apu_hz.getValue()))); me["APUGenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.hertz.getValue())));
# APU Bleed # APU Bleed
if (systems.ADIRS.Operating.adr[0].getValue() and (systems.APUNodes.Controls.bleed.getValue() == 1 or bleedapu.getValue() > 0)) { if (systems.ADIRS.Operating.adr[0].getValue() and (systems.APUNodes.Controls.bleed.getValue() or bleedapu.getValue() > 0)) {
me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941); me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941);
me["APUBleedPSI"].setText(sprintf("%s", math.round(bleedapu.getValue()))); me["APUBleedPSI"].setText(sprintf("%s", math.round(bleedapu.getValue())));
} else { } else {
@ -669,7 +634,7 @@ var canvas_lowerECAM_apu = {
# APU N and EGT # APU N and EGT
if (systems.APUNodes.Controls.master.getValue() == 1) { if (systems.APUNodes.Controls.master.getValue()) {
me["APUN"].setColor(0.0509,0.7529,0.2941); me["APUN"].setColor(0.0509,0.7529,0.2941);
me["APUN"].setText(sprintf("%s", math.round(apu_rpm.getValue() or 0))); me["APUN"].setText(sprintf("%s", math.round(apu_rpm.getValue() or 0)));
me["APUEGT"].setColor(0.0509,0.7529,0.2941); me["APUEGT"].setColor(0.0509,0.7529,0.2941);
@ -871,7 +836,7 @@ var canvas_lowerECAM_bleed = {
if (bmc1working.getValue()) { if (bmc1working.getValue()) {
var precooler_temp = precooler1_temp.getValue(); var precooler_temp = precooler1_temp.getValue();
me["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5))); me["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve1_cmd.getValue() == 1 and (precooler_temp < 150 or precooler1_ovht.getValue())) { if (eng_valve1_cmd.getValue() and (precooler_temp < 150 or precooler1_ovht.getValue())) {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else { } else {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -885,7 +850,7 @@ var canvas_lowerECAM_bleed = {
if (bmc2working.getValue()) { if (bmc2working.getValue()) {
var precooler_temp = precooler2_temp.getValue(); var precooler_temp = precooler2_temp.getValue();
me["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5))); me["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve2_cmd.getValue() == 1 and (precooler_temp < 150 or precooler2_ovht.getValue())) { if (eng_valve2_cmd.getValue() and (precooler_temp < 150 or precooler2_ovht.getValue())) {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else { } else {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -903,7 +868,7 @@ var canvas_lowerECAM_bleed = {
} }
# WING ANTI ICE # WING ANTI ICE
if (switch_wing_aice.getValue() == 1) { if (switch_wing_aice.getValue()) {
me["BLEED-Anti-Ice-Left"].show(); me["BLEED-Anti-Ice-Left"].show();
me["BLEED-Anti-Ice-Right"].show(); me["BLEED-Anti-Ice-Right"].show();
} else { } else {
@ -1015,7 +980,7 @@ var canvas_lowerECAM_bleed = {
me["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941); me["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941);
me["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941); me["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941);
me["BLEED-Ram-Air-connection"].hide(); me["BLEED-Ram-Air-connection"].hide();
} elsif (systems.PNEU.Valves.ramAir.getValue() == 1) { } elsif (systems.PNEU.Valves.ramAir.getValue()) {
me["BLEED-Ram-Air"].setRotation(0); me["BLEED-Ram-Air"].setRotation(0);
if (pts.Gear.wow[1].getValue()) { if (pts.Gear.wow[1].getValue()) {
me["BLEED-Ram-Air"].setColor(0.7333,0.3803,0); me["BLEED-Ram-Air"].setColor(0.7333,0.3803,0);
@ -1117,7 +1082,7 @@ var canvas_lowerECAM_crz = {
me["Oil1"].setText(sprintf("%2.1f", oil_qt1_actual.getValue())); me["Oil1"].setText(sprintf("%2.1f", oil_qt1_actual.getValue()));
me["Oil2"].setText(sprintf("%2.1f", oil_qt2_actual.getValue())); me["Oil2"].setText(sprintf("%2.1f", oil_qt2_actual.getValue()));
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["Fused-weight-unit"].setText("KG"); me["Fused-weight-unit"].setText("KG");
me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10)));
me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)));
@ -1297,7 +1262,7 @@ var canvas_lowerECAM_elec = {
update: func() { update: func() {
# BAT1 # BAT1
if (switch_bat1.getValue() == 0) { if (systems.ELEC.Switch.bat1.getValue() == 0) {
me["BAT1-OFF"].show(); me["BAT1-OFF"].show();
me["BAT1-content"].hide(); me["BAT1-content"].hide();
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
@ -1305,26 +1270,26 @@ var canvas_lowerECAM_elec = {
} else { } else {
me["BAT1-OFF"].hide(); me["BAT1-OFF"].hide();
me["BAT1-content"].show(); me["BAT1-content"].show();
me["Bat1Ampere"].setText(sprintf("%s", math.round(bat1_amps.getValue()))); me["Bat1Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.amps.getValue())));
me["Bat1Volt"].setText(sprintf("%s", math.round(bat1_volts.getValue()))); me["Bat1Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.volt.getValue())));
if (bat1_volts.getValue() >= 24.95 and bat1_volts.getValue() <= 31.05) { if (systems.ELEC.Source.Bat1.volt.getValue() >= 24.95 and systems.ELEC.Source.Bat1.volt.getValue() <= 31.05) {
me["Bat1Volt"].setColor(0.0509,0.7529,0.2941); me["Bat1Volt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["Bat1Volt"].setColor(0.7333,0.3803,0); me["Bat1Volt"].setColor(0.7333,0.3803,0);
} }
if (bat1_amps.getValue() > 5) { if (systems.ELEC.Source.Bat1.amps.getValue() > 5) {
me["Bat1Ampere"].setColor(0.7333,0.3803,0); me["Bat1Ampere"].setColor(0.7333,0.3803,0);
} else { } else {
me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941);
} }
if (bat1_direction.getValue() == 0) { if (systems.ELEC.Source.Bat1.direction.getValue() == 0) {
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
me["BAT1-charge"].hide(); me["BAT1-charge"].hide();
} else { } else {
if (bat1_direction.getValue() == -1) { if (systems.ELEC.Source.Bat1.direction.getValue() == -1) {
me["BAT1-charge"].show(); me["BAT1-charge"].show();
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
} else { } else {
@ -1334,14 +1299,14 @@ var canvas_lowerECAM_elec = {
} }
} }
if (bat1_fault.getValue() == 1 or bat1_volts.getValue() < 25 or bat1_volts.getValue() > 31 or bat1_amps.getValue() > 5) { if (systems.ELEC.Light.bat1Fault.getValue() or systems.ELEC.Source.Bat1.volt.getValue() < 25 or systems.ELEC.Source.Bat1.volt.getValue() > 31 or systems.ELEC.Source.Bat1.amps.getValue() > 5) {
me["BAT1-label"].setColor(0.7333,0.3803,0); me["BAT1-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["BAT1-label"].setColor(0.8078,0.8039,0.8078); me["BAT1-label"].setColor(0.8078,0.8039,0.8078);
} }
# BAT2 # BAT2
if (switch_bat2.getValue() == 0) { if (systems.ELEC.Switch.bat2.getValue() == 0) {
me["BAT2-OFF"].show(); me["BAT2-OFF"].show();
me["BAT2-content"].hide(); me["BAT2-content"].hide();
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
@ -1349,26 +1314,26 @@ var canvas_lowerECAM_elec = {
} else { } else {
me["BAT2-OFF"].hide(); me["BAT2-OFF"].hide();
me["BAT2-content"].show(); me["BAT2-content"].show();
me["Bat2Ampere"].setText(sprintf("%s", math.round(bat2_amps.getValue()))); me["Bat2Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.amps.getValue())));
me["Bat2Volt"].setText(sprintf("%s", math.round(bat2_volts.getValue()))); me["Bat2Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.volt.getValue())));
if (bat2_volts.getValue() >= 24.95 and bat2_volts.getValue() <= 31.05) { if (systems.ELEC.Source.Bat2.volt.getValue() >= 24.95 and systems.ELEC.Source.Bat2.volt.getValue() <= 31.05) {
me["Bat2Volt"].setColor(0.0509,0.7529,0.2941); me["Bat2Volt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["Bat2Volt"].setColor(0.7333,0.3803,0); me["Bat2Volt"].setColor(0.7333,0.3803,0);
} }
if (bat2_amps.getValue() > 5) { if (systems.ELEC.Source.Bat2.amps.getValue() > 5) {
me["Bat2Ampere"].setColor(0.7333,0.3803,0); me["Bat2Ampere"].setColor(0.7333,0.3803,0);
} else { } else {
me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941);
} }
if (bat2_direction.getValue() == 0) { if (systems.ELEC.Source.Bat2.direction.getValue() == 0) {
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
me["BAT2-charge"].hide(); me["BAT2-charge"].hide();
} else { } else {
if (bat2_direction.getValue() == -1) { if (systems.ELEC.Source.Bat2.direction.getValue() == -1) {
me["BAT2-charge"].show(); me["BAT2-charge"].show();
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
} else { } else {
@ -1378,7 +1343,7 @@ var canvas_lowerECAM_elec = {
} }
} }
if (bat2_fault.getValue() == 1 or bat2_volts.getValue() < 25 or bat2_volts.getValue() > 31 or bat2_amps.getValue() > 5) { if (systems.ELEC.Light.bat2Fault.getValue() or systems.ELEC.Source.Bat2.volt.getValue() < 25 or systems.ELEC.Source.Bat2.volt.getValue() > 31 or systems.ELEC.Source.Bat2.amps.getValue() > 5) {
me["BAT2-label"].setColor(0.7333,0.3803,0); me["BAT2-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["BAT2-label"].setColor(0.8078,0.8039,0.8078); me["BAT2-label"].setColor(0.8078,0.8039,0.8078);
@ -1386,8 +1351,8 @@ var canvas_lowerECAM_elec = {
# TR1 # TR1
# is only powered when ac1 has power # is only powered when ac1 has power
tr1_v = tr1_volts.getValue(); tr1_v = systems.ELEC.Source.tr1.outputVolt.getValue();
tr1_a = tr1_amps.getValue(); tr1_a = systems.ELEC.Source.tr1.outputAmp.getValue();
me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v))); me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v)));
me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a))); me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a)));
@ -1412,8 +1377,8 @@ var canvas_lowerECAM_elec = {
# TR2 # TR2
# is only powered when ac2 has power # is only powered when ac2 has power
tr2_v = tr2_volts.getValue(); tr2_v = systems.ELEC.Source.tr2.outputVolt.getValue();
tr2_a = tr2_amps.getValue(); tr2_a = systems.ELEC.Source.tr2.outputAmp.getValue();
me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v))); me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v)));
me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a))); me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a)));
@ -1437,8 +1402,8 @@ var canvas_lowerECAM_elec = {
} }
# ESS TR # ESS TR
essTrvolts = essTrVolt.getValue(); essTrvolts = systems.ELEC.Source.trEss.outputVoltRelay.getValue();
essTramps = essTrAmp.getValue(); essTramps = systems.ELEC.Source.trEss.outputAmpRelay.getValue();
if (systems.ELEC.Relay.essTrContactor.getValue()) { if (systems.ELEC.Relay.essTrContactor.getValue()) {
me["ESSTR-group"].show(); me["ESSTR-group"].show();
me["ESSTR-Volt"].setText(sprintf("%s", math.round(essTrvolts))); me["ESSTR-Volt"].setText(sprintf("%s", math.round(essTrvolts)));
@ -1466,7 +1431,7 @@ var canvas_lowerECAM_elec = {
} }
# EMER GEN # EMER GEN
if (switch_emer_gen.getValue() == 0) { if (systems.ELEC.Source.EmerGen.volts.getValue() == 0) {
me["EMERGEN-group"].hide(); me["EMERGEN-group"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide();
me["ELEC-Line-Emergen-ESSTR-off"].show(); me["ELEC-Line-Emergen-ESSTR-off"].show();
@ -1477,22 +1442,22 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-Emergen-ESSTR-off"].hide(); me["ELEC-Line-Emergen-ESSTR-off"].hide();
me["EMERGEN-Label-off"].hide(); me["EMERGEN-Label-off"].hide();
me["EmergenVolt"].setText(sprintf("%s", math.round(emerGenVolts.getValue()))); me["EmergenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.EmerGen.voltsRelay.getValue())));
me["EmergenHz"].setText(sprintf("%s", math.round(emerGenHz.getValue()))); me["EmergenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.EmerGen.hertz.getValue())));
if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110 or emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { if (systems.ELEC.Source.EmerGen.voltsRelay.getValue() > 120 or systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110 or systems.ELEC.Source.EmerGen.hertz.getValue() > 410 or systems.ELEC.Source.EmerGen.hertz.getValue() < 390) {
me["Emergen-Label"].setColor(0.7333,0.3803,0); me["Emergen-Label"].setColor(0.7333,0.3803,0);
} else { } else {
me["Emergen-Label"].setColor(0.8078,0.8039,0.8078); me["Emergen-Label"].setColor(0.8078,0.8039,0.8078);
} }
if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110) { if (systems.ELEC.Source.EmerGen.voltsRelay.getValue() > 120 or systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110) {
me["EmergenVolt"].setColor(0.7333,0.3803,0); me["EmergenVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["EmergenVolt"].setColor(0.0509,0.7529,0.2941); me["EmergenVolt"].setColor(0.0509,0.7529,0.2941);
} }
if (emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { if (systems.ELEC.Source.EmerGen.hertz.getValue() > 410 or systems.ELEC.Source.EmerGen.hertz.getValue() < 390) {
me["EmergenHz"].setColor(0.7333,0.3803,0); me["EmergenHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["EmergenHz"].setColor(0.0509,0.7529,0.2941); me["EmergenHz"].setColor(0.0509,0.7529,0.2941);
@ -1530,7 +1495,7 @@ var canvas_lowerECAM_elec = {
} }
# GEN1 # GEN1
if (switch_gen1.getValue() == 0) { if (systems.ELEC.Switch.gen1.getValue() == 0) {
me["GEN1-content"].hide(); me["GEN1-content"].hide();
me["GEN1-off"].show(); me["GEN1-off"].show();
if (systems.ELEC.Source.IDG1.gcrRelay.getValue()) { if (systems.ELEC.Source.IDG1.gcrRelay.getValue()) {
@ -1548,12 +1513,12 @@ var canvas_lowerECAM_elec = {
me["GEN1-content"].show(); me["GEN1-content"].show();
me["GEN1-off"].hide(); me["GEN1-off"].hide();
# me["Gen1Load"].setText(sprintf("%s", math.round(gen1_load.getValue()))); # me["Gen1Load"].setText(sprintf("%s", math.round(gen1_load.getValue())));
me["Gen1Volt"].setText(sprintf("%s", math.round(gen1_volts.getValue()))); me["Gen1Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG1.volts.getValue())));
if (gen1_hz.getValue() == 0) { if (systems.ELEC.Source.IDG1.hertz.getValue() == 0) {
me["Gen1Hz"].setText(sprintf("XX")); me["Gen1Hz"].setText(sprintf("XX"));
} else { } else {
me["Gen1Hz"].setText(sprintf("%s", math.round(gen1_hz.getValue()))); me["Gen1Hz"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG1.hertz.getValue())));
} }
if (eng1_running.getValue() == 0) { if (eng1_running.getValue() == 0) {
@ -1562,7 +1527,7 @@ var canvas_lowerECAM_elec = {
me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078); me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078);
} }
if (gen1_volts.getValue() > 120 or gen1_volts.getValue() < 110 or gen1_hz.getValue() > 410 or gen1_hz.getValue() < 390 or gen1_load.getValue() >= 110) { if (systems.ELEC.Source.IDG1.volts.getValue() > 120 or systems.ELEC.Source.IDG1.volts.getValue() < 110 or systems.ELEC.Source.IDG1.hertz.getValue() > 410 or systems.ELEC.Source.IDG1.hertz.getValue() < 390 or gen1_load.getValue() >= 110) {
me["GEN1-label"].setColor(0.7333,0.3803,0); me["GEN1-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["GEN1-label"].setColor(0.8078,0.8039,0.8078); me["GEN1-label"].setColor(0.8078,0.8039,0.8078);
@ -1574,13 +1539,13 @@ var canvas_lowerECAM_elec = {
me["Gen1Load"].setColor(0.0509,0.7529,0.2941); me["Gen1Load"].setColor(0.0509,0.7529,0.2941);
} }
if (gen1_volts.getValue() > 120 or gen1_volts.getValue() < 110) { if (systems.ELEC.Source.IDG1.volts.getValue() > 120 or systems.ELEC.Source.IDG1.volts.getValue() < 110) {
me["Gen1Volt"].setColor(0.7333,0.3803,0); me["Gen1Volt"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen1Volt"].setColor(0.0509,0.7529,0.2941); me["Gen1Volt"].setColor(0.0509,0.7529,0.2941);
} }
if (gen1_hz.getValue() > 410 or gen1_hz.getValue() < 390) { if (systems.ELEC.Source.IDG1.hertz.getValue() > 410 or systems.ELEC.Source.IDG1.hertz.getValue() < 390) {
me["Gen1Hz"].setColor(0.7333,0.3803,0); me["Gen1Hz"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen1Hz"].setColor(0.0509,0.7529,0.2941); me["Gen1Hz"].setColor(0.0509,0.7529,0.2941);
@ -1588,7 +1553,7 @@ var canvas_lowerECAM_elec = {
} }
# GEN2 # GEN2
if (switch_gen2.getValue() == 0) { if (systems.ELEC.Switch.gen2.getValue() == 0) {
me["GEN2-content"].hide(); me["GEN2-content"].hide();
me["GEN2-off"].show(); me["GEN2-off"].show();
if (systems.ELEC.Source.IDG2.gcrRelay.getValue()) { if (systems.ELEC.Source.IDG2.gcrRelay.getValue()) {
@ -1606,11 +1571,11 @@ var canvas_lowerECAM_elec = {
me["GEN2-content"].show(); me["GEN2-content"].show();
me["GEN2-off"].hide(); me["GEN2-off"].hide();
# me["Gen2Load"].setText(sprintf("%s", math.round(gen2_load.getValue()))); # me["Gen2Load"].setText(sprintf("%s", math.round(gen2_load.getValue())));
me["Gen2Volt"].setText(sprintf("%s", math.round(gen2_volts.getValue()))); me["Gen2Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG2.volts.getValue())));
if (gen2_hz.getValue() == 0) { if (systems.ELEC.Source.IDG2.hertz.getValue() == 0) {
me["Gen2Hz"].setText(sprintf("XX")); me["Gen2Hz"].setText(sprintf("XX"));
} else { } else {
me["Gen2Hz"].setText(sprintf("%s", math.round(gen2_hz.getValue()))); me["Gen2Hz"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG2.hertz.getValue())));
} }
if (eng2_running.getValue() == 0) { if (eng2_running.getValue() == 0) {
@ -1619,7 +1584,7 @@ var canvas_lowerECAM_elec = {
me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078); me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078);
} }
if (gen2_volts.getValue() > 120 or gen2_volts.getValue() < 110 or gen2_hz.getValue() > 410 or gen2_hz.getValue() < 390 or gen2_load.getValue() >= 110) { if (systems.ELEC.Source.IDG2.volts.getValue() > 120 or systems.ELEC.Source.IDG2.volts.getValue() < 110 or systems.ELEC.Source.IDG2.hertz.getValue() > 410 or systems.ELEC.Source.IDG2.hertz.getValue() < 390 or gen2_load.getValue() >= 110) {
me["GEN2-label"].setColor(0.7333,0.3803,0); me["GEN2-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["GEN2-label"].setColor(0.8078,0.8039,0.8078); me["GEN2-label"].setColor(0.8078,0.8039,0.8078);
@ -1632,13 +1597,13 @@ var canvas_lowerECAM_elec = {
} }
if (gen2_volts.getValue() > 120 or gen2_volts.getValue() < 110) { if (systems.ELEC.Source.IDG2.volts.getValue() > 120 or systems.ELEC.Source.IDG2.volts.getValue() < 110) {
me["Gen2Volt"].setColor(0.7333,0.3803,0); me["Gen2Volt"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen2Volt"].setColor(0.0509,0.7529,0.2941); me["Gen2Volt"].setColor(0.0509,0.7529,0.2941);
} }
if (gen2_hz.getValue() > 410 or gen2_hz.getValue() < 390) { if (systems.ELEC.Source.IDG2.hertz.getValue() > 410 or systems.ELEC.Source.IDG2.hertz.getValue() < 390) {
me["Gen2Hz"].setColor(0.7333,0.3803,0); me["Gen2Hz"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen2Hz"].setColor(0.0509,0.7529,0.2941); me["Gen2Hz"].setColor(0.0509,0.7529,0.2941);
@ -1653,7 +1618,7 @@ var canvas_lowerECAM_elec = {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else { } else {
me["APU-border"].show(); me["APU-border"].show();
if (gen_apu.getValue() == 0) { if (systems.ELEC.Source.APU.contact.getValue() == 0) {
me["APU-content"].hide(); me["APU-content"].hide();
me["APUGEN-off"].show(); me["APUGEN-off"].show();
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
@ -1661,15 +1626,15 @@ var canvas_lowerECAM_elec = {
me["APU-content"].show(); me["APU-content"].show();
me["APUGEN-off"].hide(); me["APUGEN-off"].hide();
# me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue()))); # me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue())));
me["APUGenVolt"].setText(sprintf("%s", math.round(apu_volts.getValue()))); me["APUGenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.volts.getValue())));
if (apu_hz.getValue() == 0) { if (systems.ELEC.Source.APU.hertz.getValue() == 0) {
me["APUGenHz"].setText(sprintf("XX")); me["APUGenHz"].setText(sprintf("XX"));
} else { } else {
me["APUGenHz"].setText(sprintf("%s", math.round(apu_hz.getValue()))); me["APUGenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.hertz.getValue())));
} }
if (apu_volts.getValue() > 120 or apu_volts.getValue() < 110 or apu_hz.getValue() > 410 or apu_hz.getValue() < 390 or apu_load.getValue() >= 110) { if (systems.ELEC.Source.APU.volts.getValue() > 120 or systems.ELEC.Source.APU.volts.getValue() < 110 or systems.ELEC.Source.APU.hertz.getValue() > 410 or systems.ELEC.Source.APU.hertz.getValue() < 390 or apu_load.getValue() >= 110) {
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
@ -1681,13 +1646,13 @@ var canvas_lowerECAM_elec = {
me["APUGenLoad"].setColor(0.0509,0.7529,0.2941); me["APUGenLoad"].setColor(0.0509,0.7529,0.2941);
} }
if (apu_volts.getValue() > 120 or apu_volts.getValue() < 110) { if (systems.ELEC.Source.APU.volts.getValue() > 120 or systems.ELEC.Source.APU.volts.getValue() < 110) {
me["APUGenVolt"].setColor(0.7333,0.3803,0); me["APUGenVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941); me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
} }
if (apu_hz.getValue() > 410 or apu_hz.getValue() < 390) { if (systems.ELEC.Source.APU.hertz.getValue() > 410 or systems.ELEC.Source.APU.hertz.getValue() < 390) {
me["APUGenHz"].setColor(0.7333,0.3803,0); me["APUGenHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941); me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
@ -1701,29 +1666,29 @@ var canvas_lowerECAM_elec = {
me["EXTPWR-group"].hide(); me["EXTPWR-group"].hide();
} else { } else {
me["EXTPWR-group"].show(); me["EXTPWR-group"].show();
me["ExtVolt"].setText(sprintf("%s", math.round(ext_volts.getValue()))); me["ExtVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.volts.getValue())));
me["ExtHz"].setText(sprintf("%s", math.round(ext_hz.getValue()))); me["ExtHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.hertz.getValue())));
if (ext_hz.getValue() > 410 or ext_hz.getValue() < 390 or ext_volts.getValue() > 120 or ext_volts.getValue() < 110) { if (systems.ELEC.Source.Ext.hertz.getValue() > 410 or systems.ELEC.Source.Ext.hertz.getValue() < 390 or systems.ELEC.Source.Ext.volts.getValue() > 120 or systems.ELEC.Source.Ext.volts.getValue() < 110) {
me["EXTPWR-label"].setColor(0.7333,0.3803,0); me["EXTPWR-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941);
} }
if (ext_hz.getValue() > 410 or ext_hz.getValue() < 390) { if (systems.ELEC.Source.Ext.hertz.getValue() > 410 or systems.ELEC.Source.Ext.hertz.getValue() < 390) {
me["ExtHz"].setColor(0.7333,0.3803,0); me["ExtHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["ExtHz"].setColor(0.0509,0.7529,0.2941); me["ExtHz"].setColor(0.0509,0.7529,0.2941);
} }
if (ext_volts.getValue() > 120 or ext_volts.getValue() < 110) { if (systems.ELEC.Source.Ext.volts.getValue() > 120 or systems.ELEC.Source.Ext.volts.getValue() < 110) {
me["ExtVolt"].setColor(0.7333,0.3803,0); me["ExtVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["ExtVolt"].setColor(0.0509,0.7529,0.2941); me["ExtVolt"].setColor(0.0509,0.7529,0.2941);
} }
} }
if (galleyshed.getValue()) { if (systems.ELEC.SomeThing.galley.getValue()) {
me["GalleyShed"].show(); me["GalleyShed"].show();
} else { } else {
me["GalleyShed"].hide(); me["GalleyShed"].hide();
@ -1780,25 +1745,25 @@ var canvas_lowerECAM_elec = {
# Managment of the connecting lines between the components # Managment of the connecting lines between the components
if (getprop("/systems/electrical/relay/apu-glc/contact-pos") and (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") or getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"))) { if (systems.ELEC.Relay.apuGlc.getValue() and (systems.ELEC.Relay.acTie1.getValue() or systems.ELEC.Relay.acTie2.getValue())) {
me["APU-out"].show(); me["APU-out"].show();
} else { } else {
me["APU-out"].hide(); me["APU-out"].hide();
} }
if (getprop("/systems/electrical/relay/ext-epc/contact-pos") and (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") or getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"))) { if (systems.ELEC.Relay.extEpc.getValue() and (systems.ELEC.Relay.acTie1.getValue() or systems.ELEC.Relay.acTie2.getValue())) {
me["EXT-out"].show(); me["EXT-out"].show();
} else { } else {
me["EXT-out"].hide(); me["EXT-out"].hide();
} }
if (gen1_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-1-glc/contact-pos")) { if (systems.ELEC.Source.IDG1.volts.getValue() >= 110 and systems.ELEC.Relay.glc1.getValue()) {
me["ELEC-Line-GEN1-AC1"].show(); me["ELEC-Line-GEN1-AC1"].show();
} else { } else {
me["ELEC-Line-GEN1-AC1"].hide(); me["ELEC-Line-GEN1-AC1"].hide();
} }
if (gen2_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-2-glc/contact-pos")) { if (systems.ELEC.Source.IDG2.volts.getValue() >= 110 and systems.ELEC.Relay.glc2.getValue()) {
me["ELEC-Line-GEN2-AC2"].show(); me["ELEC-Line-GEN2-AC2"].show();
} else { } else {
me["ELEC-Line-GEN2-AC2"].hide(); me["ELEC-Line-GEN2-AC2"].hide();
@ -1816,38 +1781,38 @@ var canvas_lowerECAM_elec = {
me["AC2-in"].hide(); me["AC2-in"].hide();
} }
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") and getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos")) { if (systems.ELEC.Relay.acTie1.getValue() and systems.ELEC.Relay.acTie2.getValue()) {
me["ELEC-Line-APU-AC1"].show(); me["ELEC-Line-APU-AC1"].show();
me["ELEC-Line-APU-EXT"].show(); me["ELEC-Line-APU-EXT"].show();
me["ELEC-Line-EXT-AC2"].show(); me["ELEC-Line-EXT-AC2"].show();
} else { } else {
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos")) { if (systems.ELEC.Relay.acTie1.getValue()) {
me["ELEC-Line-APU-AC1"].show(); me["ELEC-Line-APU-AC1"].show();
} else { } else {
me["ELEC-Line-APU-AC1"].hide(); me["ELEC-Line-APU-AC1"].hide();
} }
if ((getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos") and getprop("/systems/electrical/relay/apu-glc/contact-pos") and !getprop("/systems/electrical/relay/gen-2-glc/contact-pos")) or (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") and getprop("/systems/electrical/relay/ext-epc/contact-pos") and !getprop("/systems/electrical/relay/gen-1-glc/contact-pos"))) { if ((systems.ELEC.Relay.acTie2.getValue() and systems.ELEC.Relay.apuGlc.getValue() and !systems.ELEC.Relay.glc2.getValue()) or (systems.ELEC.Relay.acTie1.getValue() and systems.ELEC.Relay.extEpc.getValue() and !systems.ELEC.Relay.glc1.getValue())) {
me["ELEC-Line-APU-EXT"].show(); me["ELEC-Line-APU-EXT"].show();
} else { } else {
me["ELEC-Line-APU-EXT"].hide(); me["ELEC-Line-APU-EXT"].hide();
} }
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos")) { if (systems.ELEC.Relay.acTie2.getValue()) {
me["ELEC-Line-EXT-AC2"].show(); me["ELEC-Line-EXT-AC2"].show();
} else { } else {
me["ELEC-Line-EXT-AC2"].hide(); me["ELEC-Line-EXT-AC2"].hide();
} }
} }
if (getprop("/systems/electrical/relay/ac-ess-feed-1/contact-pos") == 1) { if (systems.ELEC.Relay.acEssFeed1.getValue()) {
if (systems.ELEC.Bus.ac1.getValue() >= 110) { if (systems.ELEC.Bus.ac1.getValue() >= 110) {
me["ELEC-Line-AC1-ACESS"].show(); me["ELEC-Line-AC1-ACESS"].show();
} else { } else {
me["ELEC-Line-AC1-ACESS"].hide(); me["ELEC-Line-AC1-ACESS"].hide();
} }
me["ELEC-Line-AC2-ACESS"].hide(); me["ELEC-Line-AC2-ACESS"].hide();
} elsif (getprop("/systems/electrical/relay/ac-ess-feed-2/contact-pos") == 1) { } elsif (systems.ELEC.Relay.acEssFeed2.getValue()) {
me["ELEC-Line-AC1-ACESS"].hide(); me["ELEC-Line-AC1-ACESS"].hide();
if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["ELEC-Line-AC2-ACESS"].show(); me["ELEC-Line-AC2-ACESS"].show();
@ -1859,7 +1824,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-AC2-ACESS"].hide(); me["ELEC-Line-AC2-ACESS"].hide();
} }
if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) { if (systems.ELEC.Relay.tr1Contactor.getValue()) {
if (systems.ELEC.Bus.ac1.getValue() < 110) { if (systems.ELEC.Bus.ac1.getValue() < 110) {
me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1872,7 +1837,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-TR1-DC1"].hide(); me["ELEC-Line-TR1-DC1"].hide();
} }
if (getprop("/systems/electrical/relay/tr-contactor-2/contact-pos") == 1) { if (systems.ELEC.Relay.tr2Contactor.getValue()) {
if (systems.ELEC.Bus.ac2.getValue() < 110) { if (systems.ELEC.Bus.ac2.getValue() < 110) {
me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1885,25 +1850,25 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-TR2-DC2"].hide(); me["ELEC-Line-TR2-DC2"].hide();
} }
if (getprop("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos")) { if (systems.ELEC.Relay.dcTie1.getValue()) {
me["ELEC-Line-DC1-DCESS_DCBAT"].show(); me["ELEC-Line-DC1-DCESS_DCBAT"].show();
} else { } else {
me["ELEC-Line-DC1-DCESS_DCBAT"].hide(); me["ELEC-Line-DC1-DCESS_DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-bat/contact-pos")) { if (systems.ELEC.Relay.dcEssFeedBat.getValue()) {
me["ELEC-Line-DC1-DCESS"].show(); me["ELEC-Line-DC1-DCESS"].show();
} else { } else {
me["ELEC-Line-DC1-DCESS"].hide(); me["ELEC-Line-DC1-DCESS"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-bat/contact-pos") or getprop("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos")) { if (systems.ELEC.Relay.dcEssFeedBat.getValue() or systems.ELEC.Relay.dcTie1.getValue()) {
me["ELEC-Line-DC1-DCBAT"].show(); me["ELEC-Line-DC1-DCBAT"].show();
} else { } else {
me["ELEC-Line-DC1-DCBAT"].hide(); me["ELEC-Line-DC1-DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos")) { if (systems.ELEC.Relay.dcTie2.getValue()) {
me["ELEC-Line-DC2-DCBAT"].show(); me["ELEC-Line-DC2-DCBAT"].show();
me["ELEC-Line-DC2-DCESS_DCBAT"].show(); me["ELEC-Line-DC2-DCESS_DCBAT"].show();
} else { } else {
@ -1911,7 +1876,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-DC2-DCESS_DCBAT"].hide(); me["ELEC-Line-DC2-DCESS_DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos")) { if (systems.ELEC.Relay.acEssEmerGenFeed.getValue()) {
me["EMERGEN-out"].show(); me["EMERGEN-out"].show();
me["ELEC-Line-Emergen-ESSTR"].show(); me["ELEC-Line-Emergen-ESSTR"].show();
} else { } else {
@ -1919,13 +1884,13 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-Emergen-ESSTR"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide();
} }
if (systems.ELEC.Bus.acEss.getValue() >= 110 and !getprop("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos") and (!getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") or !getprop("/systems/electrical/relay/tr-contactor-2/contact-pos"))) { if (systems.ELEC.Bus.acEss.getValue() >= 110 and !systems.ELEC.Relay.acEssEmerGenFeed.getValue() and (!systems.ELEC.Relay.tr1Contactor.getValue() or !systems.ELEC.Relay.tr2Contactor.getValue())) {
me["ELEC-Line-ACESS-TRESS"].show(); me["ELEC-Line-ACESS-TRESS"].show();
} else { } else {
me["ELEC-Line-ACESS-TRESS"].hide(); me["ELEC-Line-ACESS-TRESS"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-tr/contact-pos")) { if (systems.ELEC.Relay.essTrContactor.getValue()) {
me["ELEC-Line-ESSTR-DCESS"].show(); me["ELEC-Line-ESSTR-DCESS"].show();
} else { } else {
me["ELEC-Line-ESSTR-DCESS"].hide(); me["ELEC-Line-ESSTR-DCESS"].hide();
@ -1988,7 +1953,7 @@ var canvas_lowerECAM_eng = {
me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R); me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R);
# Fuel Used # Fuel Used
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10)));
me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)));
me["Fused-weight-unit"].setText("KG"); me["Fused-weight-unit"].setText("KG");
@ -2302,7 +2267,7 @@ var canvas_lowerECAM_fctl = {
if (elac1.getValue()) { if (elac1.getValue()) {
me["elac1"].setColor(0.0509,0.7529,0.2941); me["elac1"].setColor(0.0509,0.7529,0.2941);
me["path4249"].setColor(0.0509,0.7529,0.2941); me["path4249"].setColor(0.0509,0.7529,0.2941);
} else if ((elac1.getValue() == 0) or (elac1_fail.getValue() == 1)) { } else if ((elac1.getValue() == 0) or (elac1_fail.getValue())) {
me["elac1"].setColor(0.7333,0.3803,0); me["elac1"].setColor(0.7333,0.3803,0);
me["path4249"].setColor(0.7333,0.3803,0); me["path4249"].setColor(0.7333,0.3803,0);
} }
@ -2310,7 +2275,7 @@ var canvas_lowerECAM_fctl = {
if (elac2.getValue()) { if (elac2.getValue()) {
me["elac2"].setColor(0.0509,0.7529,0.2941); me["elac2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3"].setColor(0.0509,0.7529,0.2941); me["path4249-3"].setColor(0.0509,0.7529,0.2941);
} else if ((elac2.getValue() == 0) or (elac2_fail.getValue() == 1)) { } else if ((elac2.getValue() == 0) or (elac2_fail.getValue())) {
me["elac2"].setColor(0.7333,0.3803,0); me["elac2"].setColor(0.7333,0.3803,0);
me["path4249-3"].setColor(0.7333,0.3803,0); me["path4249-3"].setColor(0.7333,0.3803,0);
} }
@ -2318,7 +2283,7 @@ var canvas_lowerECAM_fctl = {
if (sec1.getValue()) { if (sec1.getValue()) {
me["sec1"].setColor(0.0509,0.7529,0.2941); me["sec1"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941);
} else if ((sec1.getValue() == 0) or (sec1_fail.getValue() == 1)) { } else if ((sec1.getValue() == 0) or (sec1_fail.getValue())) {
me["sec1"].setColor(0.7333,0.3803,0); me["sec1"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7"].setColor(0.7333,0.3803,0); me["path4249-3-6-7"].setColor(0.7333,0.3803,0);
} }
@ -2326,7 +2291,7 @@ var canvas_lowerECAM_fctl = {
if (sec2.getValue()) { if (sec2.getValue()) {
me["sec2"].setColor(0.0509,0.7529,0.2941); me["sec2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941);
} else if ((sec2.getValue() == 0) or (sec2_fail.getValue() == 1)) { } else if ((sec2.getValue() == 0) or (sec2_fail.getValue())) {
me["sec2"].setColor(0.7333,0.3803,0); me["sec2"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0); me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0);
} }
@ -2334,7 +2299,7 @@ var canvas_lowerECAM_fctl = {
if (sec3.getValue()) { if (sec3.getValue()) {
me["sec3"].setColor(0.0509,0.7529,0.2941); me["sec3"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6"].setColor(0.0509,0.7529,0.2941);
} else if ((sec3.getValue() == 0) or (sec3_fail.getValue() == 1)) { } else if ((sec3.getValue() == 0) or (sec3_fail.getValue())) {
me["sec3"].setColor(0.7333,0.3803,0); me["sec3"].setColor(0.7333,0.3803,0);
me["path4249-3-6"].setColor(0.7333,0.3803,0); me["path4249-3-6"].setColor(0.7333,0.3803,0);
} }
@ -2406,7 +2371,6 @@ var canvas_lowerECAM_fuel = {
update: func() { update: func() {
_weight_kgs = acconfig_weight_kgs.getValue(); _weight_kgs = acconfig_weight_kgs.getValue();
# if (getprop("/engines/engine[0]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng1_n1.getValue() <= 18.8) { if (eng1_n1.getValue() <= 18.8) {
me["ENG1idFFlow"].setColor(0.7333,0.3803,0); me["ENG1idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0); me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0);
@ -2415,7 +2379,6 @@ var canvas_lowerECAM_fuel = {
me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078); me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078);
} }
# if (getprop("/engines/engine[1]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng2_n1.getValue() <= 18.5) { if (eng2_n1.getValue() <= 18.5) {
me["ENG2idFFlow"].setColor(0.7333,0.3803,0); me["ENG2idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0); me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0);
@ -2440,7 +2403,7 @@ var canvas_lowerECAM_fuel = {
me["FFlow-weight-unit"].setText("LBS/MIN"); me["FFlow-weight-unit"].setText("LBS/MIN");
} }
if (fadec1.getValue() == 1 and fadec2.getValue() == 1) { if (fadec1.getValue() and fadec2.getValue() or fadecPowerUp.getValue()) {
me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941); me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941);
if (_weight_kgs == 1) { if (_weight_kgs == 1) {
me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round(((fuel_flow1.getValue() + fuel_flow2.getValue()) * LBS2KGS) / 60, 10))); me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round(((fuel_flow1.getValue() + fuel_flow2.getValue()) * LBS2KGS) / 60, 10)));
@ -2454,7 +2417,7 @@ var canvas_lowerECAM_fuel = {
# TODO use the valve prop and add amber if difference between eng master and valve # TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state # TODO add transition state
if (systems.FUEL.Valves.lpValve1.getValue() == 1) { if (systems.FUEL.Valves.lpValve1.getValue()) {
me["FUEL-ENG-Master-1"].setRotation(0); me["FUEL-ENG-Master-1"].setRotation(0);
me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-1"].setColorFill(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-1"].setColorFill(0.0509,0.7529,0.2941);
@ -2468,7 +2431,7 @@ var canvas_lowerECAM_fuel = {
# TODO use the valve prop and add amber if difference between eng master and valve # TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state # TODO add transition state
if (systems.FUEL.Valves.lpValve2.getValue() == 1) { if (systems.FUEL.Valves.lpValve2.getValue()) {
me["FUEL-ENG-Master-2"].setRotation(0); me["FUEL-ENG-Master-2"].setRotation(0);
me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-2"].setColorFill(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-2"].setColorFill(0.0509,0.7529,0.2941);
@ -2608,7 +2571,7 @@ var canvas_lowerECAM_fuel = {
if (systems.FUEL.Valves.transfer1.getValue() == 0) { if (systems.FUEL.Valves.transfer1.getValue() == 0) {
me["FUEL-Left-Transfer"].hide(); me["FUEL-Left-Transfer"].hide();
} else { } else {
if (systems.FUEL.Valves.transfer1.getValue() == 1) { if (systems.FUEL.Valves.transfer1.getValue()) {
me["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941); me["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0); me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0);
@ -2619,7 +2582,7 @@ var canvas_lowerECAM_fuel = {
if (systems.FUEL.Valves.transfer2.getValue() == 0) { if (systems.FUEL.Valves.transfer2.getValue() == 0) {
me["FUEL-Right-Transfer"].hide(); me["FUEL-Right-Transfer"].hide();
} else { } else {
if (systems.FUEL.Valves.transfer2.getValue() == 1) { if (systems.FUEL.Valves.transfer2.getValue()) {
me["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941); me["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0); me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0);
@ -2634,13 +2597,13 @@ var canvas_lowerECAM_fuel = {
} }
# APU # APU
if (systems.FUEL.Valves.apu.getValue() == 1 and systems.APUNodes.Controls.master.getValue() and !systems.APUNodes.Controls.fire.getValue()) { if (systems.FUEL.Valves.apu.getValue() and systems.APUNodes.Controls.master.getValue() and !systems.APUNodes.Controls.fire.getValue()) {
me["FUEL-APU-label"].setColor(0.8078, 0.8039, 0.8078); me["FUEL-APU-label"].setColor(0.8078, 0.8039, 0.8078);
me["FUEL-APU-line"].setColor(0.0509,0.7529,0.2941); me["FUEL-APU-line"].setColor(0.0509,0.7529,0.2941);
me["FUEL-APU-arrow"].setColor(0.0509,0.7529,0.2941); me["FUEL-APU-arrow"].setColor(0.0509,0.7529,0.2941);
me["FUEL-APU-line"].show(); me["FUEL-APU-line"].show();
me["FUEL-APU-arrow"].show(); me["FUEL-APU-arrow"].show();
} elsif (systems.FUEL.Valves.apu.getValue() == 1 and (!systems.APUNodes.Controls.master.getValue() or systems.APUNodes.Controls.fire.getValue())) { } elsif (systems.FUEL.Valves.apu.getValue() and (!systems.APUNodes.Controls.master.getValue() or systems.APUNodes.Controls.fire.getValue())) {
me["FUEL-APU-label"].setColor(0.7333,0.3803,0); me["FUEL-APU-label"].setColor(0.7333,0.3803,0);
me["FUEL-APU-line"].setColor(0.7333,0.3803,0); me["FUEL-APU-line"].setColor(0.7333,0.3803,0);
me["FUEL-APU-arrow"].setColor(0.7333,0.3803,0); me["FUEL-APU-arrow"].setColor(0.7333,0.3803,0);
@ -2886,37 +2849,37 @@ var canvas_lowerECAM_hyd = {
} }
} }
if (y_resv_lo_air_press.getValue() == 1) { if (y_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Yellow"].show(); me["LO-AIR-PRESS-Yellow"].show();
} else { } else {
me["LO-AIR-PRESS-Yellow"].hide(); me["LO-AIR-PRESS-Yellow"].hide();
} }
if (b_resv_lo_air_press.getValue() == 1) { if (b_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Blue"].show(); me["LO-AIR-PRESS-Blue"].show();
} else { } else {
me["LO-AIR-PRESS-Blue"].hide(); me["LO-AIR-PRESS-Blue"].hide();
} }
if (g_resv_lo_air_press.getValue() == 1) { if (g_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Green"].show(); me["LO-AIR-PRESS-Green"].show();
} else { } else {
me["LO-AIR-PRESS-Green"].hide(); me["LO-AIR-PRESS-Green"].hide();
} }
if (elec_pump_y_ovht.getValue() == 1) { if (elec_pump_y_ovht.getValue()) {
me["ELEC-OVHT-Yellow"].show(); me["ELEC-OVHT-Yellow"].show();
} else { } else {
me["ELEC-OVHT-Yellow"].hide(); me["ELEC-OVHT-Yellow"].hide();
} }
if (elec_pump_b_ovht.getValue() == 1) { if (elec_pump_b_ovht.getValue()) {
me["ELEC-OVHT-Blue"].show(); me["ELEC-OVHT-Blue"].show();
} else { } else {
me["ELEC-OVHT-Blue"].hide(); me["ELEC-OVHT-Blue"].hide();
} }
if (systems.HYD.Rat.position.getValue() == 1) { if (systems.HYD.Rat.position.getValue()) {
me["RAT-stowed"].hide(); me["RAT-stowed"].hide();
me["RAT-not-stowed"].show(); me["RAT-not-stowed"].show();
} else { } else {
@ -2924,19 +2887,19 @@ var canvas_lowerECAM_hyd = {
me["RAT-not-stowed"].hide(); me["RAT-not-stowed"].hide();
} }
if (y_resv_ovht.getValue() == 1) { if (y_resv_ovht.getValue()) {
me["OVHT-Yellow"].show(); me["OVHT-Yellow"].show();
} else { } else {
me["OVHT-Yellow"].hide(); me["OVHT-Yellow"].hide();
} }
if (b_resv_ovht.getValue() == 1) { if (b_resv_ovht.getValue()) {
me["OVHT-Green"].show(); me["OVHT-Green"].show();
} else { } else {
me["OVHT-Green"].hide(); me["OVHT-Green"].hide();
} }
if (g_resv_ovht.getValue() == 1) { if (g_resv_ovht.getValue()) {
me["OVHT-Blue"].show(); me["OVHT-Blue"].show();
} else { } else {
me["OVHT-Blue"].hide(); me["OVHT-Blue"].hide();
@ -3592,13 +3555,13 @@ setlistener("sim/signals/fdm-initialized", func {
lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg"); lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg");
lowerECAM_update.start(); lowerECAM_update.start();
if (getprop("/systems/acconfig/options/lecam-rate") > 1) { if (rate.getValue() > 1) {
l_rateApply(); l_rateApply();
} }
}); });
var l_rateApply = func { var l_rateApply = func {
lowerECAM_update.restart(0.05 * getprop("/systems/acconfig/options/lecam-rate")); lowerECAM_update.restart(0.05 * rate.getValue());
} }
var lowerECAM_update = maketimer(0.05, func { var lowerECAM_update = maketimer(0.05, func {

View file

@ -7204,14 +7204,37 @@
<repeatable>false</repeatable> <repeatable>false</repeatable>
<binding> <binding>
<condition> <condition>
<greater-than-equals> <and>
<property>systems/electrical/bus/dc-ess</property> <greater-than-equals>
<value>25</value> <property>systems/electrical/bus/dc-ess</property>
</greater-than-equals> <value>25</value>
</greater-than-equals>
<or>
<not>
<property>gear/gear[1]/wow</property>
</not>
<equals>
<property>/engines/engine[0]/state</property>
<value>3</value>
</equals>
<equals>
<property>/engines/engine[1]/state</property>
<value>3</value>
</equals>
</or>
</and>
</condition> </condition>
<command>property-toggle</command> <command>property-assign</command>
<property>controls/switches/LrainRpt</property> <property>controls/switches/LrainRpt</property>
<value>1</value>
</binding> </binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/switches/LrainRpt</property>
<value>0</value>
</binding>
</mod-up>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>setprop("sim/sounde/oh-btn", 1);</script> <script>setprop("sim/sounde/oh-btn", 1);</script>
@ -7227,14 +7250,37 @@
<repeatable>false</repeatable> <repeatable>false</repeatable>
<binding> <binding>
<condition> <condition>
<greater-than-equals> <and>
<property>systems/electrical/bus/dc-ess</property> <greater-than-equals>
<value>25</value> <property>systems/electrical/bus/dc-2</property>
</greater-than-equals> <value>25</value>
</greater-than-equals>
<or>
<not>
<property>gear/gear[1]/wow</property>
</not>
<equals>
<property>/engines/engine[0]/state</property>
<value>3</value>
</equals>
<equals>
<property>/engines/engine[1]/state</property>
<value>3</value>
</equals>
</or>
</and>
</condition> </condition>
<command>property-toggle</command> <command>property-assign</command>
<property>controls/switches/RrainRpt</property> <property>controls/switches/RrainRpt</property>
<value>1</value>
</binding> </binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/switches/RrainRpt</property>
<value>0</value>
</binding>
</mod-up>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>setprop("sim/sounde/oh-btn", 1);</script> <script>setprop("sim/sounde/oh-btn", 1);</script>

View file

@ -236,14 +236,21 @@ var status = {
var ECAM_controller = { var ECAM_controller = {
_recallCounter: 0, _recallCounter: 0,
_noneActive: 0, _noneActive: 0,
counter: 0,
init: func() { init: func() {
ECAMloopTimer.start(); ECAMloopTimer.start();
me.counter = 0;
me.reset(); me.reset();
}, },
loop: func() { loop: func() {
if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !getprop("systems/acconfig/acconfig-running")) { if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !pts.Acconfig.running.getBoolValue()) {
# update FWC phases # update FWC phases
phaseLoop(); if (me.counter == 0) {
phaseLoop();
me.counter = 1;
return;
}
me.counter = 0;
# check active messages # check active messages
messages_priority_3(); messages_priority_3();
@ -274,7 +281,7 @@ var ECAM_controller = {
# write to ECAM # write to ECAM
var counter = 0; var counter = 0;
if (!getprop("systems/acconfig/autoconfig-running")) { if (!pts.Acconfig.running.getBoolValue()) {
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
if (w.active == 1) { if (w.active == 1) {
if (counter < 9) { if (counter < 9) {

View file

@ -116,14 +116,14 @@ var phaseLoop = func() {
if (eng == "IAE") { if (eng == "IAE") {
eprlim = getprop("controls/engines/epr-limit"); eprlim = getprop("controls/engines/epr-limit");
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) { if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
FWC.toPower.setBoolValue(1); FWC.toPower.setBoolValue(1);
} else { } else {
FWC.toPower.setBoolValue(0); FWC.toPower.setBoolValue(0);
} }
} else { } else {
n1lim = getprop("controls/engines/n1-limit"); n1lim = getprop("controls/engines/n1-limit");
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) { if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
FWC.toPower.setBoolValue(1); FWC.toPower.setBoolValue(1);
} else { } else {
FWC.toPower.setBoolValue(0); FWC.toPower.setBoolValue(0);

View file

@ -197,15 +197,15 @@ var light_manager = {
var sh = math.sin(heading); var sh = math.sin(heading);
var ch = math.cos(heading); var ch = math.cos(heading);
if ((ll1 == 1 and getprop("systems/electrical/bus/ac-1") != 0) and (ll2 == 1 and getprop("systems/electrical/bus/ac-2") !=0)) { if ((ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) and (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0)) {
me.light1_ypos = 0.0; me.light1_ypos = 0.0;
me.light1_setSize(16); me.light1_setSize(16);
me.light1_on(); me.light1_on();
} else if (ll1 == 1 and getprop("systems/electrical/bus/ac-1") != 0) { } else if (ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) {
me.light1_ypos = 3.0; me.light1_ypos = 3.0;
me.light1_setSize(12); me.light1_setSize(12);
me.light1_on(); me.light1_on();
} else if (ll2 == 1 and getprop("systems/electrical/bus/ac-2") !=0) { } else if (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0) {
me.light1_ypos = -3.0; me.light1_ypos = -3.0;
me.light1_setSize(12); me.light1_setSize(12);
me.light1_on(); me.light1_on();

View file

@ -157,13 +157,13 @@ var FCUController = {
if (ap1.getBoolValue() or ap2.getBoolValue()) { if (ap1.getBoolValue() or ap2.getBoolValue()) {
apOff("soft", 0); apOff("soft", 0);
} else { } else {
if (getprop("it-autoflight/sound/apoffsound") == 1 or getprop("it-autoflight/sound/apoffsound2") == 1) { if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
setprop("it-autoflight/sound/apoffsound", 0); setprop("/it-autoflight/sound/apoffsound", 0);
setprop("it-autoflight/sound/apoffsound2", 0); setprop("/it-autoflight/sound/apoffsound2", 0);
} }
if (getprop("it-autoflight/output/ap-warning") != 0) { if (getprop("/it-autoflight/output/ap-warning") != 0) {
setprop("it-autoflight/output/ap-warning", 0); setprop("/it-autoflight/output/ap-warning", 0);
setprop("ECAM/warnings/master-warning-light", 0); ecam.lights[0].setValue(0);
} }
} }
} }
@ -178,11 +178,11 @@ var FCUController = {
if (me.FCUworking) { if (me.FCUworking) {
if (athr.getBoolValue()) { if (athr.getBoolValue()) {
athrOff("soft"); athrOff("soft");
setprop("ECAM/warnings/master-caution-light", 1); ecam.lights[1].setValue(1);
} else { } else {
if (getprop("it-autoflight/output/athr-warning") == 1) { if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("it-autoflight/output/athr-warning", 0); setprop("/it-autoflight/output/athr-warning", 0);
setprop("ECAM/warnings/master-caution-light", 0); ecam.lights[1].setValue(0);
} }
} }
} }
@ -349,7 +349,7 @@ var FCUController = {
}, },
ALTPush: func() { ALTPush: func() {
if (me.FCUworking) { if (me.FCUworking) {
# setprop("it-autoflight/input/vert", 8); # He don't work yet m8 # setprop("/it-autoflight/input/vert", 8); # He don't work yet m8
} }
}, },
ALTPull: func() { ALTPull: func() {
@ -523,7 +523,7 @@ var athrOff = func(type) {
var hdgInput = func { var hdgInput = func {
if (latMode.getValue() != 0) { if (latMode.getValue() != 0) {
showHDG.setBoolValue(1); showHDG.setBoolValue(1);
var hdgnow = getprop("it-autoflight/input/hdg"); var hdgnow = getprop("/it-autoflight/input/hdg");
setprop("modes/fcu/hdg-time", getprop("sim/time/elapsed-sec")); setprop("/modes/fcu/hdg-time", pts.Sim.Time.elapsedSec.getValue());
} }
} }

View file

@ -1015,12 +1015,6 @@ var reset_FMGC = func {
setprop("systems/pressurization/diff-to-target", "0"); setprop("systems/pressurization/diff-to-target", "0");
setprop("systems/pressurization/ditchingpb", 0); setprop("systems/pressurization/ditchingpb", 0);
setprop("systems/pressurization/targetvs", "0"); setprop("systems/pressurization/targetvs", "0");
setprop("systems/ventilation/cabin/fans", 0); # aircon fans
setprop("systems/ventilation/avionics/fan", 0);
setprop("systems/ventilation/avionics/extractvalve", "0");
setprop("systems/ventilation/avionics/inletvalve", "0");
setprop("systems/ventilation/lavatory/extractfan", 0);
setprop("systems/ventilation/lavatory/extractvalve", "0");
setprop("systems/pressurization/ambientpsi", "0"); setprop("systems/pressurization/ambientpsi", "0");
setprop("systems/pressurization/cabinpsi", "0"); setprop("systems/pressurization/cabinpsi", "0");

View file

@ -5,77 +5,71 @@
var wow = nil; var wow = nil;
var wowr = nil; var wowr = nil;
var Lrain = props.globals.getNode("/controls/switches/LrainRpt");
var Rrain = props.globals.getNode("/controls/switches/RrainRpt");
var OnLt = props.globals.getNode("/controls/switches/emerCallLtO"); var OnLt = props.globals.getNode("/controls/switches/emerCallLtO");
var CallLt = props.globals.getNode("/controls/switches/emerCallLtC"); var CallLt = props.globals.getNode("/controls/switches/emerCallLtC");
var EmerCall = props.globals.getNode("/controls/switches/emerCall"); var EmerCall = props.globals.getNode("/controls/switches/emerCall");
var CabinCall = props.globals.getNode("/controls/switches/cabinCall"); var CabinCall = props.globals.getNode("/controls/switches/cabinCall");
var MechCall = props.globals.getNode("/controls/switches/mechCall"); var MechCall = props.globals.getNode("/controls/switches/mechCall");
var cvr_gndCtl = props.globals.getNode("/controls/CVR/gndctl");
var cvr_power = props.globals.getNode("/controls/CVR/power");
var cvr_tone = props.globals.getNode("/controls/CVR/tone"); var cvr_tone = props.globals.getNode("/controls/CVR/tone");
# Resets buttons to the default values # Resets buttons to the default values
var variousReset = func { var variousReset = func {
setprop("modes/cpt-du-xfr", 0); setprop("modes/cpt-du-xfr", 0);
setprop("modes/fo-du-xfr", 0); setprop("modes/fo-du-xfr", 0);
setprop("controls/fadec/n1mode1", 0); setprop("/controls/fadec/n1mode1", 0);
setprop("controls/fadec/n1mode2", 0); setprop("/controls/fadec/n1mode2", 0);
setprop("instrumentation/mk-viii/serviceable", 1); setprop("instrumentation/mk-viii/serviceable", 1);
setprop("instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", 0); setprop("instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/gpws-inhibit", 0); setprop("instrumentation/mk-viii/inputs/discretes/gpws-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/glideslope-inhibit", 0); setprop("instrumentation/mk-viii/inputs/discretes/glideslope-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", 0); setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", 0);
setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0); setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0);
setprop("controls/switches/cabinCall", 0); setprop("/controls/switches/cabinCall", 0);
setprop("controls/switches/mechCall", 0); setprop("/controls/switches/mechCall", 0);
setprop("controls/switches/emer-lights", 0.5); setprop("/controls/switches/emer-lights", 0.5);
# cockpit voice recorder stuff # cockpit voice recorder stuff
setprop("controls/CVR/power", 0); setprop("/controls/CVR/power", 0);
setprop("controls/CVR/test", 0); setprop("/controls/CVR/test", 0);
setprop("controls/CVR/tone", 0); setprop("/controls/CVR/tone", 0);
setprop("controls/CVR/gndctl", 0); setprop("/controls/CVR/gndctl", 0);
setprop("controls/CVR/erase", 0); setprop("/controls/CVR/erase", 0);
setprop("controls/switches/pneumatics/cabin-fans", 1); setprop("/controls/switches/pneumatics/cabin-fans", 1);
setprop("controls/oxygen/crewOxyPB", 1); # 0 = OFF 1 = AUTO setprop("/controls/oxygen/crewOxyPB", 1); # 0 = OFF 1 = AUTO
setprop("controls/switches/emerCallLtO", 0); # ON light, flashes white for 10s setprop("/controls/switches/emerCallLtO", 0); # ON light, flashes white for 10s
setprop("controls/switches/emerCallLtC", 0); # CALL light, flashes amber for 10s setprop("/controls/switches/emerCallLtC", 0); # CALL light, flashes amber for 10s
setprop("controls/switches/emerCall", 0); setprop("/controls/switches/emerCall", 0);
setprop("controls/switches/LrainRpt", 0); setprop("/controls/switches/LrainRpt", 0);
setprop("controls/switches/RrainRpt", 0); setprop("/controls/switches/RrainRpt", 0);
setprop("controls/switches/wiperLspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI setprop("/controls/switches/wiperLspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("controls/switches/wiperRspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI setprop("/controls/switches/wiperRspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("controls/lighting/strobe", 0); setprop("/controls/lighting/strobe", 0);
setprop("controls/lighting/beacon", 0); setprop("/controls/lighting/beacon", 0);
setprop("controls/switches/beacon", 0); setprop("/controls/switches/beacon", 0);
setprop("controls/switches/wing-lights", 0); setprop("/controls/switches/wing-lights", 0);
setprop("controls/switches/landing-lights-l", 0); setprop("/controls/switches/landing-lights-l", 0);
setprop("controls/switches/landing-lights-r", 0); setprop("/controls/switches/landing-lights-r", 0);
setprop("controls/lighting/wing-lights", 0); setprop("/controls/lighting/wing-lights", 0);
setprop("controls/lighting/nav-lights-switch", 0); setprop("/controls/lighting/nav-lights-switch", 0);
setprop("controls/lighting/landing-lights[1]", 0); setprop("/controls/lighting/landing-lights[1]", 0);
setprop("controls/lighting/landing-lights[2]", 0); setprop("/controls/lighting/landing-lights[2]", 0);
setprop("controls/lighting/taxi-light-switch", 0); setprop("/controls/lighting/taxi-light-switch", 0);
setprop("controls/lighting/DU/du1", 1); setprop("/controls/lighting/DU/du1", 1);
setprop("controls/lighting/DU/du2", 1); setprop("/controls/lighting/DU/du2", 1);
setprop("controls/lighting/DU/du3", 1); setprop("/controls/lighting/DU/du3", 1);
setprop("controls/lighting/DU/du4", 1); setprop("/controls/lighting/DU/du4", 1);
setprop("controls/lighting/DU/du5", 1); setprop("/controls/lighting/DU/du5", 1);
setprop("controls/lighting/DU/du6", 1); setprop("/controls/lighting/DU/du6", 1);
setprop("controls/lighting/DU/mcdu1", 1); setprop("/controls/lighting/DU/mcdu1", 1);
setprop("controls/lighting/DU/mcdu2", 1); setprop("/controls/lighting/DU/mcdu2", 1);
setprop("modes/fcu/hdg-time", -45); setprop("modes/fcu/hdg-time", -45);
setprop("controls/switching/ATTHDG", 0); setprop("/controls/switching/ATTHDG", 0);
setprop("controls/switching/AIRDATA", 0); setprop("/controls/switching/AIRDATA", 0);
setprop("controls/switches/no-smoking-sign", 1); setprop("/controls/switches/no-smoking-sign", 1);
setprop("controls/switches/seatbelt-sign", 1); setprop("/controls/switches/seatbelt-sign", 1);
} }
var BUTTONS = { var BUTTONS = {
update: func() { update: func() {
rainRepel();
CVR_master();
if (EmerCall.getValue()) { if (EmerCall.getValue()) {
EmerCallOnLight(); EmerCallOnLight();
EmerCallLight(); EmerCallLight();
@ -83,17 +77,6 @@ var BUTTONS = {
}, },
}; };
var rainRepel = func() {
if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3 and pts.Gear.wow[0].getValue()) {
if (Lrain.getValue()) {
Lrain.setValue(0);
}
if (Rrain.getValue()) {
Rrain.setValue(0);
}
}
}
var _OnLt = nil; var _OnLt = nil;
var _EmerCall = nil; var _EmerCall = nil;
@ -120,18 +103,6 @@ var EmerCallLight = func() {
} }
} }
var CVR_master = func() {
wow = pts.Gear.wow[0].getValue();
wowr = pts.Gear.wow[1].getValue();
if (systems.ELEC.Bus.acEss.getValue() > 0 and wow and wowr and (cvr_gndCtl.getValue() or (pts.Engines.Engine.state[0].getValue() == 3 or pts.Engines.Engine.state[1].getValue() == 3))) {
cvr_power.setValue(1);
} else if (!wow and !wowr and systems.ELEC.Bus.acEss.getValue() > 0) {
cvr_power.setValue(1);
} else {
cvr_power.setValue(0);
}
}
var EmerCallFunc = func { var EmerCallFunc = func {
EmerCall.setValue(1); EmerCall.setValue(1);
settimer(func() { settimer(func() {

View file

@ -210,6 +210,7 @@ var systemsInit = func {
systems.ADIRS.init(); systems.ADIRS.init();
systems.eng_init(); systems.eng_init();
systems.APUController.init(); systems.APUController.init();
systems.BrakeSys.reset();
systems.Autobrake.init(); systems.Autobrake.init();
systems.fire_init(); systems.fire_init();
fmgc.flightPlanController.reset(); fmgc.flightPlanController.reset();
@ -256,17 +257,17 @@ var systemsLoop = maketimer(0.1, func {
systems.ELEC.loop(); systems.ELEC.loop();
systems.PNEU.loop(); systems.PNEU.loop();
systems.HYD.loop(); systems.HYD.loop();
systems.FUEL.loop();
systems.ADIRS.loop(); systems.ADIRS.loop();
systems.APUController.loop();
systems.BrakeSys.update();
ecam.ECAM.loop(); ecam.ECAM.loop();
libraries.BUTTONS.update();
fadec.FADEC.loop(); fadec.FADEC.loop();
rmp.rmpUpdate(); rmp.rmpUpdate();
fcu.FCUController.loop(); fcu.FCUController.loop();
dmc.DMController.loop(); dmc.DMController.loop();
systems.APUController.loop();
systems.HFLoop();
atsu.ATSU.loop(); atsu.ATSU.loop();
libraries.BUTTONS.update();
systems.HFLoop();
groundspeed = pts.Velocities.groundspeed.getValue(); groundspeed = pts.Velocities.groundspeed.getValue();
if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) { if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) {
@ -452,7 +453,7 @@ controls.elevatorTrim = func(d) {
if (systems.HYD.Psi.green.getValue() >= 1500) { if (systems.HYD.Psi.green.getValue() >= 1500) {
slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5) slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5)
} else { } else {
slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5) slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5)
} }
} }

View file

@ -25,6 +25,8 @@ var Controls = {
cutoffSw: [props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), props.globals.getNode("/controls/engines/engine[1]/cutoff-switch")], cutoffSw: [props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), props.globals.getNode("/controls/engines/engine[1]/cutoff-switch")],
firePb: [props.globals.getNode("/controls/engines/engine[0]/fire-btn"), props.globals.getNode("/controls/engines/engine[1]/fire-btn")], firePb: [props.globals.getNode("/controls/engines/engine[0]/fire-btn"), props.globals.getNode("/controls/engines/engine[1]/fire-btn")],
throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")], throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")],
throttleRev: [props.globals.getNode("/controls/engines/engine[0]/throttle-rev"), props.globals.getNode("/controls/engines/engine[1]/throttle-rev")],
reverser: [props.globals.getNode("/controls/engines/engine[0]/reverser"), props.globals.getNode("/controls/engines/engine[1]/reverser")],
}, },
}, },
Flight: { Flight: {
@ -43,6 +45,7 @@ var Controls = {
brake: [props.globals.getNode("/controls/gear/brake-left"),props.globals.getNode("/controls/gear/brake-right")], brake: [props.globals.getNode("/controls/gear/brake-left"),props.globals.getNode("/controls/gear/brake-right")],
gearDown: props.globals.getNode("/controls/gear/gear-down"), gearDown: props.globals.getNode("/controls/gear/gear-down"),
parkingBrake: props.globals.getNode("/controls/gear/brake-parking"), parkingBrake: props.globals.getNode("/controls/gear/brake-parking"),
chocks: props.globals.getNode("/services/chocks/enable"),
}, },
}; };
@ -55,17 +58,20 @@ var Engines = {
eprActual: [props.globals.getNode("/engines/engine[0]/epr-actual"), props.globals.getNode("/engines/engine[1]/epr-actual")], eprActual: [props.globals.getNode("/engines/engine[0]/epr-actual"), props.globals.getNode("/engines/engine[1]/epr-actual")],
n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")], n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")],
n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")], n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")],
thrust: [props.globals.getNode("/engines/engine[0]/thrust-lb"), props.globals.getNode("/engines/engine[1]/thrust-lb")],
state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")], state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")],
}, },
}; };
var Environment = { var Environment = {
magVar: props.globals.getNode("/environment/magnetic-variation-deg"), magVar: props.globals.getNode("/environment/magnetic-variation-deg"),
tempDegC: props.globals.getNode("/environment/temperature-degc"),
}; };
var Fdm = { var Fdm = {
JSBsim: { JSBsim: {
Fcs: { Fcs: {
brake: [props.globals.getNode("/fdm/jsbsim/fcs/left-brake-cmd-norm"),props.globals.getNode("/fdm/jsbsim/fcs/right-brake-cmd-norm")],
flapDeg: props.globals.getNode("/fdm/jsbsim/fcs/flap-pos-deg"), flapDeg: props.globals.getNode("/fdm/jsbsim/fcs/flap-pos-deg"),
slatDeg: props.globals.getNode("/fdm/jsbsim/fcs/slat-pos-deg"), slatDeg: props.globals.getNode("/fdm/jsbsim/fcs/slat-pos-deg"),
}, },
@ -73,12 +79,17 @@ var Fdm = {
aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"), aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"),
elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"), elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"),
}, },
Inertia: {
weightLbs: props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs"),
},
Position: { Position: {
wow: props.globals.getNode("/fdm/jsbsim/position/wow"), wow: props.globals.getNode("/fdm/jsbsim/position/wow"),
}, },
Propulsion: { Propulsion: {
tatC: props.globals.getNode("/fdm/jsbsim/propulsion/tat-c"),
Engine: { Engine: {
fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")], fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")],
reverserAngle: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad")],
}, },
}, },
}, },
@ -92,9 +103,9 @@ var FMGC = {
var Gear = { var Gear = {
compression: [props.globals.getNode("/gear/gear[0]/compression-norm"), props.globals.getNode("/gear/gear[1]/compression-norm"), props.globals.getNode("/gear/gear[2]/compression-norm")], compression: [props.globals.getNode("/gear/gear[0]/compression-norm"), props.globals.getNode("/gear/gear[1]/compression-norm"), props.globals.getNode("/gear/gear[2]/compression-norm")],
wow: [props.globals.getNode("/gear/gear[0]/wow"), props.globals.getNode("/gear/gear[1]/wow"), props.globals.getNode("/gear/gear[2]/wow")],
position: [props.globals.getNode("/gear/gear[0]/position-norm"), props.globals.getNode("/gear/gear[1]/position-norm"), props.globals.getNode("/gear/gear[2]/position-norm")], position: [props.globals.getNode("/gear/gear[0]/position-norm"), props.globals.getNode("/gear/gear[1]/position-norm"), props.globals.getNode("/gear/gear[2]/position-norm")],
rollspeed: [props.globals.getNode("/gear/gear[0]/rollspeed-ms"), props.globals.getNode("/gear/gear[1]/rollspeed-ms"), props.globals.getNode("/gear/gear[2]/rollspeed-ms")], rollspeed: [props.globals.getNode("/gear/gear[0]/rollspeed-ms"), props.globals.getNode("/gear/gear[1]/rollspeed-ms"), props.globals.getNode("/gear/gear[2]/rollspeed-ms")],
wow: [props.globals.getNode("/gear/gear[0]/wow"), props.globals.getNode("/gear/gear[1]/wow"), props.globals.getNode("/gear/gear[2]/wow")],
}; };
var Instrumentation = { var Instrumentation = {
@ -160,6 +171,7 @@ var Sim = {
online: props.globals.getNode("/sim/multiplay/online"), online: props.globals.getNode("/sim/multiplay/online"),
}, },
pause: props.globals.getNode("/sim/freeze/master"), pause: props.globals.getNode("/sim/freeze/master"),
replayState: props.globals.getNode("/sim/freeze/replay-state"),
Replay: { Replay: {
replayActive: props.globals.getNode("/sim/replay/replay-state"), replayActive: props.globals.getNode("/sim/replay/replay-state"),
}, },
@ -169,8 +181,16 @@ var Sim = {
}, },
}; };
var Systems = {
Thrust: {
state: [props.globals.getNode("/systems/thrust/state1"), props.globals.getNode("/systems/thrust/state2")],
},
};
var Velocities = { var Velocities = {
airspeed: props.globals.getNode("/velocities/airspeed-kt"),
groundspeed: props.globals.getNode("/velocities/groundspeed-kt"), groundspeed: props.globals.getNode("/velocities/groundspeed-kt"),
mach: props.globals.getNode("/velocities/mach"),
}; };
setprop("/systems/acconfig/property-tree-setup-loaded", 1); setprop("/systems/acconfig/property-tree-setup-loaded", 1);

View file

@ -17,15 +17,6 @@ var egt_lightdn_time = 10;
var shutdown_time = 20; var shutdown_time = 20;
var egt_shutdown_time = 20; var egt_shutdown_time = 20;
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[0]/last-igniter", "B");
setprop("/controls/engines/engine[1]/last-igniter", "B");
var eng_init = func { var eng_init = func {
setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/controls/engines/engine[1]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0);

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
if (getprop("/options/eng") == "IAE") { if (pts.Options.eng.getValue() == "IAE") {
io.include("engines-iae.nas"); io.include("engines-iae.nas");
} else { } else {
io.include("engines-cfm.nas"); io.include("engines-cfm.nas");
@ -50,87 +50,84 @@ var doTOGAThrust = func {
# Reverse Thrust System # Reverse Thrust System
var toggleFastRevThrust = func { var toggleFastRevThrust = func {
var state1 = getprop("/systems/thrust/state1"); if (pts.Systems.Thrust.state[0].getValue() == "IDLE" and pts.Systems.Thrust.state[1].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverser[0].getValue() == 0 and pts.Controls.Engines.Engine.reverser[1].getValue() == 0 and pts.Gear.wow[1].getValue() == 1 and pts.Gear.wow[2].getValue() == 1) {
var state2 = getprop("/systems/thrust/state2"); if (pts.Sim.Input.Selected.engine[0].getBoolValue()) {
if (state1 == "IDLE" and state2 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0" and getprop("/controls/engines/engine[1]/reverser") == "0" and getprop("/gear/gear[1]/wow") == 1 and getprop("/gear/gear[2]/wow") == 1) {
if (getprop("/sim/input/selected/engine[0]") == 1) {
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1); pts.Controls.Engines.Engine.reverser[0].setValue(1);
setprop("/controls/engines/engine[0]/throttle-rev", 0.65); pts.Controls.Engines.Engine.throttleRev[0].setValue(0.65);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(3.14);
} }
if (getprop("/sim/input/selected/engine[1]") == 1) { if (pts.Sim.Input.Selected.engine[1].getBoolValue()) {
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[1]/reverser", 1); pts.Controls.Engines.Engine.reverser[1].setValue(1);
setprop("/controls/engines/engine[1]/throttle-rev", 0.65); pts.Controls.Engines.Engine.throttleRev[1].setValue(0.65);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14);
} }
} else if ((getprop("/controls/engines/engine[0]/reverser") == "1") or (getprop("/controls/engines/engine[1]/reverser") == "1")) { } else if (pts.Controls.Engines.Engine.reverser[0].getValue() == 1 or pts.Controls.Engines.Engine.reverser[1].getValue() == 1) {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0); pts.Controls.Engines.Engine.throttleRev[0].setValue(0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0); pts.Controls.Engines.Engine.throttleRev[1].setValue(0);
setprop("/controls/engines/engine[0]/reverser", 0); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(0);
setprop("/controls/engines/engine[1]/reverser", 0); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(0);
pts.Controls.Engines.Engine.reverser[0].setValue(0);
pts.Controls.Engines.Engine.reverser[1].setValue(0);
} }
} }
var doRevThrust = func { var doRevThrust = func {
if (getprop("/gear/gear[1]/wow") != 1 and getprop("/gear/gear[2]/wow") != 1) { if (pts.Gear.wow[1].getValue() != 1 and pts.Gear.wow[2].getValue() != 1) {
# Can't select reverse if not on the ground # Can't select reverse if not on the ground
return; return;
} }
if (getprop("/sim/input/selected/engine[0]") == 1 and getprop("/controls/engines/engine[0]/reverser") == "1") { if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == 1) {
var pos = getprop("/controls/engines/engine[0]/throttle-rev"); var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue();
if (pos < 0.649) { if (pos < 0.649) {
setprop("/controls/engines/engine[0]/throttle-rev", pos + 0.15); pts.Controls.Engines.Engine.throttleRev[0].setValue(pos + 0.15);
} }
} }
if (getprop("/sim/input/selected/engine[1]") == 1 and getprop("/controls/engines/engine[1]/reverser") == "1") { if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == 1) {
var pos = getprop("/controls/engines/engine[1]/throttle-rev"); var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue();
if (pos < 0.649) { if (pos < 0.649) {
setprop("/controls/engines/engine[1]/throttle-rev", pos + 0.15); pts.Controls.Engines.Engine.throttleRev[1].setValue(pos + 0.15);
} }
} }
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2"); if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Systems.Thrust.state[0].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverser[0].getValue() == 0) {
if (getprop("/sim/input/selected/engine[0]") == 1 and state1 == "IDLE" and getprop("/controls/engines/engine[0]/reverser") == "0") {
setprop("/controls/engines/engine[0]/throttle-rev", 0.05);
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[0]/reverser", 1); pts.Controls.Engines.Engine.throttleRev[0].setValue(0.05);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14); pts.Controls.Engines.Engine.reverser[0].setValue(1);
pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(3.14);
} }
if (getprop("/sim/input/selected/engine[1]") == 1 and state2 == "IDLE" and getprop("/controls/engines/engine[1]/reverser") == "0") { if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Systems.Thrust.state[1].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverser[1].getValue() == 0) {
setprop("/controls/engines/engine[1]/throttle-rev", 0.05);
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
setprop("/controls/engines/engine[1]/reverser", 1); pts.Controls.Engines.Engine.throttleRev[1].setValue(0.05);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14); pts.Controls.Engines.Engine.reverser[1].setValue(1);
pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14);
} }
} }
var unRevThrust = func { var unRevThrust = func {
if (getprop("/sim/input/selected/engine[0]") == 1 and getprop("/controls/engines/engine[0]/reverser") == "1") { if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == 1) {
var pos = getprop("/controls/engines/engine[0]/throttle-rev"); var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue();
if (pos > 0.051) { if (pos > 0.051) {
setprop("/controls/engines/engine[0]/throttle-rev", pos - 0.15); pts.Controls.Engines.Engine.throttleRev[0].setValue(pos - 0.15);
} else { } else {
setprop("/controls/engines/engine[0]/throttle-rev", 0);
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0); pts.Controls.Engines.Engine.throttleRev[0].setValue(0);
setprop("/controls/engines/engine[0]/reverser", 0); pts.Controls.Engines.Engine.reverser[0].setValue(0);
pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(0);
} }
} }
if (getprop("/sim/input/selected/engine[1]") == 1 and getprop("/controls/engines/engine[1]/reverser") == "1") { if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == 1) {
var pos = getprop("/controls/engines/engine[1]/throttle-rev"); var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue();
if (pos > 0.051) { if (pos > 0.051) {
setprop("/controls/engines/engine[1]/throttle-rev", pos - 0.15); pts.Controls.Engines.Engine.throttleRev[1].setValue(pos - 0.15);
} else { } else {
setprop("/controls/engines/engine[1]/throttle-rev", 0);
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0); pts.Controls.Engines.Engine.throttleRev[1].setValue(0);
setprop("/controls/engines/engine[1]/reverser", 0); pts.Controls.Engines.Engine.reverser[1].setValue(0);
pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(0);
} }
} }
} }

View file

@ -17,15 +17,6 @@ var egt_lightdn_time = 10;
var shutdown_time = 20; var shutdown_time = 20;
var egt_shutdown_time = 20; var egt_shutdown_time = 20;
setprop("/controls/engines/engine[0]/reverser", 0);
setprop("/controls/engines/engine[1]/reverser", 0);
setprop("/controls/engines/engine[0]/igniter-a", 0);
setprop("/controls/engines/engine[1]/igniter-a", 0);
setprop("/controls/engines/engine[0]/igniter-b", 0);
setprop("/controls/engines/engine[1]/igniter-b", 0);
setprop("/controls/engines/engine[0]/last-igniter", "B");
setprop("/controls/engines/engine[1]/last-igniter", "B");
var eng_init = func { var eng_init = func {
setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[0]/man-start", 0);
setprop("/controls/engines/engine[1]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0);

View file

@ -2,139 +2,139 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
setprop("systems/fadec/n1mode1", 0); # Doesn't do anything, just here for other logic # setprop("/systems/fadec/n1mode1", 0); # Doesn't do anything, just here for other logic #
setprop("systems/fadec/n1mode2", 0); # Doesn't do anything, just here for other logic # setprop("/systems/fadec/n1mode2", 0); # Doesn't do anything, just here for other logic #
setprop("systems/fadec/eng1/egt", 1); setprop("/systems/fadec/eng1/egt", 1);
setprop("systems/fadec/eng1/n1", 1); setprop("/systems/fadec/eng1/n1", 1);
setprop("systems/fadec/eng1/n2", 1); setprop("/systems/fadec/eng1/n2", 1);
setprop("systems/fadec/eng1/ff", 1); setprop("/systems/fadec/eng1/ff", 1);
setprop("systems/fadec/eng2/egt", 1); setprop("/systems/fadec/eng2/egt", 1);
setprop("systems/fadec/eng2/n1", 1); setprop("/systems/fadec/eng2/n1", 1);
setprop("systems/fadec/eng2/n2", 1); setprop("/systems/fadec/eng2/n2", 1);
setprop("systems/fadec/eng2/ff", 1); setprop("/systems/fadec/eng2/ff", 1);
setprop("systems/fadec/power-avail", 0); setprop("/systems/fadec/power-avail", 0);
setprop("systems/fadec/powered1", 0); setprop("/systems/fadec/powered1", 0);
setprop("systems/fadec/powered2", 0); setprop("/systems/fadec/powered2", 0);
setprop("systems/fadec/powered-time", -300); setprop("/systems/fadec/powered-time", -300);
setprop("systems/fadec/powerup", 0); setprop("/systems/fadec/powerup", 0);
setprop("systems/fadec/eng1-master-count", 0); setprop("/systems/fadec/eng1-master-count", 0);
setprop("systems/fadec/eng1-master-time", -300); setprop("/systems/fadec/eng1-master-time", -300);
setprop("systems/fadec/eng1-off-power", 0); setprop("/systems/fadec/eng1-off-power", 0);
setprop("systems/fadec/eng2-master-count", 0); setprop("/systems/fadec/eng2-master-count", 0);
setprop("systems/fadec/eng2-master-time", -300); setprop("/systems/fadec/eng2-master-time", -300);
setprop("systems/fadec/eng2-off-power", 0); setprop("/systems/fadec/eng2-off-power", 0);
var FADEC = { var FADEC = {
init: func() { init: func() {
setprop("systems/fadec/powered-time", 0); setprop("/systems/fadec/powered-time", 0);
setprop("systems/fadec/eng1-master-time", -300); setprop("/systems/fadec/eng1-master-time", -300);
setprop("systems/fadec/eng2-master-time", -300); setprop("/systems/fadec/eng2-master-time", -300);
}, },
loop: func() { loop: func() {
var ac1 = getprop("systems/electrical/bus/ac-1"); var ac1 = systems.ELEC.Bus.ac1.getValue();
var ac2 = getprop("systems/electrical/bus/ac-2"); var ac2 = systems.ELEC.Bus.ac2.getValue();
var acess = getprop("systems/electrical/bus/ac-ess"); var acess = systems.ELEC.Bus.acEss.getValue();
var state1 = getprop("engines/engine[0]/state"); var state1 = pts.Engines.Engine.state[0].getValue();
var state2 = getprop("engines/engine[1]/state"); var state2 = pts.Engines.Engine.state[1].getValue();
var master1 = getprop("controls/engines/engine[0]/cutoff-switch"); var master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
var master2 = getprop("controls/engines/engine[1]/cutoff-switch"); var master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
var modeSel = getprop("controls/engines/engine-start-switch"); var modeSel = pts.Controls.Engines.startSw.getValue();
var elapsedSec = getprop("sim/time/elapsed-sec"); var elapsedSec = pts.Sim.Time.elapsedSec.getValue();
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) { if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
if (getprop("systems/fadec/power-avail") != 1) { if (getprop("/systems/fadec/power-avail") != 1) {
setprop("systems/fadec/powered-time", elapsedSec); setprop("/systems/fadec/powered-time", elapsedSec);
setprop("systems/fadec/power-avail", 1); setprop("/systems/fadec/power-avail", 1);
} }
} else { } else {
if (getprop("systems/fadec/power-avail") != 0) { if (getprop("/systems/fadec/power-avail") != 0) {
setprop("systems/fadec/power-avail", 0); setprop("/systems/fadec/power-avail", 0);
} }
} }
var powerAvail = getprop("systems/fadec/power-avail"); var powerAvail = getprop("/systems/fadec/power-avail");
if (getprop("systems/fadec/powered-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) {
setprop("systems/fadec/powerup", 1); setprop("/systems/fadec/powerup", 1);
} else { } else {
setprop("systems/fadec/powerup", 0); setprop("/systems/fadec/powerup", 0);
} }
if (master1 == 1) { if (master1 == 1) {
if (getprop("systems/fadec/eng1-master-count") != 1) { if (getprop("/systems/fadec/eng1-master-count") != 1) {
setprop("systems/fadec/eng1-master-time", elapsedSec); setprop("/systems/fadec/eng1-master-time", elapsedSec);
setprop("systems/fadec/eng1-master-count", 1); setprop("/systems/fadec/eng1-master-count", 1);
} }
} else { } else {
if (getprop("systems/fadec/eng1-master-count") != 0) { if (getprop("/systems/fadec/eng1-master-count") != 0) {
setprop("systems/fadec/eng1-master-count", 0); setprop("/systems/fadec/eng1-master-count", 0);
} }
} }
if (getprop("systems/fadec/eng1-master-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) {
setprop("systems/fadec/eng1-off-power", 1); setprop("/systems/fadec/eng1-off-power", 1);
} else { } else {
setprop("systems/fadec/eng1-off-power", 0); setprop("/systems/fadec/eng1-off-power", 0);
} }
if (master2 == 1) { if (master2 == 1) {
if (getprop("systems/fadec/eng2-master-count") != 1) { if (getprop("/systems/fadec/eng2-master-count") != 1) {
setprop("systems/fadec/eng2-master-time", elapsedSec); setprop("/systems/fadec/eng2-master-time", elapsedSec);
setprop("systems/fadec/eng2-master-count", 1); setprop("/systems/fadec/eng2-master-count", 1);
} }
} else { } else {
if (getprop("systems/fadec/eng2-master-count") != 0) { if (getprop("/systems/fadec/eng2-master-count") != 0) {
setprop("systems/fadec/eng2-master-count", 0); setprop("/systems/fadec/eng2-master-count", 0);
} }
} }
if (getprop("systems/fadec/eng2-master-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) {
setprop("systems/fadec/eng2-off-power", 1); setprop("/systems/fadec/eng2-off-power", 1);
} else { } else {
setprop("systems/fadec/eng2-off-power", 0); setprop("/systems/fadec/eng2-off-power", 0);
} }
if (state1 == 3) { if (state1 == 3) {
setprop("systems/fadec/powered1", 1); setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) { } else if (powerAvail and modeSel == 2) {
setprop("systems/fadec/powered1", 1); setprop("/systems/fadec/powered1", 1);
} else { } else {
setprop("systems/fadec/powered1", 0); setprop("/systems/fadec/powered1", 0);
} }
if (state2 == 3) { if (state2 == 3) {
setprop("systems/fadec/powered2", 1); setprop("/systems/fadec/powered2", 1);
} else if (powerAvail and modeSel == 2) { } else if (powerAvail and modeSel == 2) {
setprop("systems/fadec/powered2", 1); setprop("/systems/fadec/powered2", 1);
} else { } else {
setprop("systems/fadec/powered2", 0); setprop("/systems/fadec/powered2", 0);
} }
var powered1 = getprop("systems/fadec/powered1"); var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("systems/fadec/powered2"); var powered2 = getprop("/systems/fadec/powered2");
if (powered1 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng1-off-power")) { if (powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) {
setprop("systems/fadec/eng1/n1", 1); setprop("/systems/fadec/eng1/n1", 1);
setprop("systems/fadec/eng1/egt", 1); setprop("/systems/fadec/eng1/egt", 1);
setprop("systems/fadec/eng1/n2", 1); setprop("/systems/fadec/eng1/n2", 1);
setprop("systems/fadec/eng1/ff", 1); setprop("/systems/fadec/eng1/ff", 1);
} else { } else {
setprop("systems/fadec/eng1/n1", 0); setprop("/systems/fadec/eng1/n1", 0);
setprop("systems/fadec/eng1/egt", 0); setprop("/systems/fadec/eng1/egt", 0);
setprop("systems/fadec/eng1/n2", 0); setprop("/systems/fadec/eng1/n2", 0);
setprop("systems/fadec/eng1/ff", 0); setprop("/systems/fadec/eng1/ff", 0);
} }
if (powered2 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng2-off-power")) { if (powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) {
setprop("systems/fadec/eng2/n1", 1); setprop("/systems/fadec/eng2/n1", 1);
setprop("systems/fadec/eng2/egt", 1); setprop("/systems/fadec/eng2/egt", 1);
setprop("systems/fadec/eng2/n2", 1); setprop("/systems/fadec/eng2/n2", 1);
setprop("systems/fadec/eng2/ff", 1); setprop("/systems/fadec/eng2/ff", 1);
} else { } else {
setprop("systems/fadec/eng2/n1", 0); setprop("/systems/fadec/eng2/n1", 0);
setprop("systems/fadec/eng2/egt", 0); setprop("/systems/fadec/eng2/egt", 0);
setprop("systems/fadec/eng2/n2", 0); setprop("/systems/fadec/eng2/n2", 0);
setprop("systems/fadec/eng2/ff", 0); setprop("/systems/fadec/eng2/ff", 0);
} }
}, },
}; };

View file

@ -2,191 +2,191 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
setprop("controls/fadec/n1mode1", 0); setprop("/controls/fadec/n1mode1", 0);
setprop("controls/fadec/n1mode2", 0); setprop("/controls/fadec/n1mode2", 0);
setprop("systems/fadec/n1mode1", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated # setprop("/systems/fadec/n1mode1", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
setprop("systems/fadec/n1mode2", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated # setprop("/systems/fadec/n1mode2", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
setprop("systems/fadec/eng1/epr", 1); setprop("/systems/fadec/eng1/epr", 1);
setprop("systems/fadec/eng1/egt", 1); setprop("/systems/fadec/eng1/egt", 1);
setprop("systems/fadec/eng1/n1", 1); setprop("/systems/fadec/eng1/n1", 1);
setprop("systems/fadec/eng1/n2", 1); setprop("/systems/fadec/eng1/n2", 1);
setprop("systems/fadec/eng1/ff", 1); setprop("/systems/fadec/eng1/ff", 1);
setprop("systems/fadec/eng2/epr", 1); setprop("/systems/fadec/eng2/epr", 1);
setprop("systems/fadec/eng2/egt", 1); setprop("/systems/fadec/eng2/egt", 1);
setprop("systems/fadec/eng2/n1", 1); setprop("/systems/fadec/eng2/n1", 1);
setprop("systems/fadec/eng2/n2", 1); setprop("/systems/fadec/eng2/n2", 1);
setprop("systems/fadec/eng2/ff", 1); setprop("/systems/fadec/eng2/ff", 1);
setprop("systems/fadec/power-avail", 0); setprop("/systems/fadec/power-avail", 0);
setprop("systems/fadec/powered1", 0); setprop("/systems/fadec/powered1", 0);
setprop("systems/fadec/powered2", 0); setprop("/systems/fadec/powered2", 0);
setprop("systems/fadec/powered-time", -300); setprop("/systems/fadec/powered-time", -300);
setprop("systems/fadec/powerup", 0); setprop("/systems/fadec/powerup", 0);
setprop("systems/fadec/eng1-master-count", 0); setprop("/systems/fadec/eng1-master-count", 0);
setprop("systems/fadec/eng1-master-time", -300); setprop("/systems/fadec/eng1-master-time", -300);
setprop("systems/fadec/eng1-off-power", 0); setprop("/systems/fadec/eng1-off-power", 0);
setprop("systems/fadec/eng2-master-count", 0); setprop("/systems/fadec/eng2-master-count", 0);
setprop("systems/fadec/eng2-master-time", -300); setprop("/systems/fadec/eng2-master-time", -300);
setprop("systems/fadec/eng2-off-power", 0); setprop("/systems/fadec/eng2-off-power", 0);
var FADEC = { var FADEC = {
init: func() { init: func() {
setprop("systems/fadec/powered-time", 0); setprop("/systems/fadec/powered-time", 0);
setprop("systems/fadec/eng1-master-time", -300); setprop("/systems/fadec/eng1-master-time", -300);
setprop("systems/fadec/eng2-master-time", -300); setprop("/systems/fadec/eng2-master-time", -300);
}, },
loop: func() { loop: func() {
var ac1 = getprop("systems/electrical/bus/ac-1"); var ac1 = systems.ELEC.Bus.ac1.getValue();
var ac2 = getprop("systems/electrical/bus/ac-2"); var ac2 = systems.ELEC.Bus.ac2.getValue();
var acess = getprop("systems/electrical/bus/ac-ess"); var acess = systems.ELEC.Bus.acEss.getValue();
var state1 = getprop("engines/engine[0]/state"); var state1 = pts.Engines.Engine.state[0].getValue();
var state2 = getprop("engines/engine[1]/state"); var state2 = pts.Engines.Engine.state[1].getValue();
var master1 = getprop("controls/engines/engine[0]/cutoff-switch"); var master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
var master2 = getprop("controls/engines/engine[1]/cutoff-switch"); var master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
var modeSel = getprop("controls/engines/engine-start-switch"); var modeSel = pts.Controls.Engines.startSw.getValue();
var N1Mode1_sw = getprop("controls/fadec/n1mode1"); var elapsedSec = pts.Sim.Time.elapsedSec.getValue();
var N1Mode2_sw = getprop("controls/fadec/n1mode2"); var N1Mode1_sw = getprop("/controls/fadec/n1mode1");
var elapsedSec = getprop("sim/time/elapsed-sec"); var N1Mode2_sw = getprop("/controls/fadec/n1mode2");
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) { if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
if (getprop("systems/fadec/power-avail") != 1) { if (getprop("/systems/fadec/power-avail") != 1) {
setprop("systems/fadec/powered-time", elapsedSec); setprop("/systems/fadec/powered-time", elapsedSec);
setprop("systems/fadec/power-avail", 1); setprop("/systems/fadec/power-avail", 1);
} }
} else { } else {
if (getprop("systems/fadec/power-avail") != 0) { if (getprop("/systems/fadec/power-avail") != 0) {
setprop("systems/fadec/power-avail", 0); setprop("/systems/fadec/power-avail", 0);
} }
} }
var powerAvail = getprop("systems/fadec/power-avail"); var powerAvail = getprop("/systems/fadec/power-avail");
if (getprop("systems/fadec/powered-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) {
setprop("systems/fadec/powerup", 1); setprop("/systems/fadec/powerup", 1);
} else { } else {
setprop("systems/fadec/powerup", 0); setprop("/systems/fadec/powerup", 0);
} }
if (master1 == 1) { if (master1 == 1) {
if (getprop("systems/fadec/eng1-master-count") != 1) { if (getprop("/systems/fadec/eng1-master-count") != 1) {
setprop("systems/fadec/eng1-master-time", elapsedSec); setprop("/systems/fadec/eng1-master-time", elapsedSec);
setprop("systems/fadec/eng1-master-count", 1); setprop("/systems/fadec/eng1-master-count", 1);
} }
} else { } else {
if (getprop("systems/fadec/eng1-master-count") != 0) { if (getprop("/systems/fadec/eng1-master-count") != 0) {
setprop("systems/fadec/eng1-master-count", 0); setprop("/systems/fadec/eng1-master-count", 0);
} }
} }
if (getprop("systems/fadec/eng1-master-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) {
setprop("systems/fadec/eng1-off-power", 1); setprop("/systems/fadec/eng1-off-power", 1);
} else { } else {
setprop("systems/fadec/eng1-off-power", 0); setprop("/systems/fadec/eng1-off-power", 0);
} }
if (master2 == 1) { if (master2 == 1) {
if (getprop("systems/fadec/eng2-master-count") != 1) { if (getprop("/systems/fadec/eng2-master-count") != 1) {
setprop("systems/fadec/eng2-master-time", elapsedSec); setprop("/systems/fadec/eng2-master-time", elapsedSec);
setprop("systems/fadec/eng2-master-count", 1); setprop("/systems/fadec/eng2-master-count", 1);
} }
} else { } else {
if (getprop("systems/fadec/eng2-master-count") != 0) { if (getprop("/systems/fadec/eng2-master-count") != 0) {
setprop("systems/fadec/eng2-master-count", 0); setprop("/systems/fadec/eng2-master-count", 0);
} }
} }
if (getprop("systems/fadec/eng2-master-time") + 300 >= elapsedSec) { if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) {
setprop("systems/fadec/eng2-off-power", 1); setprop("/systems/fadec/eng2-off-power", 1);
} else { } else {
setprop("systems/fadec/eng2-off-power", 0); setprop("/systems/fadec/eng2-off-power", 0);
} }
if (state1 == 3) { if (state1 == 3) {
setprop("systems/fadec/powered1", 1); setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) { } else if (powerAvail and modeSel == 2) {
setprop("systems/fadec/powered1", 1); setprop("/systems/fadec/powered1", 1);
} else { } else {
setprop("systems/fadec/powered1", 0); setprop("/systems/fadec/powered1", 0);
} }
if (state2 == 3) { if (state2 == 3) {
setprop("systems/fadec/powered2", 1); setprop("/systems/fadec/powered2", 1);
} else if (powerAvail and modeSel == 2) { } else if (powerAvail and modeSel == 2) {
setprop("systems/fadec/powered2", 1); setprop("/systems/fadec/powered2", 1);
} else { } else {
setprop("systems/fadec/powered2", 0); setprop("/systems/fadec/powered2", 0);
} }
if (N1Mode1_sw == 1) { if (N1Mode1_sw == 1) {
setprop("systems/fadec/n1mode1", 1); setprop("/systems/fadec/n1mode1", 1);
} else { } else {
setprop("systems/fadec/n1mode1", 0); setprop("/systems/fadec/n1mode1", 0);
} }
if (N1Mode2_sw == 1) { if (N1Mode2_sw == 1) {
setprop("systems/fadec/n1mode2", 1); setprop("/systems/fadec/n1mode2", 1);
} else { } else {
setprop("systems/fadec/n1mode2", 0); setprop("/systems/fadec/n1mode2", 0);
} }
var powered1 = getprop("systems/fadec/powered1"); var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("systems/fadec/powered2"); var powered2 = getprop("/systems/fadec/powered2");
var N1Mode1 = getprop("systems/fadec/n1mode1"); var N1Mode1 = getprop("/systems/fadec/n1mode1");
var N1Mode2 = getprop("systems/fadec/n1mode2"); var N1Mode2 = getprop("/systems/fadec/n1mode2");
var N11 = getprop("engines/engine[0]/n1-actual"); var N11 = getprop("engines/engine[0]/n1-actual");
var N12 = getprop("engines/engine[1]/n1-actual"); var N12 = getprop("engines/engine[1]/n1-actual");
var N21 = getprop("engines/engine[0]/n2-actual"); var N21 = getprop("engines/engine[0]/n2-actual");
var N22 = getprop("engines/engine[1]/n2-actual"); var N22 = getprop("engines/engine[1]/n2-actual");
if ((powered1 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng1-off-power")) and N1Mode1 == 0) { if ((powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) and N1Mode1 == 0) {
setprop("systems/fadec/eng1/epr", 1); setprop("/systems/fadec/eng1/epr", 1);
} else { } else {
setprop("systems/fadec/eng1/epr", 0); setprop("/systems/fadec/eng1/epr", 0);
} }
if ((powered2 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng2-off-power")) and N1Mode2 == 0) { if ((powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) and N1Mode2 == 0) {
setprop("systems/fadec/eng2/epr", 1); setprop("/systems/fadec/eng2/epr", 1);
} else { } else {
setprop("systems/fadec/eng2/epr", 0); setprop("/systems/fadec/eng2/epr", 0);
} }
if (powered1 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng1-off-power")) { if (powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) {
setprop("systems/fadec/eng1/egt", 1); setprop("/systems/fadec/eng1/egt", 1);
setprop("systems/fadec/eng1/ff", 1); setprop("/systems/fadec/eng1/ff", 1);
} else { } else {
setprop("systems/fadec/eng1/egt", 0); setprop("/systems/fadec/eng1/egt", 0);
setprop("systems/fadec/eng1/ff", 0); setprop("/systems/fadec/eng1/ff", 0);
} }
if (powered2 or getprop("systems/fadec/powerup") or getprop("systems/fadec/eng2-off-power")) { if (powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) {
setprop("systems/fadec/eng2/egt", 1); setprop("/systems/fadec/eng2/egt", 1);
setprop("systems/fadec/eng2/ff", 1); setprop("/systems/fadec/eng2/ff", 1);
} else { } else {
setprop("systems/fadec/eng2/egt", 0); setprop("/systems/fadec/eng2/egt", 0);
setprop("systems/fadec/eng2/ff", 0); setprop("/systems/fadec/eng2/ff", 0);
} }
if (powered1 and N11 >= 3.5) { if (powered1 and N11 >= 3.5) {
setprop("systems/fadec/eng1/n1", 1); setprop("/systems/fadec/eng1/n1", 1);
} else { } else {
setprop("systems/fadec/eng1/n1", 0); setprop("/systems/fadec/eng1/n1", 0);
} }
if (powered2 and N12 >= 3.5) { if (powered2 and N12 >= 3.5) {
setprop("systems/fadec/eng2/n1", 1); setprop("/systems/fadec/eng2/n1", 1);
} else { } else {
setprop("systems/fadec/eng2/n1", 0); setprop("/systems/fadec/eng2/n1", 0);
} }
if (powered1 and N21 >= 3.5) { if (powered1 and N21 >= 3.5) {
setprop("systems/fadec/eng1/n2", 1); setprop("/systems/fadec/eng1/n2", 1);
} else { } else {
setprop("systems/fadec/eng1/n2", 0); setprop("/systems/fadec/eng1/n2", 0);
} }
if (powered2 and N22 >= 3.5) { if (powered2 and N22 >= 3.5) {
setprop("systems/fadec/eng2/n2", 1); setprop("/systems/fadec/eng2/n2", 1);
} else { } else {
setprop("systems/fadec/eng2/n2", 0); setprop("/systems/fadec/eng2/n2", 0);
} }
}, },
}; };

View file

@ -33,8 +33,20 @@
# #
# Added brakes temp calculations and adapted for A320-family # Added brakes temp calculations and adapted for A320-family
# 2020, Andrea Vezzali # 2020, Andrea Vezzali
# # Updated Nasal to project standards
# 2020, Jonathan Redpath
########################################################################## ##########################################################################
var LThermalEnergy = 0;
var RThermalEnergy = 0;
var dt = 0;
var LBrakeLevel = 0;
var RBrakeLevel = 0;
var tatdegc = 0;
var L_thrust = 0;
var R_thrust = 0;
var airspeed = 0;
var BrakeSystem = var BrakeSystem =
{ {
new : func() new : func()
@ -56,9 +68,17 @@ var BrakeSystem =
m.LSmokeToggle = 0; m.LSmokeToggle = 0;
m.RSmokeActive = 0; m.RSmokeActive = 0;
m.RSmokeToggle = 0; m.RSmokeToggle = 0;
# m.LnCoolFactor = math.ln(1-m.CoolingFactor); m.thermalEnergy = [0.0, 0.0];
m.brakeFans = props.globals.getNode("/controls/gear/brake-fans");
m.reset(); m.fireServices = props.globals.getNode("/sim/animation/fire-services");
m.gearSmoke = [props.globals.getNode("/gear/gear[1]/Lbrake-smoke"), props.globals.getNode("/gear/gear[2]/Rbrake-smoke")];
m.lBrakeTemp = [props.globals.getNode("/gear/gear[1]/L1brake-temp-degc"),props.globals.getNode("/gear/gear[1]/L2brake-temp-degc")];
m.rBrakeTemp = [props.globals.getNode("/gear/gear[2]/R3brake-temp-degc"),props.globals.getNode("/gear/gear[2]/R4brake-temp-degc")];
m.L1error = 0;
m.L2error = 0;
m.R3error = 0;
m.R4error = 0;
m.counter = 0;
return m; return m;
}, },
@ -66,73 +86,68 @@ var BrakeSystem =
reset : func() reset : func()
{ {
# Initial thermal energy # Initial thermal energy
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0); me.thermalEnergy[0] = 0.0;
setprop("gear/gear[2]/Rbrake-thermal-energy",0.0); me.thermalEnergy[1] = 0.0;
setprop("/controls/gear/brake-fans",0); me.brakeFans.setValue(0);
setprop("gear/gear[1]/Lbrake-smoke",0); me.gearSmoke[0].setValue(0);
setprop("gear/gear[2]/Rbrake-smoke",0); me.gearSmoke[1].setValue(0);
setprop("gear/gear[1]/L-Thrust",0); me.fireServices.setValue(0);
setprop("gear/gear[2]/R-Thrust",0);
#Introducing a random error on temp sensors (max 5°C) #Introducing a random error on temp sensors (max 5°C)
setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5))); me.L1error = math.round(rand()*(5));
setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5))); me.L2error = math.round(rand()*(5));
setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5))); me.R3error = math.round(rand()*(5));
setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5))); me.R4error = math.round(rand()*(5));
#var atemp = getprop("environment/temperature-degc") or 0; var tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
#var vmach = getprop("velocities/mach") or 0;
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0;
var atemp = getprop("environment/temperature-degc") or 0;
var vmach = getprop("velocities/mach") or 0;
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat");
setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")); me.lBrakeTemp[0].setValue(tatdegc+me.L1error);
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")); me.lBrakeTemp[1].setValue(tatdegc+me.L2error);
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")); me.rBrakeTemp[0].setValue(tatdegc+me.R3error);
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")); me.rBrakeTemp[1].setValue(tatdegc+me.R4error);
setprop("/sim/animation/fire-services",0);
me.LastSimTime = 0.0; me.LastSimTime = 0.0;
}, },
# update brake energy # update brake energy
update : func() update : func()
{ {
var CurrentTime = getprop("/sim/time/elapsed-sec"); if (me.counter == 0) {
var dt = CurrentTime - me.LastSimTime; me.counter = 1;
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); } else {
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); me.counter = 0;
var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm"); return;
var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); }
#var atemp = getprop("environment/temperature-degc") or 0;
#var vmach = getprop("velocities/mach") or 0; LThermalEnergy = me.thermalEnergy[0];
#var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); RThermalEnergy = me.thermalEnergy[1];
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0; me.CurrentTime = pts.Sim.Time.elapsedSec.getValue();
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb"); dt = me.CurrentTime - me.LastSimTime;
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb"); LBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[0].getValue();
RBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[1].getValue();
tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
if (getprop("/sim/freeze/replay-state")==0 and dt<1.0) { if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) {
var OnGround = getprop("gear/gear[1]/wow");
#cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001) #cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001)
var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
if (getprop("/controls/gear/brake-fans")) { if (me.brakeFans.getValue()) {
#increase CoolingRatio if Brake Fans are active #increase CoolingRatio if Brake Fans are active
LCoolingRatio = LCoolingRatio * 3; LCoolingRatio = LCoolingRatio * 3;
RCoolingRatio = RCoolingRatio * 3; RCoolingRatio = RCoolingRatio * 3;
}; };
if (getprop("gear/gear[1]/position-norm")) { airspeed = pts.Velocities.airspeed.getValue();
if (pts.Gear.position[1].getValue()) {
#increase CoolingRatio if gear down according to airspeed #increase CoolingRatio if gear down according to airspeed
LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt"); LCoolingRatio = LCoolingRatio * airspeed;
} else { } else {
#Reduced CoolingRatio if gear up #Reduced CoolingRatio if gear up
LCoolingRatio = LCoolingRatio * 0.1; LCoolingRatio = LCoolingRatio * 0.1;
}; };
if (getprop("gear/gear[2]/position-norm")) { if (pts.Gear.position[2].getValue()) {
#increase CoolingRatio if gear down according to airspeed #increase CoolingRatio if gear down according to airspeed
RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt"); RCoolingRatio = RCoolingRatio * airspeed;
} else { } else {
#Reduced CoolingRatio if gear up #Reduced CoolingRatio if gear up
RCoolingRatio = RCoolingRatio * 0.1; RCoolingRatio = RCoolingRatio * 0.1;
@ -149,34 +164,22 @@ var BrakeSystem =
var LnCoolFactor = math.ln(1-LCoolingRatio); var LnCoolFactor = math.ln(1-LCoolingRatio);
var RnCoolFactor = math.ln(1-RCoolingRatio); var RnCoolFactor = math.ln(1-RCoolingRatio);
L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb")); # disabled thrust effect
if (L_thrust_lb < 1) {
L_thrust_lb = 1
};
#Disabling thrust computation on Brakes temperature
#L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.0000000002;
L_Thrust = 0; L_Thrust = 0;
R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb"));
if (R_thrust_lb < 1) {
R_thrust_lb = 1
};
#Disabling thrust computation on Brakes temperature
#R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.0000000002;
R_Thrust = 0; R_Thrust = 0;
if (OnGround) { if (pts.Gear.wow[1].getValue()) {
var V1 = getprop("velocities/groundspeed-kt"); var V1 = pts.Velocities.groundspeed.getValue();
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor); var Mass = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() * me.ScalingDivisor;
# absorb some kinetic energy: # absorb some kinetic energy:
# dE= 1/2 * m * V1^2 - 1/2 * m * V2^2) # dE= 1/2 * m * V1^2 - 1/2 * m * V2^2)
var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel; var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel;
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); LThermalEnergy += (Mass * pts.Gear.compression[1].getValue() * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
if (getprop("/services/chocks/enable")) { if (pts.Controls.Gear.chocks.getValue()) {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt # cooling effect: reduce thermal energy by (LnCoolFactor) * dt
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
} else { } else {
@ -185,7 +188,7 @@ var BrakeSystem =
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
}; };
} else { } else {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
if (LBrakeLevel>0) { if (LBrakeLevel>0) {
if (V2_L>0) { if (V2_L>0) {
#LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust;
@ -207,9 +210,9 @@ var BrakeSystem =
}; };
}; };
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); RThermalEnergy += (Mass * pts.Gear.compression[2].getValue() * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
if (getprop("/services/chocks/enable")) { if (pts.Controls.Gear.chocks.getValue()) {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt # cooling effect: reduce thermal energy by (RnCoolFactor) * dt
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
} else { } else {
@ -218,7 +221,7 @@ var BrakeSystem =
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
}; };
} else { } else {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
if (RBrakeLevel>0) { if (RBrakeLevel>0) {
if (V2_R>0) { if (V2_R>0) {
#RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust;
@ -256,67 +259,62 @@ var BrakeSystem =
RThermalEnergy = 3 RThermalEnergy = 3
}; };
setprop("gear/gear[1]/L-Thrust",L_Thrust); me.thermalEnergy[0] = LThermalEnergy;
setprop("gear/gear[2]/R-Thrust",R_Thrust); me.thermalEnergy[1] = RThermalEnergy;
setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy);
setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy);
#Calculating Brakes temperature #Calculating Brakes temperature
setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L1error-temp-degc")))); me.lBrakeTemp[0].setValue(tatdegc+me.L1error+(LThermalEnergy * (300-tatdegc-me.L1error)));
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc")))); me.lBrakeTemp[1].setValue(tatdegc+me.L2error+(LThermalEnergy * (300-tatdegc-me.L2error)));
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc")))); me.rBrakeTemp[0].setValue(tatdegc+me.R3error+(RThermalEnergy * (300-tatdegc-me.R3error)));
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc")))); me.rBrakeTemp[1].setValue(tatdegc+me.R4error+(RThermalEnergy * (300-tatdegc-me.R4error)));
if ((LThermalEnergy>1)and(!me.LSmokeActive)) { if (LThermalEnergy>1 and !me.LSmokeActive) {
# start smoke processing # start smoke processing
me.LSmokeActive = 1; me.LSmokeActive = 1;
settimer(func { BrakeSys.Lsmoke(); },0); settimer(func { BrakeSys.Lsmoke(); },0);
}; };
if ((RThermalEnergy>1)and(!me.RSmokeActive)) { if (RThermalEnergy>1 and !me.RSmokeActive) {
# start smoke processing # start smoke processing
me.RSmokeActive = 1; me.RSmokeActive = 1;
settimer(func { BrakeSys.Rsmoke(); },0); settimer(func { BrakeSys.Rsmoke(); },0);
}; };
}; };
me.LastSimTime = CurrentTime; me.LastSimTime = me.CurrentTime;
# 5 updates per second are good enough
settimer(func { BrakeSys.update(); },0.2);
}, },
# smoke processing # smoke processing
Lsmoke : func() Lsmoke : func()
{ {
if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1)) { if (me.LSmokeActive and me.thermalEnergy[0] > 1) {
# make density of smoke effect depend on energy level # make density of smoke effect depend on energy level
var LSmokeDelay=0; var LSmokeDelay = 0;
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); var LThermalEnergy = me.thermalEnergy[0];
if (LThermalEnergy < 1.5) { if (LThermalEnergy < 1.5) {
LSmokeDelay=(1.5-LThermalEnergy); LSmokeDelay = (1.5 - LThermalEnergy);
}; };
# No smoke when gear retracted # No smoke when gear retracted
var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5); var LSmokeValue = (pts.Gear.position[1].getValue() > 0.5);
# toggle smoke to interpolate different densities # toggle smoke to interpolate different densities
if (LSmokeDelay>0.05) { if (LSmokeDelay > 0.05) {
me.LSmokeToggle = !me.LSmokeToggle; me.LSmokeToggle = !me.LSmokeToggle;
if (!me.LSmokeToggle) if (!me.LSmokeToggle)
LSmokeValue = 0; LSmokeValue = 0;
else else
LSmokeDelay = 0; LSmokeDelay = 0;
}; };
setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue); me.gearSmoke[0].setValue(LSmokeValue);
settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay); settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay);
} else { } else {
# stop smoke processing # stop smoke processing
setprop("gear/gear[1]/Lbrake-smoke",0); me.gearSmoke[0].setValue(0);
setprop("/sim/animation/fire-services",0);
me.LSmokeActive = 0; me.LSmokeActive = 0;
}; };
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) { if (me.thermalEnergy[0] > 1.5) {
setprop("/sim/animation/fire-services",1); me.fireServices.setValue(1);
} else { } else {
setprop("/sim/animation/fire-services",0); me.fireServices.setValue(0);
}; };
}, },
@ -324,35 +322,35 @@ var BrakeSystem =
# smoke processing # smoke processing
Rsmoke : func() Rsmoke : func()
{ {
if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1)) { if (me.RSmokeActive and me.thermalEnergy[1] > 1) {
# make density of smoke effect depend on energy level # make density of smoke effect depend on energy level
var RSmokeDelay=0; var RSmokeDelay = 0;
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); var RThermalEnergy = me.thermalEnergy[1];
if (RThermalEnergy < 1.5) { if (RThermalEnergy < 1.5) {
RSmokeDelay=(1.5-RThermalEnergy); RSmokeDelay = (1.5 - RThermalEnergy);
}; };
# No smoke when gear retracted # No smoke when gear retracted
var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5); var RSmokeValue = (pts.Gear.position[2].getValue() > 0.5);
# toggle smoke to interpolate different densities # toggle smoke to interpolate different densities
if (RSmokeDelay>0.05) { if (RSmokeDelay > 0.05) {
me.RSmokeToggle = !me.RSmokeToggle; me.RSmokeToggle = !me.RSmokeToggle;
if (!me.RSmokeToggle) if (!me.RSmokeToggle)
RSmokeValue = 0; RSmokeValue = 0;
else else
RSmokeDelay = 0; RSmokeDelay = 0;
}; };
setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue); me.gearSmoke[1].setValue(RSmokeValue);
settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay); settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay);
} else { } else {
# stop smoke processing # stop smoke processing
setprop("gear/gear[2]/Rbrake-smoke",0); me.gearSmoke[1].setValue(0);
me.RSmokeActive = 0; me.RSmokeActive = 0;
}; };
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) { if (me.thermalEnergy[1] > 1.5) {
setprop("/sim/animation/fire-services",1); me.fireServices.setValue(1);
} else { } else {
setprop("/sim/animation/fire-services",0); me.fireServices.setValue(0);
}; };
}, },
}; };
@ -437,13 +435,6 @@ controls.applyBrakes = func(v, which = 0) {
} }
} }
} }
setlistener("/sim/signals/fdm-initialized",
# executed on _every_ FDM reset (but not installing new listeners)
func(idle) { BrakeSys.reset(); },
0,0);
settimer(func() { BrakeSys.update(); }, 5);
# Autobrake loop # Autobrake loop
var absChk = maketimer(0.2, func { var absChk = maketimer(0.2, func {

View file

@ -17,38 +17,38 @@ var ELEC = {
_timer2On: 0, _timer2On: 0,
EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"), EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"),
Bus: { Bus: {
acEss: props.globals.getNode("systems/electrical/bus/ac-ess"), acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"),
acEssShed: props.globals.getNode("systems/electrical/bus/ac-ess-shed"), acEssShed: props.globals.getNode("/systems/electrical/bus/ac-ess-shed"),
ac1: props.globals.getNode("systems/electrical/bus/ac-1"), ac1: props.globals.getNode("/systems/electrical/bus/ac-1"),
ac2: props.globals.getNode("systems/electrical/bus/ac-2"), ac2: props.globals.getNode("/systems/electrical/bus/ac-2"),
dcBat: props.globals.getNode("systems/electrical/bus/dc-bat"), dcBat: props.globals.getNode("/systems/electrical/bus/dc-bat"),
dcEss: props.globals.getNode("systems/electrical/bus/dc-ess"), dcEss: props.globals.getNode("/systems/electrical/bus/dc-ess"),
dcEssShed: props.globals.getNode("systems/electrical/bus/dc-ess-shed"), dcEssShed: props.globals.getNode("/systems/electrical/bus/dc-ess-shed"),
dc1: props.globals.getNode("systems/electrical/bus/dc-1"), dc1: props.globals.getNode("/systems/electrical/bus/dc-1"),
dc2: props.globals.getNode("systems/electrical/bus/dc-2"), dc2: props.globals.getNode("/systems/electrical/bus/dc-2"),
dcHot1: props.globals.getNode("systems/electrical/bus/dc-hot-1"), dcHot1: props.globals.getNode("/systems/electrical/bus/dc-hot-1"),
dcHot2: props.globals.getNode("systems/electrical/bus/dc-hot-2"), dcHot2: props.globals.getNode("/systems/electrical/bus/dc-hot-2"),
}, },
Fail: { Fail: {
acEssBusFault: props.globals.getNode("systems/failures/electrical/ac-ess-bus"), acEssBusFault: props.globals.getNode("/systems/failures/electrical/ac-ess-bus"),
ac1BusFault: props.globals.getNode("systems/failures/electrical/ac-1-bus"), ac1BusFault: props.globals.getNode("/systems/failures/electrical/ac-1-bus"),
ac2BusFault: props.globals.getNode("systems/failures/electrical/ac-2-bus"), ac2BusFault: props.globals.getNode("/systems/failures/electrical/ac-2-bus"),
bat1Fault: props.globals.getNode("systems/failures/electrical/bat-1"), bat1Fault: props.globals.getNode("/systems/failures/electrical/bat-1"),
bat2Fault: props.globals.getNode("systems/failures/electrical/bat-2"), bat2Fault: props.globals.getNode("/systems/failures/electrical/bat-2"),
dcBatBusFault: props.globals.getNode("systems/failures/electrical/dc-bat-bus"), dcBatBusFault: props.globals.getNode("/systems/failures/electrical/dc-bat-bus"),
dcEssBusFault: props.globals.getNode("systems/failures/electrical/dc-ess-bus"), dcEssBusFault: props.globals.getNode("/systems/failures/electrical/dc-ess-bus"),
dc1BusFault: props.globals.getNode("systems/failures/electrical/dc-1-bus"), dc1BusFault: props.globals.getNode("/systems/failures/electrical/dc-1-bus"),
dc2BusFault: props.globals.getNode("systems/failures/electrical/dc-2-bus"), dc2BusFault: props.globals.getNode("/systems/failures/electrical/dc-2-bus"),
emerGenFault: props.globals.getNode("systems/failures/electrical/emer-gen"), emerGenFault: props.globals.getNode("/systems/failures/electrical/emer-gen"),
essTrFault: props.globals.getNode("systems/failures/electrical/ess-tr"), essTrFault: props.globals.getNode("/systems/failures/electrical/ess-tr"),
gen1Fault: props.globals.getNode("systems/failures/electrical/gen-1"), gen1Fault: props.globals.getNode("/systems/failures/electrical/gen-1"),
gen2Fault: props.globals.getNode("systems/failures/electrical/gen-2"), gen2Fault: props.globals.getNode("/systems/failures/electrical/gen-2"),
genApuFault: props.globals.getNode("systems/failures/electrical/apu"), genApuFault: props.globals.getNode("/systems/failures/electrical/apu"),
idg1Fault: props.globals.getNode("systems/failures/electrical/idg-1"), # oil leak or low press idg1Fault: props.globals.getNode("/systems/failures/electrical/idg-1"), # oil leak or low press
idg2Fault: props.globals.getNode("systems/failures/electrical/idg-2"), idg2Fault: props.globals.getNode("/systems/failures/electrical/idg-2"),
statInvFault: props.globals.getNode("systems/failures/electrical/stat-inv"), statInvFault: props.globals.getNode("/systems/failures/electrical/stat-inv"),
tr1Fault: props.globals.getNode("systems/failures/electrical/tr-1"), tr1Fault: props.globals.getNode("/systems/failures/electrical/tr-1"),
tr2Fault: props.globals.getNode("systems/failures/electrical/tr-2"), tr2Fault: props.globals.getNode("/systems/failures/electrical/tr-2"),
}, },
Generic: { Generic: {
adf: props.globals.initNode("/systems/electrical/outputs/adf", 0, "DOUBLE"), adf: props.globals.initNode("/systems/electrical/outputs/adf", 0, "DOUBLE"),
@ -69,39 +69,86 @@ var ELEC = {
turnCoordinator: props.globals.initNode("/systems/electrical/outputs/turn-coordinator", 0, "DOUBLE"), turnCoordinator: props.globals.initNode("/systems/electrical/outputs/turn-coordinator", 0, "DOUBLE"),
}, },
Light: { Light: {
bat1Fault: props.globals.getNode("/systems/electrical/light/bat-1-fault"),
bat2Fault: props.globals.getNode("/systems/electrical/light/bat-2-fault"),
}, },
Misc: { Misc: {
}, },
Relay: { Relay: {
essTrContactor: props.globals.getNode("systems/electrical/relay/dc-ess-feed-tr/contact-pos"), acEssFeed1: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-1/contact-pos"),
acEssFeed2: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-2/contact-pos"),
acEssEmerGenFeed: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos"),
acTie1: props.globals.getNode("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos"),
acTie2: props.globals.getNode("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"),
apuGlc: props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos"),
dcEssFeedBat: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-bat/contact-pos"),
essTrContactor: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/contact-pos"),
extEpc: props.globals.getNode("/systems/electrical/relay/ext-epc/contact-pos"),
dcTie1: props.globals.getNode("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos"),
dcTie2: props.globals.getNode("/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos"),
glc1: props.globals.getNode("/systems/electrical/relay/gen-1-glc/contact-pos"),
glc2: props.globals.getNode("/systems/electrical/relay/gen-2-glc/contact-pos"),
tr1Contactor: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/contact-pos"),
tr2Contactor: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/contact-pos"),
}, },
SomeThing: { SomeThing: {
emerGenSignal: props.globals.getNode("systems/electrical/some-electric-thingie/emer-gen-operate"), emerGenSignal: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-gen-operate"),
galley: props.globals.getNode("/systems/electrical/some-electric-thingie/galley-shed"),
}, },
Source: { Source: {
APU: {
volts: props.globals.getNode("/systems/electrical/sources/apu/output-volt"),
hertz: props.globals.getNode("/systems/electrical/sources/apu/output-hertz"),
contact: props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos"),
},
Bat1: { Bat1: {
volt: props.globals.getNode("systems/electrical/sources/bat-1/volt"), volt: props.globals.getNode("/systems/electrical/sources/bat-1/volt"),
amps: props.globals.getNode("systems/electrical/sources/bat-1/amps"), amps: props.globals.getNode("/systems/electrical/sources/bat-1/amps"),
contact: props.globals.getNode("systems/electrical/sources/bat-1/contact"), contact: props.globals.getNode("/systems/electrical/sources/bat-1/contact"),
percent: props.globals.getNode("systems/electrical/sources/bat-1/percent"), percent: props.globals.getNode("/systems/electrical/sources/bat-1/percent"),
time: props.globals.getNode("systems/electrical/sources/bat-1/time"), direction: props.globals.getNode("/systems/electrical/sources/bat-1/direction"),
time: props.globals.getNode("/systems/electrical/sources/bat-1/time"),
}, },
Bat2: { Bat2: {
volt: props.globals.getNode("systems/electrical/sources/bat-2/volt"), volt: props.globals.getNode("/systems/electrical/sources/bat-2/volt"),
amps: props.globals.getNode("systems/electrical/sources/bat-2/amps"), amps: props.globals.getNode("/systems/electrical/sources/bat-2/amps"),
contact: props.globals.getNode("systems/electrical/sources/bat-2/contact"), contact: props.globals.getNode("/systems/electrical/sources/bat-2/contact"),
percent: props.globals.getNode("systems/electrical/sources/bat-2/percent"), percent: props.globals.getNode("/systems/electrical/sources/bat-2/percent"),
time: props.globals.getNode("systems/electrical/sources/bat-2/time"), direction: props.globals.getNode("/systems/electrical/sources/bat-2/direction"),
time: props.globals.getNode("/systems/electrical/sources/bat-2/time"),
},
EmerGen: {
volts: props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt"),
hertz: props.globals.getNode("/systems/electrical/sources/emer-gen/output-hertz"),
},
Ext: {
volts: props.globals.getNode("/systems/electrical/sources/ext/output-volt"),
voltsRelay: props.globals.getNode("/systems/electrical/relay/emer-glc/output"),
hertz: props.globals.getNode("/systems/electrical/sources/ext/output-hertz"),
},
tr1: {
outputVolt: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output"),
outputAmp: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output-amp"),
},
tr2: {
outputVolt: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output"),
outputAmp: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output-amp"),
}, },
trEss: { trEss: {
outputVolt: props.globals.getNode("systems/electrical/sources/tr-ess/output-volt"), outputVolt: props.globals.getNode("/systems/electrical/sources/tr-ess/output-volt"),
outputAmp: props.globals.getNode("systems/electrical/sources/tr-ess/output-amp"), outputAmp: props.globals.getNode("/systems/electrical/sources/tr-ess/output-amp"),
outputVoltRelay: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output"),
outputAmpRelay: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output-amp"),
}, },
IDG1: { IDG1: {
gcrRelay: props.globals.getNode("systems/electrical/sources/idg-1/gcr-relay"), gcrRelay: props.globals.getNode("/systems/electrical/sources/idg-1/gcr-relay"),
hertz: props.globals.getNode("/systems/electrical/sources/idg-1/output-hertz"),
volts: props.globals.getNode("/systems/electrical/sources/idg-1/output-volt"),
}, },
IDG2: { IDG2: {
gcrRelay: props.globals.getNode("systems/electrical/sources/idg-1/gcr-relay"), gcrRelay: props.globals.getNode("/systems/electrical/sources/idg-2/gcr-relay"),
hertz: props.globals.getNode("/systems/electrical/sources/idg-2/output-hertz"),
volts: props.globals.getNode("/systems/electrical/sources/idg-2/output-volt"),
}, },
}, },
Switch: { Switch: {
@ -162,7 +209,7 @@ var ELEC = {
loop: func() { loop: func() {
# Autopilot Disconnection routines # Autopilot Disconnection routines
if (me.Bus.dcEssShed.getValue() < 25) { if (me.Bus.dcEssShed.getValue() < 25) {
if (getprop("it-autoflight/output/ap1") == 1 and !me._timer1On) { if (fmgc.Output.ap1.getValue() and !me._timer1On) {
me._timer1On = 1; me._timer1On = 1;
settimer(func() { settimer(func() {
if (me.Bus.dcEssShed.getValue() < 25) { if (me.Bus.dcEssShed.getValue() < 25) {
@ -177,7 +224,7 @@ var ELEC = {
} }
if (me.Bus.dc2.getValue() < 25) { if (me.Bus.dc2.getValue() < 25) {
if (getprop("it-autoflight/output/ap2") == 1 and !me._timer2On) { if (fmgc.Output.ap2.getValue() and !me._timer2On) {
me._timer2On = 1; me._timer2On = 1;
settimer(func() { settimer(func() {
if (me.Bus.dc2.getValue() < 25) { if (me.Bus.dc2.getValue() < 25) {

View file

@ -7,8 +7,8 @@ var FUEL = {
offset1: 0, offset1: 0,
offset2: 0, offset2: 0,
timeEngStart: 0, timeEngStart: 0,
cmdCtrOn: props.globals.getNode("systems/fuel/ctr-pump-cmd-on-eng-start"), cmdCtrOn: props.globals.getNode("/systems/fuel/ctr-pump-cmd-on-eng-start"),
refuelling: props.globals.getNode("systems/fuel/refuel/refuelling"), refuelling: props.globals.getNode("/systems/fuel/refuel/refuelling"),
Fail: { Fail: {
pumpLeft1: props.globals.getNode("/systems/failures/fuel/left-tank-pump-1"), pumpLeft1: props.globals.getNode("/systems/failures/fuel/left-tank-pump-1"),
@ -19,43 +19,43 @@ var FUEL = {
pumpRight2: props.globals.getNode("/systems/failures/fuel/right-tank-pump-2"), pumpRight2: props.globals.getNode("/systems/failures/fuel/right-tank-pump-2"),
}, },
Switches: { Switches: {
centerTkMode: props.globals.getNode("controls/fuel/switches/center-mode"), centerTkMode: props.globals.getNode("/controls/fuel/switches/center-mode"),
crossfeed: props.globals.getNode("controls/fuel/switches/crossfeed"), crossfeed: props.globals.getNode("/controls/fuel/switches/crossfeed"),
pumpLeft1: props.globals.getNode("controls/fuel/switches/pump-left-1"), pumpLeft1: props.globals.getNode("/controls/fuel/switches/pump-left-1"),
pumpLeft2: props.globals.getNode("controls/fuel/switches/pump-left-2"), pumpLeft2: props.globals.getNode("/controls/fuel/switches/pump-left-2"),
pumpCenter1: props.globals.getNode("controls/fuel/switches/pump-center-1"), pumpCenter1: props.globals.getNode("/controls/fuel/switches/pump-center-1"),
pumpCenter2: props.globals.getNode("controls/fuel/switches/pump-center-2"), pumpCenter2: props.globals.getNode("/controls/fuel/switches/pump-center-2"),
pumpRight1: props.globals.getNode("controls/fuel/switches/pump-right-1"), pumpRight1: props.globals.getNode("/controls/fuel/switches/pump-right-1"),
pumpRight2: props.globals.getNode("controls/fuel/switches/pump-right-2"), pumpRight2: props.globals.getNode("/controls/fuel/switches/pump-right-2"),
}, },
Pumps: { Pumps: {
apu: props.globals.getNode("systems/fuel/pumps/apu-operate"), apu: props.globals.getNode("/systems/fuel/pumps/apu-operate"),
allOff: props.globals.getNode("systems/fuel/pumps/all-eng-pump-off"), allOff: props.globals.getNode("/systems/fuel/pumps/all-eng-pump-off"),
}, },
Valves: { Valves: {
apu: props.globals.getNode("systems/fuel/valves/apu-lp-valve"), apu: props.globals.getNode("/systems/fuel/valves/apu-lp-valve"),
crossfeed: props.globals.getNode("systems/fuel/valves/crossfeed-valve"), crossfeed: props.globals.getNode("/systems/fuel/valves/crossfeed-valve"),
lpValve1: props.globals.getNode("systems/fuel/valves/engine-1-lp-valve"), lpValve1: props.globals.getNode("/systems/fuel/valves/engine-1-lp-valve"),
lpValve2: props.globals.getNode("systems/fuel/valves/engine-2-lp-valve"), lpValve2: props.globals.getNode("/systems/fuel/valves/engine-2-lp-valve"),
transfer1: props.globals.getNode("systems/fuel/valves/outer-inner-transfer-valve-1"), transfer1: props.globals.getNode("/systems/fuel/valves/outer-inner-transfer-valve-1"),
transfer2: props.globals.getNode("systems/fuel/valves/outer-inner-transfer-valve-2"), transfer2: props.globals.getNode("/systems/fuel/valves/outer-inner-transfer-valve-2"),
refuelLeft: props.globals.getNode("systems/fuel/refuel/left-valve"), refuelLeft: props.globals.getNode("/systems/fuel/refuel/left-valve"),
refuelCenter: props.globals.getNode("systems/fuel/refuel/center-valve"), refuelCenter: props.globals.getNode("/systems/fuel/refuel/center-valve"),
refuelRight: props.globals.getNode("systems/fuel/refuel/right-valve"), refuelRight: props.globals.getNode("/systems/fuel/refuel/right-valve"),
}, },
Quantity: { Quantity: {
leftOuter: props.globals.getNode("consumables/fuel/tank[0]/level-lbs"), leftOuter: props.globals.getNode("/consumables/fuel/tank[0]/level-lbs"),
leftOuterPct: props.globals.getNode("consumables/fuel/tank[0]/level-norm"), leftOuterPct: props.globals.getNode("/consumables/fuel/tank[0]/level-norm"),
leftInner: props.globals.getNode("consumables/fuel/tank[1]/level-lbs"), leftInner: props.globals.getNode("/consumables/fuel/tank[1]/level-lbs"),
leftInnerPct: props.globals.getNode("consumables/fuel/tank[1]/level-norm"), leftInnerPct: props.globals.getNode("/consumables/fuel/tank[1]/level-norm"),
center: props.globals.getNode("consumables/fuel/tank[2]/level-lbs"), center: props.globals.getNode("/consumables/fuel/tank[2]/level-lbs"),
centerPct: props.globals.getNode("consumables/fuel/tank[2]/level-norm"), centerPct: props.globals.getNode("/consumables/fuel/tank[2]/level-norm"),
rightInner: props.globals.getNode("consumables/fuel/tank[3]/level-lbs"), rightInner: props.globals.getNode("/consumables/fuel/tank[3]/level-lbs"),
rightInnerPct: props.globals.getNode("consumables/fuel/tank[3]/level-norm"), rightInnerPct: props.globals.getNode("/consumables/fuel/tank[3]/level-norm"),
rightOuter: props.globals.getNode("consumables/fuel/tank[4]/level-lbs"), rightOuter: props.globals.getNode("/consumables/fuel/tank[4]/level-lbs"),
rightOuterPct: props.globals.getNode("consumables/fuel/tank[4]/level-norm"), rightOuterPct: props.globals.getNode("/consumables/fuel/tank[4]/level-norm"),
usedLeft: props.globals.getNode("systems/fuel/fuel-used-1"), offsetLeft: props.globals.getNode("/systems/fuel/offset-left"),
usedRight: props.globals.getNode("systems/fuel/fuel-used-2"), offsetRight: props.globals.getNode("/systems/fuel/offset-right"),
}, },
resetFail: func() { resetFail: func() {
me.Fail.pumpLeft1.setValue(0); me.Fail.pumpLeft1.setValue(0);
@ -68,13 +68,11 @@ var FUEL = {
init: func() { init: func() {
me.resetFail(); me.resetFail();
}, },
loop: func() { setOffsetLeft: func() {
systems.FUEL.Quantity.usedLeft.setValue(pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[0].getValue() + me.offset1); me.Quantity.offsetLeft.setValue(me.Quantity.offsetLeft.getValue() - pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[0].getValue());
systems.FUEL.Quantity.usedRight.setValue(pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[1].getValue() + me.offset2);
}, },
setOffset: func() { setOffsetRight: func() {
me.offset1 = me.offset1 -(pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[0].getValue()); me.Quantity.offsetRight.setValue(me.Quantity.offsetRight.getValue() - pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[1].getValue());
me.offset2 = me.offset2 -(pts.Fdm.JSBsim.Propulsion.Engine.fuelUsed[1].getValue());
} }
}; };
@ -83,6 +81,8 @@ setlistener("/engines/engine[0]/state", func() {
FUEL.timeEngStart = pts.Sim.Time.elapsedSec.getValue(); FUEL.timeEngStart = pts.Sim.Time.elapsedSec.getValue();
FUEL.cmdCtrOn.setValue(1); FUEL.cmdCtrOn.setValue(1);
ctrTkTimer.start(); ctrTkTimer.start();
} elsif (pts.Engines.Engine.state[0].getValue() == 2) {
FUEL.setOffsetLeft();
} }
}, 0, 0); }, 0, 0);
@ -91,6 +91,8 @@ setlistener("/engines/engine[1]/state", func() {
FUEL.timeEngStart = pts.Sim.Time.elapsedSec.getValue(); FUEL.timeEngStart = pts.Sim.Time.elapsedSec.getValue();
FUEL.cmdCtrOn.setValue(1); FUEL.cmdCtrOn.setValue(1);
ctrTkTimer.start(); ctrTkTimer.start();
} elsif (pts.Engines.Engine.state[1].getValue() == 2) {
FUEL.setOffsetRight();
} }
}, 0, 0); }, 0, 0);

View file

@ -3,15 +3,9 @@
# Copyright (c) 2019 Jonathan Redpath # Copyright (c) 2019 Jonathan Redpath
var accum = 0;
var parking = 0;
var askidnws_sw = 0;
var down = 0;
var HYD = { var HYD = {
Brakes: { Brakes: {
accumPressPsi: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi", 0, "INT"), accumPressPsi: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi", 0, "INT"),
accumPressPsi1: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0, "INT"),
leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"), leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"),
rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"), rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"),
askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"), askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"),
@ -85,30 +79,16 @@ var HYD = {
me.Fail.yellowLeak.setBoolValue(0); me.Fail.yellowLeak.setBoolValue(0);
}, },
loop: func() { loop: func() {
accum = me.Brakes.accumPressPsi.getValue(); if (me.Brakes.mode.getValue() == 2) {
parking = getprop("/controls/gear/brake-parking"); if (me.Psi.yellow.getValue() > 2500 and me.Brakes.accumPressPsi.getValue() < 700) {
askidnws_sw = me.Brakes.askidSw.getBoolValue(); me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50);
}
if (!parking and askidnws_sw and me.Psi.green.getValue() > 2500) {
# set mode to on
me.Brakes.mode.setValue(1);
} else if ((!parking and askidnws_sw and me.Psi.yellow.getValue() > 2500) or (!parking and askidnws_sw and accum > 0)) {
# set mode to altn
me.Brakes.mode.setValue(2);
} else {
# set mode to off
me.Brakes.mode.setValue(0);
}
if (me.Brakes.mode.getValue() == 2 and me.Psi.yellow.getValue() > 2500 and accum < 700) {
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50);
} }
}, },
}; };
setlistener("/controls/gear/gear-down", func { setlistener("/controls/gear/gear-down", func {
down = getprop("/controls/gear/gear-down"); if (!pts.Controls.Gear.gearDown.getValue() and (pts.Gear.wow[0].getValue() or pts.Gear.wow[1].getValue() or pts.Gear.wow[2].getValue())) {
if (!down and (getprop("gear/gear[0]/wow") or getprop("gear/gear[1]/wow") or getprop("gear/gear[2]/wow"))) { pts.Controls.Gear.gearDown.setValue(1);
setprop("/controls/gear/gear-down", 1);
} }
}); });

View file

@ -8,10 +8,7 @@ var ambient = nil;
var cabinpsi = nil; var cabinpsi = nil;
var state1 = nil; var state1 = nil;
var state2 = nil; var state2 = nil;
var stateL = nil;
var stateR = nil;
var pressmode = nil; var pressmode = nil;
var wowc = nil;
var wowl = nil; var wowl = nil;
var wowr = nil; var wowr = nil;
var vs = nil; var vs = nil;
@ -135,12 +132,9 @@ var PNEU = {
setprop("/systems/pressurization/pack-2-comp-out-temp", 0); setprop("/systems/pressurization/pack-2-comp-out-temp", 0);
setprop("/systems/pressurization/pack-1-valve", 0); setprop("/systems/pressurization/pack-1-valve", 0);
setprop("/systems/pressurization/pack-2-valve", 0); setprop("/systems/pressurization/pack-2-valve", 0);
setprop("/systems/ventilation/cabin/fans", 0); # aircon fans #setprop("/systems/ventilation/cabin/fans", 0); # aircon fans
setprop("/systems/ventilation/avionics/fan", 0); #setprop("/systems/ventilation/avionics/extractvalve", "0");
setprop("/systems/ventilation/avionics/extractvalve", "0"); #setprop("/systems/ventilation/avionics/inletvalve", "0");
setprop("/systems/ventilation/avionics/inletvalve", "0");
setprop("/systems/ventilation/lavatory/extractfan", 0);
setprop("/systems/ventilation/lavatory/extractvalve", "0");
setprop("/controls/oxygen/masksDeploy", 0); setprop("/controls/oxygen/masksDeploy", 0);
setprop("/controls/oxygen/masksDeployMan", 0); setprop("/controls/oxygen/masksDeployMan", 0);
setprop("/controls/oxygen/masksReset", 0); # this is the TMR RESET pb on the maintenance panel, needs 3D model setprop("/controls/oxygen/masksReset", 0); # this is the TMR RESET pb on the maintenance panel, needs 3D model
@ -163,26 +157,8 @@ var PNEU = {
me.Fail.xbleed.setBoolValue(0); me.Fail.xbleed.setBoolValue(0);
}, },
loop: func() { loop: func() {
stateL = getprop("engines/engine[0]/state");
stateR = getprop("engines/engine[1]/state");
wowc = getprop("gear/gear[0]/wow");
wowl = getprop("gear/gear[1]/wow"); wowl = getprop("gear/gear[1]/wow");
wowr = getprop("gear/gear[2]/wow"); wowr = getprop("gear/gear[2]/wow");
eng1_starter = getprop("/systems/pneumatics/valves/starter-valve-1");
eng2_starter = getprop("/systems/pneumatics/valves/starter-valve-2");
if (stateL == 1 or stateR == 1 or stateL == 2 or stateR == 2) {
setprop("/systems/pneumatics/start-psi", 18);
} else {
setprop("/systems/pneumatics/start-psi", 0);
}
if (getprop("/controls/engines/engine-start-switch") == 2 and wowc == 1 and (stateL != 3 or stateR != 3)) {
setprop("/systems/pneumatics/starting", 1);
} else if (wowc == 1 and eng1_starter == 1 or eng2_starter == 1) {
setprop("/systems/pneumatics/starting", 1);
} else {
setprop("/systems/pneumatics/starting", 0);
}
# Legacy pressurization # Legacy pressurization
cabinalt = getprop("/systems/pressurization/cabinalt"); cabinalt = getprop("/systems/pressurization/cabinalt");
@ -220,20 +196,11 @@ var PNEU = {
setprop("/systems/pressurization/cabinalt", cabinalt + ((manvs / 60) / 10)); setprop("/systems/pressurization/cabinalt", cabinalt + ((manvs / 60) / 10));
} }
if (ditch and auto) { #if (ditch and auto) {
setprop("/systems/pressurization/outflowpos", "1"); #setprop("/systems/pressurization/outflowpos", "1");
setprop("/systems/ventilation/avionics/extractvalve", "1"); #setprop("/systems/ventilation/avionics/extractvalve", "1");
setprop("/systems/ventilation/avionics/inletvalve", "1"); #setprop("/systems/ventilation/avionics/inletvalve", "1");
} #}
if (systems.ELEC.Bus.dcEss.getValue() >= 25 or systems.ELEC.Bus.acEss.getValue() > 110) {
setprop("/systems/ventilation/avionics/fan", 1);
setprop("/systems/ventilation/lavatory/extractfan", 1);
} else {
setprop("/systems/ventilation/avionics/fan", 0);
setprop("/systems/ventilation/lavatory/extractfan", 0);
}
# Oxygen # Oxygen
if (cabinalt > 13500) { if (cabinalt > 13500) {

View file

@ -8,8 +8,7 @@ var tyresmoke_2 = aircraft.tyresmoke.new(2, 0, 0.8, 0);
# =============================== listeners =============================== # =============================== listeners ===============================
setlistener("gear/gear[0]/position-norm", func { setlistener("gear/gear[0]/position-norm", func {
var gear = getprop("gear/gear[0]/position-norm"); if (pts.Gear.position[0].getValue()){
if (gear == 1 ){
run_tyresmoke0 = 1; run_tyresmoke0 = 1;
}else{ }else{
run_tyresmoke0 = 0; run_tyresmoke0 = 0;
@ -17,8 +16,7 @@ setlistener("gear/gear[0]/position-norm", func {
},1,0); },1,0);
setlistener("gear/gear[1]/position-norm", func { setlistener("gear/gear[1]/position-norm", func {
var gear = getprop("gear/gear[1]/position-norm"); if (pts.Gear.position[1].getValue()){
if (gear == 1 ){
run_tyresmoke1 = 1; run_tyresmoke1 = 1;
}else{ }else{
run_tyresmoke1 = 0; run_tyresmoke1 = 0;
@ -26,8 +24,7 @@ setlistener("gear/gear[1]/position-norm", func {
},1,0); },1,0);
setlistener("gear/gear[2]/position-norm", func { setlistener("gear/gear[2]/position-norm", func {
var gear = getprop("gear/gear[2]/position-norm"); if (pts.Gear.position[2].getValue()){
if (gear == 1 ){
run_tyresmoke2 = 1; run_tyresmoke2 = 1;
}else{ }else{
run_tyresmoke2 = 0; run_tyresmoke2 = 0;

Binary file not shown.

View file

@ -544,9 +544,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -575,9 +574,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -606,9 +604,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -637,9 +634,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -668,9 +664,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>
@ -699,9 +694,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>
@ -730,9 +724,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<reference-dist>30</reference-dist> <reference-dist>30</reference-dist>
<position> <position>
@ -753,9 +746,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<reference-dist>30</reference-dist> <reference-dist>30</reference-dist>
<position> <position>

View file

@ -458,9 +458,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -489,9 +488,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -520,9 +518,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -551,9 +548,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -582,9 +578,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>
@ -613,9 +608,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>

View file

@ -361,9 +361,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -392,9 +391,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -423,9 +421,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -454,9 +451,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>-1</x> <x>-1</x>
@ -485,9 +481,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<reference-dist>30</reference-dist> <reference-dist>30</reference-dist>
<position> <position>
@ -508,9 +503,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<reference-dist>30</reference-dist> <reference-dist>30</reference-dist>
<position> <position>
@ -531,9 +525,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>
@ -562,9 +555,8 @@
</equals> </equals>
</condition> </condition>
<volume> <volume>
<property>/sim/sound/internal-custom</property> <property>/sim/sound/external-custom</property>
<factor>-1</factor> <factor>1</factor>
<offset>1</offset>
</volume> </volume>
<orientation> <orientation>
<x>1</x> <x>1</x>

View file

@ -75,51 +75,19 @@
<fcs_function name="/systems/navigation/probes/tat-1/compute-tat"> <fcs_function name="/systems/navigation/probes/tat-1/compute-tat">
<function> <function>
<difference> <product>
<product> <value>0.995</value> <!-- empirical recovery factor -->
<sum> <property>propulsion/tat-c</property>
<property>/environment/temperature-degc</property> <!-- SAT --> </product>
<value>273.15</value>
</sum>
<sum>
<value>1</value>
<product>
<value>0.2</value> <!-- ratio of specific heats - 1 / 2 -->
<value>0.995</value> <!-- empirical recovery factor -->
<pow>
<property>velocities/mach</property> <!-- going to use the pure value of mach here and then calculate another value -->
<value>2</value>
</pow>
</product>
</sum>
</product>
<value>273.15</value>
</difference>
</function> </function>
</fcs_function> </fcs_function>
<fcs_function name="/systems/navigation/probes/tat-2/compute-tat"> <fcs_function name="/systems/navigation/probes/tat-2/compute-tat">
<function> <function>
<difference> <product>
<product> <value>0.996</value> <!-- empirical recovery factor -->
<sum> <property>propulsion/tat-c</property>
<property>/environment/temperature-degc</property> <!-- SAT --> </product>
<value>273.15</value>
</sum>
<sum>
<value>1</value>
<product>
<value>0.2</value> <!-- ratio of specific heats - 1 / 2 -->
<value>0.996</value> <!-- empirical recovery factor -->
<pow>
<property>velocities/mach</property> <!-- going to use the pure value of mach here and then calculate another value -->
<value>2</value>
</pow>
</product>
</sum>
</product>
<value>273.15</value>
</difference>
</function> </function>
</fcs_function> </fcs_function>

View file

@ -410,6 +410,16 @@
<channel name="Flow Rates" execrate="2"> <channel name="Flow Rates" execrate="2">
<summer name="/systems/fuel/fuel-used-1">
<input>/systems/fuel/offset-left</input>
<input>propulsion/engine[0]/fuel-used-lbs</input>
</summer>
<summer name="/systems/fuel/fuel-used-2">
<input>/systems/fuel/offset-right</input>
<input>propulsion/engine[1]/fuel-used-lbs</input>
</summer>
<switch name="/systems/fuel/feed-left-inner"> <switch name="/systems/fuel/feed-left-inner">
<default value="0"/> <default value="0"/>
<test logic="OR" value="1"> <test logic="OR" value="1">

View file

@ -500,6 +500,27 @@
</channel> </channel>
<channel name="Brakes" execrate="8">
<switch name="/systems/hydraulic/brakes/mode">
<default value="0"/>
<test logic="AND" value="1">
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1
/systems/hydraulic/green-psi ge 2500
</test>
<test logic="AND" value="2">
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1
/systems/hydraulic/yellow-psi ge 2500
</test>
<test logic="AND" value="2">
/controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/accumulator-pressure-psi ge 0
</test>
</switch>
</channel>
<channel name="Lights" execrate="8"> <channel name="Lights" execrate="8">
<switch name="/systems/hydraulic/lights/blue-elec-fault"> <switch name="/systems/hydraulic/lights/blue-elec-fault">

32
Systems/a320-misc.xml Normal file
View file

@ -0,0 +1,32 @@
<!-- Airbus A320 Misc Systems -->
<!-- Copyright (c) 2020 Jonathan Redpath -->
<system name="A320: APU">
<channel name="CVR" execrate="8">
<switch name="/controls/CVR/power">
<default value="0"/>
<test logic="AND" value="1">
/systems/electrical/bus/ac-ess ge 110
<test logic="OR">
/gear/gear[1]/wow eq 1
/gear/gear[2]/wow eq 1
</test>
<test logic="OR">
/controls/CVR/gndctl eq 1
/engines/engine[0]/state eq 3
/engines/engine[1]/state eq 3
</test>
</test>
<test logic="AND" value="1">
/systems/electrical/bus/ac-ess ge 110
/gear/gear[1]/wow eq 0
/gear/gear[2]/wow eq 0
</test>
</switch>
</channel>
</system>

View file

@ -750,7 +750,7 @@
</channel> </channel>
<channel name="System PSI" execrate="8"> <channel name="System PSI" execrate="8">
<fcs_function name="/systems/pneumatics/psi/engine-1-upstream-src"> <fcs_function name="/systems/pneumatics/psi/engine-1-upstream-src">
<function> <function>
<ifthen> <ifthen>

View file

@ -55,6 +55,18 @@
<output>/sim/sound/internal-custom</output> <output>/sim/sound/internal-custom</output>
</logic> </logic>
<logic>
<input>
<not>
<equals>
<property>/sim/sound/internal-custom</property>
<value>1</value>
</equals>
</not>
</input>
<output>/sim/sound/external-custom</output>
</logic>
<!-- Misc --> <!-- Misc -->
<filter> <filter>
<type>gain</type> <type>gain</type>