Debian Codegraph @

Aircraft/c172p/Systems/static-sources.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!--
3 c182s static system (POH p. 7-42)
4 Copyright (c) 2020 B. Hallinger
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 -->
19
20 <system name="static">
21
22 <!-- initialize some properties -->
23 <!-- defined by default: <property type="bool" value="1">/systems/static[0]/serviceable</property>-->
24 <property type="bool" value="1">/systems/static[1]/serviceable</property>
25 <!--<property type="double" value="0">/systems/static-pressure-inhg-selected</property>-->
26 <!--<property type="double" value="0">/systems/static[1]/pressure-inhg-venturi</property>-->
27 <property type="int" value="0">/systems/static-selected-source</property>
28 <property type="double" value="0">/systems/static-selected-source-norm</property> <!-- knob position / degree of openness of alt source -->
29
30 <channel name="static_sources">
31 <!-- Venturi effect: the airflow around the plane creates a slight underpressure in the cabin.
32 in the cabin. This means that there is a difference in pressure comared to the actual
33 outside static pressure, affecting the alternate static port which is located inside. -->
34 <fcs_function name="static-pressure-inhg-venturi">
35 <function>
36 <!-- The idea of this implementation is, to calculate the deviation based on the altitude calibration chart.
37 This gives us the amount of needed adjustemnt based on speed and pressure altitude, and direct from the POH.
38 Then we calculate a correction factor out of that and apply it to the static pressure.
39 Of course, this yields not perfect results but should be close enough...
40 -->
41 <product>
42
43 <sum>
44 <value>1</value>
45 <product>
46 <value>0.1</value> <!-- so the inHg fractions are treaten correctly -->
47 <quotient>
48 <table> <!-- based on altimeter correction POH 5-11 and adjusted for declining drag effect at slow speeds -->
49 <independentVar lookup="row">/position/altitude-ft</independentVar>
50 <independentVar lookup="column">/velocities/airspeed-kt</independentVar>
51 <tableData>
52 0 40 60 80 100 120 140 160
53 0 0 10 20 -10 -30 -60 -90 -120
54 2000 0 10 20 -10 -30 -60 -90 -130
55 4000 0 10 20 -10 -30 -70 -100 -140
56 6000 0 15 30 -10 -40 -70 -110 -140
57 8000 0 15 30 -10 -40 -80 -110 -150
58 10000 0 15 30 -10 -40 -80 -120 -160
59 12000 0 15 30 -10 -40 -80 -120 -170
60 14000 0 15 30 -10 -50 -90 -120 -180
61 </tableData>
62 </table>
63 <property>/position/altitude-ft</property>
64 </quotient>
65 </product>
66 </sum>
67
68 <!--<property>/environment/pressure-inhg</property>-->
69 <property>/systems/static[1]/pressure-inhg</property>
70 </product>
71 </function>
72 <output>/systems/static[1]/pressure-inhg-venturi</output>
73 </fcs_function>
74
75 <!-- The kinematic simulates a smoother transition between the two sources
76 and is used for displaying the knob position -->
77 <kinematic name="/systems/static-selected-source-norm">
78 <input>/systems/static-selected-source</input>
79 <traverse>
80 <setting>
81 <position>0</position>
82 <time>0</time>
83 </setting>
84 <setting>
85 <position>1</position>
86 <time>0.35</time>
87 </setting>
88 </traverse>
89 <output>/systems/static-selected-source-norm</output>
90 </kinematic>
91
92 <!-- Caluclate the selected sources pressure -->
93 <!-- That is expressed as the knob-adjusted difference between sources 1+2, so we get a smooth transition beween the two -->
94 <fcs_function name="/systems/static-pressure-inhg-selected">
95 <function>
96 <sum>
97 <property>/systems/static[0]/pressure-inhg</property>
98
99 <product> <!-- applied difference between the primary and alt sources -->
100 <property>/systems/static-selected-source-norm</property>
101 <difference>
102 <property>/systems/static[1]/pressure-inhg-venturi</property>
103 <property>/systems/static[0]/pressure-inhg</property>
104 </difference>
105 </product>
106 </sum>
107 </function>
108 <output>/systems/static-pressure-inhg-selected</output>
109 </fcs_function>
110
111 </channel>
112 </system>