Debian Codegraph @

Aircraft/c172p/Systems/c172p-engine.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2
3 <!--
4
5 c172p damage effects for JSBSim.
6
7 Copyright (c) 2015 Gilberto Agostinho
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23 -->
24
25 <system name="engine">
26
27 <channel name="oil">
28
29 <fcs_function name="consumed-oil-weight">
30 <function>
31 <product>
32 <property>/engines/active-engine/oil-lacking</property>
33 <value>1.7686</value>
34 <value>-1</value>
35 </product>
36 </function>
37 <output>/fdm/jsbsim/inertia/pointmass-weight-lbs[16]</output>
38 </fcs_function>
39
40 </channel>
41
42 <channel name="carburetor">
43
44 <fcs_function name="Carb heat on causes RPM drop on 160 HP engine">
45 <function>
46 <ifthen>
47 <property>/controls/anti-ice/engine[0]/carb-heat</property>
48 <value>0.475</value>
49 <value>0.15185</value>
50 </ifthen>
51 </function>
52 <output>/fdm/jsbsim/propulsion/engine[0]/air-intake-impedance-factor</output>
53 </fcs_function>
54
55 <fcs_function name="Carb heat on causes RPM drop on 180 HP engine">
56 <function>
57 <ifthen>
58 <property>/controls/anti-ice/engine[1]/carb-heat</property>
59 <value>0.475</value>
60 <value>0.15185</value>
61 </ifthen>
62 </function>
63 <output>/fdm/jsbsim/propulsion/engine[1]/air-intake-impedance-factor</output>
64 </fcs_function>
65
66 </channel>
67
68 <channel name="damage">
69 <fcs_function name="engine/rpm-over-redline">
70 <function>
71 <sum>
72 <property>/engines/active-engine/rpm</property>
73 <value>-2750</value>
74 <property>engine/rpm-over-redline-offset</property>
75 </sum>
76 </function>
77 <clipto>
78 <min>0</min>
79 <max>10000</max>
80 </clipto>
81 </fcs_function>
82
83 <fcs_function name="engine/rpm-over-redline-offset"> <!-- reduce the damage threshold as damage increases -->
84 <function>
85 <product>
86 <pow>
87 <property>engine/damage-level</property>
88 <value>2</value>
89 </pow>
90 <value>0.00075</value>
91 </product>
92 </function>
93 <clipto>
94 <min>0</min>
95 <max>10000</max>
96 </clipto>
97 </fcs_function>
98
99 <fcs_function name="engine/oil-temp-above-max">
100 <function>
101 <sum>
102 <property>/engines/active-engine/oil-temperature-degf</property>
103 <value>-245</value>
104 </sum>
105 </function>
106 <clipto>
107 <min>0</min>
108 <max>1000</max>
109 </clipto>
110 </fcs_function>
111
112 <fcs_function name="engine-damage"> <!-- it0uchpods suggests this to allow repair button to reset to 0 -->
113 <function>
114 <ifthen>
115 <and>
116 <eq>
117 <property>settings/damage</property>
118 <value>1</value>
119 </eq>
120 <eq>
121 <property>/engines/active-engine/damage_allowed</property>
122 <value>1</value>
123 </eq>
124 </and>
125 <sum>
126 <property>engine/damage-level</property>
127 <product>
128 <table>
129 <independentVar lookup="row">engine/rpm-over-redline</independentVar>
130 <independentVar lookup="column">engine/oil-temp-above-max</independentVar>
131 <tableData>
132 0 50 100 250
133 0 0 1 9 16
134 100 1 2 16 50
135 200 4 5 25 65
136 300 9 10 36 82
137 400 16 17 49 101
138 500 25 25 64 122
139 600 36 37 81 145
140 700 49 50 100 170
141 800 64 65 121 197
142 900 81 82 144 226
143 1000 100 101 169 256
144 1100 121 123 196 289
145 1200 144 147 225 324
146 1300 169 175 256 361
147 1400 196 199 289 400
148 1500 225 228 324 441
149 </tableData>
150 </table>
151 <property>simulation/channel-dt</property>
152 </product>
153 </sum>
154 <value>0</value> <!-- this is the value if damage is disabled -->
155 </ifthen>
156 </function>
157 <output>engine/damage-level</output>
158 </fcs_function>
159
160 <fcs_function>
161 <function> <!-- derived from a graphical calculator: 0.01x pow 2 + 2.15x + 0.625 multiplied by 2.4 -->
162 <product>
163 <sum>
164 <product>
165 <value>0.00008</value>
166 <pow>
167 <property>engine/damage-level</property>
168 <value>2</value>
169 </pow>
170 </product>
171 <value>0.625</value>
172 </sum>
173 <value>2.4</value>
174 </product>
175 </function>
176 <clipto>
177 <min>1.5</min>
178 <max>10000</max>
179 </clipto>
180 <output>engine/friction-hp</output>
181 </fcs_function>
182
183 <switch name="engine/engine-0-friction-hp">
184 <default value="1.5"/>
185 <test logic="AND" value="engine/friction-hp">
186 /controls/engines/active-engine eq 0
187 </test>
188 <output>/fdm/jsbsim/propulsion/engine[0]/friction-hp</output>
189 </switch>
190
191 <switch name="engine/engine-1-friction-hp">
192 <default value="1.5"/>
193 <test logic="AND" value="engine/friction-hp">
194 /controls/engines/active-engine eq 1
195 </test>
196 <output>/fdm/jsbsim/propulsion/engine[1]/friction-hp</output>
197 </switch>
198
199 <switch name="engine/engine-0-cooling-factor">
200 <default value=".514"/>
201 <test logic="AND" value="/engines/active-engine/cooling-factor">
202 /controls/engines/active-engine eq 0
203 </test>
204 <output>/fdm/jsbsim/propulsion/engine[0]/cooling-factor</output>
205 </switch>
206
207 <switch name="engine/engine-1-cooling-factor">
208 <default value=".514"/>
209 <test logic="AND" value="/engines/active-engine/cooling-factor">
210 /controls/engines/active-engine eq 1
211 </test>
212 <output>/fdm/jsbsim/propulsion/engine[1]/cooling-factor</output>
213 </switch>
214
215 <switch name="engine/damage-smoke">
216 <default value="0"/>
217 <test logic="AND" value="1">
218 /fdm/jsbsim/engine/damage-level GT 100
219 /engines/active-engine/running EQ 1
220 </test>
221 <output>/aircraft/effects/damage-smoke-visible</output>
222 </switch>
223
224 <fcs_function name="density-altitude-ft">
225 <function>
226 <sum>
227 <!-- Pressure Altitude -->
228 <product>
229 <difference>
230 <value>29.92</value>
231 <property>/environment/pressure-inhg</property>
232 </difference>
233 <value>1000</value>
234 </product>
235 <property>/position/altitude-ft</property>
236 <!-- Temperature Offset -->
237 <product>
238 <value>120</value>
239 <difference>
240 <property>/environment/temperature-degc</property>
241 <difference>
242 <value>15</value>
243 <product>
244 <sum>
245 <product>
246 <difference>
247 <value>29.92</value>
248 <property>/environment/pressure-inhg</property>
249 </difference>
250 <value>1000</value>
251 </product>
252 <property>/position/altitude-ft</property>
253 </sum>
254 <value>0.0019812</value>
255 </product>
256 </difference>
257 </difference>
258 </product>
259 </sum>
260 </function>
261 <output>/environment/density-altitude-ft</output>
262 </fcs_function>
263
264 <fcs_function name="auto-engine-mixture">
265 <function> <!-- Mixture rich above 3000 feet, LEAN to obtain maximum RPM -->
266 <table>
267 <independentVar>/environment/density-altitude-ft</independentVar>
268 <tableData>
269 0 1.00
270 3000 0.70
271 6000 0.50
272 9000 0.35
273 12000 0.30
274 15000 0.25
275 </tableData>
276 </table>
277 </function>
278 <output>engine/auto-mixture</output>
279 </fcs_function>
280
281 </channel>
282 </system>