Improved cockpit sounds, implement realistic powerup from battery

This commit is contained in:
Jonathan Redpath 2018-03-22 14:55:00 +00:00
parent 25fb1ae41b
commit c441ce4683
9 changed files with 83 additions and 24 deletions

View file

@ -451,6 +451,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
<system file="pushback" />
<system file="fuel" />
<system file="electrical" />
<system file="glass-effect1" />
<system file="fmgc" />
<system file="a320-fcs" />

View file

@ -43,6 +43,8 @@
<object-name>BatteryBtn22O</object-name>
<object-name>BusTieBtn2O</object-name>
<object-name>DitchBtn2O</object-name>
<object-name>ELAC1Btn1F</object-name>
<object-name>ELAC1Btn2O</object-name>
<object-name>EmerExtLtBtn2O</object-name>
<object-name>Eng1FireAgt1Btn1S</object-name>
<object-name>Eng1FireAgt1Btn2D</object-name>
@ -53,6 +55,8 @@
<object-name>Eng2FireAgt2Btn1S</object-name>
<object-name>Eng2FireAgt2Btn2D</object-name>
<object-name>ExtPwrBtn2O</object-name>
<object-name>FAC1Btn1F</object-name>
<object-name>FAC1Btn2O</object-name>
<object-name>Gen1Btn1F</object-name>
<object-name>Gen1Btn2O</object-name>
<object-name>Gen2Btn1F</object-name>
@ -65,6 +69,8 @@
<object-name>IR3Btn2A</object-name>
<object-name>IrsOnBatLightOB</object-name>
<object-name>RamAirBtn2O</object-name>
<object-name>SEC1Btn1F</object-name>
<object-name>SEC1Btn2O</object-name>
<condition>
<or>
<greater-than-equals>
@ -101,8 +107,6 @@
<object-name>CFuelTank2Btn1F</object-name>
<object-name>CFuelTank2Btn2O</object-name>
<object-name>CrewOxyBtn2O</object-name>
<object-name>ELAC1Btn1F</object-name>
<object-name>ELAC1Btn2O</object-name>
<object-name>ELAC2Btn1F</object-name>
<object-name>ELAC2Btn2O</object-name>
<object-name>EmerCallBtn1C</object-name>
@ -120,8 +124,6 @@
<object-name>Eng2ManStartBtn2O</object-name>
<object-name>EvacCommandBtn1E</object-name>
<object-name>EvacCommandBtn2O</object-name>
<object-name>FAC1Btn1F</object-name>
<object-name>FAC1Btn2O</object-name>
<object-name>FAC2Btn1F</object-name>
<object-name>FAC2Btn2O</object-name>
<object-name>FuelModeBtn1F</object-name>
@ -161,8 +163,6 @@
<object-name>RFuelTank1Btn2O</object-name>
<object-name>RFuelTank2Btn1F</object-name>
<object-name>RFuelTank2Btn2O</object-name>
<object-name>SEC1Btn1F</object-name>
<object-name>SEC1Btn2O</object-name>
<object-name>SEC2Btn1F</object-name>
<object-name>SEC2Btn2O</object-name>
<object-name>SEC3Btn1F</object-name>
@ -2718,6 +2718,10 @@
<command>nasal</command>
<script>setprop("/sim/sounde/oh-btn", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>systems.batflash();</script>
</binding>
</action>
</animation>
@ -2779,6 +2783,10 @@
<command>nasal</command>
<script>setprop("/sim/sounde/oh-btn", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>systems.batflash();</script>
</binding>
</action>
</animation>

View file

@ -187,6 +187,7 @@ var ELEC = {
setprop("/systems/electrical/idg2-fault", 0);
setprop("/controls/electrical/xtie/xtieL", 0);
setprop("/controls/electrical/xtie/xtieR", 0);
setprop("/systems/electrical/battery-available", 0);
# Below are standard FG Electrical stuff to keep things working when the plane is powered
setprop("/systems/electrical/outputs/adf", 0);
setprop("/systems/electrical/outputs/audio-panel", 0);
@ -290,24 +291,16 @@ var ELEC = {
replay = getprop("/sim/replay/replay-state");
wow = getprop("/gear/gear[1]/wow");
if (battery1_sw and !batt1_fail) {
setprop("/systems/electrical/battery1-amps", dc_amps_std);
} else {
setprop("/systems/electrical/battery1-amps", 0);
}
if (battery2_sw and !batt2_fail) {
setprop("/systems/electrical/battery2-amps", dc_amps_std);
} else {
setprop("/systems/electrical/battery2-amps", 0);
}
if (getprop("/systems/electrical/battery1-amps") > 120 or getprop("/systems/electrical/battery2-amps") > 120) {
setprop("/systems/electrical/bus/dcbat", dc_volt_std);
} else {
setprop("/systems/electrical/bus/dcbat", 0);
}
if (battery1_sw == 0 and battery2_sw == 0) {
setprop("/systems/electrical/battery-available", 0);
}
dcbat = getprop("/systems/electrical/bus/dcbat");
if (extpwr_on and gen_ext_sw) {
@ -731,3 +724,20 @@ var decharge2 = maketimer(69, func {
bat2_volts = getprop("/systems/electrical/battery2-volts");
setprop("/systems/electrical/battery2-volts", bat2_volts - 0.1);
});
var batflash = func {
if (getprop("/systems/electrical/battery-available") == 0) {
setprop("/systems/failures/elac1", 1);
setprop("/systems/failures/sec1", 1);
setprop("/systems/failures/fac1", 1);
setprop("/systems/electrical/battery-available", 1);
settimer(func(){
setprop("/systems/failures/elac1", 0);
},1.5);
settimer(func(){
setprop("/systems/failures/sec1", 0);
setprop("/systems/failures/fac1", 0);
},2);
}
}

View file

@ -11,4 +11,9 @@ Present pack includes the following Airbus A320 Family variants:
- A320-214
- A320-232
- A320-251N
- A320-271N
- A320-271N
Thank you to:
Amanda Santos for the sound "botaodepressao", used for the overhead panel under the CC0 license:
https://freesound.org/people/amandasantos/sounds/392148/

View file

@ -1292,7 +1292,7 @@
<relay>
<name>RelayBatt1</name>
<mode>once</mode>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay2.wav</path>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay-battery.wav</path>
<condition>
<greater-than>
<property>/systems/electrical/battery1-amps</property>
@ -1300,14 +1300,14 @@
</greater-than>
</condition>
<volume>
<factor>0.60</factor>
<factor>0.80</factor>
</volume>
</relay>
<relay>
<name>RelayBatt2</name>
<mode>once</mode>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay2.wav</path>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay-battery.wav</path>
<condition>
<greater-than>
<property>/systems/electrical/battery2-amps</property>
@ -1315,7 +1315,7 @@
</greater-than>
</condition>
<volume>
<factor>0.60</factor>
<factor>0.80</factor>
</volume>
</relay>
@ -1343,7 +1343,7 @@
<relay>
<name>RelayAPU</name>
<mode>once</mode>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay4.wav</path>
<path>Aircraft/IDG-A32X/Sounds/Cockpit/relay-apu.wav</path>
<condition>
<equals>
<property>/systems/electrical/gen-apu</property>

Binary file not shown.

Binary file not shown.

Binary file not shown.

35
Systems/electrical.xml Normal file
View file

@ -0,0 +1,35 @@
<!-- Airbus A320 Electrical -->
<!--
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
-->
<system name="A320: Electrical">
<property>/controls/electrical/switches/battery1</property>
<property>/systems/failures/elec-batt1</property>
<property>/controls/electrical/switches/battery2</property>
<property>/systems/failures/elec-batt2</property>
<channel name="Battery">
<switch name="electrical/battery-1">
<test logic="AND" value="150">
/controls/electrical/switches/battery1 eq 1
/systems/failures/elec-batt1 eq 0
</test>
<delay type="time">0.85</delay>
<output>/systems/electrical/battery1-amps</output>
</switch>
<switch name="electrical/battery-2">
<test logic="AND" value="150">
/controls/electrical/switches/battery2 eq 1
/systems/failures/elec-batt2 eq 0
</test>
<delay type="time">0.85</delay>
<output>/systems/electrical/battery2-amps</output>
</switch>
</channel>
</system>