1
0
Fork 0

Hydraulic and brake systems improvements:

- fix flightdeck brakes pressure indicator's bug;
- disable autobrake if antiskid is disabled or green pressure is low/missing;
- set hydraulic brakes snd accumulator's pressure;

to be done: set brake power according to brake's pressure
This commit is contained in:
vezza 2020-11-23 02:14:05 +01:00
parent 024fca8b7d
commit 4b58edb995
4 changed files with 115 additions and 47 deletions

View file

@ -365,7 +365,7 @@
<type>rotate</type>
<object-name>brakes_lb_psi</object-name>
<property>systems/hydraulic/brakes/pressure-left-psi</property>
<factor>0.03</factor>
<factor>-0.03</factor>
<condition>
<equals>
<property>systems/hydraulic/brakes/mode</property>
@ -381,7 +381,7 @@
<type>rotate</type>
<object-name>brakes_rb_psi</object-name>
<property>systems/hydraulic/brakes/pressure-right-psi</property>
<factor>-0.03</factor>
<factor>0.03</factor>
<condition>
<equals>
<property>systems/hydraulic/brakes/mode</property>
@ -399,10 +399,16 @@
<property>systems/hydraulic/brakes/accumulator-pressure-psi</property>
<interpolation>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>700</ind><dep>66</dep></entry>
<entry><ind>2000</ind><dep>78</dep></entry>
<entry><ind>3000</ind><dep>90</dep></entry>
<entry><ind>700</ind><dep>-66</dep></entry>
<entry><ind>2000</ind><dep>-78</dep></entry>
<entry><ind>3000</ind><dep>-90</dep></entry>
</interpolation>
<condition>
<equals>
<property>systems/hydraulic/brakes/mode</property>
<value>2</value>
</equals>
</condition>
<axis>
<object-name>brakes_accum_psi.axis</object-name>
</axis>

View file

@ -406,7 +406,7 @@ var Autobrake = {
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) {
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 and systems.HYD.Brakes.askidSw.getValue() and systems.HYD.Psi.green.getValue() >= 2500 ) {
me.active.setBoolValue(1);
} elsif (me._active) {
me.active.setBoolValue(0);

View file

@ -2,6 +2,8 @@
# Jonathan Redpath
# Copyright (c) 2019 Jonathan Redpath
var lcont = 0;
var rcont = 0;
var HYD = {
Brakes: {
@ -10,10 +12,11 @@ var HYD = {
rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"),
askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"),
mode: props.globals.initNode("/systems/hydraulic/brakes/mode", 0, "INT"),
leftbrake: props.globals.getNode("/controls/gear/brake-left"),
rightbrake: props.globals.getNode("/controls/gear/brake-right"),
lbrake: props.globals.initNode("/systems/hydraulic/brakes/lbrake", 0, "INT"),
rbrake: props.globals.initNode("/systems/hydraulic/brakes/rbrake", 0, "INT"),
noserubber: props.globals.initNode("/systems/hydraulic/brakes/nose-rubber", 0, "INT"),
counter: props.globals.initNode("/systems/hydraulic/brakes/counter", 0, "INT"),
},
Fail: {
blueElec: props.globals.getNode("/systems/failures/hydraulic/blue-elec"),
@ -85,11 +88,110 @@ var HYD = {
me.Fail.yellowLeak.setBoolValue(0);
},
loop: func() {
if (me.Brakes.leftbrake.getValue() == 1) {
me.Brakes.lbrake.setValue(1);
} else {
me.Brakes.lbrake.setValue(0);
}
if (me.Brakes.rightbrake.getValue() == 1) {
me.Brakes.rbrake.setValue(1);
} else {
me.Brakes.rbrake.setValue(0);
}
if (props.globals.getValue("/controls/gear/nws-switch") == 1) {
me.Brakes.askidSw.setBoolValue(1); #true
} else {
me.Brakes.askidSw.setBoolValue(0); #false
}
if (me.Brakes.mode.getValue() == 2) {
if (me.Psi.yellow.getValue() > 2500 and me.Brakes.accumPressPsi.getValue() < 700) {
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50);
}
}
# Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized
if (me.Brakes.leftbrake.getValue() > 0) {
lcont = lcont + 1;
} else {
lcont = 0;
}
if (me.Brakes.rightbrake.getValue() > 0) {
rcont = rcont + 1;
} else {
rcont = 0;
}
if ((me.Psi.green.getValue() == 0) and (me.Psi.yellow.getValue() == 0) and (me.Brakes.accumPressPsi.getValue()) > 0) {
if (lcont == 1) {
#me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue()));
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 35);
}
if (rcont == 1) {
#me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue()));
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 35);
}
if (me.Brakes.accumPressPsi.getValue() < 0) {
me.Brakes.accumPressPsi.setValue(0);
}
}
# Braking Pressure
if (me.Brakes.mode.getValue() == 1 or (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() >= 2500)) {
# Normal braking - Green OK
if (me.Brakes.lbrake.getValue() > 0) {
me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu"));
} else {
me.Brakes.leftPressPsi.setValue(0);
}
if (me.Brakes.rbrake.getValue() > 0) {
me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu"));
} else {
me.Brakes.rightPressPsi.setValue(0);
}
} else {
if (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) {
# Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO
if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) {
if (me.Brakes.lbrake.getValue() > 0) {
me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu"));
} else {
me.Brakes.leftPressPsi.setValue(0);
}
if (me.Brakes.rbrake.getValue() > 0) {
me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu"));
} else {
me.Brakes.rightPressPsi.setValue(0);
}
} else {
# Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO
if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) {
if (me.Brakes.lbrake.getValue() > 0) {
me.Brakes.leftPressPsi.setValue(1000);
} else {
me.Brakes.leftPressPsi.setValue(0);
}
if (me.Brakes.rbrake.getValue() > 0) {
me.Brakes.rightPressPsi.setValue(1000);
} else {
me.Brakes.rightPressPsi.setValue(0);
}
} else {
# Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO
if (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or !props.globals.getValue("/systems/electrical/serviceable")) {
if (me.Brakes.lbrake.getValue() > 0) {
me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue());
} else {
me.Brakes.leftPressPsi.setValue(0);
}
if (me.Brakes.rbrake.getValue() > 0) {
me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue());
} else {
me.Brakes.rightPressPsi.setValue(0);
}
}
}
}
}
}
},
};

View file

@ -740,46 +740,6 @@
<output>/controls/flight/auto-coordination</output>
</filter>
<!-- Braking -->
<filter>
<name>Left Press</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/controls/gear/brake-left</property>
<entry><ind>0.0</ind><dep> 0</dep></entry>
<entry><ind>0.3</ind><dep>1000</dep></entry>
<entry><ind>0.6</ind><dep>2000</dep></entry>
<entry><ind>1.0</ind><dep>3000</dep></entry>
</table>
</expression>
</input>
<output>/systems/hydraulic/brakes/pressure-left-psi</output>
</filter>
<filter>
<name>Right Press</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/controls/gear/brake-right</property>
<entry><ind>0.0</ind><dep> 0</dep></entry>
<entry><ind>0.3</ind><dep>1000</dep></entry>
<entry><ind>0.6</ind><dep>2000</dep></entry>
<entry><ind>1.0</ind><dep>3000</dep></entry>
</table>
</expression>
</input>
<output>/systems/hydraulic/brakes/pressure-right-psi</output>
</filter>
<filter>
<name>Left Door</name>
<type>gain</type>