Added a nasal file to eliminate the need for adding new properties for each aircraft that uses the Primus 1000 system
This commit is contained in:
parent
ba429a7110
commit
a6496bbf0b
3 changed files with 127 additions and 15 deletions
100
Aircraft/Instruments-3d/primus-1000/Primus1000.nas
Normal file
100
Aircraft/Instruments-3d/primus-1000/Primus1000.nas
Normal file
|
@ -0,0 +1,100 @@
|
|||
###### Primus 1000 system ########
|
||||
FDMODE = props.globals.getNode("/instrumentation/primus1000/fdmode",1);
|
||||
NavPtr1=props.globals.getNode("/instrumentation/primus1000/nav1pointer",1);
|
||||
NavPtr2=props.globals.getNode("/instrumentation/primus1000/nav2pointer",1);
|
||||
NavPtr1_offset=props.globals.getNode("/instrumentation/primus1000/nav1pointer-heading-offset",1);
|
||||
NavPtr2_offset=props.globals.getNode("/instrumentation/primus1000/nav2pointer-heading-offset",1);
|
||||
RAmode=props.globals.getNode("/instrumentation/primus1000/ra-mode",1);
|
||||
NavDist=props.globals.getNode("/instrumentation/primus1000/nav-dist-nm",1);
|
||||
APoff=props.globals.getNode("/autopilot/locks/passive-mode",1);
|
||||
Hyd1=props.globals.getNode("systems/hydraulic/pump-psi[0]",1);
|
||||
Hyd2=props.globals.getNode("systems/hydraulic/pump-psi[1]",1);
|
||||
FuelPph1=props.globals.getNode("engines/engine[0]/fuel-flow-pph",1);
|
||||
FuelPph2=props.globals.getNode("engines/engine[1]/fuel-flow-pph",1);
|
||||
FuelDensity = 6.0;
|
||||
|
||||
get_pointer_offset = func{
|
||||
var test=arg[0];
|
||||
var offset = 0;
|
||||
var hdg = getprop("/orientation/heading-magnetic-deg");
|
||||
if(test==0 or test == nil){return 0.0;}
|
||||
|
||||
if(test == 1){
|
||||
offset=getprop("/instrumentation/nav/heading-deg");
|
||||
offset -= hdg;
|
||||
if(offset < -180){offset += 360;}
|
||||
elsif(offset > 180){offset -= 360;}
|
||||
}elsif(test == 2){
|
||||
offset = getprop("/instrumentation/adf/indicated-bearing-deg");
|
||||
}elsif(test == 3){
|
||||
offset = getprop("/autopilot/internal/true-heading-error-deg");
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
update_pfd = func{
|
||||
NavPtr1_offset.setValue(get_pointer_offset(NavPtr1.getValue()));
|
||||
NavPtr2_offset.setValue(get_pointer_offset(NavPtr2.getValue()));
|
||||
|
||||
if(getprop("/instrumentation/nav/data-is-valid")=="true"){
|
||||
nm_calc = getprop("/instrumentation/nav/nav-distance");
|
||||
if(nm_calc == nil){nm_calc = 0.0;}
|
||||
nm_calc = 0.000539 * nm_calc;
|
||||
NavDist.setValue(nm_calc);
|
||||
}
|
||||
}
|
||||
|
||||
update_mfd = func{
|
||||
}
|
||||
|
||||
update_eicas = func{
|
||||
var hpsi = getprop("/engines/engine[0]/n2");
|
||||
if(hpsi == nil){hpsi=0.0;}
|
||||
hpsi = hpsi * 100;
|
||||
if(hpsi > 3000){hpsi=3000;}
|
||||
Hyd1.setValue(hpsi);
|
||||
hpsi = getprop("/engines/engine[1]/n2");
|
||||
if(hpsi == nil){hpsi=0.0;}
|
||||
hpsi = hpsi * 100;
|
||||
if(hpsi > 3000){hpsi=3000;}
|
||||
Hyd2.setValue(hpsi);
|
||||
|
||||
var pph=getprop("/engines/engine[0]/fuel-flow-gph");
|
||||
if(pph == nil){pph = 0.0};
|
||||
FuelPph1.setValue(pph* FuelDensity);
|
||||
pph=getprop("/engines/engine[1]/fuel-flow-gph");
|
||||
if(pph == nil){pph = 0.0};
|
||||
FuelPph2.setValue(pph* FuelDensity);
|
||||
|
||||
}
|
||||
|
||||
|
||||
update_p1000 = func {
|
||||
update_pfd();
|
||||
update_mfd();
|
||||
update_eicas();
|
||||
settimer(update_p1000,0);
|
||||
}
|
||||
|
||||
settimer(update_p1000,0);
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
setprop("/instrumentation/gps/wp/wp/waypoint-type","airport");
|
||||
setprop("/instrumentation/gps/wp/wp/ID",getprop("/sim/tower/airport-id"));
|
||||
setprop("/instrumentation/gps/serviceable","true");
|
||||
FDMODE.setBoolValue(1);
|
||||
NavPtr1.setValue(0.0);
|
||||
NavPtr2.setValue(0.0);
|
||||
NavPtr1_offset.setValue(0.0);
|
||||
NavPtr2_offset.setValue(0.0);
|
||||
RAmode.setValue(0.0);
|
||||
NavDist.setValue(0.0);
|
||||
Hyd1.setValue(0.0);
|
||||
Hyd2.setValue(0.0);
|
||||
FuelPph1.setValue(0.0);
|
||||
FuelPph2.setValue(0.0);
|
||||
APoff.setBoolValue(1);
|
||||
FuelDensity=props.globals.getNode("consumables/fuel/tank[0]/density-ppg",1).getValue();
|
||||
print("Primus 1000 systems OK");
|
||||
});
|
||||
|
|
@ -11,21 +11,10 @@ Primus 1000 Primary Flight Display
|
|||
<type>select</type>
|
||||
<object-name>AP.annun</object-name>
|
||||
<condition>
|
||||
<or>
|
||||
<not-equals>
|
||||
<property>autopilot/locks/heading</property>
|
||||
<value></value>
|
||||
</not-equals>
|
||||
<not-equals>
|
||||
<property>autopilot/locks/altitude</property>
|
||||
<value></value>
|
||||
</not-equals>
|
||||
<not-equals>
|
||||
<property>autopilot/locks/speed</property>
|
||||
<value></value>
|
||||
</not-equals>
|
||||
</or>
|
||||
</condition>
|
||||
<not>
|
||||
<property>autopilot/locks/passive-mode</property>
|
||||
</not>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
|
|
23
Aircraft/Instruments-3d/primus-1000/primus1000.README
Normal file
23
Aircraft/Instruments-3d/primus-1000/primus1000.README
Normal file
|
@ -0,0 +1,23 @@
|
|||
To incorporate the Primus 1000 system into your aircraft , you need to add the following to your files:
|
||||
|
||||
Add this to your aircraft file:
|
||||
|
||||
<model>
|
||||
<path>Aircraft/Instruments-3d/primus-1000/primus1000-pfd.xml</path>
|
||||
<offsets>
|
||||
<x-m>-7.523</x-m>
|
||||
<y-m>0.380</y-m>
|
||||
<z-m>0.020</z-m>
|
||||
<pitch-deg>-10.0</pitch-deg>
|
||||
</offsets>
|
||||
</model>
|
||||
|
||||
This file sets up certain properties needed by the system
|
||||
Add the Primus1000.nas to your set file....
|
||||
|
||||
<nasal>
|
||||
<file>Aircraft/Instruments-3d/primus-1000/Primus1000.nas</file>
|
||||
</nasal>
|
||||
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue