1
0
Fork 0

Merge remote-tracking branch 'origin/dev' into tcas

This commit is contained in:
legoboyvdlp R 2021-02-09 13:08:32 +00:00
commit cf38d944e8
20 changed files with 184 additions and 125 deletions

View file

@ -206,9 +206,9 @@
<autopilot n="0"> <autopilot n="0">
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path> <path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
</autopilot> </autopilot>
<autopilot n="10"> <property-rule n="100">
<path>Aircraft/A320-family/Systems/cfm56-sound.xml</path> <path>Aircraft/A320-family/Systems/cfm56-sound.xml</path>
</autopilot> </property-rule>
</systems> </systems>
</sim> </sim>

View file

@ -206,9 +206,9 @@
<autopilot n="0"> <autopilot n="0">
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path> <path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
</autopilot> </autopilot>
<autopilot n="10"> <property-rule n="100">
<path>Aircraft/A320-family/Systems/cfm56-sound.xml</path> <path>Aircraft/A320-family/Systems/cfm56-sound.xml</path>
</autopilot> </property-rule>
</systems> </systems>
</sim> </sim>

View file

@ -206,9 +206,9 @@
<autopilot n="0"> <autopilot n="0">
<path>Aircraft/A320-family/Systems/fadec-iae.xml</path> <path>Aircraft/A320-family/Systems/fadec-iae.xml</path>
</autopilot> </autopilot>
<autopilot n="10"> <property-rule n="100">
<path>Aircraft/A320-family/Systems/v2500-sound.xml</path> <path>Aircraft/A320-family/Systems/v2500-sound.xml</path>
</autopilot> </property-rule>
</systems> </systems>
</sim> </sim>

View file

@ -234,15 +234,15 @@
<path>Aircraft/A320-family/Systems/pfd.xml</path> <path>Aircraft/A320-family/Systems/pfd.xml</path>
</autopilot> </autopilot>
<!-- 10 is sound --> <!-- 10 is sound -->
<autopilot n="11"> <property-rule n="101">
<path>Aircraft/A320-family/Systems/sound-common.xml</path> <path>Aircraft/A320-family/Systems/sound-common.xml</path>
</autopilot> </property-rule>
<autopilot n="12"> <property-rule n="110">
<path>Aircraft/A320-family/Systems/a320-lights-proprules.xml</path> <path>Aircraft/A320-family/Systems/a320-lights-proprules.xml</path>
</autopilot> </property-rule>
<autopilot n="13"> <property-rule n="111">
<path>Aircraft/A320-family/Systems/ecam-proprules.xml</path> <path>Aircraft/A320-family/Systems/ecam-proprules.xml</path>
</autopilot> </property-rule>
<path>Aircraft/A320-family/Systems/pitot-static.xml</path> <path>Aircraft/A320-family/Systems/pitot-static.xml</path>
</systems> </systems>

View file

@ -206,9 +206,9 @@
<autopilot n="0"> <autopilot n="0">
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path> <path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
</autopilot> </autopilot>
<autopilot n="10"> <property-rule n="100">
<path>Aircraft/A320-family/Systems/leapx-sound.xml</path> <path>Aircraft/A320-family/Systems/leapx-sound.xml</path>
</autopilot> </property-rule>
</systems> </systems>
</sim> </sim>

View file

@ -206,9 +206,9 @@
<autopilot n="0"> <!-- Apparently PW PurePower uses N1, not EPR.... sooo I use CFM FADEC --> <autopilot n="0"> <!-- Apparently PW PurePower uses N1, not EPR.... sooo I use CFM FADEC -->
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path> <path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
</autopilot> </autopilot>
<autopilot n="10"> <property-rule n="100">
<path>Aircraft/A320-family/Systems/leapx-sound.xml</path> <path>Aircraft/A320-family/Systems/leapx-sound.xml</path>
</autopilot> </property-rule>
</systems> </systems>
</sim> </sim>

View file

@ -261,8 +261,6 @@ var input = {
"altitude_ind": "/instrumentation/altimeter/indicated-altitude-ft-pfd", "altitude_ind": "/instrumentation/altimeter/indicated-altitude-ft-pfd",
"altimeter_mode": "/instrumentation/altimeter[0]/std", "altimeter_mode": "/instrumentation/altimeter[0]/std",
"attReset": "/instrumentation/iesi/att-reset", "attReset": "/instrumentation/iesi/att-reset",
"dcEss": "/systems/electrical/bus/dc-ess",
"dcHot1": "/systems/electrical/bus/dc-hot-1",
"iesiBrt": "/controls/lighting/DU/iesi", "iesiBrt": "/controls/lighting/DU/iesi",
"iesiInit": "/instrumentation/iesi/iesi-init", "iesiInit": "/instrumentation/iesi/iesi-init",
"mach": "/instrumentation/airspeed-indicator/indicated-mach", "mach": "/instrumentation/airspeed-indicator/indicated-mach",

View file

@ -3010,7 +3010,7 @@ var canvas_lowerECAM_wheel = {
rightdoor = gear_door_R.getValue(); rightdoor = gear_door_R.getValue();
nosedoor = gear_door_N.getValue(); nosedoor = gear_door_N.getValue();
gearlvr = gear_down.getValue(); gearlvr = gear_down.getValue();
askidsw = systems.HYD.Brakes.askidSw.getBoolValue(); askidsw = systems.HYD.Switch.nwsSwitch.getBoolValue();
brakemode = systems.HYD.Brakes.mode.getBoolValue(); brakemode = systems.HYD.Brakes.mode.getBoolValue();
accum = systems.HYD.Brakes.accumPressPsi.getBoolValue(); accum = systems.HYD.Brakes.accumPressPsi.getBoolValue();

View file

@ -66,7 +66,7 @@ var FCUController = {
me.FCU2 = FCU.new(systems.ELEC.Bus.dc2); me.FCU2 = FCU.new(systems.ELEC.Bus.dc2);
me._init = 1; me._init = 1;
}, },
loop: func() { loop: func(notification) {
if (me._init == 0) { return; } if (me._init == 0) { return; }
# Update FCU Power # Update FCU Power
@ -82,11 +82,11 @@ var FCUController = {
} }
foreach (var update_item; me.update_items) { foreach (var update_item; me.update_items) {
update_item.update(nil); update_item.update(notification);
} }
}, },
update_items: [ update_items: [
props.UpdateManager.FromPropertyHashList(["/it-autoflight/output/fd1","/it-autoflight/output/fd2", "/it-autoflight/output/ap1", "/it-autoflight/output/ap2"], 1, func(notification) props.UpdateManager.FromPropertyHashList(["/it-autoflight/output/fd1","/it-autoflight/output/fd2", "/it-autoflight/output/ap1", "/it-autoflight/output/ap2"], nil, func(notification)
{ {
updateActiveFMGC(); updateActiveFMGC();
} }

View file

@ -174,19 +174,18 @@ var update_items = [
var systemsLoop = func(notification) { var systemsLoop = func(notification) {
if (!systemsInitialized) { return; } if (!systemsInitialized) { return; }
systems.ELEC.loop(); systems.PNEU.loop(notification);
systems.PNEU.loop(); systems.ADIRS.loop(notification);
systems.HYD.loop(); systems.BrakeSys.update(notification);
systems.ADIRS.loop(); systems.HFLoop(notification);
systems.APUController.loop(); systems.APUController.loop();
systems.BrakeSys.update();
fadec.FADEC.loop(); fadec.FADEC.loop();
rmp.rmpUpdate(); rmp.rmpUpdate();
fcu.FCUController.loop(); fcu.FCUController.loop(notification);
atc.Transponders.vector[atc.transponderPanel.atcSel - 1].update(notification);
dmc.DMController.loop(); dmc.DMController.loop();
atsu.ATSU.loop(); atsu.ATSU.loop();
libraries.BUTTONS.update(); libraries.BUTTONS.update();
systems.HFLoop(notification);
if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) { if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) {
systems.cutoff_one(); systems.cutoff_one();

View file

@ -24,7 +24,6 @@ var Transponder = {
serviceableNode: props.globals.getNode("/instrumentation/transponder/serviceable", 1), serviceableNode: props.globals.getNode("/instrumentation/transponder/serviceable", 1),
knobNode: props.globals.getNode("/instrumentation/transponder/inputs/knob-mode", 1), knobNode: props.globals.getNode("/instrumentation/transponder/inputs/knob-mode", 1),
identNode: props.globals.getNode("/instrumentation/transponder/inputs/ident-btn", 1), identNode: props.globals.getNode("/instrumentation/transponder/inputs/ident-btn", 1),
ac1Node: props.globals.getNode("/systems/electrical/bus/ac-1", 1),
tcasNode: props.globals.getNode("/instrumentation/tcas/inputs/mode"), tcasNode: props.globals.getNode("/instrumentation/tcas/inputs/mode"),
aglNode: props.globals.getNode("/position/gear-agl-ft", 1), aglNode: props.globals.getNode("/position/gear-agl-ft", 1),
electricNode: props.globals.getNode("/systems/electrical/outputs/transponder", 1), # communicate to generic systems electricNode: props.globals.getNode("/systems/electrical/outputs/transponder", 1), # communicate to generic systems
@ -40,9 +39,9 @@ var Transponder = {
return t; return t;
}, },
update: func() { update: func(notification) {
# TCAS - on seperate electrical source, so has to be before transponder electrical checking # TCAS - on seperate electrical source, so has to be before transponder electrical checking
if (me.ac1Node.getValue() < 110) { if (notification.elecAC1 < 110) {
me.tcasNode.setValue(0); # off me.tcasNode.setValue(0); # off
} else { } else {
if (me.mode >= 1 and me.mode <= 3) { if (me.mode >= 1 and me.mode <= 3) {
@ -285,7 +284,6 @@ var transponderPanel = {
var init = func() { var init = func() {
transponderPanel.atcSwitch(1); transponderPanel.atcSwitch(1);
transponderPanel.updateAirData(); transponderPanel.updateAirData();
transponderTimer.start();
} }
# Handler for code change from generic dialog # Handler for code change from generic dialog
@ -297,9 +295,6 @@ setlistener("/instrumentation/transponder/id-code", func {
var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]); var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]);
var transponderTimer = maketimer(0.1, func() {
Transponders.vector[transponderPanel.atcSel - 1].update();
});
setlistener("/systems/navigation/adr/operating-1", func() { setlistener("/systems/navigation/adr/operating-1", func() {
transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue()); transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue());

View file

@ -324,7 +324,7 @@ var ADIRS = {
} }
), ),
], ],
loop: func() { loop: func(notification) {
if (me._init) { if (me._init) {
for (i = 0; i < _NUMADIRU; i = i + 1) { for (i = 0; i < _NUMADIRU; i = i + 1) {
# update ADR units power # update ADR units power
@ -348,7 +348,6 @@ var ADIRS = {
} }
# Update VFE # Update VFE
notification = nil;
foreach (var update_item; me.update_items) { foreach (var update_item; me.update_items) {
update_item.update(notification); update_item.update(notification);
} }

View file

@ -111,7 +111,7 @@ var BrakeSystem =
}, },
# update brake energy # update brake energy
update : func() update : func(notification)
{ {
if (me.counter == 0) { if (me.counter == 0) {
me.counter = 1; me.counter = 1;
@ -122,10 +122,10 @@ var BrakeSystem =
LThermalEnergy = me.thermalEnergy[0]; LThermalEnergy = me.thermalEnergy[0];
RThermalEnergy = me.thermalEnergy[1]; RThermalEnergy = me.thermalEnergy[1];
me.CurrentTime = pts.Sim.Time.elapsedSec.getValue(); me.CurrentTime = notification.elapsedTime;
dt = me.CurrentTime - me.LastSimTime; dt = me.CurrentTime - me.LastSimTime;
LBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[0].getValue(); LBrakeLevel = notification.leftBrakeFCS;
RBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[1].getValue(); RBrakeLevel = notification.rightBrakeFCS;
tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0; tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) { if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) {
@ -137,7 +137,7 @@ var BrakeSystem =
LCoolingRatio = LCoolingRatio * 3; LCoolingRatio = LCoolingRatio * 3;
RCoolingRatio = RCoolingRatio * 3; RCoolingRatio = RCoolingRatio * 3;
}; };
airspeed = pts.Velocities.airspeed.getValue(); airspeed = notification.airspeedV;
if (pts.Gear.position[1].getValue()) { if (pts.Gear.position[1].getValue()) {
#increase CoolingRatio if gear down according to airspeed #increase CoolingRatio if gear down according to airspeed
LCoolingRatio = LCoolingRatio * airspeed; LCoolingRatio = LCoolingRatio * airspeed;
@ -168,7 +168,7 @@ var BrakeSystem =
L_Thrust = 0; L_Thrust = 0;
R_Thrust = 0; R_Thrust = 0;
if (pts.Gear.wow[1].getValue()) { if (notification.gear1Wow) {
var V1 = pts.Velocities.groundspeed.getValue(); var V1 = pts.Velocities.groundspeed.getValue();
var Mass = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() * me.ScalingDivisor; var Mass = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() * me.ScalingDivisor;
@ -179,7 +179,7 @@ var BrakeSystem =
LThermalEnergy += (Mass * pts.Gear.compression[1].getValue() * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); LThermalEnergy += (Mass * pts.Gear.compression[1].getValue() * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
if (pts.Controls.Gear.chocks.getValue()) { if (pts.Controls.Gear.chocks.getValue()) {
if (!pts.Controls.Gear.parkingBrake.getValue()) { if (!notification.parkingBrake) {
# 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 {
@ -188,7 +188,7 @@ var BrakeSystem =
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
}; };
} else { } else {
if (!pts.Controls.Gear.parkingBrake.getValue()) { if (!notification.parkingBrake) {
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;
@ -212,7 +212,7 @@ var BrakeSystem =
RThermalEnergy += (Mass * pts.Gear.compression[2].getValue() * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); RThermalEnergy += (Mass * pts.Gear.compression[2].getValue() * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
if (pts.Controls.Gear.chocks.getValue()) { if (pts.Controls.Gear.chocks.getValue()) {
if (!pts.Controls.Gear.parkingBrake.getValue()) { if (!notification.parkingBrake) {
# 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 {
@ -221,7 +221,7 @@ var BrakeSystem =
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
}; };
} else { } else {
if (!pts.Controls.Gear.parkingBrake.getValue()) { if (!notification.parkingBrake) {
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;
@ -271,7 +271,7 @@ var BrakeSystem =
if (LThermalEnergy>1 and !me.LSmokeActive) { if (LThermalEnergy>1 and !me.LSmokeActive) {
# start smoke processing # start smoke processing
me.LSmokeActive = 1; me.LSmokeActive = 1;
settimer(func { BrakeSys.Lsmoke(); },0); settimer(func { BrakeSys.Lsmoke(); },0); # is settimer needed?
}; };
if (RThermalEnergy>1 and !me.RSmokeActive) { if (RThermalEnergy>1 and !me.RSmokeActive) {
# start smoke processing # start smoke processing
@ -406,7 +406,7 @@ var Autobrake = {
me._mode = me.mode.getValue(); me._mode = me.mode.getValue();
me._active = me.active.getBoolValue(); me._active = me.active.getBoolValue();
if (me._gnd_speed > 72) { 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 and systems.HYD.Brakes.askidSw.getValue() and systems.HYD.Psi.green.getValue() >= 2500 ) { 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.Switch.nwsSwitch.getBoolValue() and systems.HYD.Psi.green.getValue() >= 2500 ) {
me.active.setBoolValue(1); me.active.setBoolValue(1);
} elsif (me._active) { } elsif (me._active) {
me.active.setBoolValue(0); me.active.setBoolValue(0);

View file

@ -13,8 +13,6 @@ var dc2 = 0;
# Main class # Main class
var ELEC = { var ELEC = {
_timer1On: 0,
_timer2On: 0,
EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"), EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"),
Bus: { Bus: {
acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"), acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"),
@ -207,36 +205,65 @@ var ELEC = {
me.Fail.tr1Fault.setBoolValue(0); me.Fail.tr1Fault.setBoolValue(0);
me.Fail.tr2Fault.setBoolValue(0); me.Fail.tr2Fault.setBoolValue(0);
}, },
loop: func() { _FMGC1: 0,
_FMGC2: 0,
_activeFMGC: nil,
_timer1On: 0,
_timer2On: 0,
loop: func(notification) {
# Autopilot Disconnection routines # Autopilot Disconnection routines
if (me.Bus.dcEssShed.getValue() < 25) { me._activeFMGC = fcu.FCUController.activeFMGC.getValue();
if (fmgc.Output.ap1.getValue() and !me._timer1On) { me._FMGC1 = fmgc.Output.ap1.getValue();
me._FMGC2 = fmgc.Output.ap2.getValue();
if (notification.dcEssShed < 25) {
if (me._FMGC1 and !me._timer1On) { # delay 1 cycle to avoid spurious
me._timer1On = 1; me._timer1On = 1;
settimer(func() { } elsif (me._FMGC1) {
if (me.Bus.dcEssShed.getValue() < 25) { if (notification.dcEssShed < 25) {
fcu.apOff("hard", 1); fcu.apOff("hard", 1);
if (fcu.FCUController.activeFMGC.getValue() == 1) { if (me._activeFMGC == 1) {
fcu.athrOff("hard"); fcu.athrOff("hard");
} }
} }
me._timer1On = 0; me._timer1On = 0;
}, 0.1);
} }
} }
if (me.Bus.dc2.getValue() < 25) { if (notification.dc2 < 25) {
if (fmgc.Output.ap2.getValue() and !me._timer2On) { if (me._FMGC2 and !me._timer2On) { # delay 1 cycle to avoid spurious
me._timer2On = 1; me._timer2On = 1;
settimer(func() { } elsif (me._FMGC2) {
if (me.Bus.dc2.getValue() < 25) { if (notification.dc2 < 25) {
fcu.apOff("hard", 2); fcu.apOff("hard", 2);
if (fcu.FCUController.activeFMGC.getValue() == 2) { if (me._activeFMGC == 2) {
fcu.athrOff("hard"); fcu.athrOff("hard");
} }
} }
me._timer2On = 0; me._timer2On = 0;
}, 0.1);
} }
} }
}, },
};
# Emesary
var A320Electrical = notifications.SystemRecipient.new("A320 Electrical",ELEC.loop,ELEC);
emesary.GlobalTransmitter.Register(A320Electrical);
var input = {
"elecAC1": "/systems/electrical/bus/ac-1",
"elecAC2": "/systems/electrical/bus/ac-2",
"elecACEss": "/systems/electrical/bus/ac-ess",
"elecACEssShed": "/systems/electrical/bus/ac-ess-shed",
"dc1": "/systems/electrical/bus/dc-1",
"dc2": "/systems/electrical/bus/dc-2",
"dcBat": "/systems/electrical/bus/dc-bat",
"dcEss": "/systems/electrical/bus/dc-ess",
"dcEssShed": "/systems/electrical/bus/dc-ess-shed",
"dcHot1": "/systems/electrical/bus/dc-hot-1",
"dcHot2": "/systems/electrical/bus/dc-hot-2",
};
foreach (var name; keys(input)) {
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Electrical", name, input[name]));
} }

View file

@ -10,7 +10,6 @@ var HYD = {
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"),
rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"), 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"), mode: props.globals.initNode("/systems/hydraulic/brakes/mode", 0, "INT"),
leftbrake: props.globals.getNode("/controls/gear/brake-left"), leftbrake: props.globals.getNode("/controls/gear/brake-left"),
rightbrake: props.globals.getNode("/controls/gear/brake-right"), rightbrake: props.globals.getNode("/controls/gear/brake-right"),
@ -57,6 +56,7 @@ var HYD = {
rat: props.globals.getNode("/controls/hydraulic/switches/rat-man"), rat: props.globals.getNode("/controls/hydraulic/switches/rat-man"),
yellowEDP: props.globals.getNode("/controls/hydraulic/switches/yellow-edp"), yellowEDP: props.globals.getNode("/controls/hydraulic/switches/yellow-edp"),
yellowElec: props.globals.getNode("/controls/hydraulic/switches/yellow-elec"), yellowElec: props.globals.getNode("/controls/hydraulic/switches/yellow-elec"),
nwsSwitch: props.globals.getNode("/controls/gear/nws-switch"),
}, },
Valve: { Valve: {
yellowFire: props.globals.getNode("/systems/hydraulic/sources/yellow-edp/fire-valve"), yellowFire: props.globals.getNode("/systems/hydraulic/sources/yellow-edp/fire-valve"),
@ -85,97 +85,91 @@ var HYD = {
me.Fail.yellowElec.setBoolValue(0); me.Fail.yellowElec.setBoolValue(0);
me.Fail.yellowLeak.setBoolValue(0); me.Fail.yellowLeak.setBoolValue(0);
}, },
loop: func() { loop: func(notification) {
if (props.globals.getValue("/controls/gear/nws-switch") == 1) {
me.Brakes.askidSw.setBoolValue(1); #true
} else {
me.Brakes.askidSw.setBoolValue(0); #false
}
# Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized # Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) {
lcont = lcont + 1; lcont = lcont + 1;
} else { } else {
lcont = 0; lcont = 0;
} }
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) {
rcont = rcont + 1; rcont = rcont + 1;
} else { } else {
rcont = 0; rcont = 0;
} }
if (me.Psi.yellow.getValue() < me.Brakes.accumPressPsi.getValue() and me.Brakes.accumPressPsi.getValue() > 0) { if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) {
if (lcont == 1) { if (lcont == 1) {
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
} }
if (rcont == 1) { if (rcont == 1) {
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
} }
if (me.Brakes.accumPressPsi.getValue() < 0) { if (notification.accumPressPsi < 0) {
me.Brakes.accumPressPsi.setValue(0); me.Brakes.accumPressPsi.setValue(0);
} }
} }
# Braking Pressure # Braking Pressure
if (me.Brakes.mode.getValue() == 1 or (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() >= 2500)) { if (notification.brakesMode == 1 or (notification.brakesMode == 2 and notification.green >= 2500)) {
# Normal braking - Green OK # Normal braking - Green OK
if (me.Brakes.leftbrake.getValue() > 0) { if (notification.leftBrake > 0) {
me.Brakes.leftPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); me.Brakes.leftPressPsi.setValue(notification.green * notification.leftBrakeFCS);
} else { } else {
me.Brakes.leftPressPsi.setValue(0); me.Brakes.leftPressPsi.setValue(0);
} }
if (me.Brakes.rightbrake.getValue() > 0) { if (notification.rightBrake > 0) {
me.Brakes.rightPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); me.Brakes.rightPressPsi.setValue(notification.green * notification.rightBrakeFCS);
} else { } else {
me.Brakes.rightPressPsi.setValue(0); me.Brakes.rightPressPsi.setValue(0);
} }
} else { } else {
if ((me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) or me.Brakes.mode.getValue() == 0) { if ((notification.brakesMode == 2 and notification.green < 2500) or notification.brakesMode == 0) {
# Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO # 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 (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (notification.yellow >= 2500 and notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) {
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.leftBrake > 0 or notification.brakesMode == 0) {
me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); me.Brakes.leftPressPsi.setValue(notification.yellow * notification.leftBrakeFCS);
} else { } else {
me.Brakes.leftPressPsi.setValue(0); me.Brakes.leftPressPsi.setValue(0);
} }
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.rightBrake > 0 or notification.brakesMode == 0) {
me.Brakes.rightPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); me.Brakes.rightPressPsi.setValue(notification.yellow * notification.rightBrakeFCS);
} else { } else {
me.Brakes.rightPressPsi.setValue(0); me.Brakes.rightPressPsi.setValue(0);
} }
} else { } else {
# Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO # 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 (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (notification.yellow >= 2500 and !notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) {
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.leftBrake > 0 or notification.brakesMode == 0) {
me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS);
} else { } else {
me.Brakes.leftPressPsi.setValue(0); me.Brakes.leftPressPsi.setValue(0);
} }
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.rightBrake > 0 or notification.brakesMode == 0) {
me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS);
} else { } else {
me.Brakes.rightPressPsi.setValue(0); me.Brakes.rightPressPsi.setValue(0);
} }
} else { } else {
# Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO # Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO
if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcEss.getValue() < 24))) { if (notification.accumPressPsi < 1000 and (notification.yellow < 2500 or !notification.NWSSwitch or (notification.dc1 < 24 and notification.dc2 < 24 and notification.dcEss < 24))) {
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.leftBrake > 0 or notification.brakesMode == 0) {
me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); me.Brakes.leftPressPsi.setValue(notification.accumPressPsi * notification.leftBrakeFCS);
} else { } else {
me.Brakes.leftPressPsi.setValue(0); me.Brakes.leftPressPsi.setValue(0);
} }
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.rightBrake > 0 or notification.brakesMode == 0) {
me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); me.Brakes.rightPressPsi.setValue(notification.accumPressPsi * notification.rightBrakeFCS);
} else { } else {
me.Brakes.rightPressPsi.setValue(0); me.Brakes.rightPressPsi.setValue(0);
} }
} else { } else {
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.leftBrake > 0 or notification.brakesMode == 0) {
me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS);
} else { } else {
me.Brakes.leftPressPsi.setValue(0); me.Brakes.leftPressPsi.setValue(0);
} }
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { if (notification.rightBrake > 0 or notification.brakesMode == 0) {
me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS);
} else { } else {
me.Brakes.rightPressPsi.setValue(0); me.Brakes.rightPressPsi.setValue(0);
} }
@ -192,3 +186,25 @@ setlistener("/controls/gear/gear-down", func {
pts.Controls.Gear.gearDown.setValue(1); pts.Controls.Gear.gearDown.setValue(1);
} }
}); });
# Emesary
var A320Hydraulic = notifications.SystemRecipient.new("A320 Hydraulic",HYD.loop,HYD);
emesary.GlobalTransmitter.Register(A320Hydraulic);
var input = {
"blue": "/systems/hydraulic/blue-psi",
"green": "/systems/hydraulic/green-psi",
"yellow": "/systems/hydraulic/yellow-psi",
"brakesMode": "/systems/hydraulic/brakes/mode",
"accumPressPsi": "/systems/hydraulic/yellow-accumulator-psi-cmd",
"leftBrake": "/controls/gear/brake-left",
"rightBrake": "/controls/gear/brake-right",
"leftBrakeFCS": "/fdm/jsbsim/fcs/left-brake-cmd-norm",
"rightBrakeFCS": "/fdm/jsbsim/fcs/right-brake-cmd-norm",
"NWSSwitch": "/controls/gear/nws-switch",
};
foreach (var name; keys(input)) {
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Hydraulic", name, input[name]));
}

View file

@ -161,9 +161,9 @@ var PNEU = {
me.Fail.trimValveFwd.setBoolValue(0); me.Fail.trimValveFwd.setBoolValue(0);
me.Fail.xbleed.setBoolValue(0); me.Fail.xbleed.setBoolValue(0);
}, },
loop: func() { loop: func(notification) {
wowl = getprop("gear/gear[1]/wow"); wowl = notification.gear1Wow;
wowr = getprop("gear/gear[2]/wow"); wowr = notification.gear2Wow;
# Legacy pressurization # Legacy pressurization
cabinalt = getprop("/systems/pressurization/cabinalt"); cabinalt = getprop("/systems/pressurization/cabinalt");

View file

@ -101,3 +101,27 @@ var frameNotification = FrameNotification.new(1);
# 5 = ECAM # 5 = ECAM
# 7 = FWC phases # 7 = FWC phases
# 10 = ECAM messages # 10 = ECAM messages
var SystemRecipient =
{
new: func(_ident,loopFunc, instance)
{
var NewSystemRecipient = emesary.Recipient.new(_ident);
NewSystemRecipient.Receive = func(notification)
{
if (notification.NotificationType == "FrameNotification")
{
if (math.mod(notifications.frameNotification.FrameCount,5) == 0) {
call(loopFunc,[notification],instance, nil, var errors = []);
if (size(errors) > 0) {
debug.printerror(errors);
}
}
return emesary.Transmitter.ReceiptStatus_OK;
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
return NewSystemRecipient;
},
};

View file

@ -42,13 +42,14 @@ input = {
frame_rate: "/sim/frame-rate", frame_rate: "/sim/frame-rate",
elapsedTime: "/sim/time/elapsed-sec", elapsedTime: "/sim/time/elapsed-sec",
FWCPhase: "/ECAM/warning-phase", FWCPhase: "/ECAM/warning-phase",
gear0Wow: "/gear/gear[0]/wow",
# Just about everything uses these properties at some stage, lets add them here! # Just about everything uses these properties at some stage, lets add them here!
elecAC1: "/systems/electrical/bus/ac-1", gear0Wow: "/gear/gear[0]/wow",
elecAC2: "/systems/electrical/bus/ac-2", gear1Wow: "/gear/gear[1]/wow",
elecACEss: "/systems/electrical/bus/ac-ess", gear2Wow: "/gear/gear[2]/wow",
elecACEssShed: "/systems/electrical/bus/ac-ess-shed", parkingBrake: "/controls/gear/brake-parking",
airspeedV: "/velocities/airspeed-kt",
groundspeed: "/velocities/groundspeed-kt",
engine1State: "/engines/engine[0]/state", engine1State: "/engines/engine[0]/state",
engine2State: "/engines/engine[1]/state", engine2State: "/engines/engine[1]/state",
}; };

View file

@ -528,12 +528,12 @@
<default value="0"/> <default value="0"/>
<test logic="AND" value="1"> <test logic="AND" value="1">
/controls/gear/brake-parking ne 1 /controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1 /controls/gear/nws-switch eq 1
/systems/hydraulic/green-psi ge 2500 /systems/hydraulic/green-psi ge 2500
</test> </test>
<test logic="AND" value="2"> <test logic="AND" value="2">
/controls/gear/brake-parking ne 1 /controls/gear/brake-parking ne 1
/systems/hydraulic/brakes/askidnwssw eq 1 /controls/gear/nws-switch eq 1
/systems/hydraulic/yellow-psi ge 2500 /systems/hydraulic/yellow-psi ge 2500
</test> </test>
<test logic="AND" value="2"> <test logic="AND" value="2">