Add engine fire. Still need to make temperature simulation and fix messages

This commit is contained in:
legoboyvdlp R 2019-04-15 19:58:54 +01:00
parent 584860d422
commit 8e7dfdfbf5
16 changed files with 995 additions and 20 deletions

View file

@ -95,6 +95,17 @@
<output-property>/systems/pitot/icing</output-property>
</iceable>
</icing>
<flame>
<red-high type="double">1.0</red-high>
<red-low type="double">0.95</red-low>
<red-base type="double">1.0</red-base>
<green-high type="double">0.741</green-high>
<green-low type="double">0.32</green-low>
<green-base type="double">0.741</green-base>
<blue-high type="double">0.10</blue-high>
<blue-low type="double">0.02</blue-low>
<blue-base type="double">0.09</blue-base>
</flame>
</model>
<startup>
@ -613,6 +624,10 @@
<throttle-fdm type="double">0</throttle-fdm>
</engine>
</engines>
<fire>
<apu-test-btn type="bool">0</apu-test-btn>
<test-btn type="bool">0</test-btn>
</fire>
<flight>
<aileron-drives-tiller type="bool">0</aileron-drives-tiller>
<aileron-input>0</aileron-input>

View file

@ -73,6 +73,8 @@ var failReset = func {
setprop("/systems/failures/fuelmode", 0);
setprop("/systems/failures/cargo-aft-fire", 0);
setprop("/systems/failures/cargo-fwd-fire", 0);
setprop("/systems/failures/engine-left-fire", 0);
setprop("/systems/failures/engine-right-fire", 0);
}
failReset();

View file

@ -487,6 +487,39 @@
</binding>
<live>true</live>
</checkbox>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>Engine Fire</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>Left Engine</label>
<halign>left</halign>
<property>/systems/failures/engine-left-fire</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Right Engine</label>
<halign>left</halign>
<property>/systems/failures/engine-right-fire</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<hrule/>
@ -502,9 +535,7 @@
</script>
</binding>
</button>
</group>
</group>
</PropertyList>

25
Models/Effects/flame.eff Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>AB-flame</name>
<inherits-from>Effects/thrust-flame</inherits-from>
<parameters>
<base_flame_b type="float"><use>/sim/model/flame/blue-base</use></base_flame_b>
<base_flame_density type="float">0.01</base_flame_density>
<base_flame_g type="float"><use>/sim/model/flame/green-base</use></base_flame_g>
<base_flame_r type="float"><use>/sim/model/flame/red-base</use></base_flame_r>
<deflection_coeff type="float">0</deflection_coeff>
<flame_color_high_b type="float"><use>/sim/model/flame/blue-high</use></flame_color_high_b>
<flame_color_high_g type="float"><use>/sim/model/flame/green-high</use></flame_color_high_g>
<flame_color_high_r type="float"><use>/sim/model/flame/red-high</use></flame_color_high_r>
<flame_color_low_b type="float"><use>/sim/model/flame/blue-low</use></flame_color_low_b>
<flame_color_low_g type="float"><use>/sim/model/flame/green-low</use></flame_color_low_g>
<flame_color_low_r type="float"><use>/sim/model/flame/red-low</use></flame_color_low_r>
<flame_radius_fraction type="float">0.82</flame_radius_fraction>
<noise_scale type="float">0.8</noise_scale>
<noise_strength type="float">0.2</noise_strength>
<thrust_collimation type="float">0.2</thrust_collimation>
<thrust_density type="float">0.8</thrust_density>
<use_noise type="int">1</use_noise>
<use_shocks type="int">0</use_shocks>
</parameters>
</PropertyList>

View file

@ -182,21 +182,11 @@
<type>select</type>
<object-name>AftCargoIsoBtn1F</object-name>
<object-name>AftCargoIsoBtn2O</object-name>
<object-name>APUFireAgtBtn1S</object-name>
<object-name>APUFireAgtBtn2D</object-name>
<object-name>CargoHotAirBtn1F</object-name>
<object-name>CargoHotAirBtn2O</object-name>
<object-name>EmerCallBtn1C</object-name>
<object-name>EmerCallBtn2O</object-name>
<object-name>EmerGenInd1F</object-name>
<object-name>Eng1FireAgt1Btn1S</object-name>
<object-name>Eng1FireAgt1Btn2D</object-name>
<object-name>Eng1FireAgt2Btn1S</object-name>
<object-name>Eng1FireAgt2Btn2D</object-name>
<object-name>Eng2FireAgt1Btn1S</object-name>
<object-name>Eng2FireAgt1Btn2D</object-name>
<object-name>Eng2FireAgt2Btn1S</object-name>
<object-name>Eng2FireAgt2Btn2D</object-name>
<object-name>EvacCommandBtn1E</object-name>
<object-name>EvacCommandBtn2O</object-name>
<object-name>Gen1LineBtn1S</object-name>
@ -6203,6 +6193,159 @@
</axis>
</animation>
<animation>
<type>material</type>
<object-name>Eng1FireBtn</object-name>
<condition>
<property>systems/fire/engine1/warning-active</property>
</condition>
<emission>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</emission>
</animation>
<animation>
<type>pick</type>
<object-name>Eng1FireAgt1Btn1S</object-name>
<object-name>Eng1FireAgt1Btn2D</object-name>
<object-name>Eng1FireAgt1Btn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/engines/engine[0]/agent1-btn</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Eng1FireAgt2Btn1S</object-name>
<object-name>Eng1FireAgt2Btn2D</object-name>
<object-name>Eng1FireAgt2Btn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/engines/engine[0]/agent2-btn</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>Eng1FireAgt1Btn1S</object-name>
<object-name>Eng1FireAgt2Btn1S</object-name>
<condition>
<or>
<equals>
<property>controls/engines/engine[0]/fire-btn</property>
<value>1</value>
</equals>
<equals>
<property>/controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Eng1FireAgt1Btn2D</object-name>
<condition>
<or>
<equals>
<property>/systems/fire/engine1/disch1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Eng1FireAgt2Btn2D</object-name>
<condition>
<or>
<equals>
<property>/systems/fire/engine1/disch2</property>
<value>1</value>
</equals>
<equals>
<property>/controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Test -->
<animation>
<type>pick</type>
<object-name>Eng1FireTst</object-name>
<object-name>Eng2FireTst</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/fire/test-btn</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/fire/test-btn</property>
<value>0</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>APUFireTst</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/fire/apu-test-btn</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/fire/apu-test-btn</property>
<value>0</value>
</binding>
</mod-up>
</action>
</animation>
<!-- APU -->
<animation>
<type>pick</type>
@ -6289,6 +6432,77 @@
</axis>
</animation>
<animation>
<type>material</type>
<object-name>APUFireBtn</object-name>
<condition>
<property>systems/fire/apu/warning-active</property>
</condition>
<emission>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</emission>
</animation>
<animation>
<type>pick</type>
<object-name>APUFireAgtBtn1S</object-name>
<object-name>APUFireAgtBtn2D</object-name>
<object-name>APUFireAgtBtn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/APU/agent-btn</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>APUFireAgtBtn1S</object-name>
<condition>
<or>
<equals>
<property>controls/APU/fire-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/fire/apu-test-btn</property>
<value>true</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>APUFireAgtBtn2D</object-name>
<condition>
<or>
<equals>
<property>systems/fire/apu/disch</property>
<value>1</value>
</equals>
<equals>
<property>controls/fire/apu-test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Engine 2 -->
<animation>
<type>pick</type>
@ -6375,6 +6589,115 @@
</axis>
</animation>
<animation>
<type>material</type>
<object-name>Eng2FireBtn</object-name>
<condition>
<property>systems/fire/engine2/warning-active</property>
</condition>
<emission>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</emission>
</animation>
<animation>
<type>pick</type>
<object-name>Eng2FireAgt1Btn1S</object-name>
<object-name>Eng2FireAgt1Btn2D</object-name>
<object-name>Eng2FireAgt1Btn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/engines/engine[1]/agent1-btn</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>Eng2FireAgt2Btn1S</object-name>
<object-name>Eng2FireAgt2Btn2D</object-name>
<object-name>Eng2FireAgt2Btn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/engines/engine[1]/agent2-btn</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>Eng2FireAgt1Btn1S</object-name>
<object-name>Eng2FireAgt2Btn1S</object-name>
<condition>
<or>
<equals>
<property>controls/engines/engine[1]/fire-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Eng2FireAgt1Btn2D</object-name>
<condition>
<or>
<equals>
<property>systems/fire/engine2/disch1</property>
<value>1</value>
</equals>
<equals>
<property>controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Eng2FireAgt2Btn2D</object-name>
<condition>
<or>
<equals>
<property>systems/fire/engine2/disch2</property>
<value>1</value>
</equals>
<equals>
<property>controls/fire/test-btn</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Sounds -->
<animation>
<type>pick</type>

View file

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<PropertyList>
<path>Aircraft/Generic/Effects/Thruster/thrust_flame.ac</path>
<nopreview/>
<animation>
<type>scale</type>
<property>systems/failures/engine-left-fire</property>
<x-min>0.2</x-min>
<y-min>0.3</y-min>
<z-min>0.3</z-min>
<y-max>0.8</y-max>
<z-max>0.8</z-max>
<x-factor>0.4</x-factor>
<y-factor>0.7</y-factor>
<z-factor>0.7</z-factor>
</animation>
<animation>
<type>select</type>
<object-name>Bounding_box</object-name>
<condition>
<greater-than>
<property>systems/failures/engine-left-fire</property>
<value>0.8</value>
</greater-than>
</condition>
</animation>
<effect>
<inherits-from>Aircraft/IDG-A32X/Models/Effects/flame</inherits-from>
<object-name>Bounding_box</object-name>
</effect>
</PropertyList>

View file

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<PropertyList>
<path>Aircraft/Generic/Effects/Thruster/thrust_flame.ac</path>
<nopreview/>
<animation>
<type>scale</type>
<property>systems/failures/engine-right-fire</property>
<x-min>0.2</x-min>
<y-min>0.3</y-min>
<z-min>0.3</z-min>
<y-max>0.8</y-max>
<z-max>0.8</z-max>
<x-factor>0.4</x-factor>
<y-factor>0.7</y-factor>
<z-factor>0.7</z-factor>
</animation>
<animation>
<type>select</type>
<object-name>Bounding_box</object-name>
<condition>
<greater-than>
<property>systems/failures/engine-right-fire</property>
<value>0.8</value>
</greater-than>
</condition>
</animation>
<effect>
<inherits-from>Aircraft/IDG-A32X/Models/Effects/flame</inherits-from>
<object-name>Bounding_box</object-name>
</effect>
</PropertyList>

View file

@ -24,7 +24,27 @@
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.CFM.Left.FireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-left.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>-5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.CFM.RightFireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-right.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<!-- ANIMATIONS -->
<!-- Ailerons -->
<animation>

View file

@ -24,6 +24,26 @@
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.IAE.Left.FireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-left.xml</path>
<offsets>
<x-m>3.2</x-m>
<y-m>-5.755</y-m>
<z-m>-1.15</z-m>
</offsets>
</model>
<model>
<name>Engine.IAE.RightFireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-right.xml</path>
<offsets>
<x-m>3.2</x-m>
<y-m>5.755</y-m>
<z-m>-1.15</z-m>
</offsets>
</model>
<!-- ANIMATIONS -->
<!-- Ailerons -->

View file

@ -24,6 +24,26 @@
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.CFM.Left.FireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-left.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>-5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.CFM.RightFireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-right.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<!-- ANIMATIONS -->
<!-- Ailerons -->

View file

@ -24,6 +24,26 @@
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.PW.Left.FireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-left.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>-5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<model>
<name>Engine.PW.RightFireBBox</name>
<path>Aircraft/IDG-A32X/Models/Wings/a320-fire-right.xml</path>
<offsets>
<x-m>-1.6387912</x-m>
<y-m>5.755</y-m>
<z-m>-1.0170087</z-m>
</offsets>
</model>
<!-- ANIMATIONS -->
<!-- Ailerons -->

View file

@ -161,9 +161,14 @@ var ECAM_controller = {
}
# write to ECAM
var counter = 0;
foreach (var w; warnings.vector) {
w.write();
if (counter >= 9) { break; }
if (w.active == 1) {
w.write();
counter += 1;
}
}
foreach (var w2; warnings.vector) {

View file

@ -41,7 +41,7 @@ var messages_priority_3 = func {
if (phaseVar >= 5 and phaseVar <= 7 and dualFailNode.getBoolValue()) {
dualFail.active = 1;
} elsif (dualFailbatt.clearFlag == 1) {
} elsif (dualFailbatt.clearFlag == 1 or !dualFailNode.getBoolValue()) {
ECAM_controller.warningReset(dualFail);
dualFailFACActive = 1; # reset FAC local variable
@ -190,6 +190,95 @@ var messages_priority_3 = func {
ECAM_controller.warningReset(dualFailbatt);
ECAM_controller.warningReset(dualFailtouch);
}
} else {
ECAM_controller.warningReset(dualFailModeSel);
ECAM_controller.warningReset(dualFailLevers);
ECAM_controller.warningReset(dualFailRelightSPD);
ECAM_controller.warningReset(dualFailRelightSPDCFM);
ECAM_controller.warningReset(dualFailElec);
ECAM_controller.warningReset(dualFailRadio);
ECAM_controller.warningReset(dualFailFAC);
ECAM_controller.warningReset(dualFailRelight);
ECAM_controller.warningReset(dualFailMasters);
ECAM_controller.warningReset(dualFailSuccess);
ECAM_controller.warningReset(dualFailSPDGD);
ECAM_controller.warningReset(dualFailAPU);
ECAM_controller.warningReset(dualFailAPUwing);
ECAM_controller.warningReset(dualFailAPUbleed);
ECAM_controller.warningReset(dualFailMastersAPU);
ECAM_controller.warningReset(dualFailAPPR);
ECAM_controller.warningReset(dualFailflap);
ECAM_controller.warningReset(dualFailcabin);
ECAM_controller.warningReset(dualFailrudd);
ECAM_controller.warningReset(dualFailgear);
ECAM_controller.warningReset(dualFail5000);
ECAM_controller.warningReset(dualFailfinalspeed);
ECAM_controller.warningReset(dualFailmasteroff);
ECAM_controller.warningReset(dualFailapuoff);
ECAM_controller.warningReset(dualFailevac);
ECAM_controller.warningReset(dualFailbatt);
ECAM_controller.warningReset(dualFailtouch);
}
# ENG FIRE
if (eng1FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine1/warning-active") == 1 and phaseVar >= 5 and phaseVar <= 7) {
eng1FireFl.active = 1;
} else {
ECAM_controller.warningReset(eng1FireFl);
}
if (eng1FireGnevacBat.clearFlag == 0 and getprop("/systems/fire/engine1/warning-active") == 1 and (phaseVar < 5 or phaseVar > 7)) {
eng1FireGn.active = 1;
} else {
ECAM_controller.warningReset(eng1FireGn);
}
if (eng2FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine2/warning-active") == 1 and phaseVar >= 5 and phaseVar <= 7) {
eng2FireFl.active = 1;
} else {
ECAM_controller.warningReset(eng2FireFl);
}
if (eng2FireGnevacBat.clearFlag == 0 and getprop("/systems/fire/engine2/warning-active") == 1 and (phaseVar < 5 or phaseVar > 7)) {
eng2FireGn.active = 1;
} else {
ECAM_controller.warningReset(eng2FireGn);
}
if (eng1FireFl.active == 1) {
eng1FireFllever.active = 1;
eng1FireFlmaster.active = 1;
eng1FireFlPB.active = 1;
eng1FireFlAgent1.active = 1;
eng1FireFlATC.active = 1;
eng1FireFl30Sec.active = 1;
eng1FireFlAgent2.active = 1;
} else {
ECAM_controller.warningReset(eng1FireFllever);
ECAM_controller.warningReset(eng1FireFlmaster);
ECAM_controller.warningReset(eng1FireFlPB);
ECAM_controller.warningReset(eng1FireFlAgent1);
ECAM_controller.warningReset(eng1FireFlATC);
ECAM_controller.warningReset(eng1FireFl30Sec);
ECAM_controller.warningReset(eng1FireFlAgent2);
}
if (eng2FireFl.active == 1) {
eng2FireFllever.active = 1;
eng2FireFlmaster.active = 1;
eng2FireFlPB.active = 1;
eng2FireFlAgent1.active = 1;
eng2FireFlATC.active = 1;
eng2FireFl30Sec.active = 1;
eng2FireFlAgent2.active = 1;
} else {
ECAM_controller.warningReset(eng2FireFllever);
ECAM_controller.warningReset(eng2FireFlmaster);
ECAM_controller.warningReset(eng2FireFlPB);
ECAM_controller.warningReset(eng2FireFlAgent1);
ECAM_controller.warningReset(eng2FireFlATC);
ECAM_controller.warningReset(eng2FireFl30Sec);
ECAM_controller.warningReset(eng2FireFlAgent2);
}
# CONFIG

View file

@ -42,6 +42,60 @@ var warnings = std.Vector.new([
var dualFailevac = warning.new(msg: " -EVAC..........INITIATE", colour: "c"),
var dualFailbatt = warning.new(msg: " -BAT 1+2............OFF", colour: "c"),
# ENG 1 FIRE (flight)
var eng1FireFl = warning.new(msg: "ENG 1 FIRE", colour: "r", aural: 0, light: 0, hasSubmsg: 1),
var eng1FireFllever = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"),
var eng1FireFlmaster = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"),
var eng1FireFlPB = warning.new(msg: " -ENG 1 FIRE P/B....PUSH", colour: "c"),
var eng1FireFlAgent1 = warning.new(msg: " -AGENT 1 AFT 10 S.DISCH", colour: "w"),
var eng1FireFlATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"),
var eng1FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w"),
var eng1FireFlAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"),
# ENG 1 FIRE (ground)
var eng1FireGn = warning.new(msg: "ENG 1 FIRE", colour: "r", aural: 0, light: 0, hasSubmsg: 1),
var eng1FireGnlever = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"),
var eng1FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w"),
var eng1FireGnparkbrk = warning.new(msg: " -PARKING BRK.........ON", colour: "c"),
var eng1FireGnmaster = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"),
var eng1FireGnPB = warning.new(msg: " -ENG 1 FIRE P/B....PUSH", colour: "c"),
var eng1FireGnAgent1 = warning.new(msg: " -AGENT 1..........DISCH", colour: "c"),
var eng1FireGnAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"),
var eng1FireGnmaster2 = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"),
var eng1FireGnATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"),
var eng1FireGncrew = warning.new(msg: " -CABIN CREW.......ALERT", colour: "c"),
var eng1FireGnevac = warning.new(msg: " •IF EVAC RQRD:", colour: "w"),
var eng1FireGnevacSw = warning.new(msg: " -EVAC COMMAND........ON", colour: "c"),
var eng1FireGnevacApu = warning.new(msg: " -APU MASTER SW......OFF", colour: "c"),
var eng1FireGnevacBat = warning.new(msg: " -BAT 1+2............OFF", colour: "c"),
# ENG 2 FIRE (flight)
var eng2FireFl = warning.new(msg: "ENG 2 FIRE", colour: "r", aural: 0, light: 0, hasSubmsg: 1),
var eng2FireFllever = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"),
var eng2FireFlmaster = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"),
var eng2FireFlPB = warning.new(msg: " -ENG 2 FIRE P/B....PUSH", colour: "c"),
var eng2FireFlAgent1 = warning.new(msg: " -AGENT 1 AFT 10 S.DISCH", colour: "w"),
var eng2FireFlATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"),
var eng2FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w"),
var eng2FireFlAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"),
# ENG 2 FIRE (ground)
var eng2FireGn = warning.new(msg: "ENG 2 FIRE", colour: "r", aural: 0, light: 0, hasSubmsg: 1),
var eng2FireGnlever = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"),
var eng2FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w"),
var eng2FireGnparkbrk = warning.new(msg: " -PARKING BRK.........ON", colour: "c"),
var eng2FireGnmaster = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"),
var eng2FireGnPB = warning.new(msg: " -ENG 1 FIRE P/B....PUSH", colour: "c"),
var eng2FireGnAgent1 = warning.new(msg: " -AGENT 1..........DISCH", colour: "c"),
var eng2FireGnAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"),
var eng2FireGnmaster2 = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"),
var eng2FireGnATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"),
var eng2FireGncrew = warning.new(msg: " -CABIN CREW.......ALERT", colour: "c"),
var eng2FireGnevac = warning.new(msg: " •IF EVAC RQRD:", colour: "w"),
var eng2FireGnevacSw = warning.new(msg: " -EVAC COMMAND........ON", colour: "c"),
var eng2FireGnevacApu = warning.new(msg: " -APU MASTER SW......OFF", colour: "c"),
var eng2FireGnevacBat = warning.new(msg: " -BAT 1+2............OFF", colour: "c"),
# Config
var slats_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0),
var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", colour: "r", aural: 0, light: 0),

View file

@ -27,6 +27,17 @@ var dc1 = 0;
var dc2 = 0;
var dcbat = 0;
var pause = 0;
var et = 0;
var elapsedTime = props.globals.getNode("/sim/time/elapsed-sec");
var apuTestBtn = props.globals.getNode("/controls/fire/apu-test-btn", 1);
var testBtn = props.globals.getNode("/controls/fire/test-btn", 1);
var eng1FireWarn = props.globals.initNode("/systems/fire/engine1/warning-active", 0, "BOOL");
var eng2FireWarn = props.globals.initNode("/systems/fire/engine2/warning-active", 0, "BOOL");
var apuFireWarn = props.globals.initNode("/systems/fire/apu/warning-active", 0, "BOOL");
var wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
var dcbatNode = props.globals.getNode("systems/electrical/bus/dcbat", 1);
var dcessNode = props.globals.getNode("systems/electrical/bus/dc-ess", 1);
var fire_init = func {
setprop("/controls/OH/protectors/fwddisch", 0);
@ -78,7 +89,7 @@ var master_fire = func {
state = getprop("/controls/fire/cargo/test/state");
dc1 = getprop("/systems/electrical/bus/dc1");
dc2 = getprop("/systems/electrical/bus/dc2");
dcbat = getprop("/systems/electrical/bus/dcbat");
dcbat = dcbatNode.getValue();
pause = getprop("/sim/freeze/master");
###############
@ -171,7 +182,6 @@ var master_fire = func {
setprop("/controls/fire/cargo/fwddischLight", 0);
setprop("/controls/fire/cargo/aftdischLight", 0);
}
}
###################
@ -185,7 +195,7 @@ setlistener("/systems/failures/cargo-fwd-fire", func() {
} else {
setprop("/controls/fire/cargo/fwdsmokeLight", 0);
}
}, 0, );
}, 0, 0);
setlistener("/systems/failures/cargo-aft-fire", func() {
if (getprop("/systems/failures/cargo-aft-fire")) {
@ -194,8 +204,280 @@ setlistener("/systems/failures/cargo-aft-fire", func() {
} else {
setprop("/controls/fire/cargo/aftsmokeLight", 0);
}
}, 0, );
}, 0, 0);
###################
# Engine Fire #
###################
var engFireDetectorUnit = {
sys: 0,
active: 0,
loopOne: 0,
loopTwo: 0,
condition: 100,
new: func(sys) {
var eF = {parents:[engFireDetectorUnit]};
eF.sys = sys;
eF.active = 0;
eF.loopOne = 0;
eF.loopTwo = 0;
return eF;
},
update: func() {
foreach(var detector; detectorLoops.vector) {
detector.updateTemp(detector.sys, detector.type);
}
if ((me.loopOne == 1 and me.loopOne == 2) or (me.loopOne == 9 and me.loopOne == 1) or (me.loopOne == 1 and me.loopOne == 9)) {
me.TriggerWarning(me.sys);
}
},
receiveSignal: func(type) {
if (type == 1 and me.loopOne != 9) {
me.loopOne = 1;
} elsif (type == 2 and me.loopTwo != 9) {
me.loopTwo = 1;
}
},
fail: func(loop) {
if (loop != 1 and loop != 2) { return; }
if (loop == 1) { me.loopOne = 9; }
else { me.loopTwo = 9; }
me.startFailTimer(loop);
},
startFailTimer: func(loop) {
if (me.sys != 2) {
if (loop == 1) {
propsNasFireTime[sys].setValue(elapsedTime.getValue());
} elsif (loop == 2) {
propsNasFireTime[sys + 1].setValue(elapsedTime.getValue());
}
} else {
if (loop == 1) {
propsNasFireTime[4].setValue(elapsedTime.getValue());
} elsif (loop == 2) {
propsNasFireTime[5].setValue(elapsedTime.getValue());
}
}
if (!fireTimer.isRunning) {
fireTimer.start();
}
},
TriggerWarning: func(system) {
if (system == 0) {
eng1FireWarn.setBoolValue(1);
} elsif (system == 1) {
eng2FireWarn.setBoolValue(1);
} elsif (system == 2) {
apuFireWarn.setBoolValue(1);
if (wow.getValue() == 1) {
extinguisherBottles[4].discharge();
}
}
}
};
var detectorLoop = {
sys: 9,
type: 0,
temperature: "",
new: func(type, sys, temperature) {
var dL = {parents:[detectorLoop]};
dL.sys = sys;
dL.type = type;
dL.temperature = temperature;
return dL;
},
updateTemp: func(system, typeLoop) {
var index = 0;
if (system == 1) { index += 2 }
elsif (system == 2) { index += 4 }
if (typeLoop == 1) { index += 1 }
if (propsNasFire[index].getValue() > 250) {
me.sendSignal(system,typeLoop);
}
},
sendSignal: func(system,typeLoop) {
engFireDetectorUnits[system].receiveSignal(typeLoop);
}
};
var extinguisherBottle = {
quantity: 100,
squib: 0,
lightProp: "",
elecProp: "",
new: func(lightProp, elecProp) {
var eB = {parents:[extinguisherBottle]};
eB.quantity = 100;
eB.squib = 0;
eB.lightProp = props.globals.getNode(lightProp, 1);
eB.elecProp = props.globals.getNode(elecProp, 1);
return eB;
},
emptyBottle: func() {
me.quantity = me.quantity - 1;
if (me.quantity > 0) { settimer(me.emptyBottle, 0.05); }
else {
me.lightProp.setValue(1);
}
},
discharge: func() {
if (me.elecProp.getValue() < 25) { return; }
me.squib = 1;
me.emptyBottle();
}
};
# If two loops fail within five seconds then assume there is a fire
var propsNasFireTime = std.Vector.new([
props.globals.getNode("/systems/fire/engine1/loop1-failtime", 1), props.globals.getNode("/systems/fire/engine1/loop2-failtime", 1),
props.globals.getNode("/systems/fire/engine2/loop1-failtime", 1), props.globals.getNode("/systems/fire/engine2/loop2-failtime", 1),
props.globals.getNode("/systems/fire/apu/loop1-failtime", 1), props.globals.getNode("/systems/fire/apu/loop2-failtime", 1)
]);
var checkTimeFire1 = func() {
et = elapsedTime.getValue();
var loop1 = propsNasFireTime[0].getValue();
var loop2 = propsNasFireTime[1].getValue();
if ((loop1 != 0 and et > loop1 + 5) or (loop2 != 0 and et > loop2 + 5)) {
fireTimer1.stop();
loop1.setValue(0);
loop2.setValue(0);
}
if (engFireDetectorUnits[0].loop1 == 9 and engFireDetectorUnits[0].loop2 == 9) {
fireTimer1.stop();
engFireDetectorUnits[0].TriggerWarning(engFireDetectorUnits[0].sys);
loop1.setValue(0);
loop2.setValue(0);
}
}
var checkTimeFire2 = func() {
et = elapsedTime.getValue();
var loop3 = propsNasFireTime[2].getValue();
var loop4 = propsNasFireTime[3].getValue();
if ((loop3 != 0 and et > loop3 + 5) or (loop4 != 0 and et > loop4 + 5)) {
fireTimer2.stop();
loop3.setValue(0);
loop4.setValue(0);
}
if (engFireDetectorUnits[1].loop1 == 9 and engFireDetectorUnits[1].loop2 == 9) {
fireTimer2.stop();
engFireDetectorUnits[1].TriggerWarning(engFireDetectorUnits[1].sys);
loop3.setValue(0);
loop4.setValue(0);
}
}
var checkTimeFire3 = func() {
et = elapsedTime.getValue();
var loop4 = propsNasFireTime[3].getValue();
var loop5 = propsNasFireTime[4].getValue();
if ((loop4 != 0 and et > loop4 + 5) or (loop5 != 0 and et > loop5 + 5)) {
fireTimer3.stop();
loop4.setValue(0);
loop5.setValue(0);
}
if (engFireDetectorUnits[2].loop1 == 9 and engFireDetectorUnits[2].loop2 == 9) {
fireTimer3.stop();
engFireDetectorUnits[2].TriggerWarning(engFireDetectorUnits[2].sys);
loop4.setValue(0);
loop5.setValue(0);
}
}
var fireTimer1 = maketimer(0.25, checkTimeFire1);
fireTimer1.simulatedTime = 1;
var fireTimer2 = maketimer(0.25, checkTimeFire2);
fireTimer2.simulatedTime = 1;
var fireTimer3 = maketimer(0.25, checkTimeFire3);
fireTimer3.simulatedTime = 1;
# Create engine fire systems
var engFireDetectorUnits = std.Vector.new([ engFireDetectorUnit.new(0), engFireDetectorUnit.new(1), engFireDetectorUnit.new(2) ]);
# Create detector loops
var detectorLoops = std.Vector.new([
detectorLoop.new(0, 0, "/systems/fire/engine1/temperature"), detectorLoop.new(1, 0, "/systems/fire/engine1/temperature"),
detectorLoop.new(0, 1, "/systems/fire/engine2/temperature"), detectorLoop.new(1, 1, "/systems/fire/engine2/temperature"),
detectorLoop.new(0, 2, "/systems/fire/apu/temperature"), detectorLoop.new(1, 2, "/systems/fire/apu/temperature")
]);
# Create extinguisher bottles
var extinguisherBottles = std.Vector.new([extinguisherBottle.new("/systems/fire/engine1/disch1", "/systems/electrical/bus/dcbat"), extinguisherBottle.new("/systems/fire/engine1/disch2", "/systems/electrical/bus/dc2"),
extinguisherBottle.new("/systems/fire/engine2/disch1", "/systems/electrical/bus/dcbat"), extinguisherBottle.new("/systems/fire/engine2/disch2", "/systems/electrical/bus/dc2"), extinguisherBottle.new("/systems/fire/apu/disch", "/systems/electrical/bus/dcbat") ]);
# Props.nas helper
var propsNasFire = std.Vector.new();
foreach (detectorLoop; detectorLoops.vector) {
propsNasFire.append(props.globals.getNode(detectorLoop.temperature));
};
# Setlistener helper
var createFireBottleListener = func(prop, index) {
if (index >= extinguisherBottles.size()) {
print("Error - calling listener on non-existent fire extinguisher bottle, index: " ~ index);
return;
}
setlistener(prop, func() {
if (getprop(prop) == 1) {
extinguisherBottles.vector[index].discharge();
}
}, 0, 0);
}
# Listeners
setlistener("/controls/engines/engine[0]/fire-btn", func() { eng1FireWarn.setBoolValue(0); }, 0, 0);
setlistener("/controls/engines/engine[1]/fire-btn", func() { eng2FireWarn.setBoolValue(0); }, 0, 0);
setlistener("/controls/APU/fire-btn", func() { apuFireWarn.setBoolValue(0); }, 0, 0);
setlistener("/controls/fire/test-btn", func() {
if (testBtn.getValue() == 1) {
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
eng1FireWarn.setBoolValue(1);
eng2FireWarn.setBoolValue(1);
} else {
eng1FireWarn.setBoolValue(0);
eng2FireWarn.setBoolValue(0);
}
} else {
eng1FireWarn.setBoolValue(0);
eng2FireWarn.setBoolValue(0);
}
}, 0, 0);
setlistener("/controls/fire/apu-test-btn", func() {
if (apuTestBtn.getValue() == 1) {
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
apuFireWarn.setBoolValue(1);
} else {
apuFireWarn.setBoolValue(0);
}
} else {
apuFireWarn.setBoolValue(0);
}
}, 0, 0);
createFireBottleListener("/controls/engines/engine[0]/agent1-btn", 0);
createFireBottleListener("/controls/engines/engine[0]/agent2-btn", 1);
createFireBottleListener("/controls/engines/engine[1]/agent1-btn", 2);
createFireBottleListener("/controls/engines/engine[1]/agent2-btn", 3);
createFireBottleListener("/controls/APU/agent-btn", 4);
###################
# Update Function #
###################

View file

@ -1169,5 +1169,4 @@
<output>/instrumentation/ddrmi/flag-2</output>
<filter-time>0.64</filter-time>
</filter>
</PropertyList>