From 32a17efa6715095ad9c53ec49801e1a9987e3e93 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 15 Sep 2020 18:17:06 +0100 Subject: [PATCH 1/5] Reverser control code to PTS --- Nasal/Libraries/property-tree-setup.nas | 11 ++- Nasal/Systems/FADEC/engines-common.nas | 93 ++++++++++++------------- 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index fe9151fb..5dfa8ccd 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -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")], 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")], + 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: { @@ -79,6 +81,7 @@ var Fdm = { Propulsion: { Engine: { 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 +95,9 @@ var FMGC = { 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")], - 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")], 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 = { @@ -169,6 +172,12 @@ var Sim = { }, }; +var Systems = { + Thrust: { + state: [props.globals.getNode("/systems/thrust/state1"), props.globals.getNode("/systems/thrust/state2")], + }, +}; + var Velocities = { groundspeed: props.globals.getNode("/velocities/groundspeed-kt"), }; diff --git a/Nasal/Systems/FADEC/engines-common.nas b/Nasal/Systems/FADEC/engines-common.nas index b3234b00..276f8f7f 100644 --- a/Nasal/Systems/FADEC/engines-common.nas +++ b/Nasal/Systems/FADEC/engines-common.nas @@ -3,7 +3,7 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -if (getprop("/options/eng") == "IAE") { +if (pts.Options.eng.getValue() == "IAE") { io.include("engines-iae.nas"); } else { io.include("engines-cfm.nas"); @@ -50,87 +50,84 @@ var doTOGAThrust = func { # Reverse Thrust System var toggleFastRevThrust = func { - var state1 = getprop("/systems/thrust/state1"); - var state2 = getprop("/systems/thrust/state2"); - 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) { + 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) { + if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); - setprop("/controls/engines/engine[0]/reverser", 1); - setprop("/controls/engines/engine[0]/throttle-rev", 0.65); - setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14); + pts.Controls.Engines.Engine.reverser[0].setValue(1); + pts.Controls.Engines.Engine.throttleRev[0].setValue(0.65); + 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); - setprop("/controls/engines/engine[1]/reverser", 1); - setprop("/controls/engines/engine[1]/throttle-rev", 0.65); - setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14); + pts.Controls.Engines.Engine.reverser[1].setValue(1); + pts.Controls.Engines.Engine.throttleRev[1].setValue(0.65); + 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")) { - setprop("/controls/engines/engine[0]/throttle-rev", 0); - setprop("/controls/engines/engine[1]/throttle-rev", 0); + } else if (pts.Controls.Engines.Engine.reverser[0].getValue() == "1" or pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { interpolate("/engines/engine[0]/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); - setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0); - setprop("/controls/engines/engine[0]/reverser", 0); - setprop("/controls/engines/engine[1]/reverser", 0); + pts.Controls.Engines.Engine.throttleRev[0].setValue(0); + pts.Controls.Engines.Engine.throttleRev[1].setValue(0); + pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(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 { - 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 return; } - if (getprop("/sim/input/selected/engine[0]") == 1 and getprop("/controls/engines/engine[0]/reverser") == "1") { - var pos = getprop("/controls/engines/engine[0]/throttle-rev"); + if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == "1") { + var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue(); 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") { - var pos = getprop("/controls/engines/engine[1]/throttle-rev"); + if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { + var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue(); 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 (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); + + 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") { interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); - setprop("/controls/engines/engine[0]/reverser", 1); - setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14); + pts.Controls.Engines.Engine.throttleRev[0].setValue(0.05); + 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") { - setprop("/controls/engines/engine[1]/throttle-rev", 0.05); + 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") { interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); - setprop("/controls/engines/engine[1]/reverser", 1); - setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14); + pts.Controls.Engines.Engine.throttleRev[1].setValue(0.05); + pts.Controls.Engines.Engine.reverser[1].setValue(1); + pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14); } } var unRevThrust = func { - if (getprop("/sim/input/selected/engine[0]") == 1 and getprop("/controls/engines/engine[0]/reverser") == "1") { - var pos = getprop("/controls/engines/engine[0]/throttle-rev"); + if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == "1") { + var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue(); 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 { - setprop("/controls/engines/engine[0]/throttle-rev", 0); interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); - setprop("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0); - setprop("/controls/engines/engine[0]/reverser", 0); + pts.Controls.Engines.Engine.throttleRev[0].setValue(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") { - var pos = getprop("/controls/engines/engine[1]/throttle-rev"); + if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { + var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue(); 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 { - setprop("/controls/engines/engine[1]/throttle-rev", 0); interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); - setprop("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0); - setprop("/controls/engines/engine[1]/reverser", 0); + pts.Controls.Engines.Engine.throttleRev[1].setValue(0); + pts.Controls.Engines.Engine.reverser[1].setValue(0); + pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14); } } } From 96e1b7332bc6d8a4c55111066e33fce1f8b8c7a2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 15 Sep 2020 18:18:34 +0100 Subject: [PATCH 2/5] Correction --- Nasal/Systems/FADEC/engines-common.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/Systems/FADEC/engines-common.nas b/Nasal/Systems/FADEC/engines-common.nas index 276f8f7f..54790554 100644 --- a/Nasal/Systems/FADEC/engines-common.nas +++ b/Nasal/Systems/FADEC/engines-common.nas @@ -127,7 +127,7 @@ var unRevThrust = func { interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); pts.Controls.Engines.Engine.throttleRev[1].setValue(0); pts.Controls.Engines.Engine.reverser[1].setValue(0); - pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14); + pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(0); } } } From f69ed58384336620b29fb0b689b6f00abdef2123 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 15 Sep 2020 18:22:35 +0100 Subject: [PATCH 3/5] Nasal fixup --- A320-main.xml | 8 ++++++++ Nasal/Systems/FADEC/engines-cfm.nas | 9 --------- Nasal/Systems/FADEC/engines-common.nas | 16 ++++++++-------- Nasal/Systems/FADEC/engines-iae.nas | 9 --------- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 9efa3013..d1236ada 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -719,6 +719,10 @@ 0.94 0 0 + 0 + 0 + 0 + B true @@ -732,6 +736,10 @@ 0.94 0 0 + 0 + 0 + 0 + B true diff --git a/Nasal/Systems/FADEC/engines-cfm.nas b/Nasal/Systems/FADEC/engines-cfm.nas index 1dff0379..e8749cbd 100644 --- a/Nasal/Systems/FADEC/engines-cfm.nas +++ b/Nasal/Systems/FADEC/engines-cfm.nas @@ -17,15 +17,6 @@ var egt_lightdn_time = 10; var 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 { setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0); diff --git a/Nasal/Systems/FADEC/engines-common.nas b/Nasal/Systems/FADEC/engines-common.nas index 54790554..52a71b10 100644 --- a/Nasal/Systems/FADEC/engines-common.nas +++ b/Nasal/Systems/FADEC/engines-common.nas @@ -50,7 +50,7 @@ var doTOGAThrust = func { # Reverse Thrust System var toggleFastRevThrust = func { - 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) { + 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) { if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); pts.Controls.Engines.Engine.reverser[0].setValue(1); @@ -63,7 +63,7 @@ var toggleFastRevThrust = func { pts.Controls.Engines.Engine.throttleRev[1].setValue(0.65); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[1].setValue(3.14); } - } else if (pts.Controls.Engines.Engine.reverser[0].getValue() == "1" or pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { + } else if (pts.Controls.Engines.Engine.reverser[0].getValue() == 1 or pts.Controls.Engines.Engine.reverser[1].getValue() == 1) { interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0); interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0); pts.Controls.Engines.Engine.throttleRev[0].setValue(0); @@ -80,26 +80,26 @@ var doRevThrust = func { # Can't select reverse if not on the ground return; } - if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == "1") { + if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == 1) { var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue(); if (pos < 0.649) { pts.Controls.Engines.Engine.throttleRev[0].setValue(pos + 0.15); } } - if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { + if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == 1) { var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue(); if (pos < 0.649) { pts.Controls.Engines.Engine.throttleRev[1].setValue(pos + 0.15); } } - 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 (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Systems.Thrust.state[0].getValue() == "IDLE" and pts.Controls.Engines.Engine.reverser[0].getValue() == 0) { interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4); pts.Controls.Engines.Engine.throttleRev[0].setValue(0.05); pts.Controls.Engines.Engine.reverser[0].setValue(1); pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(3.14); } - 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") { + 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) { interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4); pts.Controls.Engines.Engine.throttleRev[1].setValue(0.05); pts.Controls.Engines.Engine.reverser[1].setValue(1); @@ -108,7 +108,7 @@ var doRevThrust = func { } var unRevThrust = func { - if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == "1") { + if (pts.Sim.Input.Selected.engine[0].getBoolValue() and pts.Controls.Engines.Engine.reverser[0].getValue() == 1) { var pos = pts.Controls.Engines.Engine.throttleRev[0].getValue(); if (pos > 0.051) { pts.Controls.Engines.Engine.throttleRev[0].setValue(pos - 0.15); @@ -119,7 +119,7 @@ var unRevThrust = func { pts.Fdm.JSBsim.Propulsion.Engine.reverserAngle[0].setValue(0); } } - if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == "1") { + if (pts.Sim.Input.Selected.engine[1].getBoolValue() and pts.Controls.Engines.Engine.reverser[1].getValue() == 1) { var pos = pts.Controls.Engines.Engine.throttleRev[1].getValue(); if (pos > 0.051) { pts.Controls.Engines.Engine.throttleRev[1].setValue(pos - 0.15); diff --git a/Nasal/Systems/FADEC/engines-iae.nas b/Nasal/Systems/FADEC/engines-iae.nas index 40f2fd8c..41c8ccd2 100644 --- a/Nasal/Systems/FADEC/engines-iae.nas +++ b/Nasal/Systems/FADEC/engines-iae.nas @@ -17,15 +17,6 @@ var egt_lightdn_time = 10; var 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 { setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0); From c71b92da1383deeae862634ae5bdf89f7f1d0431 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 15 Sep 2020 18:24:22 +0100 Subject: [PATCH 4/5] Un-init properties --- A320-main.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A320-main.xml b/A320-main.xml index d1236ada..cf54b960 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -719,6 +719,7 @@ 0.94 0 0 + 0 0 0 0 @@ -736,6 +737,7 @@ 0.94 0 0 + 0 0 0 0 From bf4f576359afbd385b228abac6eb891b31597583 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 15 Sep 2020 18:41:40 +0100 Subject: [PATCH 5/5] More PTS / getValue() --- Nasal/ECAM/ECAM-controller.nas | 4 ++-- Nasal/ECAM/ECAM-phases.nas | 4 ++-- Nasal/FMGC/FCU.nas | 26 +++++++++++++------------- Nasal/Systems/electrical.nas | 4 ++-- Nasal/Systems/hydraulics.nas | 12 +++--------- Nasal/Systems/tyresmoke.nas | 9 +++------ 6 files changed, 25 insertions(+), 34 deletions(-) diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index c1ace389..5e029a8f 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -241,7 +241,7 @@ var ECAM_controller = { me.reset(); }, 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 phaseLoop(); @@ -274,7 +274,7 @@ var ECAM_controller = { # write to ECAM var counter = 0; - if (!getprop("systems/acconfig/autoconfig-running")) { + if (!pts.Acconfig.running.getBoolValue()) { foreach (var w; warnings.vector) { if (w.active == 1) { if (counter < 9) { diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index 6ac15d44..e94ba100 100644 --- a/Nasal/ECAM/ECAM-phases.nas +++ b/Nasal/ECAM/ECAM-phases.nas @@ -116,14 +116,14 @@ var phaseLoop = func() { if (eng == "IAE") { 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); } else { FWC.toPower.setBoolValue(0); } } else { 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); } else { FWC.toPower.setBoolValue(0); diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 3f38e7cd..ad7e12e9 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -157,13 +157,13 @@ var FCUController = { if (ap1.getBoolValue() or ap2.getBoolValue()) { apOff("soft", 0); } else { - if (getprop("it-autoflight/sound/apoffsound") == 1 or getprop("it-autoflight/sound/apoffsound2") == 1) { - setprop("it-autoflight/sound/apoffsound", 0); - setprop("it-autoflight/sound/apoffsound2", 0); + if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) { + setprop("/it-autoflight/sound/apoffsound", 0); + setprop("/it-autoflight/sound/apoffsound2", 0); } - if (getprop("it-autoflight/output/ap-warning") != 0) { - setprop("it-autoflight/output/ap-warning", 0); - setprop("ECAM/warnings/master-warning-light", 0); + if (getprop("/it-autoflight/output/ap-warning") != 0) { + setprop("/it-autoflight/output/ap-warning", 0); + ecam.lights[0].setValue(0); } } } @@ -178,11 +178,11 @@ var FCUController = { if (me.FCUworking) { if (athr.getBoolValue()) { athrOff("soft"); - setprop("ECAM/warnings/master-caution-light", 1); + ecam.lights[1].setValue(1); } else { - if (getprop("it-autoflight/output/athr-warning") == 1) { - setprop("it-autoflight/output/athr-warning", 0); - setprop("ECAM/warnings/master-caution-light", 0); + if (getprop("/it-autoflight/output/athr-warning") == 1) { + setprop("/it-autoflight/output/athr-warning", 0); + ecam.lights[1].setValue(0); } } } @@ -349,7 +349,7 @@ var FCUController = { }, ALTPush: func() { 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() { @@ -523,7 +523,7 @@ var athrOff = func(type) { var hdgInput = func { if (latMode.getValue() != 0) { showHDG.setBoolValue(1); - var hdgnow = getprop("it-autoflight/input/hdg"); - setprop("modes/fcu/hdg-time", getprop("sim/time/elapsed-sec")); + var hdgnow = getprop("/it-autoflight/input/hdg"); + setprop("/modes/fcu/hdg-time", pts.Sim.Time.elapsedSec.getValue()); } } diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index 7848532b..81ba1126 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -162,7 +162,7 @@ var ELEC = { loop: func() { # Autopilot Disconnection routines 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; settimer(func() { if (me.Bus.dcEssShed.getValue() < 25) { @@ -177,7 +177,7 @@ var ELEC = { } 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; settimer(func() { if (me.Bus.dc2.getValue() < 25) { diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index 3b95f47b..7fee62d6 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -3,9 +3,6 @@ # Copyright (c) 2019 Jonathan Redpath -var accum = 0; -var down = 0; - var HYD = { Brakes: { accumPressPsi: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi", 0, "INT"), @@ -82,10 +79,8 @@ var HYD = { me.Fail.yellowLeak.setBoolValue(0); }, loop: func() { - accum = me.Brakes.accumPressPsi.getValue(); - if (me.Brakes.mode.getValue() == 2) { - if (me.Psi.yellow.getValue() > 2500 and accum < 700) { + if (me.Psi.yellow.getValue() > 2500 and me.Brakes.accumPressPsi.getValue() < 700) { me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50); } } @@ -93,8 +88,7 @@ var HYD = { }; setlistener("/controls/gear/gear-down", func { - down = getprop("/controls/gear/gear-down"); - if (!down and (getprop("gear/gear[0]/wow") or getprop("gear/gear[1]/wow") or getprop("gear/gear[2]/wow"))) { - setprop("/controls/gear/gear-down", 1); + if (!pts.Controls.Gear.gearDown.getValue() and (pts.Gear.wow[0].getValue() or pts.Gear.wow[1].getValue() or pts.Gear.wow[2].getValue())) { + pts.Controls.Gear.gearDown.setValue(1); } }); diff --git a/Nasal/Systems/tyresmoke.nas b/Nasal/Systems/tyresmoke.nas index e0736dd5..d9d72aff 100755 --- a/Nasal/Systems/tyresmoke.nas +++ b/Nasal/Systems/tyresmoke.nas @@ -8,8 +8,7 @@ var tyresmoke_2 = aircraft.tyresmoke.new(2, 0, 0.8, 0); # =============================== listeners =============================== setlistener("gear/gear[0]/position-norm", func { - var gear = getprop("gear/gear[0]/position-norm"); - if (gear == 1 ){ + if (pts.Gear.position[0].getValue()){ run_tyresmoke0 = 1; }else{ run_tyresmoke0 = 0; @@ -17,8 +16,7 @@ setlistener("gear/gear[0]/position-norm", func { },1,0); setlistener("gear/gear[1]/position-norm", func { - var gear = getprop("gear/gear[1]/position-norm"); - if (gear == 1 ){ + if (pts.Gear.position[1].getValue()){ run_tyresmoke1 = 1; }else{ run_tyresmoke1 = 0; @@ -26,8 +24,7 @@ setlistener("gear/gear[1]/position-norm", func { },1,0); setlistener("gear/gear[2]/position-norm", func { - var gear = getprop("gear/gear[2]/position-norm"); - if (gear == 1 ){ + if (pts.Gear.position[2].getValue()){ run_tyresmoke2 = 1; }else{ run_tyresmoke2 = 0;