1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-09-15 18:50:50 +01:00
commit 990f2ed349
11 changed files with 90 additions and 101 deletions

View file

@ -739,6 +739,11 @@
<max-athr-thrust type="double">0.94</max-athr-thrust>
<throttle-output type="double">0</throttle-output>
<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 n="1">
<cutoff type="bool">true</cutoff>
@ -752,6 +757,11 @@
<max-athr-thrust type="double">0.94</max-athr-thrust>
<throttle-output type="double">0</throttle-output>
<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 n="2">
<cutoff type="bool">true</cutoff>

View file

@ -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) {

View file

@ -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);

View file

@ -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());
}
}

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")],
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"),
};

View file

@ -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);

View file

@ -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(0);
}
}
}

View file

@ -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);

View file

@ -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) {

View file

@ -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);
}
});

View file

@ -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;