Debian Codegraph @

Aircraft/Instruments-3d/ISFD/PhysicalController.nas

raw
1
2 # ISFD controller drive by physical properties rather
3 # than instruments. Useful for testing with the UFO
4 var PhysicalController =
5 {
6
7 new : func (isfd)
8 {
9 var obj = {
10 parents : [PhysicalController],
11 _isfd: isfd,
12 _navRadio: "/instrumentation/nav[0]/",
13 _isSTDBaro : 0,
14 _isHPa : 1,
15 _approachMode : 0
16 };
17
18 print("ISFD is using physical properties, not indicated");
19 return obj;
20 },
21
22 update : func
23 {
24 },
25
26 getAltitudeFt : func
27 {
28 return getprop("/position/altitude-ft");
29 },
30
31 getIndicatedAirspeedKnots : func
32 {
33 return getprop("/velocities/airspeed-kt");
34 },
35
36 getHeadingDeg : func
37 {
38 return getprop("/orientation/heading-deg");
39 },
40
41 getPitchDeg : func
42 {
43 return getprop("/orientation/pitch-deg");
44 },
45
46 getBankAngleDeg : func
47 {
48 return getprop("/orientation/roll-deg");
49 },
50
51 isSTDBarometricPressure : func
52 {
53 return me._isSTDBaro;
54 },
55
56 toggleSTDBarometricPressure : func
57 {
58 me._isSTDBaro = (me._isSTDBaro == 0);
59 },
60
61 isHPaBarometer : func
62 {
63 return me._isHPa;
64 },
65
66 toggleHPaBarometer : func
67 {
68 me._isHPa = (me._isHPa == 0);
69 },
70
71 getBarometricPressureSettingInHg : func
72 {
73 return 29.92;
74 },
75
76 getBarometricPressureSettingHPa : func
77 {
78 return 1013;
79 },
80
81 setBarometricPressureSettingInHg : func (inHg)
82 {
83 print('ISFD: no-op with PhysicalController, no altimeter')
84 },
85
86 setBarometricPressureSettingHPa : func (hpa)
87 {
88 print('ISFD: no-op with PhysicalController, no altimeter')
89 },
90
91 isApproachMode: func {
92
93 return me._approachMode;
94 },
95
96 toggleApproachMode : func { me._approachMode = (me._approachMode == 0); },
97
98 isLocalizerValid: func { return getprop(me._navRadio ~ "in-range"); },
99 isGSValid: func { return getprop(me._navRadio ~ "gs-in-range");},
100
101 getLocalizerDeviationNorm: func {
102 return getprop(me._navRadio ~ "heading-needle-deflection-norm");
103 },
104
105 getGSDeviationNorm: func {
106 return getprop(me._navRadio ~ "gs-needle-deflection-norm");
107 },
108 }