Improvements for brakes, merge two brake nasal files and use PTS / props.globals for brakes
This commit is contained in:
parent
c3c56e34ae
commit
6b9209bd08
8 changed files with 192 additions and 131 deletions
|
@ -4209,7 +4209,6 @@
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas</file>
|
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas</file>
|
||||||
<file>Aircraft/A320-family/Nasal/Panels/SwitchingPanel.nas</file>
|
<file>Aircraft/A320-family/Nasal/Panels/SwitchingPanel.nas</file>
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/Comm/HF.nas</file>
|
<file>Aircraft/A320-family/Nasal/Systems/Comm/HF.nas</file>
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/brakes.nas</file>
|
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/brakesystem.nas</file>
|
<file>Aircraft/A320-family/Nasal/Systems/brakesystem.nas</file>
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
|
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
|
||||||
<file>Aircraft/A320-family/Nasal/Systems/ground_services.nas</file>
|
<file>Aircraft/A320-family/Nasal/Systems/ground_services.nas</file>
|
||||||
|
|
|
@ -519,7 +519,7 @@ var takeoff = func {
|
||||||
setprop("/controls/atc/mode-knob", 4);
|
setprop("/controls/atc/mode-knob", 4);
|
||||||
atc.transponderPanel.modeSwitch(5);
|
atc.transponderPanel.modeSwitch(5);
|
||||||
setprop("/controls/flight/elevator-trim", -0.07);
|
setprop("/controls/flight/elevator-trim", -0.07);
|
||||||
systems.arm_autobrake(3);
|
systems.Autobrake.arm_autobrake(3);
|
||||||
setprop("/ECAM/to-config-test", 1);
|
setprop("/ECAM/to-config-test", 1);
|
||||||
settimer(func {
|
settimer(func {
|
||||||
setprop("/ECAM/to-config-test", 0);
|
setprop("/ECAM/to-config-test", 0);
|
||||||
|
|
|
@ -1630,10 +1630,10 @@
|
||||||
</condition>
|
</condition>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
if (getprop("controls/autobrake/mode") != 1) {
|
if (systems.Autobrake.mode.getValue() != 1) {
|
||||||
systems.arm_autobrake(1);
|
systems.Autobrake.arm_autobrake(1);
|
||||||
} else {
|
} else {
|
||||||
systems.arm_autobrake(0);
|
systems.Autobrake.arm_autobrake(0);
|
||||||
}
|
}
|
||||||
setprop("sim/sounde/oh-btn", 1);
|
setprop("sim/sounde/oh-btn", 1);
|
||||||
</script>
|
</script>
|
||||||
|
@ -1657,10 +1657,10 @@
|
||||||
</condition>
|
</condition>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
if (getprop("controls/autobrake/mode") != 2) {
|
if (systems.Autobrake.mode.getValue() != 2) {
|
||||||
systems.arm_autobrake(2);
|
systems.Autobrake.arm_autobrake(2);
|
||||||
} else {
|
} else {
|
||||||
systems.arm_autobrake(0);
|
systems.Autobrake.arm_autobrake(0);
|
||||||
}
|
}
|
||||||
setprop("sim/sounde/oh-btn", 1);
|
setprop("sim/sounde/oh-btn", 1);
|
||||||
</script>
|
</script>
|
||||||
|
@ -1684,10 +1684,10 @@
|
||||||
</condition>
|
</condition>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
if (getprop("controls/autobrake/mode") != 3) {
|
if (systems.Autobrake.mode.getValue() != 3) {
|
||||||
systems.arm_autobrake(3);
|
systems.Autobrake.arm_autobrake(3);
|
||||||
} else {
|
} else {
|
||||||
systems.arm_autobrake(0);
|
systems.Autobrake.arm_autobrake(0);
|
||||||
}
|
}
|
||||||
setprop("sim/sounde/oh-btn", 1);
|
setprop("sim/sounde/oh-btn", 1);
|
||||||
</script>
|
</script>
|
||||||
|
@ -6243,7 +6243,7 @@
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>LRudderPedalL</object-name>
|
<object-name>LRudderPedalL</object-name>
|
||||||
<object-name>LRudderPedalR</object-name>
|
<object-name>LRudderPedalR</object-name>
|
||||||
<property>controls/gear/brake-left</property>
|
<property>/fdm/jsbsim/fcs/brake-left</property>
|
||||||
<factor>15</factor>
|
<factor>15</factor>
|
||||||
<axis>
|
<axis>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -6261,7 +6261,7 @@
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>RRudderPedalL</object-name>
|
<object-name>RRudderPedalL</object-name>
|
||||||
<object-name>RRudderPedalR</object-name>
|
<object-name>RRudderPedalR</object-name>
|
||||||
<property>controls/gear/brake-right</property>
|
<property>/fdm/jsbsim/fcs/brake-right</property>
|
||||||
<factor>15</factor>
|
<factor>15</factor>
|
||||||
<axis>
|
<axis>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
|
|
@ -188,7 +188,7 @@ var systemsInit = func {
|
||||||
systems.ADIRS.init();
|
systems.ADIRS.init();
|
||||||
systems.eng_init();
|
systems.eng_init();
|
||||||
systems.APUController.init();
|
systems.APUController.init();
|
||||||
systems.autobrake_init();
|
systems.Autobrake.init();
|
||||||
systems.fire_init();
|
systems.fire_init();
|
||||||
fmgc.flightPlanController.reset();
|
fmgc.flightPlanController.reset();
|
||||||
fmgc.windController.reset();
|
fmgc.windController.reset();
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
# Anything that says Temp is set by another file to avoid multiple getValue calls
|
# Anything that says Temp is set by another file to avoid multiple getValue calls
|
||||||
# Usage Example: pts.Class.SubClass.node.getValue()
|
# Usage Example: pts.Class.SubClass.node.getValue()
|
||||||
|
|
||||||
|
var Acconfig = {
|
||||||
|
running: props.globals.getNode("/systems/acconfig/autoconfig-running"),
|
||||||
|
};
|
||||||
|
|
||||||
var APU = {
|
var APU = {
|
||||||
masterSw: props.globals.getNode("/controls/apu/master"),
|
masterSw: props.globals.getNode("/controls/apu/master"),
|
||||||
rpm: props.globals.getNode("/engines/engine[2]/n1"),
|
rpm: props.globals.getNode("/engines/engine[2]/n1"),
|
||||||
|
@ -37,6 +41,7 @@ var Controls = {
|
||||||
rudderTrim: props.globals.getNode("/controls/flight/rudder-trim"),
|
rudderTrim: props.globals.getNode("/controls/flight/rudder-trim"),
|
||||||
},
|
},
|
||||||
Gear: {
|
Gear: {
|
||||||
|
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"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
# A3XX Autobrake
|
|
||||||
# Joshua Davidson (Octal450)
|
|
||||||
|
|
||||||
# Copyright (c) 2020 Josh Davidson (Octal450)
|
|
||||||
|
|
||||||
var thr1 = 0;
|
|
||||||
var thr2 = 0;
|
|
||||||
var wow0 = 0;
|
|
||||||
var gnd_speed = 0;
|
|
||||||
setprop("controls/autobrake/active", 0);
|
|
||||||
setprop("controls/autobrake/mode", 0);
|
|
||||||
setprop("controls/autobrake/decel-rate", 0);
|
|
||||||
|
|
||||||
var autobrake_init = func {
|
|
||||||
setprop("controls/autobrake/active", 0);
|
|
||||||
setprop("controls/autobrake/mode", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Override FG's generic brake
|
|
||||||
controls.applyBrakes = func(v, which = 0) {
|
|
||||||
if (getprop("systems/acconfig/autoconfig-running") != 1) {
|
|
||||||
if (which <= 0) {
|
|
||||||
interpolate("/controls/gear/brake-left", v, 0.5);
|
|
||||||
}
|
|
||||||
if (which >= 0) {
|
|
||||||
interpolate("/controls/gear/brake-right", v, 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set autobrake mode
|
|
||||||
var arm_autobrake = func(mode) {
|
|
||||||
wow0 = getprop("gear/gear[0]/wow");
|
|
||||||
gnd_speed = getprop("velocities/groundspeed-kt");
|
|
||||||
if (mode == 0) { # OFF
|
|
||||||
absChk.stop();
|
|
||||||
if (getprop("controls/autobrake/active") == 1) {
|
|
||||||
setprop("controls/autobrake/active", 0);
|
|
||||||
setprop("controls/gear/brake-left", 0);
|
|
||||||
setprop("controls/gear/brake-right", 0);
|
|
||||||
}
|
|
||||||
setprop("controls/autobrake/decel-rate", 0);
|
|
||||||
setprop("controls/autobrake/mode", 0);
|
|
||||||
} else if (mode == 1 and wow0 != 1) { # LO
|
|
||||||
setprop("controls/autobrake/decel-rate", 1.7);
|
|
||||||
setprop("controls/autobrake/mode", 1);
|
|
||||||
absChk.start();
|
|
||||||
} else if (mode == 2 and wow0 != 1) { # MED
|
|
||||||
setprop("controls/autobrake/decel-rate", 3);
|
|
||||||
setprop("controls/autobrake/mode", 2);
|
|
||||||
absChk.start();
|
|
||||||
} else if (mode == 3 and wow0 == 1 and gnd_speed < 40) { # MAX
|
|
||||||
setprop("controls/autobrake/decel-rate", 6);
|
|
||||||
setprop("controls/autobrake/mode", 3);
|
|
||||||
absChk.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Autobrake loop
|
|
||||||
var absChk = maketimer(0.2, func {
|
|
||||||
thr1 = getprop("controls/engines/engine[0]/throttle");
|
|
||||||
thr2 = getprop("controls/engines/engine[1]/throttle");
|
|
||||||
wow0 = getprop("gear/gear[0]/wow");
|
|
||||||
gnd_speed = getprop("velocities/groundspeed-kt");
|
|
||||||
if (gnd_speed > 72) {
|
|
||||||
if (getprop("controls/autobrake/mode") != 0 and thr1 < 0.15 and thr2 < 0.15 and wow0 == 1) {
|
|
||||||
setprop("controls/autobrake/active", 1);
|
|
||||||
} else {
|
|
||||||
setprop("controls/autobrake/active", 0);
|
|
||||||
setprop("controls/gear/brake-left", 0);
|
|
||||||
setprop("controls/gear/brake-right", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getprop("controls/autobrake/mode") == 3 and getprop("controls/gear/gear-down") == 0) {
|
|
||||||
arm_autobrake(0);
|
|
||||||
}
|
|
||||||
if (getprop("controls/autobrake/mode") != 0 and wow0 == 1 and getprop("controls/autobrake/active") == 1 and (getprop("controls/gear/brake-left") > 0.05 or getprop("controls/gear/brake-right") > 0.05)) {
|
|
||||||
arm_autobrake(0);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# A3XX Autobrake and Braking
|
||||||
|
# Joshua Davidson (Octal450)
|
||||||
|
|
||||||
|
# Copyright (c) 2020 Josh Davidson (Octal450)
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Simple Brake Simulation System
|
# Simple Brake Simulation System
|
||||||
# 2010, Thorsten Brehm
|
# 2010, Thorsten Brehm
|
||||||
|
@ -63,7 +69,7 @@ var BrakeSystem =
|
||||||
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0);
|
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0);
|
||||||
setprop("gear/gear[2]/Rbrake-thermal-energy",0.0);
|
setprop("gear/gear[2]/Rbrake-thermal-energy",0.0);
|
||||||
|
|
||||||
setprop("controls/gear/brake-fans",0);
|
setprop("/controls/gear/brake-fans",0);
|
||||||
setprop("gear/gear[1]/Lbrake-smoke",0);
|
setprop("gear/gear[1]/Lbrake-smoke",0);
|
||||||
setprop("gear/gear[2]/Rbrake-smoke",0);
|
setprop("gear/gear[2]/Rbrake-smoke",0);
|
||||||
setprop("gear/gear[1]/L-Thrust",0);
|
setprop("gear/gear[1]/L-Thrust",0);
|
||||||
|
@ -80,21 +86,21 @@ var BrakeSystem =
|
||||||
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0;
|
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0;
|
||||||
var atemp = getprop("environment/temperature-degc") or 0;
|
var atemp = getprop("environment/temperature-degc") or 0;
|
||||||
var vmach = getprop("velocities/mach") or 0;
|
var vmach = getprop("velocities/mach") or 0;
|
||||||
var tatdegc = getprop("systems/navigation/probes/tat-1/compute-tat");
|
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"));
|
setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc"));
|
||||||
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc"));
|
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc"));
|
||||||
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc"));
|
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc"));
|
||||||
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc"));
|
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc"));
|
||||||
|
|
||||||
setprop("sim/animation/fire-services",0);
|
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");
|
var CurrentTime = getprop("/sim/time/elapsed-sec");
|
||||||
var dt = CurrentTime - me.LastSimTime;
|
var dt = CurrentTime - me.LastSimTime;
|
||||||
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy");
|
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy");
|
||||||
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy");
|
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy");
|
||||||
|
@ -107,12 +113,12 @@ var BrakeSystem =
|
||||||
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb");
|
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb");
|
||||||
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb");
|
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb");
|
||||||
|
|
||||||
if (getprop("sim/freeze/replay-state")==0 and dt<1.0) {
|
if (getprop("/sim/freeze/replay-state")==0 and dt<1.0) {
|
||||||
var OnGround = getprop("gear/gear[1]/wow");
|
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 (getprop("/controls/gear/brake-fans")) {
|
||||||
#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;
|
||||||
|
@ -169,8 +175,8 @@ var BrakeSystem =
|
||||||
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 * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
|
||||||
if (getprop("services/chocks/enable")) {
|
if (getprop("/services/chocks/enable")) {
|
||||||
if (!getprop("controls/gear/brake-parking")) {
|
if (!getprop("/controls/gear/brake-parking")) {
|
||||||
# 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 {
|
||||||
|
@ -179,7 +185,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 (!getprop("/controls/gear/brake-parking")) {
|
||||||
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;
|
||||||
|
@ -202,8 +208,8 @@ var BrakeSystem =
|
||||||
};
|
};
|
||||||
|
|
||||||
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
|
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
|
||||||
if (getprop("services/chocks/enable")) {
|
if (getprop("/services/chocks/enable")) {
|
||||||
if (!getprop("controls/gear/brake-parking")) {
|
if (!getprop("/controls/gear/brake-parking")) {
|
||||||
# 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 {
|
||||||
|
@ -212,7 +218,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 (!getprop("/controls/gear/brake-parking")) {
|
||||||
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;
|
||||||
|
@ -304,13 +310,13 @@ var BrakeSystem =
|
||||||
} else {
|
} else {
|
||||||
# stop smoke processing
|
# stop smoke processing
|
||||||
setprop("gear/gear[1]/Lbrake-smoke",0);
|
setprop("gear/gear[1]/Lbrake-smoke",0);
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("/sim/animation/fire-services",0);
|
||||||
me.LSmokeActive = 0;
|
me.LSmokeActive = 0;
|
||||||
};
|
};
|
||||||
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) {
|
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) {
|
||||||
setprop("sim/animation/fire-services",1);
|
setprop("/sim/animation/fire-services",1);
|
||||||
} else {
|
} else {
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("/sim/animation/fire-services",0);
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -344,21 +350,102 @@ var BrakeSystem =
|
||||||
me.RSmokeActive = 0;
|
me.RSmokeActive = 0;
|
||||||
};
|
};
|
||||||
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) {
|
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) {
|
||||||
setprop("sim/animation/fire-services",1);
|
setprop("/sim/animation/fire-services",1);
|
||||||
} else {
|
} else {
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("/sim/animation/fire-services",0);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var BrakeSys = BrakeSystem.new();
|
var BrakeSys = BrakeSystem.new();
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized",
|
#############
|
||||||
|
# Autobrake #
|
||||||
|
#############
|
||||||
|
|
||||||
|
var Autobrake = {
|
||||||
|
active: props.globals.initNode("/controls/autobrake/active", 0, "BOOL"),
|
||||||
|
mode: props.globals.initNode("/controls/autobrake/mode", 0, "INT"),
|
||||||
|
decel: props.globals.initNode("/controls/autobrake/decel-rate", 0, "DOUBLE"),
|
||||||
|
_wow0: 0,
|
||||||
|
_gnd_speed: 0,
|
||||||
|
_mode: 0,
|
||||||
|
_active: 0,
|
||||||
|
init: func() {
|
||||||
|
me.active.setBoolValue(0);
|
||||||
|
me.mode.setValue(0);
|
||||||
|
me.decel.setValue(0);
|
||||||
|
},
|
||||||
|
arm_autobrake: func(mode) {
|
||||||
|
me._wow0 = pts.Gear.wow[0].getBoolValue();
|
||||||
|
me._gnd_speed = pts.Velocities.groundspeed.getValue();
|
||||||
|
if (mode == 0) { # OFF
|
||||||
|
absChk.stop();
|
||||||
|
if (me.active.getBoolValue()) {
|
||||||
|
me.active.setBoolValue(0);
|
||||||
|
pts.Controls.Gear.brake[0].setValue(0);
|
||||||
|
pts.Controls.Gear.brake[1].setValue(0);
|
||||||
|
}
|
||||||
|
me.decel.setValue(0);
|
||||||
|
me.mode.setValue(0);
|
||||||
|
} else if (mode == 1 and !me._wow0) { # LO
|
||||||
|
me.decel.setValue(2.0);
|
||||||
|
me.mode.setValue(1);
|
||||||
|
absChk.start();
|
||||||
|
} else if (mode == 2 and !me._wow0) { # MED
|
||||||
|
me.decel.setValue(3);
|
||||||
|
me.mode.setValue(2);
|
||||||
|
absChk.start();
|
||||||
|
} else if (mode == 3 and me._wow0 and me._gnd_speed < 40) { # MAX
|
||||||
|
me.decel.setValue(6);
|
||||||
|
me.mode.setValue(3);
|
||||||
|
absChk.start();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loop: func() {
|
||||||
|
me._wow0 = pts.Gear.wow[0].getBoolValue();
|
||||||
|
me._gnd_speed = pts.Velocities.groundspeed.getValue();
|
||||||
|
me._mode = me.mode.getValue();
|
||||||
|
me._active = me.active.getBoolValue();
|
||||||
|
if (me._gnd_speed > 72) {
|
||||||
|
if (me._mode != 0 and pts.Controls.Engines.Engine.throttle[0].getValue() < 0.15 and pts.Controls.Engines.Engine.throttle[1].getValue() < 0.15 and me._wow0) {
|
||||||
|
me.active.setBoolValue(1);
|
||||||
|
} elsif (me._active) {
|
||||||
|
me.active.setBoolValue(0);
|
||||||
|
pts.Controls.Gear.brake[0].setValue(0);
|
||||||
|
pts.Controls.Gear.brake[1].setValue(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (me._mode == 3 and !pts.Controls.Gear.gearDown.getBoolValue()) {
|
||||||
|
me.arm_autobrake(0);
|
||||||
|
}
|
||||||
|
if (me._mode != 0 and me._wow0 and me._active and (pts.Controls.Gear.brake[0].getValue() > 0.05 or pts.Controls.Gear.brake[1].getValue() > 0.05)) {
|
||||||
|
me.arm_autobrake(0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
# Override FG's generic brake
|
||||||
|
controls.applyBrakes = func(v, which = 0) {
|
||||||
|
if (!pts.Acconfig.running.getBoolValue()) {
|
||||||
|
if (which <= 0) {
|
||||||
|
pts.Controls.Gear.brake[0].setValue(v);
|
||||||
|
}
|
||||||
|
if (which >= 0) {
|
||||||
|
pts.Controls.Gear.brake[1].setValue(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setlistener("/sim/signals/fdm-initialized",
|
||||||
# executed on _every_ FDM reset (but not installing new listeners)
|
# executed on _every_ FDM reset (but not installing new listeners)
|
||||||
func(idle) { BrakeSys.reset(); },
|
func(idle) { BrakeSys.reset(); },
|
||||||
0,0);
|
0,0);
|
||||||
|
|
||||||
settimer(func()
|
settimer(func() { BrakeSys.update(); }, 5);
|
||||||
{
|
|
||||||
BrakeSys.update();
|
|
||||||
}, 5);
|
# Autobrake loop
|
||||||
|
var absChk = maketimer(0.2, func {
|
||||||
|
Autobrake.loop();
|
||||||
|
});
|
||||||
|
|
|
@ -1087,38 +1087,88 @@
|
||||||
<c1>20</c1>
|
<c1>20</c1>
|
||||||
</lag_filter>
|
</lag_filter>
|
||||||
|
|
||||||
<summer name="fcs/left-brake-summer">
|
<actuator name="fcs/brake-left">
|
||||||
<input>/controls/gear/brake-left</input>
|
<input>/controls/gear/brake-left</input>
|
||||||
<input>/controls/gear/brake-parking</input>
|
<rate_limit>2</rate_limit>
|
||||||
<input>/services/chocks/enable</input>
|
</actuator>
|
||||||
|
|
||||||
|
<actuator name="fcs/brake-right">
|
||||||
|
<input>/controls/gear/brake-right</input>
|
||||||
|
<rate_limit>2</rate_limit>
|
||||||
|
</actuator>
|
||||||
|
|
||||||
|
<switch name="fcs/brake-avail">
|
||||||
|
<default value="1"/>
|
||||||
|
<!--<test logic="OR" value="1">
|
||||||
|
/systems/hydraulic/green-psi ge 2000
|
||||||
|
/systems/hydraulic/yellow-psi ge 1500
|
||||||
|
</test>-->
|
||||||
|
</switch>
|
||||||
|
|
||||||
|
<fcs_function name="fcs/left-brake-input">
|
||||||
|
<function>
|
||||||
|
<product>
|
||||||
|
<property>fcs/brake-avail</property>
|
||||||
|
<max>
|
||||||
|
<property>/services/chocks/enable</property>
|
||||||
|
<property>fcs/brake-left</property>
|
||||||
|
<product>
|
||||||
|
<property>/controls/autobrake/brake-left</property>
|
||||||
|
<property>/controls/autobrake/active</property>
|
||||||
|
</product>
|
||||||
|
<property>/controls/gear/brake-parking</property>
|
||||||
|
</max>
|
||||||
|
</product>
|
||||||
|
</function>
|
||||||
<clipto>
|
<clipto>
|
||||||
<min>0</min>
|
<min>0</min>
|
||||||
<max>1</max>
|
<max>1</max>
|
||||||
</clipto>
|
</clipto>
|
||||||
</summer>
|
</fcs_function>
|
||||||
|
|
||||||
|
<actuator name="fcs/left-brake-actuator">
|
||||||
|
<input>fcs/left-brake-input</input>
|
||||||
|
<rate_limit>10</rate_limit>
|
||||||
|
</actuator>
|
||||||
|
|
||||||
<switch name="rubbish/left-brake-cmd-norm">
|
<switch name="rubbish/left-brake-cmd-norm">
|
||||||
<default value="fcs/left-brake-summer"/>
|
<default value="fcs/left-brake-actuator"/>
|
||||||
<test value="/controls/autobrake/brake-left">
|
<test value="1">
|
||||||
/controls/autobrake/active eq 1
|
/systems/acconfig/autoconfig-running eq 1
|
||||||
</test>
|
</test>
|
||||||
<output>fcs/left-brake-cmd-norm</output>
|
<output>fcs/left-brake-cmd-norm</output>
|
||||||
</switch>
|
</switch>
|
||||||
|
|
||||||
<summer name="fcs/right-brake-summer">
|
<fcs_function name="fcs/right-brake-input">
|
||||||
<input>/controls/gear/brake-right</input>
|
<function>
|
||||||
<input>/controls/gear/brake-parking</input>
|
<product>
|
||||||
<input>/services/chocks/enable</input>
|
<property>fcs/brake-avail</property>
|
||||||
|
<max>
|
||||||
|
<property>/services/chocks/enable</property>
|
||||||
|
<property>fcs/brake-right</property>
|
||||||
|
<product>
|
||||||
|
<property>/controls/autobrake/brake-right</property>
|
||||||
|
<property>/controls/autobrake/active</property>
|
||||||
|
</product>
|
||||||
|
<property>/controls/gear/brake-parking</property>
|
||||||
|
</max>
|
||||||
|
</product>
|
||||||
|
</function>
|
||||||
<clipto>
|
<clipto>
|
||||||
<min>0</min>
|
<min>0</min>
|
||||||
<max>1</max>
|
<max>1</max>
|
||||||
</clipto>
|
</clipto>
|
||||||
</summer>
|
</fcs_function>
|
||||||
|
|
||||||
|
<actuator name="fcs/right-brake-actuator">
|
||||||
|
<input>fcs/right-brake-input</input>
|
||||||
|
<rate_limit>10</rate_limit>
|
||||||
|
</actuator>
|
||||||
|
|
||||||
<switch name="rubbish/right-brake-cmd-norm">
|
<switch name="rubbish/right-brake-cmd-norm">
|
||||||
<default value="fcs/right-brake-summer"/>
|
<default value="fcs/right-brake-actuator"/>
|
||||||
<test value="/controls/autobrake/brake-right">
|
<test value="1">
|
||||||
/controls/autobrake/active eq 1
|
/systems/acconfig/autoconfig-running eq 1
|
||||||
</test>
|
</test>
|
||||||
<output>fcs/right-brake-cmd-norm</output>
|
<output>fcs/right-brake-cmd-norm</output>
|
||||||
</switch>
|
</switch>
|
||||||
|
|
Loading…
Reference in a new issue