Skip to content

Commit

Permalink
JSBSIM Misc file added.
Browse files Browse the repository at this point in the history
  • Loading branch information
legoboyvdlp committed Sep 12, 2020
1 parent a1b5edf commit f5c66d6
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 84 deletions.
1 change: 1 addition & 0 deletions A320-100-CFM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/>
<system file="a320-apu"/>
<system file="a320-fmgc"/>
<system file="a320-misc"/>

<flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/>
Expand Down
1 change: 1 addition & 0 deletions A320-200-CFM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/>
<system file="a320-apu"/>
<system file="a320-fmgc"/>
<system file="a320-misc"/>

<flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/>
Expand Down
1 change: 1 addition & 0 deletions A320-200-IAE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/>
<system file="a320-apu"/>
<system file="a320-fmgc"/>
<system file="a320-misc"/>

<flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/>
Expand Down
1 change: 1 addition & 0 deletions A320neo-CFM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/>
<system file="a320-apu"/>
<system file="a320-fmgc"/>
<system file="a320-misc"/>

<flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/>
Expand Down
1 change: 1 addition & 0 deletions A320neo-PW.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="a320-adr"/>
<system file="a320-apu"/>
<system file="a320-fmgc"/>
<system file="a320-misc"/>

<flight_control name="none"/>
<aerodynamics file="Systems/a320-aerodynamics.xml"/>
Expand Down
66 changes: 56 additions & 10 deletions Models/Instruments/OHpanel/OHpanel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7204,14 +7204,37 @@
<repeatable>false</repeatable>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<or>
<not>
<property>gear/gear[1]/wow</property>
</not>
<equals>
<property>/engines/engine[0]/state</property>
<value>3</value>
</equals>
<equals>
<property>/engines/engine[1]/state</property>
<value>3</value>
</equals>
</or>
</and>
</condition>
<command>property-toggle</command>
<command>property-assign</command>
<property>controls/switches/LrainRpt</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/switches/LrainRpt</property>
<value>0</value>
</binding>
</mod-up>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/oh-btn", 1);</script>
Expand All @@ -7227,14 +7250,37 @@
<repeatable>false</repeatable>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-2</property>
<value>25</value>
</greater-than-equals>
<or>
<not>
<property>gear/gear[1]/wow</property>
</not>
<equals>
<property>/engines/engine[0]/state</property>
<value>3</value>
</equals>
<equals>
<property>/engines/engine[1]/state</property>
<value>3</value>
</equals>
</or>
</and>
</condition>
<command>property-toggle</command>
<command>property-assign</command>
<property>controls/switches/RrainRpt</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/switches/RrainRpt</property>
<value>0</value>
</binding>
</mod-up>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/oh-btn", 1);</script>
Expand Down
113 changes: 42 additions & 71 deletions Nasal/Libraries/buttons.nas
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,78 @@

var wow = nil;
var wowr = nil;
var Lrain = props.globals.getNode("/controls/switches/LrainRpt");
var Rrain = props.globals.getNode("/controls/switches/RrainRpt");
var OnLt = props.globals.getNode("/controls/switches/emerCallLtO");
var CallLt = props.globals.getNode("/controls/switches/emerCallLtC");
var EmerCall = props.globals.getNode("/controls/switches/emerCall");
var CabinCall = props.globals.getNode("/controls/switches/cabinCall");
var MechCall = props.globals.getNode("/controls/switches/mechCall");
var cvr_gndCtl = props.globals.getNode("/controls/CVR/gndctl");
var cvr_power = props.globals.getNode("/controls/CVR/power");
var cvr_tone = props.globals.getNode("/controls/CVR/tone");

# Resets buttons to the default values
var variousReset = func {
setprop("modes/cpt-du-xfr", 0);
setprop("modes/fo-du-xfr", 0);
setprop("controls/fadec/n1mode1", 0);
setprop("controls/fadec/n1mode2", 0);
setprop("/controls/fadec/n1mode1", 0);
setprop("/controls/fadec/n1mode2", 0);
setprop("instrumentation/mk-viii/serviceable", 1);
setprop("instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/gpws-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/glideslope-inhibit", 0);
setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", 0);
setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0);
setprop("controls/switches/cabinCall", 0);
setprop("controls/switches/mechCall", 0);
setprop("controls/switches/emer-lights", 0.5);
setprop("/controls/switches/cabinCall", 0);
setprop("/controls/switches/mechCall", 0);
setprop("/controls/switches/emer-lights", 0.5);
# cockpit voice recorder stuff
setprop("controls/CVR/power", 0);
setprop("controls/CVR/test", 0);
setprop("controls/CVR/tone", 0);
setprop("controls/CVR/gndctl", 0);
setprop("controls/CVR/erase", 0);
setprop("controls/switches/pneumatics/cabin-fans", 1);
setprop("controls/oxygen/crewOxyPB", 1); # 0 = OFF 1 = AUTO
setprop("controls/switches/emerCallLtO", 0); # ON light, flashes white for 10s
setprop("controls/switches/emerCallLtC", 0); # CALL light, flashes amber for 10s
setprop("controls/switches/emerCall", 0);
setprop("controls/switches/LrainRpt", 0);
setprop("controls/switches/RrainRpt", 0);
setprop("controls/switches/wiperLspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("controls/switches/wiperRspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("controls/lighting/strobe", 0);
setprop("controls/lighting/beacon", 0);
setprop("controls/switches/beacon", 0);
setprop("controls/switches/wing-lights", 0);
setprop("controls/switches/landing-lights-l", 0);
setprop("controls/switches/landing-lights-r", 0);
setprop("controls/lighting/wing-lights", 0);
setprop("controls/lighting/nav-lights-switch", 0);
setprop("controls/lighting/landing-lights[1]", 0);
setprop("controls/lighting/landing-lights[2]", 0);
setprop("controls/lighting/taxi-light-switch", 0);
setprop("controls/lighting/DU/du1", 1);
setprop("controls/lighting/DU/du2", 1);
setprop("controls/lighting/DU/du3", 1);
setprop("controls/lighting/DU/du4", 1);
setprop("controls/lighting/DU/du5", 1);
setprop("controls/lighting/DU/du6", 1);
setprop("controls/lighting/DU/mcdu1", 1);
setprop("controls/lighting/DU/mcdu2", 1);
setprop("/controls/CVR/power", 0);
setprop("/controls/CVR/test", 0);
setprop("/controls/CVR/tone", 0);
setprop("/controls/CVR/gndctl", 0);
setprop("/controls/CVR/erase", 0);
setprop("/controls/switches/pneumatics/cabin-fans", 1);
setprop("/controls/oxygen/crewOxyPB", 1); # 0 = OFF 1 = AUTO
setprop("/controls/switches/emerCallLtO", 0); # ON light, flashes white for 10s
setprop("/controls/switches/emerCallLtC", 0); # CALL light, flashes amber for 10s
setprop("/controls/switches/emerCall", 0);
setprop("/controls/switches/LrainRpt", 0);
setprop("/controls/switches/RrainRpt", 0);
setprop("/controls/switches/wiperLspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("/controls/switches/wiperRspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("/controls/lighting/strobe", 0);
setprop("/controls/lighting/beacon", 0);
setprop("/controls/switches/beacon", 0);
setprop("/controls/switches/wing-lights", 0);
setprop("/controls/switches/landing-lights-l", 0);
setprop("/controls/switches/landing-lights-r", 0);
setprop("/controls/lighting/wing-lights", 0);
setprop("/controls/lighting/nav-lights-switch", 0);
setprop("/controls/lighting/landing-lights[1]", 0);
setprop("/controls/lighting/landing-lights[2]", 0);
setprop("/controls/lighting/taxi-light-switch", 0);
setprop("/controls/lighting/DU/du1", 1);
setprop("/controls/lighting/DU/du2", 1);
setprop("/controls/lighting/DU/du3", 1);
setprop("/controls/lighting/DU/du4", 1);
setprop("/controls/lighting/DU/du5", 1);
setprop("/controls/lighting/DU/du6", 1);
setprop("/controls/lighting/DU/mcdu1", 1);
setprop("/controls/lighting/DU/mcdu2", 1);
setprop("modes/fcu/hdg-time", -45);
setprop("controls/switching/ATTHDG", 0);
setprop("controls/switching/AIRDATA", 0);
setprop("controls/switches/no-smoking-sign", 1);
setprop("controls/switches/seatbelt-sign", 1);
setprop("/controls/switching/ATTHDG", 0);
setprop("/controls/switching/AIRDATA", 0);
setprop("/controls/switches/no-smoking-sign", 1);
setprop("/controls/switches/seatbelt-sign", 1);
}

var BUTTONS = {
update: func() {
rainRepel();
CVR_master();
if (EmerCall.getValue()) {
EmerCallOnLight();
EmerCallLight();
}
},
};

var rainRepel = func() {
if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3 and pts.Gear.wow[0].getValue()) {
if (Lrain.getValue()) {
Lrain.setValue(0);
}
if (Rrain.getValue()) {
Rrain.setValue(0);
}
}
}

var _OnLt = nil;
var _EmerCall = nil;

Expand All @@ -120,18 +103,6 @@ var EmerCallLight = func() {
}
}

var CVR_master = func() {
wow = pts.Gear.wow[0].getValue();
wowr = pts.Gear.wow[1].getValue();
if (systems.ELEC.Bus.acEss.getValue() > 0 and wow and wowr and (cvr_gndCtl.getValue() or (pts.Engines.Engine.state[0].getValue() == 3 or pts.Engines.Engine.state[1].getValue() == 3))) {
cvr_power.setValue(1);
} else if (!wow and !wowr and systems.ELEC.Bus.acEss.getValue() > 0) {
cvr_power.setValue(1);
} else {
cvr_power.setValue(0);
}
}

var EmerCallFunc = func {
EmerCall.setValue(1);
settimer(func() {
Expand Down
6 changes: 3 additions & 3 deletions Nasal/Libraries/libraries.nas
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ var systemsLoop = maketimer(0.1, func {
systems.PNEU.loop();
systems.HYD.loop();
systems.ADIRS.loop();
systems.APUController.loop();
ecam.ECAM.loop();
libraries.BUTTONS.update();
fadec.FADEC.loop();
rmp.rmpUpdate();
fcu.FCUController.loop();
dmc.DMController.loop();
systems.APUController.loop();
systems.HFLoop();
atsu.ATSU.loop();
libraries.BUTTONS.update();
systems.HFLoop();

groundspeed = pts.Velocities.groundspeed.getValue();
if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) {
Expand Down
32 changes: 32 additions & 0 deletions Systems/a320-misc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Airbus A320 Misc Systems -->

<!-- Copyright (c) 2020 Jonathan Redpath -->

<system name="A320: APU">

<channel name="CVR" execrate="8">

<switch name="/controls/CVR/power">
<default value="0"/>
<test logic="AND" value="1">
/systems/electrical/bus/ac-ess ge 110
<test logic="OR">
/gear/gear[1]/wow eq 1
/gear/gear[2]/wow eq 1
</test>
<test logic="OR">
/controls/CVR/gndctl eq 1
/engines/engine[0]/state eq 3
/engines/engine[1]/state eq 3
</test>
</test>
<test logic="AND" value="1">
/systems/electrical/bus/ac-ess ge 110
/gear/gear[1]/wow eq 0
/gear/gear[2]/wow eq 0
</test>
</switch>

</channel>

</system>

0 comments on commit f5c66d6

Please sign in to comment.