Hydraulics / brakes: smooth the pressure guague
This commit is contained in:
parent
8e0603d48d
commit
9798a20850
3 changed files with 46 additions and 16 deletions
|
@ -346,7 +346,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_lb_psi</object-name>
|
<object-name>brakes_lb_psi</object-name>
|
||||||
<property>systems/hydraulic/brakes/pressure-left-psi</property>
|
<property>systems/hydraulic/brakes/pressure-left-psi-output</property>
|
||||||
<factor>-0.03</factor>
|
<factor>-0.03</factor>
|
||||||
<condition>
|
<condition>
|
||||||
<or>
|
<or>
|
||||||
|
@ -360,7 +360,7 @@
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/hydraulic/brakes/pressure-left-psi</property>
|
<property>systems/hydraulic/brakes/pressure-left-psi-output</property>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</equals>
|
</equals>
|
||||||
</and>
|
</and>
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_rb_psi</object-name>
|
<object-name>brakes_rb_psi</object-name>
|
||||||
<property>systems/hydraulic/brakes/pressure-right-psi</property>
|
<property>systems/hydraulic/brakes/pressure-right-psi-output</property>
|
||||||
<factor>0.03</factor>
|
<factor>0.03</factor>
|
||||||
<condition>
|
<condition>
|
||||||
<or>
|
<or>
|
||||||
|
@ -392,7 +392,7 @@
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/hydraulic/brakes/pressure-right-psi</property>
|
<property>systems/hydraulic/brakes/pressure-right-psi-output</property>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</equals>
|
</equals>
|
||||||
</and>
|
</and>
|
||||||
|
@ -410,7 +410,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_accum_psi</object-name>
|
<object-name>brakes_accum_psi</object-name>
|
||||||
<property>systems/hydraulic/yellow-accumulator-psi</property>
|
<property>systems/hydraulic/yellow-accumulator-psi-output</property>
|
||||||
<interpolation>
|
<interpolation>
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
<entry><ind>0</ind><dep>0</dep></entry>
|
||||||
<entry><ind>700</ind><dep>-20</dep></entry>
|
<entry><ind>700</ind><dep>-20</dep></entry>
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# Jonathan Redpath
|
# Jonathan Redpath
|
||||||
|
|
||||||
# Copyright (c) 2019 Jonathan Redpath
|
# Copyright (c) 2019 Jonathan Redpath
|
||||||
var lcont = 0;
|
|
||||||
var rcont = 0;
|
|
||||||
|
|
||||||
var HYD = {
|
var HYD = {
|
||||||
|
lcont: 0,
|
||||||
|
rcont: 0,
|
||||||
Brakes: {
|
Brakes: {
|
||||||
accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"),
|
accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 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"),
|
||||||
|
@ -86,22 +86,23 @@ var HYD = {
|
||||||
me.Fail.yellowLeak.setBoolValue(0);
|
me.Fail.yellowLeak.setBoolValue(0);
|
||||||
},
|
},
|
||||||
loop: func(notification) {
|
loop: func(notification) {
|
||||||
# Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized
|
# Decrease accumPressPsi when green and yellow hydraulics aren't pressurized
|
||||||
if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) {
|
if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) {
|
||||||
lcont = lcont + 1;
|
me.lcont = me.lcont + 1;
|
||||||
} else {
|
} else {
|
||||||
lcont = 0;
|
me.lcont = 0;
|
||||||
}
|
}
|
||||||
if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) {
|
if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) {
|
||||||
rcont = rcont + 1;
|
me.rcont = me.rcont + 1;
|
||||||
} else {
|
} else {
|
||||||
rcont = 0;
|
me.rcont = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) {
|
if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) {
|
||||||
if (lcont == 1) {
|
if (me.lcont == 1) {
|
||||||
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
||||||
}
|
}
|
||||||
if (rcont == 1) {
|
if (me.rcont == 1) {
|
||||||
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
||||||
}
|
}
|
||||||
if (notification.accumPressPsi < 0) {
|
if (notification.accumPressPsi < 0) {
|
||||||
|
@ -181,6 +182,7 @@ var HYD = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Restrict gear raising on the ground
|
||||||
setlistener("/controls/gear/gear-down", func {
|
setlistener("/controls/gear/gear-down", func {
|
||||||
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 (!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);
|
pts.Controls.Gear.gearDown.setValue(1);
|
||||||
|
|
|
@ -1326,4 +1326,32 @@
|
||||||
<output>/instrumentation/mk-viii/inputs/discretes/landing-flaps</output>
|
<output>/instrumentation/mk-viii/inputs/discretes/landing-flaps</output>
|
||||||
</logic>
|
</logic>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Brake Pressure Guague -->
|
||||||
|
<filter>
|
||||||
|
<type>noise-spike</type>
|
||||||
|
<input>
|
||||||
|
<property>/systems/hydraulic/yellow-accumulator-psi</property>
|
||||||
|
</input>
|
||||||
|
<output>/systems/hydraulic/yellow-accumulator-psi-output</output>
|
||||||
|
<max-rate-of-change>3000</max-rate-of-change>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<type>noise-spike</type>
|
||||||
|
<input>
|
||||||
|
<property>/systems/hydraulic/brakes/pressure-left-psi</property>
|
||||||
|
</input>
|
||||||
|
<output>/systems/hydraulic/brakes/pressure-left-psi-output</output>
|
||||||
|
<max-rate-of-change>3000</max-rate-of-change>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<type>noise-spike</type>
|
||||||
|
<input>
|
||||||
|
<property>/systems/hydraulic/brakes/pressure-right-psi</property>
|
||||||
|
</input>
|
||||||
|
<output>/systems/hydraulic/brakes/pressure-right-psi-output</output>
|
||||||
|
<max-rate-of-change>3000</max-rate-of-change>
|
||||||
|
</filter>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
Loading…
Reference in a new issue