From 9798a20850e97fdd2881e00e3582c781defc297b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 7 Jun 2021 15:38:50 +0100 Subject: [PATCH] Hydraulics / brakes: smooth the pressure guague --- Models/FlightDeck/a320.flightdeck.xml | 10 +++++----- Nasal/Systems/hydraulics.nas | 24 ++++++++++++----------- Systems/libraries.xml | 28 +++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index c0e5eed8..cd816a46 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -346,7 +346,7 @@ rotate brakes_lb_psi - systems/hydraulic/brakes/pressure-left-psi + systems/hydraulic/brakes/pressure-left-psi-output -0.03 @@ -360,7 +360,7 @@ 1 - systems/hydraulic/brakes/pressure-left-psi + systems/hydraulic/brakes/pressure-left-psi-output 0 @@ -378,7 +378,7 @@ rotate brakes_rb_psi - systems/hydraulic/brakes/pressure-right-psi + systems/hydraulic/brakes/pressure-right-psi-output 0.03 @@ -392,7 +392,7 @@ 1 - systems/hydraulic/brakes/pressure-right-psi + systems/hydraulic/brakes/pressure-right-psi-output 0 @@ -410,7 +410,7 @@ rotate brakes_accum_psi - systems/hydraulic/yellow-accumulator-psi + systems/hydraulic/yellow-accumulator-psi-output 00 700-20 diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index 204c40b5..04bef4bc 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -2,10 +2,10 @@ # Jonathan Redpath # Copyright (c) 2019 Jonathan Redpath -var lcont = 0; -var rcont = 0; var HYD = { + lcont: 0, + rcont: 0, Brakes: { accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"), leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"), @@ -86,23 +86,24 @@ var HYD = { me.Fail.yellowLeak.setBoolValue(0); }, 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) { - lcont = lcont + 1; + me.lcont = me.lcont + 1; } else { - lcont = 0; + me.lcont = 0; } if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) { - rcont = rcont + 1; + me.rcont = me.rcont + 1; } else { - rcont = 0; + me.rcont = 0; } + if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) { - if (lcont == 1) { - me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); + if (me.lcont == 1) { + me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); } - if (rcont == 1) { - me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); + if (me.rcont == 1) { + me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); } if (notification.accumPressPsi < 0) { me.Brakes.accumPressPsi.setValue(0); @@ -181,6 +182,7 @@ var HYD = { }, }; +# Restrict gear raising on the ground 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())) { pts.Controls.Gear.gearDown.setValue(1); diff --git a/Systems/libraries.xml b/Systems/libraries.xml index 52d14c55..ba0338a4 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -1326,4 +1326,32 @@ /instrumentation/mk-viii/inputs/discretes/landing-flaps + + + + noise-spike + + /systems/hydraulic/yellow-accumulator-psi + + /systems/hydraulic/yellow-accumulator-psi-output + 3000 + + + + noise-spike + + /systems/hydraulic/brakes/pressure-left-psi + + /systems/hydraulic/brakes/pressure-left-psi-output + 3000 + + + + noise-spike + + /systems/hydraulic/brakes/pressure-right-psi + + /systems/hydraulic/brakes/pressure-right-psi-output + 3000 +