Many bugfixes to systems, proper engine spinup speed, NEW electrical system, NEW OVERHEAD SWITCH LIGHTS, and ELEC panel switches working, APU BLEED, and APU MASTER and START

This commit is contained in:
Joshua Davidson 2017-04-05 22:24:04 -04:00
parent 4ae105e6e7
commit 173a23d657
23 changed files with 7186 additions and 4674 deletions

View file

@ -75,7 +75,6 @@
<nasal>
<A320>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/systems.nas</file>
<file>Aircraft/A320Family/Nasal/a319livery.nas</file>
<file>Aircraft/A320Family/Models/Instruments/ND/ND.nas</file>
@ -88,6 +87,7 @@
<file>Aircraft/A320Family/AircraftConfig/acconfig.nas</file>
</acconfig>
<systems>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/engines.nas</file>
</systems>
<itaf>

View file

@ -68,7 +68,6 @@
<nasal>
<A320>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/systems.nas</file>
<file>Aircraft/A320Family/Nasal/a320livery.nas</file>
<file>Aircraft/A320Family/Models/Instruments/ND/ND.nas</file>
@ -81,6 +80,7 @@
<file>Aircraft/A320Family/AircraftConfig/acconfig.nas</file>
</acconfig>
<systems>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/engines.nas</file>
</systems>
<itaf>

View file

@ -346,6 +346,7 @@
<!-- Smoking is bad :P -->
<no-smoking-sign type="bool">true</no-smoking-sign>
<seatbelt-sign type="bool">0</seatbelt-sign>
<annun-test>0</annun-test>
</switches>
</controls>

View file

@ -68,7 +68,6 @@
<nasal>
<A320>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/systems.nas</file>
<file>Aircraft/A320Family/Nasal/a321livery.nas</file>
<file>Aircraft/A320Family/Models/Instruments/ND/ND.nas</file>
@ -81,6 +80,7 @@
<file>Aircraft/A320Family/AircraftConfig/acconfig.nas</file>
</acconfig>
<systems>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/engines.nas</file>
</systems>
<itaf>

View file

@ -74,7 +74,6 @@
<nasal>
<A320>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/systems.nas</file>
<file>Aircraft/A320Family/Nasal/acjlivery.nas</file>
<file>Aircraft/A320Family/Models/Instruments/ND/ND.nas</file>
@ -87,6 +86,7 @@
<file>Aircraft/A320Family/AircraftConfig/acconfig.nas</file>
</acconfig>
<systems>
<file>Aircraft/A320Family/Nasal/electrical.nas</file>
<file>Aircraft/A320Family/Nasal/engines.nas</file>
</systems>
<itaf>

View file

@ -26,14 +26,14 @@ var colddark = func {
setprop("/controls/engines/engine-start-switch", 1);
setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/electric/engine[0]/generator", 0);
setprop("/controls/electric/engine[1]/generator", 0);
setprop("/controls/electrical/switches/gen1", 0);
setprop("/controls/electrical/switches/gen2", 0);
setprop("/controls/flight/slats", 0.000);
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/flap-lever", 0);
setprop("/controls/flight/speedbrake-arm", 0);
setprop("/controls/gear/gear-down", 1);
# systems.elec_init();
systems.elec_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
@ -53,8 +53,9 @@ var colddark_b = func {
setprop("/controls/APU/master", 0);
setprop("/controls/APU/start", 0);
setprop("/controls/APU/bleed", 0);
setprop("/controls/electric/APU-generator", 0);
setprop("/controls/electric/battery-switch", 0);
setprop("/controls/electrical/switches/gen-apu", 0);
setprop("/controls/electrical/switches/battery1", 0);
setprop("/controls/electrical/switches/battery2", 0);
setprop("/systems/acconfig/autoconfig-running", 0);
ps_load_dlg.close();
ps_loaded_dlg.open();
@ -68,25 +69,27 @@ var beforestart = func {
setprop("/controls/engines/engine-start-switch", 1);
setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/electric/engine[0]/generator", 0);
setprop("/controls/electric/engine[1]/generator", 0);
setprop("/controls/electrical/switches/gen1", 0);
setprop("/controls/electrical/switches/gen2", 0);
setprop("/controls/flight/slats", 0.000);
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/flap-lever", 0);
setprop("/controls/flight/speedbrake-arm", 0);
setprop("/controls/gear/gear-down", 1);
# systems.elec_init();
systems.elec_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
setprop("/controls/APU/master", 0);
setprop("/controls/APU/start", 0);
setprop("/controls/APU/bleed", 0);
setprop("/controls/electric/APU-generator", 0);
setprop("/controls/electric/battery-switch", 0);
setprop("/controls/electrical/switches/gen-apu", 0);
setprop("/controls/electrical/switches/battery1", 0);
setprop("/controls/electrical/switches/battery2", 0);
# Now the Startup!
setprop("/controls/electric/battery-switch", 1);
setprop("/controls/electrical/switches/battery1", 1);
setprop("/controls/electrical/switches/battery2", 1);
setprop("/controls/APU/master", 1);
setprop("/controls/APU/start", 1);
var apu_rpm_chk = setlistener("/systems/apu/rpm", func {
@ -98,10 +101,11 @@ var beforestart = func {
}
var beforestart_b = func {
# Continue with engine start prep.
setprop("/controls/electric/APU-generator", 1);
setprop("/controls/electrical/switches/gen-apu", 1);
setprop("/controls/electrical/switches/galley", 1);
setprop("/controls/APU/bleed", 1);
setprop("/controls/electric/engine[0]/generator", 1);
setprop("/controls/electric/engine[1]/generator", 1);
setprop("/controls/electrical/switches/gen1", 1);
setprop("/controls/electrical/switches/gen2", 1);
setprop("/systems/acconfig/autoconfig-running", 0);
ps_load_dlg.close();
ps_loaded_dlg.open();
@ -115,25 +119,27 @@ var taxi = func {
setprop("/controls/engines/engine-start-switch", 1);
setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/electric/engine[0]/generator", 0);
setprop("/controls/electric/engine[1]/generator", 0);
setprop("/controls/electrical/switches/gen1", 0);
setprop("/controls/electrical/switches/gen2", 0);
setprop("/controls/flight/slats", 0.000);
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/flap-lever", 0);
setprop("/controls/flight/speedbrake-arm", 0);
setprop("/controls/gear/gear-down", 1);
# systems.elec_init();
systems.elec_init();
itaf.ap_init();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
setprop("/controls/APU/master", 0);
setprop("/controls/APU/start", 0);
setprop("/controls/APU/bleed", 0);
setprop("/controls/electric/APU-generator", 0);
setprop("/controls/electric/battery-switch", 0);
setprop("/controls/electrical/switches/gen-apu", 0);
setprop("/controls/electrical/switches/battery1", 0);
setprop("/controls/electrical/switches/battery2", 0);
# Now the Startup!
setprop("/controls/electric/battery-switch", 1);
setprop("/controls/electrical/switches/battery1", 1);
setprop("/controls/electrical/switches/battery2", 1);
setprop("/controls/APU/master", 1);
setprop("/controls/APU/start", 1);
var apu_rpm_chk = setlistener("/systems/apu/rpm", func {
@ -145,10 +151,11 @@ var taxi = func {
}
var taxi_b = func {
# Continue with engine start prep, and start engine 2.
setprop("/controls/electric/APU-generator", 1);
setprop("/controls/electrical/switches/gen-apu", 1);
setprop("/controls/electrical/switches/galley", 1);
setprop("/controls/APU/bleed", 1);
setprop("/controls/electric/engine[0]/generator", 1);
setprop("/controls/electric/engine[1]/generator", 1);
setprop("/controls/electrical/switches/gen1", 1);
setprop("/controls/electrical/switches/gen2", 1);
setprop("/controls/engines/engine-start-switch", 2);
setprop("/controls/engines/engine[1]/cutoff-switch", 0);
var eng_two_chk = setlistener("/engines/engine[1]/state", func {

View file

@ -214,9 +214,6 @@
<checkbox>
<label>Enable External Power Box</label>
<halign>left</halign>
<enable>
<property>/systems/unused/unusedthing</property>
</enable>
<property>/controls/switches/cart</property>
<binding>
<command>dialog-apply</command>

View file

@ -13,13 +13,13 @@
<turbine_engine name="V2527_A5">
<milthrust> 23000 </milthrust>
<bypassratio> 2.0 </bypassratio>
<bypassratio> 5.1 </bypassratio>
<tsfc> 0.8 </tsfc>
<bleed> 0.03 </bleed>
<idlen1> 23.4 </idlen1>
<idlen2> 63.7 </idlen2>
<n1spinup> 5.1 </n1spinup>
<n2spinup> 22.8 </n2spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 2.0 </n2spinup>
<maxn1> 105.8 </maxn1>
<maxn2> 102.1 </maxn2>
<augmented> 0 </augmented>

View file

@ -13,13 +13,13 @@
<turbine_engine name="V2527_A5">
<milthrust> 26600 </milthrust>
<bypassratio> 2.0 </bypassratio>
<bypassratio> 5.1 </bypassratio>
<tsfc> 0.8 </tsfc>
<bleed> 0.03 </bleed>
<idlen1> 23.4 </idlen1>
<idlen2> 63.7 </idlen2>
<n1spinup> 5.1 </n1spinup>
<n2spinup> 22.8 </n2spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 2.0 </n2spinup>
<maxn1> 105.8 </maxn1>
<maxn2> 102.1 </maxn2>
<augmented> 0 </augmented>

View file

@ -13,13 +13,13 @@
<turbine_engine name="V2527_A5">
<milthrust> 32000 </milthrust>
<bypassratio> 2.0 </bypassratio>
<bypassratio> 5.1 </bypassratio>
<tsfc> 0.8 </tsfc>
<bleed> 0.03 </bleed>
<idlen1> 23.4 </idlen1>
<idlen2> 63.7 </idlen2>
<n1spinup> 5.1 </n1spinup>
<n2spinup> 22.8 </n2spinup>
<n1spinup> 0.2 </n1spinup>
<n2spinup> 2.0 </n2spinup>
<maxn1> 105.8 </maxn1>
<maxn2> 102.1 </maxn2>
<augmented> 0 </augmented>

View file

@ -73,10 +73,36 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<or>
<and>
<or>
<equals>
<property>/controls/electrical/switches/battery1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/electrical/switches/battery2</property>
<value>1</value>
</equals>
</or>
<less-than>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</less-than>
<less-than>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</less-than>
</and>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</or>
</condition>
</model>
@ -89,10 +115,16 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</and>
</condition>
</model>
@ -107,10 +139,16 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<or>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</or>
</condition>
</model>
@ -123,10 +161,16 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</and>
</condition>
</model>
@ -141,10 +185,36 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<or>
<and>
<or>
<equals>
<property>/controls/electrical/switches/battery1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/electrical/switches/battery2</property>
<value>1</value>
</equals>
</or>
<less-than>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</less-than>
<less-than>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</less-than>
</and>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</or>
</condition>
</model>
@ -159,10 +229,16 @@
<pitch-deg>-15</pitch-deg>
</offsets>
<condition>
<greater-than-equals>
<property>/systems/electrical/outputs/efis</property>
<value>12</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>/systems/electrical/bus/ac1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
</and>
</condition>
</model>

View file

@ -9,16 +9,10 @@
<instruments>
<instrument include="page-eng2.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>ENG</value>
</equals>
</and>
</condition>
<name>ENG</name>
<x>128</x>
@ -29,16 +23,10 @@
<instrument include="page-bleed.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>BLEED</value>
</equals>
</and>
</condition>
<name>BLEED</name>
<x>128</x>
@ -49,16 +37,10 @@
<instrument include="page-status.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>STATUS</value> <!-- The textures are there - legoboy -->
</equals>
</and>
</condition>
<name>STATUS</name>
<x>128</x>
@ -69,19 +51,13 @@
<instrument include="page-press.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>PRESS</value>
</equals>
</and>
</condition>
<name>PRESS</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -89,19 +65,13 @@
<instrument include="page-elec.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>ELEC</value>
</equals>
</and>
</condition>
<name>ELEC</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -109,19 +79,13 @@
<instrument include="page-hyd.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>HYD</value>
</equals>
</and>
</condition>
<name>HYD</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -129,19 +93,13 @@
<instrument include="page-fuel.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>FUEL</value>
</equals>
</and>
</condition>
<name>FUEL</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -149,19 +107,13 @@
<instrument include="page-apu.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>APU</value>
</equals>
</and>
</condition>
<name>APU</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -169,19 +121,13 @@
<instrument include="page-cond.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>COND</value>
</equals>
</and>
</condition>
<name>COND</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -189,19 +135,13 @@
<instrument include="page-door.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>DOOR</value>
</equals>
</and>
</condition>
<name>DOOR</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -210,19 +150,13 @@
<instrument include="page-wheel.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>WHEEL</value>
</equals>
</and>
</condition>
<name>WHEEL</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -230,19 +164,13 @@
<instrument include="page-fctl.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>FCTL</value>
</equals>
</and>
</condition>
<name>FCTL</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>
@ -252,16 +180,10 @@
<instrument include="page-fctl-rudder.xml">
<name>Rudder animation</name>
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>FCTL</value>
</equals>
</and>
</condition>
<x>128</x> <!-- required horizontal placement -->
<y>80</y> <!-- required vertical placement -->
@ -271,19 +193,13 @@
<instrument include="page-all.xml">
<condition>
<and>
<greater-than>
<property>systems/electrical/outputs/efis</property>
<value>15</value>
</greater-than>
<equals>
<property>instrumentation/efis/ecam/display-mode</property>
<value>ALL</value>
</equals>
</and>
</condition>
<name>ALL</name>
<x>128</x>/
<x>128</x>
<y>128</y>
<w>256</w>
<h>256</h>

View file

@ -69,10 +69,61 @@
</emission>
</animation>
<!-- No buttons without power! -->
<animation>
<type>select</type>
<object-name>ACESSFeedBtn1F</object-name>
<object-name>ACESSFeedBtn2O</object-name>
<object-name>APUBleedBtn1F</object-name>
<object-name>APUBleedBtn2O</object-name>
<object-name>APUGenBtn1F</object-name>
<object-name>APUGenBtn2O</object-name>
<object-name>APUMasterBtn1F</object-name>
<object-name>APUMasterBtn2O</object-name>
<object-name>APUStartBtn1A</object-name>
<object-name>APUStartBtn2O</object-name>
<object-name>BatteryBtn11F</object-name>
<object-name>BatteryBtn21F</object-name>
<object-name>BatteryBtn12O</object-name>
<object-name>BatteryBtn22O</object-name>
<object-name>Battery-lvl</object-name>
<object-name>BusTieBtn2O</object-name>
<object-name>ExtPwrBtn1A</object-name>
<object-name>ExtPwrBtn2O</object-name>
<object-name>GalleyPwrBtn1F</object-name>
<object-name>GalleyPwrBtn2O</object-name>
<object-name>Gen1Btn1F</object-name>
<object-name>Gen1Btn2O</object-name>
<object-name>Gen2Btn1F</object-name>
<object-name>Gen2Btn2O</object-name>
<object-name>IDG1Btn1F</object-name>
<object-name>IDG2Btn1F</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/battery1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/electrical/switches/battery2</property>
<value>1</value>
</equals>
<greater-than-equals>
<property>/systems/electrical/bus/dc1</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>/systems/electrical/bus/dc2</property>
<value>25</value>
</greater-than-equals>
</or>
</condition>
</animation>
<animation>
<type>material</type>
<object-name>adirs-coords</object-name>
<object-name>battery-lvl</object-name>
<object-name>Battery-lvl</object-name>
<emission>
<red>1</red>
<green>1</green>
@ -98,7 +149,7 @@
<animation>
<type>select</type>
<object-name>battery-lvl</object-name>
<object-name>Battery-lvl</object-name>
<condition>
<property>controls/electric/battery-switch</property>
</condition>
@ -663,63 +714,290 @@
<!-- Electrical -->
<animation>
<name>Battery pick</name>
<name>Galley pick</name>
<type>pick</type>
<object-name>BatteryBtn1</object-name>
<object-name>BatteryBtn2</object-name>
<object-name>GalleyPwrBtn</object-name>
<object-name>GalleyPwrBtn1F</object-name>
<object-name>GalleyPwrBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/electric/battery-switch</property>
<property>/controls/electrical/switches/galley</property>
</binding>
</action>
</animation>
<animation>
<name>Battery off</name>
<type>textranslate</type>
<object-name>BatteryBtn2</object-name>
<property>controls/electric/battery-switch</property>
<interpolation>
<entry><ind>0</ind><dep>0.5</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>GalleyPwrBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>GalleyPwrBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/galley</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>Battery1 pick</name>
<type>pick</type>
<object-name>BatteryBtn11</object-name>
<object-name>BatteryBtn12</object-name>
<object-name>BatteryBtn11F</object-name>
<object-name>BatteryBtn12O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/controls/electrical/switches/battery1</property>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>BatteryBtn11F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>BatteryBtn12O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/battery1</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>Battery2 pick</name>
<type>pick</type>
<object-name>BatteryBtn21</object-name>
<object-name>BatteryBtn22</object-name>
<object-name>BatteryBtn21F</object-name>
<object-name>BatteryBtn22O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/controls/electrical/switches/battery2</property>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>BatteryBtn21F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>BatteryBtn22O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/battery2</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Not modeled in electric system yet -->
<!--animation>
<name>IDG 1 pick</name>
<type>pick</type>
<object-name>IDG1Btn</object-name>
<object-name>IDG1Btn1F</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/systems/unused/unused-oh</property>
</binding>
</action>
</animation-->
<animation>
<type>select</type>
<object-name>IDG1Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>Generator 1 pick</name>
<type>pick</type>
<object-name>Gen1Btn1</object-name>
<object-name>Gen1Btn2</object-name>
<object-name>Gen1Btn1F</object-name>
<object-name>Gen1Btn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/electric/engine[0]/generator</property>
<property>/controls/electrical/switches/gen1</property>
</binding>
</action>
</animation>
<animation>
<name>Generator 1 off</name>
<type>textranslate</type>
<object-name>Gen1Btn2</object-name>
<property>controls/electric/engine[0]/generator</property>
<interpolation>
<entry><ind>0</ind><dep>0.5</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>Gen1Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Gen1Btn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/gen1</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>AC ESS pick</name>
<type>pick</type>
<object-name>ACESSFeedBtn</object-name>
<object-name>ACESSFeedBtn1F</object-name>
<object-name>ACESSFeedBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/controls/electrical/switches/acc-ess-feed</property>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>ACESSFeedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>ACESSFeedBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/acc-ess-feed</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
@ -727,29 +1005,80 @@
<type>pick</type>
<object-name>APUGenBtn1</object-name>
<object-name>APUGenBtn2</object-name>
<object-name>APUGenBtnA</object-name>
<object-name>APUGenBtnO</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/electric/APU-generator</property>
<property>/controls/electrical/switches/gen-apu</property>
</binding>
</action>
</animation>
<animation>
<name>APU generator off</name>
<type>textranslate</type>
<object-name>APUGenBtn2</object-name>
<property>controls/electric/APU-generator</property>
<interpolation>
<entry><ind>0</ind><dep>0.5</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>APUGenBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>APUGenBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/gen-apu</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>Bus Tie pick</name>
<type>pick</type>
<object-name>BusTieBtn</object-name>
<object-name>BusTieBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/controls/electrical/switches/apu-ext-crosstie</property>
</binding>
</action>
</animation>
<animation>
<type>select</type>
<object-name>BusTieBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/apu-ext-crosstie</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
@ -757,26 +1086,54 @@
<type>pick</type>
<object-name>ExtPwrBtn1</object-name>
<object-name>ExtPwrBtn2</object-name>
<object-name>ExtPwrBtn1A</object-name>
<object-name>ExtPwrBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/electric/external-power</property>
<property>/controls/electrical/switches/gen-ext</property>
</binding>
</action>
</animation>
<animation>
<name>External power on</name>
<type>textranslate</type>
<object-name>ExtPwrBtn2</object-name>
<property>controls/electric/external-power</property>
<factor>0.5</factor>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>ExtPwrBtn1A</object-name>
<condition>
<or>
<equals>
<property>/controls/switches/cart</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>ExtPwrBtn2O</object-name>
<condition>
<or>
<and>
<equals>
<property>/controls/switches/cart</property>
<value>1</value>
</equals>
<equals>
<property>/controls/electrical/switches/gen-ext</property>
<value>1</value>
</equals>
</and>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
@ -784,29 +1141,84 @@
<type>pick</type>
<object-name>Gen2Btn1</object-name>
<object-name>Gen2Btn2</object-name>
<object-name>Gen2Btn1F</object-name>
<object-name>Gen2Btn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/electric/engine[1]/generator</property>
<property>/controls/electrical/switches/gen2</property>
</binding>
</action>
</animation>
<animation>
<name>Generator 2 off</name>
<type>textranslate</type>
<object-name>Gen2Btn2</object-name>
<property>controls/electric/engine[1]/generator</property>
<interpolation>
<entry><ind>0</ind><dep>0.5</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>Gen2Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>Gen2Btn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/electrical/switches/gen2</property>
<value>0</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Not modeled in electric system yet -->
<!--animation>
<name>IDG 2 pick</name>
<type>pick</type>
<object-name>IDG2Btn</object-name>
<object-name>IDG2Btn1F</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>/systems/unused/unused-oh</property>
</binding>
</action>
</animation-->
<animation>
<type>select</type>
<object-name>IDG2Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Air conditioning -->
@ -917,6 +1329,8 @@
<type>pick</type>
<object-name>APUBleedBtn1</object-name>
<object-name>APUBleedBtn2</object-name>
<object-name>APUBleedBtn1F</object-name>
<object-name>APUBleedBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
@ -926,16 +1340,39 @@
</binding>
</action>
</animation>
<animation>
<name>APU bleed on</name>
<type>textranslate</type>
<object-name>APUBleedBtn2</object-name>
<property>controls/APU/bleed</property>
<factor>0.5</factor>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>APUBleedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>APUBleedBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/APU/bleed</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
@ -1361,40 +1798,48 @@
<type>pick</type>
<object-name>APUMasterBtn1</object-name>
<object-name>APUMasterBtn2</object-name>
<object-name>APUMasterBtn1F</object-name>
<object-name>APUMasterBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/APU/master</property>
<property>/controls/APU/master</property>
</binding>
</action>
</animation><!-- I didn't model faults yet -->
<animation>
<type>select</type>
<object-name>APUMasterBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<name>APU master switch fault</name>
<type>textranslate</type>
<object-name>APUMasterBtn1</object-name>
<property>engines/apu/serviceable</property>
<interpolation>
<entry><ind>0</ind><dep>0</dep></entry> <!-- Set 0.5 to make the FAULT light appear -->
<entry><ind>1</ind><dep>0</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
</axis>
</animation>
<animation>
<name>APU master switch on</name>
<type>textranslate</type>
<object-name>APUMasterBtn2</object-name>
<property>controls/APU/master</property>
<factor>0.5</factor>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>APUMasterBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/APU/master</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
@ -1402,6 +1847,8 @@
<type>pick</type>
<object-name>APUStartBtn1</object-name>
<object-name>APUStartBtn2</object-name>
<object-name>APUStartBtn1A</object-name>
<object-name>APUStartBtn2O</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
@ -1409,19 +1856,39 @@
<command>property-toggle</command>
<property>controls/APU/start</property>
</binding>
</action>
</animation>
<animation>
<name>APU starter on</name>
<type>textranslate</type>
<object-name>APUStartBtn2</object-name>
<property>controls/APU/start</property>
<factor>0.5</factor>
<axis>
<x>1</x>
<y>0</y>
</axis>
<type>select</type>
<object-name>APUStartBtn1A</object-name>
<condition>
<or>
<greater-than>
<property>/systems/apu/rpm</property>
<value>99</value>
</greater-than>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>APUStartBtn2O</object-name>
<condition>
<or>
<equals>
<property>/controls/APU/start</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<!-- Interior lights -->
@ -1510,6 +1977,46 @@
<z-m>-0.2597</z-m>
</center>
</animation>
<animation>
<name>Annun lights pick</name>
<type>pick</type>
<object-name>AnnunciatorLtSwtch</object-name>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<property>/controls/switches/annun-test</property>
<!--value>-1</value-->
<value>0</value>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<name>Annun lights rotate</name>
<type>rotate</type>
<object-name>AnnunciatorLtSwtch</object-name>
<property>/controls/switches/annun-test</property>
<interpolation>
<entry><ind>-1</ind><dep>35</dep></entry>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
</interpolation>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
<center>
<x-m>-0.01</x-m>
<y-m>0</y-m>
<z-m>-0.2597</z-m>
</center>
</animation>
<!-- Passenger signs -->
<animation>
@ -1830,7 +2337,7 @@
</text>
<text>
<name>battery-lvl</name>
<name>Battery-lvl</name>
<offsets>
<x-m>-0.008</x-m>
<y-m>-0.057</y-m>
@ -1843,7 +2350,7 @@
<axis-alignment>xy-plane</axis-alignment>
<type type="string">number-value</type>
<format type="string">%2.1f</format>
<property>/systems/electrical/suppliers/battery</property>
<property>/systems/electrical/battery1-volts</property>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
@ -1856,7 +2363,7 @@
</text>
<text>
<name>battery-lvl</name>
<name>Battery-lvl</name>
<offsets>
<x-m>-0.008</x-m>
<y-m>0.035</y-m>
@ -1869,7 +2376,7 @@
<axis-alignment>xy-plane</axis-alignment>
<type type="string">number-value</type>
<format type="string">%2.1f</format>
<property>/systems/electrical/suppliers/battery</property>
<property>/systems/electrical/battery2-volts</property>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1235,6 +1235,30 @@
</animation>
<!-- Flaps Indicator -->
<text>
<name>osgtext-green</name>
<offsets>
<x-m>0.0007</x-m>
<y-m>0.0445</y-m>
<z-m>-0.0018</z-m>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<property>/controls/flight/flap-txt</property>
<truncate type="bool">false</truncate>
<font type="string">helvetica_bold.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.005</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<!--animation>
<type>rotate</type>

View file

@ -1,365 +1,266 @@
#### jet engine electrical system ####
#### Syd Adams ####
var count=0;
var ammeter_ave = 0.0;
var Lbus = props.globals.initNode("/systems/electrical/left-bus",0,"DOUBLE");
var Rbus = props.globals.initNode("/systems/electrical/right-bus",0,"DOUBLE");
var Amps = props.globals.initNode("/systems/electrical/amps",0,"DOUBLE");
var EXT = props.globals.initNode("/controls/electric/external-power",0,"DOUBLE");
var XTie = props.globals.initNode("/systems/electrical/xtie",0,"BOOL");
var APUgen=props.globals.initNode("controls/electric/APU-generator",0,"BOOL");
var extpwr=props.globals.initNode("controls/electric/external-power",0,"BOOL");
var lbus_volts = 0.0;
var rbus_volts = 0.0;
# Electrical system for A320 by Joshua Davidson (it0uchpods/411).
var lbus_input=[];
var lbus_output=[];
var lbus_load=[];
var ELEC_UPDATE_PERIOD = 0.5; # A periodic update in secs
var STD_VOLTS_AC = 115; # Typical volts for a power source
var MIN_VOLTS_AC = 110; # Typical minimum voltage level for generic equipment
var STD_VOLTS_DC = 28; # Typical volts for a power source
var MIN_VOLTS_DC = 25; # Typical minimum voltage level for generic equipment
var STD_AMPS = 0; # Not used yet
var NUM_ENGINES = 2;
var rbus_input=[];
var rbus_output=[];
var rbus_load=[];
# Set all the stuff I need
var elec_init = func {
setprop("/controls/switches/annun-test", 0);
setprop("/controls/electrical/switches/galley", 0);
setprop("/controls/electrical/switches/idg1", 0);
setprop("/controls/electrical/switches/idg2", 0);
setprop("/controls/electrical/switches/gen1", 0);
setprop("/controls/electrical/switches/gen2", 0);
setprop("/controls/electrical/switches/gen-apu", 0);
setprop("/controls/electrical/switches/gen-ext", 0);
setprop("/controls/electrical/switches/apu-ext-crosstie", 1);
setprop("/controls/electrical/switches/acc-ess-feed", 1);
setprop("/controls/electrical/switches/battery1", 0);
setprop("/controls/electrical/switches/battery2", 0);
setprop("/systems/electrical/battery1-volts", 25.9);
setprop("/systems/electrical/battery2-volts", 25.9);
setprop("/systems/electrical/bus/dc1", 0);
setprop("/systems/electrical/bus/dc2", 0);
setprop("/systems/electrical/bus/ac1", 0);
setprop("/systems/electrical/bus/ac2", 0);
setprop("/systems/electrical/bus/ac-ess", 0);
setprop("systems/electrical/on", 0);
setprop("/controls/electrical/xtie/xtieL", 0);
setprop("/controls/electrical/xtie/xtieR", 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);
setprop("/systems/electrical/outputs/audio-panel[1]", 0);
setprop("/systems/electrical/outputs/autopilot", 0);
setprop("/systems/electrical/outputs/avionics-fan", 0);
setprop("/systems/electrical/outputs/beacon", 0);
setprop("/systems/electrical/outputs/bus", 0);
setprop("/systems/electrical/outputs/cabin-lights", 0);
setprop("/systems/electrical/outputs/dme", 0);
setprop("/systems/electrical/outputs/efis", 0);
setprop("/systems/electrical/outputs/flaps", 0);
setprop("/systems/electrical/outputs/fuel-pump", 0);
setprop("/systems/electrical/outputs/fuel-pump[1]", 0);
setprop("/systems/electrical/outputs/gps", 0);
setprop("/systems/electrical/outputs/gps-mfd", 0);
setprop("/systems/electrical/outputs/hsi", 0);
setprop("/systems/electrical/outputs/instr-ignition-switch", 0);
setprop("/systems/electrical/outputs/instrument-lights", 0);
setprop("/systems/electrical/outputs/landing-lights", 0);
setprop("/systems/electrical/outputs/map-lights", 0);
setprop("/systems/electrical/outputs/mk-viii", 0);
setprop("/systems/electrical/outputs/nav", 0);
setprop("/systems/electrical/outputs/nav[1]", 0);
setprop("/systems/electrical/outputs/pitot-head", 0);
setprop("/systems/electrical/outputs/stobe-lights", 0);
setprop("/systems/electrical/outputs/tacan", 0);
setprop("/systems/electrical/outputs/taxi-lights", 0);
setprop("/systems/electrical/outputs/transponder", 0);
setprop("/systems/electrical/outputs/turn-coordinator", 0);
}
var lights_input=[];
var lights_output=[];
var lights_load=[];
# Define all the stuff I need for the main elec loop
var master_elec = func {
var gallery_sw = getprop("/controls/electrical/switches/galley");
var idg1_sw = getprop("/controls/electrical/switches/idg1");
var idg2_sw = getprop("/controls/electrical/switches/idg2");
var gen1_sw = getprop("/controls/electrical/switches/gen1");
var gen2_sw = getprop("/controls/electrical/switches/gen2");
var gen_apu_sw = getprop("/controls/electrical/switches/gen-apu");
var gen_ext_sw = getprop("/controls/electrical/switches/gen-ext");
var apu_ext_crosstie_sw = getprop("/controls/electrical/switches/apu-ext-crosstie");
var acc_ess_feed_sw = getprop("/controls/electrical/switches/acc-ess-feed");
var battery1_sw = getprop("/controls/electrical/switches/battery1");
var battery2_sw = getprop("/controls/electrical/switches/battery2");
var rpmapu = getprop("/systems/apu/rpm");
var extpwr_on = getprop("/controls/switches/cart");
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var xtieL = getprop("/controls/electrical/xtie/xtieL");
var xtieR = getprop("/controls/electrical/xtie/xtieR");
var ac1 = getprop("/systems/electrical/bus/ac1");
var ac2 = getprop("/systems/electrical/bus/ac2");
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
var dc1 = getprop("/systems/electrical/bus/dc1");
var dc2 = getprop("/systems/electrical/bus/dc2");
# Left cross tie yes?
if (extpwr_on and gen_ext_sw) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else if (rpmapu >= 99 and gen_apu_sw) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else if (stateL == 3 and gen1_sw) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else {
setprop("/controls/electrical/xtie/xtieR", 0);
}
# Right cross tie yes?
if (extpwr_on and gen_ext_sw) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else if (rpmapu >= 99 and gen_apu_sw) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else if (stateR == 3 and gen2_sw) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else {
setprop("/controls/electrical/xtie/xtieL", 0);
}
# Left AC/DC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/ac1", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc1", 28);
} else if (rpmapu >= 99 and gen_apu_sw) {
setprop("/systems/electrical/bus/ac1", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc1", 28);
} else if (stateL == 3 and gen1_sw) {
setprop("/systems/electrical/bus/ac1", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc1", 28);
} else if (apu_ext_crosstie_sw == 1 and xtieL) {
setprop("/systems/electrical/bus/ac1", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc1", 28);
} else {
setprop("/systems/electrical/bus/ac1", 0);
if (getprop("/systems/electrical/bus/ac2") == 0) {
setprop("/systems/electrical/bus/ac-ess", 0);
}
setprop("/systems/electrical/bus/dc1", 0);
}
# Right AC/DC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/ac2", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc2", 28);
} else if (rpmapu >= 99 and gen_apu_sw) {
setprop("/systems/electrical/bus/ac2", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc2", 28);
} else if (stateR == 3 and gen2_sw) {
setprop("/systems/electrical/bus/ac2", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc2", 28);
} else if (apu_ext_crosstie_sw == 1 and xtieR) {
setprop("/systems/electrical/bus/ac2", 115);
setprop("/systems/electrical/bus/ac-ess", 115);
setprop("/systems/electrical/bus/dc2", 28);
} else {
setprop("/systems/electrical/bus/ac2", 0);
if (getprop("/systems/electrical/bus/ac1") == 0) {
setprop("/systems/electrical/bus/ac-ess", 0);
}
setprop("/systems/electrical/bus/dc2", 0);
}
if (ac_ess >= 100) {
if (gallery_sw == 1) {
setprop("/systems/electrical/bus/galley", 115);
} else if (gallery_sw == 0) {
setprop("/systems/electrical/bus/galley", 0);
}
} else {
setprop("/systems/electrical/bus/galley", 0);
}
}
var strobe_switch = props.globals.getNode("controls/lighting/strobe", 1);
aircraft.light.new("controls/lighting/strobe-state", [0.05, 1.30], strobe_switch);
var beacon_switch = props.globals.getNode("controls/lighting/beacon", 1);
aircraft.light.new("controls/lighting/beacon-state", [0.05, 2.0], beacon_switch);
#var battery = Battery.new(switch-prop,volts,amps,amp_hours,charge_percent,charge_amps);
var Battery = {
new : func(swtch,vlt,amp,hr,chp,cha){
m = { parents : [Battery] };
m.switch = props.globals.getNode(swtch,1);
m.switch.setBoolValue(0);
m.ideal_volts = vlt;
m.ideal_amps = amp;
m.amp_hours = hr;
m.charge_percent = chp;
m.charge_amps = cha;
return m;
},
apply_load : func(load,dt) {
if(me.switch.getValue()){
var amphrs_used = load * dt / 3600.0;
var percent_used = amphrs_used / me.amp_hours;
me.charge_percent -= percent_used;
if ( me.charge_percent < 0.0 ) {
me.charge_percent = 0.0;
} elsif ( me.charge_percent > 1.0 ) {
me.charge_percent = 1.0;
}
var output =me.amp_hours * me.charge_percent;
return output;
}else return 0;
},
get_output_volts : func {
if(me.switch.getValue()){
var x = 1.0 - me.charge_percent;
var tmp = -(3.0 * x - 1.0);
var factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
var output =me.ideal_volts * factor;
return output;
}else return 0;
},
get_output_amps : func {
if(me.switch.getValue()){
var x = 1.0 - me.charge_percent;
var tmp = -(3.0 * x - 1.0);
var factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
var output =me.ideal_amps * factor;
return output;
}else return 0;
}
};
# var alternator = Alternator.new(num,switch,gen_output,rpm_source,rpm_threshold,volts,amps);
var Alternator = {
new : func (num,switch,gen_output,src,thr,vlt,amp){
m = { parents : [Alternator] };
m.switch = props.globals.getNode(switch,1);
m.switch.setBoolValue(0);
m.meter = props.globals.getNode("systems/electrical/gen-load["~num~"]",1);
m.meter.setDoubleValue(0);
m.gen_output = props.globals.getNode(gen_output,1);
m.gen_output.setDoubleValue(0);
m.meter.setDoubleValue(0);
m.rpm_source = props.globals.getNode(src,1);
m.rpm_threshold = thr;
m.ideal_volts = vlt;
m.ideal_amps = amp;
return m;
},
apply_load : func(load) {
var cur_volt=me.gen_output.getValue();
var cur_amp=me.meter.getValue();
if(cur_volt >1){
var factor=1/cur_volt;
gout = (load * factor);
if(gout>1)gout=1;
}else{
gout=0;
}
me.meter.setValue(gout);
},
get_output_volts : func {
var out = 0;
if(me.switch.getBoolValue()){
var factor = me.rpm_source.getValue() / me.rpm_threshold or 0;
if ( factor > 1.0 )factor = 1.0;
var out = (me.ideal_volts * factor);
}
me.gen_output.setValue(out);
return out;
},
get_output_amps : func {
var ampout =0;
if(me.switch.getBoolValue()){
var factor = me.rpm_source.getValue() / me.rpm_threshold or 0;
if ( factor > 1.0 ) {
factor = 1.0;
}
ampout = me.ideal_amps * factor;
}
return ampout;
}
};
var battery = Battery.new("/controls/electric/battery-switch",24,30,34,1.0,7.0);
var alternator1 = Alternator.new(0,"controls/electric/engine[0]/generator","/engines/engine[0]/amp-v","/engines/engine[0]/n2",50.0,28.0,60.0);
var alternator2 = Alternator.new(1,"controls/electric/engine[1]/generator","/engines/engine[1]/amp-v","/engines/engine[1]/n2",50.0,28.0,60.0);
var alternator3 = Alternator.new(2,"controls/electric/APU-generator","/engines/apu/amp-v","/systems/apu/rpm",80.0,24.0,60.0);
#####################################
setlistener("/sim/signals/fdm-initialized", func {
init_switches();
settimer(update_electrical,5);
print("Electrical System ... Done!");
setlistener("/systems/electrical/bus/ac-ess", func {
if (getprop("/systems/electrical/bus/ac-ess") == 0) {
setprop("systems/electrical/on", 0);
# ai_spin.setValue(0.2);
# aispin.stop();
setprop("systems/electrical/outputs/adf", 0);
setprop("systems/electrical/outputs/audio-panel", 0);
setprop("systems/electrical/outputs/audio-panel[1]", 0);
setprop("systems/electrical/outputs/autopilot", 0);
setprop("systems/electrical/outputs/avionics-fan", 0);
setprop("systems/electrical/outputs/beacon", 0);
setprop("systems/electrical/outputs/bus", 0);
setprop("systems/electrical/outputs/cabin-lights", 0);
setprop("systems/electrical/outputs/dme", 0);
setprop("systems/electrical/outputs/efis", 0);
setprop("systems/electrical/outputs/flaps", 0);
setprop("systems/electrical/outputs/fuel-pump", 0);
setprop("systems/electrical/outputs/fuel-pump[1]", 0);
setprop("systems/electrical/outputs/gps", 0);
setprop("systems/electrical/outputs/gps-mfd", 0);
setprop("systems/electrical/outputs/hsi", 0);
setprop("systems/electrical/outputs/instr-ignition-switch", 0);
setprop("systems/electrical/outputs/instrument-lights", 0);
setprop("systems/electrical/outputs/landing-lights", 0);
setprop("systems/electrical/outputs/map-lights", 0);
setprop("systems/electrical/outputs/mk-viii", 0);
setprop("systems/electrical/outputs/nav", 0);
setprop("systems/electrical/outputs/nav[1]", 0);
setprop("systems/electrical/outputs/pitot-head", 0);
setprop("systems/electrical/outputs/stobe-lights", 0);
setprop("systems/electrical/outputs/tacan", 0);
setprop("systems/electrical/outputs/taxi-lights", 0);
setprop("systems/electrical/outputs/transponder", 0);
setprop("systems/electrical/outputs/turn-coordinator", 0);
} else {
setprop("systems/electrical/on", 1);
# aispin.start();
setprop("systems/electrical/outputs/adf", 28);
setprop("systems/electrical/outputs/audio-panel", 28);
setprop("systems/electrical/outputs/audio-panel[1]", 28);
setprop("systems/electrical/outputs/autopilot", 28);
setprop("systems/electrical/outputs/avionics-fan", 28);
setprop("systems/electrical/outputs/beacon", 28);
setprop("systems/electrical/outputs/bus", 28);
setprop("systems/electrical/outputs/cabin-lights", 28);
setprop("systems/electrical/outputs/dme", 28);
setprop("systems/electrical/outputs/efis", 28);
setprop("systems/electrical/outputs/flaps", 28);
setprop("systems/electrical/outputs/fuel-pump", 28);
setprop("systems/electrical/outputs/fuel-pump[1]", 28);
setprop("systems/electrical/outputs/gps", 28);
setprop("systems/electrical/outputs/gps-mfd", 28);
setprop("systems/electrical/outputs/hsi", 28);
setprop("systems/electrical/outputs/instr-ignition-switch", 28);
setprop("systems/electrical/outputs/instrument-lights", 28);
setprop("systems/electrical/outputs/landing-lights", 28);
setprop("systems/electrical/outputs/map-lights", 28);
setprop("systems/electrical/outputs/mk-viii", 28);
setprop("systems/electrical/outputs/nav", 28);
setprop("systems/electrical/outputs/nav[1]", 28);
setprop("systems/electrical/outputs/pitot-head", 28);
setprop("systems/electrical/outputs/stobe-lights", 28);
setprop("systems/electrical/outputs/tacan", 28);
setprop("systems/electrical/outputs/taxi-lights", 28);
setprop("systems/electrical/outputs/transponder", 28);
setprop("systems/electrical/outputs/turn-coordinator", 28);
}
});
var init_switches = func{
var AVswitch=props.globals.initNode("controls/electric/avionics-switch",1,"BOOL");
setprop("controls/lighting/instruments-norm",0.8);
setprop("controls/lighting/engines-norm",0.8);
props.globals.initNode("controls/electric/ammeter-switch",0,"BOOL");
props.globals.getNode("systems/electrical/serviceable",0,"BOOL");
props.globals.getNode("controls/electric/external-power",0,"BOOL");
setprop("controls/lighting/instrument-lights-norm",0.8);
setprop("controls/lighting/efis-norm",0.8);
setprop("controls/lighting/panel-norm",0.8);
append(lights_input,props.globals.initNode("controls/lighting/landing-light[0]",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/landing-light[0]",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/landing-light[1]",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/landing-light[1]",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/landing-light[2]",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/landing-light[2]",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/nav-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/nav-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/cabin-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/cabin-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/map-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/map-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/wing-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/wing-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/recog-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/recog-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/logo-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/logo-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/taxi-lights",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/taxi-lights",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/beacon-state/state",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/beacon",0,"DOUBLE"));
append(lights_load,1);
append(lights_input,props.globals.initNode("controls/lighting/strobe-state/state",0,"BOOL"));
append(lights_output,props.globals.initNode("systems/electrical/outputs/strobe",0,"DOUBLE"));
append(lights_load,1);
append(rbus_input,props.globals.initNode("controls/electric/wiper-switch",0,"BOOL"));
append(rbus_output,props.globals.initNode("systems/electrical/outputs/wiper",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,props.globals.initNode("controls/engines/engine[0]/fuel-pump",0,"BOOL"));
append(rbus_output,props.globals.initNode("systems/electrical/outputs/fuel-pump[0]",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,props.globals.initNode("controls/engines/engine[1]/fuel-pump",0,"BOOL"));
append(rbus_output,props.globals.initNode("systems/electrical/outputs/fuel-pump[1]",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,props.globals.initNode("controls/engines/engine[0]/starter",0,"BOOL"));
append(rbus_output,props.globals.initNode("systems/electrical/outputs/starter",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,props.globals.initNode("controls/engines/engine[1]/starter",0,"BOOL"));
append(rbus_output,props.globals.initNode("systems/electrical/outputs/starter[1]",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,AVswitch);
append(rbus_output,props.globals.initNode("systems/electrical/outputs/KNS80",0,"DOUBLE"));
append(rbus_load,1);
append(rbus_input,AVswitch);
append(rbus_output,props.globals.initNode("systems/electrical/outputs/efis",0,"DOUBLE"));
append(rbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/adf",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/dme",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/gps",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/DG",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/transponder",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/mk-viii",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/turn-coordinator",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/comm",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/comm[1]",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/nav",0,"DOUBLE"));
append(lbus_load,1);
append(lbus_input,AVswitch);
append(lbus_output,props.globals.initNode("systems/electrical/outputs/nav[1]",0,"DOUBLE"));
append(lbus_load,1);
var update_electrical = func {
master_elec();
settimer(update_electrical, ELEC_UPDATE_PERIOD);
}
update_virtual_bus = func( dt ) {
var PWR = getprop("systems/electrical/serviceable");
var xtie=0;
load = 0.0;
power_source = nil;
if(count==0){
var battery_volts = battery.get_output_volts();
lbus_volts = battery_volts;
power_source = "battery";
if (extpwr.getValue() and getprop("velocities/groundspeed-kt") < 1)
{
power_source = "external";
lbus_volts = 28;
}
elsif (APUgen.getValue())
{
power_source = "APU";
var alternator3_volts = alternator3.get_output_volts();
lbus_volts = alternator3_volts;
}
var alternator1_volts = alternator1.get_output_volts();
if (alternator1_volts > lbus_volts) {
lbus_volts = alternator1_volts;
power_source = "alternator1";
}
lbus_volts *=PWR;
Lbus.setValue(lbus_volts);
load += lh_bus(lbus_volts);
alternator1.apply_load(load);
}else{
var battery_volts = battery.get_output_volts();
rbus_volts = battery_volts;
power_source = "battery";
if (extpwr.getValue() and getprop("velocities/groundspeed-kt") < 1)
{
power_source = "external";
rbus_volts = 28;
}
elsif (APUgen.getValue())
{
power_source = "APU";
var alternator3_volts = alternator3.get_output_volts();
rbus_volts = alternator3_volts;
}
var alternator2_volts = alternator2.get_output_volts();
if (alternator2_volts > rbus_volts) {
rbus_volts = alternator2_volts;
power_source = "alternator2";
}
rbus_volts *=PWR;
Rbus.setValue(rbus_volts);
load += rh_bus(rbus_volts);
alternator2.apply_load(load);
}
count=1-count;
if(rbus_volts > 5 and lbus_volts>5) xtie=1;
XTie.setValue(xtie);
if(rbus_volts > 5 or lbus_volts>5) load += lighting(24);
ammeter = 0.0;
return load;
}
rh_bus = func(bv) {
var bus_volts = bv;
var load = 0.0;
var srvc = 0.0;
for(var i=0; i<size(rbus_input); i+=1) {
var srvc = rbus_input[i].getValue();
load += rbus_load[i] * srvc;
rbus_output[i].setValue(bus_volts * srvc);
}
return load;
}
lh_bus = func(bv) {
var load = 0.0;
var srvc = 0.0;
for(var i=0; i<size(lbus_input); i+=1) {
var srvc = lbus_input[i].getValue();
load += lbus_load[i] * srvc;
lbus_output[i].setValue(bv * srvc);
}
setprop("systems/electrical/outputs/flaps",bv);
return load;
}
lighting = func(bv) {
var load = 0.0;
var srvc = 0.0;
var ac=bv*4.29;
for(var i=0; i<size(lights_input); i+=1) {
var srvc = lights_input[i].getValue();
load += lights_load[i] * srvc;
lights_output[i].setValue(bv * srvc);
}
return load;
}
update_electrical = func {
var scnd = getprop("sim/time/delta-sec");
update_virtual_bus( scnd );
}
settimer(update_electrical, 2);

View file

@ -1,114 +0,0 @@
# Electrical system for A320 by Joshua Davidson (it0uchpods/411).
var ELEC_UPDATE_PERIOD = 1; # A periodic update in secs
var STD_VOLTS_AC = 115; # Typical volts for a power source
var MIN_VOLTS_AC = 110; # Typical minimum voltage level for generic equipment
var STD_VOLTS_DC = 28; # Typical volts for a power source
var MIN_VOLTS_DC = 25; # Typical minimum voltage level for generic equipment
var STD_AMPS = 0; # Not used yet
var NUM_ENGINES = 2;
# Set all the stuff I need
setlistener("/sim/signals/fdm-initialized", func {
# Electrical Buses
setprop("/electrical/bus/dc-bat", 0);
setprop("/electrical/bus/dc-bus1", 0);
setprop("/electrical/bus/dc-bus2", 0);
setprop("/electrical/bus/dc-ess", 0);
setprop("/electrical/bus/ac-bus1", 0);
setprop("/electrical/bus/ac-bus2", 0);
setprop("/electrical/bus/ac-ess", 0);
setprop("/electrical/bus/hot-bus1", 0);
setprop("/electrical/bus/hot-bus2", 0);
# Electrical Inputs
setprop("/electrical/input/gen1", 0);
setprop("/electrical/input/gen2", 0);
setprop("/electrical/input/apu-gen", 0);
setprop("/electrical/input/ext-pwr", 0);
setprop("/electrical/input/bat1", 0);
setprop("/electrical/input/bat2", 0);
setprop("/electrical/input/emer-gen", 0);
# Switches
setprop("/electrical/switches/gen1", 0);
setprop("/electrical/switches/gen2", 0);
setprop("/electrical/switches/apu-gen", 0);
setprop("/electrical/switches/ext-pwr", 0);
setprop("/electrical/switches/emer", 0);
setprop("/electrical/switches/galley", 0);
setprop("/electrical/switches/ties/apu-ext-ac1", 0);
setprop("/electrical/switches/ties/apu-ext-ac2", 0);
setprop("/electrical/switches/ties/ac-ess-ac1", 0);
setprop("/electrical/switches/ties/ac-ess-ac2", 0);
setprop("/electrical/switches/ties/ac-ess-dc-ess", 0);
setprop("/electrical/switches/ties/dc1-dc-bat", 0);
setprop("/electrical/switches/ties/dc2-dc-bat", 0);
setprop("/electrical/switches/ties/bat1-dc-bat", 0);
setprop("/electrical/switches/ties/bat2-dc-bat", 0);
setprop("/electrical/switches/ties/dc-bat-dc-ess", 0);
setprop("/electrical/switches/ties/ac-bat-ac-ess", 0);
setprop("/electrical/switches/ties/emer-dc-ess", 0);
setprop("/electrical/switches/ties/emer-ac-ess", 0);
});
# Define all the stuff I need for the main elec loop
var master_elec = func {
}
var update_electrical = func {
master_elec();
settimer(update_electrical, ELEC_UPDATE_PERIOD);
}
settimer(update_electrical, 2);
setlistener("/sim/signals/fdm-initialized", func {
# 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);
setprop("/systems/electrical/outputs/audio-panel[1]", 0);
setprop("/systems/electrical/outputs/autopilot", 0);
setprop("/systems/electrical/outputs/avionics-fan", 0);
setprop("/systems/electrical/outputs/beacon", 0);
setprop("/systems/electrical/outputs/bus", 0);
setprop("/systems/electrical/outputs/cabin-lights", 0);
setprop("/systems/electrical/outputs/dme", 0);
setprop("/systems/electrical/outputs/efis", 0);
setprop("/systems/electrical/outputs/flaps", 0);
setprop("/systems/electrical/outputs/fuel-pump", 0);
setprop("/systems/electrical/outputs/fuel-pump[1]", 0);
setprop("/systems/electrical/outputs/gps", 0);
setprop("/systems/electrical/outputs/gps-mfd", 0);
setprop("/systems/electrical/outputs/hsi", 0);
setprop("/systems/electrical/outputs/instr-ignition-switch", 0);
setprop("/systems/electrical/outputs/instrument-lights", 0);
setprop("/systems/electrical/outputs/landing-lights", 0);
setprop("/systems/electrical/outputs/map-lights", 0);
setprop("/systems/electrical/outputs/mk-viii", 0);
setprop("/systems/electrical/outputs/nav", 0);
setprop("/systems/electrical/outputs/nav[1]", 0);
setprop("/systems/electrical/outputs/pitot-head", 0);
setprop("/systems/electrical/outputs/stobe-lights", 0);
setprop("/systems/electrical/outputs/tacan", 0);
setprop("/systems/electrical/outputs/taxi-lights", 0);
setprop("/systems/electrical/outputs/transponder", 0);
setprop("/systems/electrical/outputs/turn-coordinator", 0);
});

View file

@ -13,14 +13,14 @@ var n1_spin = 5.1;
var n2_spin = 22.8;
var n1_start = 23.3;
var n2_start = 63.6;
var egt_start = 489;
var egt_start = 545;
var n1_max = 105.8;
var n2_max = 102.1;
var egt_max = 860;
var n1_wm = 0;
var n2_wm = 0;
var apu_max = 99.8;
var apu_egt_max = 462;
var apu_egt_max = 513;
var spinup_time = 15;
var start_time = 10;
var egt_lightup_time = 3;

View file

@ -1,54 +1,6 @@
# AIRBUS A320 SYSTEMS FILE
##########################
# NOTE: This file contains a loop for running all update functions, so it should be loaded last
## SYSTEMS LOOP
###############
var systems =
{
stopUpdate: 0,
init: func
{
print("A320 Systems ... Done!");
systems.stop();
settimer(func
{
systems.stopUpdate = 0;
systems.update();
}, 0.5);
},
stop: func
{
systems.stopUpdate = 1;
},
update: func
{
update_electrical();
# stop calling our systems code if the stop() function was called or the aircraft crashes
if (!systems.stopUpdate and !props.globals.getNode("sim/crashed").getBoolValue())
{
settimer(systems.update, 0);
}
}
};
# call init() 2 seconds after the FDM is ready
setlistener("sim/signals/fdm-initialized", func
{
settimer(systems.init, 2);
}, 0, 0);
# call init() if the simulator resets
setlistener("sim/signals/reinit", func(reinit)
{
if (reinit.getBoolValue())
{
systems.init();
}
}, 0, 0);
## LIGHTS
#########
@ -173,7 +125,8 @@ var triggerDoor = func(door, doorName, doorDesc)
}
};
setlistener("/sim/signals/fdm-initialized", func {
setlistener("/sim/signals/fdm-initialized", func {
systems.elec_init();
itaf.ap_init();
var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/A320Family/Systems/autopilot-dlg.xml");
setprop("/controls/engines/thrust-limit", "TOGA");