Merge remote-tracking branch 'origin/dev' into tcas
This commit is contained in:
commit
cf38d944e8
20 changed files with 184 additions and 125 deletions
|
@ -206,9 +206,9 @@
|
|||
<autopilot n="0">
|
||||
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="10">
|
||||
<property-rule n="100">
|
||||
<path>Aircraft/A320-family/Systems/cfm56-sound.xml</path>
|
||||
</autopilot>
|
||||
</property-rule>
|
||||
</systems>
|
||||
|
||||
</sim>
|
||||
|
|
|
@ -206,9 +206,9 @@
|
|||
<autopilot n="0">
|
||||
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="10">
|
||||
<path>Aircraft/A320-family/Systems/cfm56-sound.xml</path>
|
||||
</autopilot>
|
||||
<property-rule n="100">
|
||||
<path>Aircraft/A320-family/Systems/cfm56-sound.xml</path>
|
||||
</property-rule>
|
||||
</systems>
|
||||
|
||||
</sim>
|
||||
|
|
|
@ -206,9 +206,9 @@
|
|||
<autopilot n="0">
|
||||
<path>Aircraft/A320-family/Systems/fadec-iae.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="10">
|
||||
<property-rule n="100">
|
||||
<path>Aircraft/A320-family/Systems/v2500-sound.xml</path>
|
||||
</autopilot>
|
||||
</property-rule>
|
||||
</systems>
|
||||
|
||||
</sim>
|
||||
|
|
|
@ -234,15 +234,15 @@
|
|||
<path>Aircraft/A320-family/Systems/pfd.xml</path>
|
||||
</autopilot>
|
||||
<!-- 10 is sound -->
|
||||
<autopilot n="11">
|
||||
<property-rule n="101">
|
||||
<path>Aircraft/A320-family/Systems/sound-common.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="12">
|
||||
</property-rule>
|
||||
<property-rule n="110">
|
||||
<path>Aircraft/A320-family/Systems/a320-lights-proprules.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="13">
|
||||
</property-rule>
|
||||
<property-rule n="111">
|
||||
<path>Aircraft/A320-family/Systems/ecam-proprules.xml</path>
|
||||
</autopilot>
|
||||
</property-rule>
|
||||
<path>Aircraft/A320-family/Systems/pitot-static.xml</path>
|
||||
</systems>
|
||||
|
||||
|
|
|
@ -206,9 +206,9 @@
|
|||
<autopilot n="0">
|
||||
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="10">
|
||||
<property-rule n="100">
|
||||
<path>Aircraft/A320-family/Systems/leapx-sound.xml</path>
|
||||
</autopilot>
|
||||
</property-rule>
|
||||
</systems>
|
||||
|
||||
</sim>
|
||||
|
|
|
@ -206,9 +206,9 @@
|
|||
<autopilot n="0"> <!-- Apparently PW PurePower uses N1, not EPR.... sooo I use CFM FADEC -->
|
||||
<path>Aircraft/A320-family/Systems/fadec-cfm.xml</path>
|
||||
</autopilot>
|
||||
<autopilot n="10">
|
||||
<property-rule n="100">
|
||||
<path>Aircraft/A320-family/Systems/leapx-sound.xml</path>
|
||||
</autopilot>
|
||||
</property-rule>
|
||||
</systems>
|
||||
|
||||
</sim>
|
||||
|
|
|
@ -261,8 +261,6 @@ var input = {
|
|||
"altitude_ind": "/instrumentation/altimeter/indicated-altitude-ft-pfd",
|
||||
"altimeter_mode": "/instrumentation/altimeter[0]/std",
|
||||
"attReset": "/instrumentation/iesi/att-reset",
|
||||
"dcEss": "/systems/electrical/bus/dc-ess",
|
||||
"dcHot1": "/systems/electrical/bus/dc-hot-1",
|
||||
"iesiBrt": "/controls/lighting/DU/iesi",
|
||||
"iesiInit": "/instrumentation/iesi/iesi-init",
|
||||
"mach": "/instrumentation/airspeed-indicator/indicated-mach",
|
||||
|
|
|
@ -3010,7 +3010,7 @@ var canvas_lowerECAM_wheel = {
|
|||
rightdoor = gear_door_R.getValue();
|
||||
nosedoor = gear_door_N.getValue();
|
||||
gearlvr = gear_down.getValue();
|
||||
askidsw = systems.HYD.Brakes.askidSw.getBoolValue();
|
||||
askidsw = systems.HYD.Switch.nwsSwitch.getBoolValue();
|
||||
brakemode = systems.HYD.Brakes.mode.getBoolValue();
|
||||
accum = systems.HYD.Brakes.accumPressPsi.getBoolValue();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ var FCUController = {
|
|||
me.FCU2 = FCU.new(systems.ELEC.Bus.dc2);
|
||||
me._init = 1;
|
||||
},
|
||||
loop: func() {
|
||||
loop: func(notification) {
|
||||
if (me._init == 0) { return; }
|
||||
|
||||
# Update FCU Power
|
||||
|
@ -82,11 +82,11 @@ var FCUController = {
|
|||
}
|
||||
|
||||
foreach (var update_item; me.update_items) {
|
||||
update_item.update(nil);
|
||||
update_item.update(notification);
|
||||
}
|
||||
},
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -174,19 +174,18 @@ var update_items = [
|
|||
|
||||
var systemsLoop = func(notification) {
|
||||
if (!systemsInitialized) { return; }
|
||||
systems.ELEC.loop();
|
||||
systems.PNEU.loop();
|
||||
systems.HYD.loop();
|
||||
systems.ADIRS.loop();
|
||||
systems.PNEU.loop(notification);
|
||||
systems.ADIRS.loop(notification);
|
||||
systems.BrakeSys.update(notification);
|
||||
systems.HFLoop(notification);
|
||||
systems.APUController.loop();
|
||||
systems.BrakeSys.update();
|
||||
fadec.FADEC.loop();
|
||||
rmp.rmpUpdate();
|
||||
fcu.FCUController.loop();
|
||||
fcu.FCUController.loop(notification);
|
||||
atc.Transponders.vector[atc.transponderPanel.atcSel - 1].update(notification);
|
||||
dmc.DMController.loop();
|
||||
atsu.ATSU.loop();
|
||||
libraries.BUTTONS.update();
|
||||
systems.HFLoop(notification);
|
||||
|
||||
if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) {
|
||||
systems.cutoff_one();
|
||||
|
|
|
@ -24,7 +24,6 @@ var Transponder = {
|
|||
serviceableNode: props.globals.getNode("/instrumentation/transponder/serviceable", 1),
|
||||
knobNode: props.globals.getNode("/instrumentation/transponder/inputs/knob-mode", 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"),
|
||||
aglNode: props.globals.getNode("/position/gear-agl-ft", 1),
|
||||
electricNode: props.globals.getNode("/systems/electrical/outputs/transponder", 1), # communicate to generic systems
|
||||
|
@ -40,9 +39,9 @@ var Transponder = {
|
|||
|
||||
return t;
|
||||
},
|
||||
update: func() {
|
||||
update: func(notification) {
|
||||
# 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
|
||||
} else {
|
||||
if (me.mode >= 1 and me.mode <= 3) {
|
||||
|
@ -285,7 +284,6 @@ var transponderPanel = {
|
|||
var init = func() {
|
||||
transponderPanel.atcSwitch(1);
|
||||
transponderPanel.updateAirData();
|
||||
transponderTimer.start();
|
||||
}
|
||||
|
||||
# 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 transponderTimer = maketimer(0.1, func() {
|
||||
Transponders.vector[transponderPanel.atcSel - 1].update();
|
||||
});
|
||||
|
||||
setlistener("/systems/navigation/adr/operating-1", func() {
|
||||
transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue());
|
||||
|
|
|
@ -324,7 +324,7 @@ var ADIRS = {
|
|||
}
|
||||
),
|
||||
],
|
||||
loop: func() {
|
||||
loop: func(notification) {
|
||||
if (me._init) {
|
||||
for (i = 0; i < _NUMADIRU; i = i + 1) {
|
||||
# update ADR units power
|
||||
|
@ -348,7 +348,6 @@ var ADIRS = {
|
|||
}
|
||||
|
||||
# Update VFE
|
||||
notification = nil;
|
||||
foreach (var update_item; me.update_items) {
|
||||
update_item.update(notification);
|
||||
}
|
||||
|
|
|
@ -448,4 +448,4 @@ setlistener("/systems/thrust/thr-locked", func {
|
|||
}, 0, 0);
|
||||
|
||||
var lockTimer = maketimer(0.1, checkLockThr);
|
||||
var lockTimer2 = maketimer(0.1, checkLockThr2);
|
||||
var lockTimer2 = maketimer(0.1, checkLockThr2);
|
|
@ -111,7 +111,7 @@ var BrakeSystem =
|
|||
},
|
||||
|
||||
# update brake energy
|
||||
update : func()
|
||||
update : func(notification)
|
||||
{
|
||||
if (me.counter == 0) {
|
||||
me.counter = 1;
|
||||
|
@ -122,10 +122,10 @@ var BrakeSystem =
|
|||
|
||||
LThermalEnergy = me.thermalEnergy[0];
|
||||
RThermalEnergy = me.thermalEnergy[1];
|
||||
me.CurrentTime = pts.Sim.Time.elapsedSec.getValue();
|
||||
me.CurrentTime = notification.elapsedTime;
|
||||
dt = me.CurrentTime - me.LastSimTime;
|
||||
LBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[0].getValue();
|
||||
RBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[1].getValue();
|
||||
LBrakeLevel = notification.leftBrakeFCS;
|
||||
RBrakeLevel = notification.rightBrakeFCS;
|
||||
tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
|
||||
|
||||
if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) {
|
||||
|
@ -137,7 +137,7 @@ var BrakeSystem =
|
|||
LCoolingRatio = LCoolingRatio * 3;
|
||||
RCoolingRatio = RCoolingRatio * 3;
|
||||
};
|
||||
airspeed = pts.Velocities.airspeed.getValue();
|
||||
airspeed = notification.airspeedV;
|
||||
if (pts.Gear.position[1].getValue()) {
|
||||
#increase CoolingRatio if gear down according to airspeed
|
||||
LCoolingRatio = LCoolingRatio * airspeed;
|
||||
|
@ -168,7 +168,7 @@ var BrakeSystem =
|
|||
L_Thrust = 0;
|
||||
R_Thrust = 0;
|
||||
|
||||
if (pts.Gear.wow[1].getValue()) {
|
||||
if (notification.gear1Wow) {
|
||||
var V1 = pts.Velocities.groundspeed.getValue();
|
||||
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);
|
||||
if (pts.Controls.Gear.chocks.getValue()) {
|
||||
if (!pts.Controls.Gear.parkingBrake.getValue()) {
|
||||
if (!notification.parkingBrake) {
|
||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ var BrakeSystem =
|
|||
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
||||
};
|
||||
} else {
|
||||
if (!pts.Controls.Gear.parkingBrake.getValue()) {
|
||||
if (!notification.parkingBrake) {
|
||||
if (LBrakeLevel>0) {
|
||||
if (V2_L>0) {
|
||||
#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);
|
||||
if (pts.Controls.Gear.chocks.getValue()) {
|
||||
if (!pts.Controls.Gear.parkingBrake.getValue()) {
|
||||
if (!notification.parkingBrake) {
|
||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ var BrakeSystem =
|
|||
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
||||
};
|
||||
} else {
|
||||
if (!pts.Controls.Gear.parkingBrake.getValue()) {
|
||||
if (!notification.parkingBrake) {
|
||||
if (RBrakeLevel>0) {
|
||||
if (V2_R>0) {
|
||||
#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) {
|
||||
# start smoke processing
|
||||
me.LSmokeActive = 1;
|
||||
settimer(func { BrakeSys.Lsmoke(); },0);
|
||||
settimer(func { BrakeSys.Lsmoke(); },0); # is settimer needed?
|
||||
};
|
||||
if (RThermalEnergy>1 and !me.RSmokeActive) {
|
||||
# start smoke processing
|
||||
|
@ -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 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);
|
||||
} elsif (me._active) {
|
||||
me.active.setBoolValue(0);
|
||||
|
|
|
@ -13,8 +13,6 @@ var dc2 = 0;
|
|||
|
||||
# Main class
|
||||
var ELEC = {
|
||||
_timer1On: 0,
|
||||
_timer2On: 0,
|
||||
EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"),
|
||||
Bus: {
|
||||
acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"),
|
||||
|
@ -207,36 +205,65 @@ var ELEC = {
|
|||
me.Fail.tr1Fault.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
|
||||
if (me.Bus.dcEssShed.getValue() < 25) {
|
||||
if (fmgc.Output.ap1.getValue() and !me._timer1On) {
|
||||
me._activeFMGC = fcu.FCUController.activeFMGC.getValue();
|
||||
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;
|
||||
settimer(func() {
|
||||
if (me.Bus.dcEssShed.getValue() < 25) {
|
||||
fcu.apOff("hard", 1);
|
||||
if (fcu.FCUController.activeFMGC.getValue() == 1) {
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
} elsif (me._FMGC1) {
|
||||
if (notification.dcEssShed < 25) {
|
||||
fcu.apOff("hard", 1);
|
||||
if (me._activeFMGC == 1) {
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
me._timer1On = 0;
|
||||
}, 0.1);
|
||||
}
|
||||
me._timer1On = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (me.Bus.dc2.getValue() < 25) {
|
||||
if (fmgc.Output.ap2.getValue() and !me._timer2On) {
|
||||
if (notification.dc2 < 25) {
|
||||
if (me._FMGC2 and !me._timer2On) { # delay 1 cycle to avoid spurious
|
||||
me._timer2On = 1;
|
||||
settimer(func() {
|
||||
if (me.Bus.dc2.getValue() < 25) {
|
||||
fcu.apOff("hard", 2);
|
||||
if (fcu.FCUController.activeFMGC.getValue() == 2) {
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
} elsif (me._FMGC2) {
|
||||
if (notification.dc2 < 25) {
|
||||
fcu.apOff("hard", 2);
|
||||
if (me._activeFMGC == 2) {
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
me._timer2On = 0;
|
||||
}, 0.1);
|
||||
}
|
||||
me._timer2On = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
# 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]));
|
||||
}
|
|
@ -10,7 +10,6 @@ var HYD = {
|
|||
accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 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"),
|
||||
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"),
|
||||
|
@ -57,6 +56,7 @@ var HYD = {
|
|||
rat: props.globals.getNode("/controls/hydraulic/switches/rat-man"),
|
||||
yellowEDP: props.globals.getNode("/controls/hydraulic/switches/yellow-edp"),
|
||||
yellowElec: props.globals.getNode("/controls/hydraulic/switches/yellow-elec"),
|
||||
nwsSwitch: props.globals.getNode("/controls/gear/nws-switch"),
|
||||
},
|
||||
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.yellowLeak.setBoolValue(0);
|
||||
},
|
||||
loop: func() {
|
||||
if (props.globals.getValue("/controls/gear/nws-switch") == 1) {
|
||||
me.Brakes.askidSw.setBoolValue(1); #true
|
||||
} else {
|
||||
me.Brakes.askidSw.setBoolValue(0); #false
|
||||
}
|
||||
|
||||
loop: func(notification) {
|
||||
# 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;
|
||||
} else {
|
||||
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;
|
||||
} else {
|
||||
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) {
|
||||
me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200);
|
||||
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
# 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
|
||||
if (me.Brakes.leftbrake.getValue() > 0) {
|
||||
me.Brakes.leftPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue());
|
||||
if (notification.leftBrake > 0) {
|
||||
me.Brakes.leftPressPsi.setValue(notification.green * notification.leftBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.leftPressPsi.setValue(0);
|
||||
}
|
||||
if (me.Brakes.rightbrake.getValue() > 0) {
|
||||
me.Brakes.rightPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue());
|
||||
if (notification.rightBrake > 0) {
|
||||
me.Brakes.rightPressPsi.setValue(notification.green * notification.rightBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.rightPressPsi.setValue(0);
|
||||
}
|
||||
} 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
|
||||
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 (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue());
|
||||
if (notification.yellow >= 2500 and notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) {
|
||||
if (notification.leftBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(notification.yellow * notification.leftBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.leftPressPsi.setValue(0);
|
||||
}
|
||||
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue());
|
||||
if (notification.rightBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(notification.yellow * notification.rightBrakeFCS);
|
||||
} 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 (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) {
|
||||
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue());
|
||||
if (notification.yellow >= 2500 and !notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) {
|
||||
if (notification.leftBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.leftPressPsi.setValue(0);
|
||||
}
|
||||
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue());
|
||||
if (notification.rightBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.rightPressPsi.setValue(0);
|
||||
}
|
||||
} else {
|
||||
# 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 (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue());
|
||||
if (notification.accumPressPsi < 1000 and (notification.yellow < 2500 or !notification.NWSSwitch or (notification.dc1 < 24 and notification.dc2 < 24 and notification.dcEss < 24))) {
|
||||
if (notification.leftBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(notification.accumPressPsi * notification.leftBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.leftPressPsi.setValue(0);
|
||||
}
|
||||
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue());
|
||||
if (notification.rightBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(notification.accumPressPsi * notification.rightBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.rightPressPsi.setValue(0);
|
||||
}
|
||||
} else {
|
||||
if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue());
|
||||
if (notification.leftBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.leftPressPsi.setValue(0);
|
||||
}
|
||||
if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue());
|
||||
if (notification.rightBrake > 0 or notification.brakesMode == 0) {
|
||||
me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS);
|
||||
} else {
|
||||
me.Brakes.rightPressPsi.setValue(0);
|
||||
}
|
||||
|
@ -192,3 +186,25 @@ setlistener("/controls/gear/gear-down", func {
|
|||
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]));
|
||||
}
|
|
@ -161,9 +161,9 @@ var PNEU = {
|
|||
me.Fail.trimValveFwd.setBoolValue(0);
|
||||
me.Fail.xbleed.setBoolValue(0);
|
||||
},
|
||||
loop: func() {
|
||||
wowl = getprop("gear/gear[1]/wow");
|
||||
wowr = getprop("gear/gear[2]/wow");
|
||||
loop: func(notification) {
|
||||
wowl = notification.gear1Wow;
|
||||
wowr = notification.gear2Wow;
|
||||
|
||||
# Legacy pressurization
|
||||
cabinalt = getprop("/systems/pressurization/cabinalt");
|
||||
|
|
|
@ -100,4 +100,28 @@ var frameNotification = FrameNotification.new(1);
|
|||
# Frame count
|
||||
# 5 = ECAM
|
||||
# 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;
|
||||
},
|
||||
};
|
|
@ -42,13 +42,14 @@ input = {
|
|||
frame_rate: "/sim/frame-rate",
|
||||
elapsedTime: "/sim/time/elapsed-sec",
|
||||
FWCPhase: "/ECAM/warning-phase",
|
||||
gear0Wow: "/gear/gear[0]/wow",
|
||||
|
||||
# Just about everything uses these properties at some stage, lets add them here!
|
||||
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",
|
||||
gear0Wow: "/gear/gear[0]/wow",
|
||||
gear1Wow: "/gear/gear[1]/wow",
|
||||
gear2Wow: "/gear/gear[2]/wow",
|
||||
parkingBrake: "/controls/gear/brake-parking",
|
||||
airspeedV: "/velocities/airspeed-kt",
|
||||
groundspeed: "/velocities/groundspeed-kt",
|
||||
engine1State: "/engines/engine[0]/state",
|
||||
engine2State: "/engines/engine[1]/state",
|
||||
};
|
||||
|
|
|
@ -528,12 +528,12 @@
|
|||
<default value="0"/>
|
||||
<test logic="AND" value="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
|
||||
</test>
|
||||
<test logic="AND" value="2">
|
||||
/controls/gear/brake-parking ne 1
|
||||
/systems/hydraulic/brakes/askidnwssw eq 1
|
||||
/controls/gear/nws-switch eq 1
|
||||
/systems/hydraulic/yellow-psi ge 2500
|
||||
</test>
|
||||
<test logic="AND" value="2">
|
||||
|
|
Loading…
Reference in a new issue