Debian Codegraph @

Aircraft/c172p/Systems/c172p-damage.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4 Copyright (c) 2015 onox
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="c172p damage">
21
22 <channel name="gear-forces">
23
24 <!--
25 References:
26 [1] https://www.youtube.com/watch?v=O1yWkbJuqkE#t=420
27 -->
28
29 <!--
30 Numbers MUST be the same coefficients as spring_coeff and
31 damping_coeff in the FDM for nose and main gear!
32 -->
33
34 <fcs_function name="damage/force-nose-gear">
35 <function>
36 <sum>
37 <product>
38 <value>1800</value><!-- spring coefficient -->
39 <property>gear/unit[0]/compression-ft</property>
40 </product>
41 <product>
42 <value>600</value><!-- damping coefficient -->
43 <property>gear/unit[0]/compression-velocity-fps</property>
44 </product>
45 </sum>
46 </function>
47 </fcs_function>
48
49 <fcs_function name="damage/force-left-gear">
50 <function>
51 <sum>
52 <product>
53 <value>5400</value><!-- spring coefficient -->
54 <property>gear/unit[1]/compression-ft</property>
55 </product>
56 <product>
57 <value>400</value><!-- damping coefficient -->
58 <property>gear/unit[1]/compression-velocity-fps</property>
59 </product>
60 </sum>
61 </function>
62 </fcs_function>
63
64 <fcs_function name="damage/force-right-gear">
65 <function>
66 <sum>
67 <product>
68 <value>5400</value><!-- spring coefficient -->
69 <property>gear/unit[2]/compression-ft</property>
70 </product>
71 <product>
72 <value>400</value><!-- damping coefficient -->
73 <property>gear/unit[2]/compression-velocity-fps</property>
74 </product>
75 </sum>
76 </function>
77 </fcs_function>
78
79 <switch name="nose-gear-broken">
80 <output>gear/unit[0]/broken</output>
81 <default value="gear/unit[0]/broken"/>
82
83 <!-- No damage -->
84 <test logic="OR" value="0">
85 settings/damage EQ 0
86 damage/repairing EQ 1
87 simulation/sim-time-sec LT 0.25
88 </test>
89
90 <test logic="AND" value="1">
91 damage/force-nose-gear GT 1500.0
92 gear/unit[0]/compression-ft GT 0.3
93 </test>
94 </switch>
95
96 <switch name="left-gear-broken">
97 <output>gear/unit[1]/broken</output>
98 <default value="gear/unit[1]/broken"/>
99
100 <!-- No damage -->
101 <test logic="OR" value="0">
102 settings/damage EQ 0
103 damage/repairing EQ 1
104 simulation/sim-time-sec LT 0.25
105 </test>
106
107 <!-- [1] used to guess required force -->
108 <test logic="AND" value="1">
109 damage/force-left-gear GT 6500.0
110 gear/unit[1]/compression-ft GT 0.8
111 </test>
112
113 <!-- Side force on left gear -->
114 <test logic="AND" value="1">
115 forces/fby-gear-lbs GT 1500.0
116 gear/unit[1]/compression-ft GT 0.23
117 </test>
118 </switch>
119
120 <switch name="right-gear-broken">
121 <output>gear/unit[2]/broken</output>
122 <default value="gear/unit[2]/broken"/>
123
124 <!-- No damage -->
125 <test logic="OR" value="0">
126 settings/damage EQ 0
127 damage/repairing EQ 1
128 simulation/sim-time-sec LT 0.25
129 </test>
130
131 <!-- [1] used to guess required force -->
132 <test logic="AND" value="1">
133 damage/force-right-gear GT 6500.0
134 gear/unit[2]/compression-ft GT 0.8
135 </test>
136
137 <!-- Side force on right gear -->
138 <test logic="AND" value="1">
139 forces/fby-gear-lbs LT -1500.0
140 gear/unit[2]/compression-ft GT 0.23
141 </test>
142 </switch>
143
144 </channel>
145
146 <channel name="amphibious-gear-forces">
147
148 <!--
149 Numbers MUST be the same coefficients as spring_coeff and
150 damping_coeff in the FDM for nose and main gear!
151 -->
152
153 <fcs_function name="damage/amph-force-left-nose-gear">
154 <function>
155 <sum>
156 <product>
157 <value>1000</value><!-- spring coefficient -->
158 <property>gear/unit[19]/compression-ft</property>
159 </product>
160 <product>
161 <value>600</value><!-- damping coefficient -->
162 <property>gear/unit[19]/compression-velocity-fps</property>
163 </product>
164 </sum>
165 </function>
166 </fcs_function>
167
168 <fcs_function name="damage/amph-force-right-nose-gear">
169 <function>
170 <sum>
171 <product>
172 <value>1000</value><!-- spring coefficient -->
173 <property>gear/unit[20]/compression-ft</property>
174 </product>
175 <product>
176 <value>600</value><!-- damping coefficient -->
177 <property>gear/unit[20]/compression-velocity-fps</property>
178 </product>
179 </sum>
180 </function>
181 </fcs_function>
182
183 <fcs_function name="damage/amph-force-left-gear">
184 <function>
185 <sum>
186 <product>
187 <value>5400</value><!-- spring coefficient -->
188 <property>gear/unit[21]/compression-ft</property>
189 </product>
190 <product>
191 <value>1600</value><!-- damping coefficient -->
192 <property>gear/unit[21]/compression-velocity-fps</property>
193 </product>
194 </sum>
195 </function>
196 </fcs_function>
197
198 <fcs_function name="damage/amph-force-right-gear">
199 <function>
200 <sum>
201 <product>
202 <value>5400</value><!-- spring coefficient -->
203 <property>gear/unit[22]/compression-ft</property>
204 </product>
205 <product>
206 <value>1600</value><!-- damping coefficient -->
207 <property>gear/unit[22]/compression-velocity-fps</property>
208 </product>
209 </sum>
210 </function>
211 </fcs_function>
212
213 <switch name="amph-left-nose-gear-broken">
214 <output>gear/unit[19]/broken</output>
215 <default value="gear/unit[19]/broken"/>
216
217 <!-- No damage -->
218 <test logic="OR" value="0">
219 settings/damage EQ 0
220 damage/repairing EQ 1
221 simulation/sim-time-sec LT 0.25
222 </test>
223
224 <test logic="AND" value="1">
225 damage/amph-force-left-nose-gear GT 1500.0
226 gear/unit[19]/compression-ft GT 0.3
227 </test>
228 </switch>
229
230 <switch name="amph-right-nose-gear-broken">
231 <output>gear/unit[20]/broken</output>
232 <default value="gear/unit[20]/broken"/>
233
234 <!-- No damage -->
235 <test logic="OR" value="0">
236 settings/damage EQ 0
237 damage/repairing EQ 1
238 simulation/sim-time-sec LT 0.25
239 </test>
240
241 <test logic="AND" value="1">
242 damage/amph-force-right-nose-gear GT 1500.0
243 gear/unit[20]/compression-ft GT 0.3
244 </test>
245 </switch>
246
247 <switch name="amph-left-gear-broken">
248 <output>gear/unit[21]/broken</output>
249 <default value="gear/unit[21]/broken"/>
250
251 <!-- No damage -->
252 <test logic="OR" value="0">
253 settings/damage EQ 0
254 damage/repairing EQ 1
255 simulation/sim-time-sec LT 0.25
256 </test>
257
258 <!-- [1] used to guess required force -->
259 <test logic="AND" value="1">
260 damage/amph-force-left-gear GT 6500.0
261 gear/unit[21]/compression-ft GT 0.8
262 </test>
263 </switch>
264
265 <switch name="amph-right-gear-broken">
266 <output>gear/unit[22]/broken</output>
267 <default value="gear/unit[22]/broken"/>
268
269 <!-- No damage -->
270 <test logic="OR" value="0">
271 settings/damage EQ 0
272 damage/repairing EQ 1
273 simulation/sim-time-sec LT 0.25
274 </test>
275
276 <!-- [1] used to guess required force -->
277 <test logic="AND" value="1">
278 damage/amph-force-right-gear GT 6500.0
279 gear/unit[22]/compression-ft GT 0.8
280 </test>
281 </switch>
282
283 </channel>
284
285 <channel name="wing-damage">
286
287 <!-- Roll moment due to (diedra + roll rate + yaw rate + ailerons) -->
288 <fcs_function name="damage/roll-moment">
289 <function>
290 <sum>
291 <property>aero/coefficient/Clb</property>
292 <property>aero/coefficient/Clp</property>
293 <property>aero/coefficient/Clr</property>
294 <property>aero/coefficient/ClDa</property>
295 </sum>
296 </function>
297 </fcs_function>
298
299 <!-- Limits for overspeed damage -->
300 <pure_gain name="damage/limits-vne-high">
301 <input>/limits/vne</input>
302 <gain>1.225</gain> <!-- Vne x sqrt(1.5), 194 KIAS -->
303 </pure_gain>
304 <pure_gain name="damage/limits-vne-medium">
305 <input>/limits/vne</input>
306 <gain>1.14</gain> <!-- 180 KIAS -->
307 </pure_gain>
308 <pure_gain name="damage/limits-vne-low">
309 <input>/limits/vne</input>
310 <gain>1.0</gain> <!-- 158 KIAS -->
311 </pure_gain>
312
313 <!-- Limits for over-g damage, lift-force driven -->
314 <pure_gain name="damage/limits-lift-high">
315 <input>/fdm/jsbsim/inertia/weight-lbs</input>
316 <gain>5.7</gain> <!-- 3.8 g's x 1.5 -->
317 </pure_gain>
318 <pure_gain name="damage/limits-lift-medium">
319 <input>/fdm/jsbsim/inertia/weight-lbs</input>
320 <gain>4.75</gain> <!-- 3.8 g's x 1.25 -->
321 </pure_gain>
322 <pure_gain name="damage/limits-lift-low">
323 <input>/fdm/jsbsim/inertia/weight-lbs</input>
324 <gain>3.8</gain> <!-- 3.8 g's -->
325 </pure_gain>
326
327 <pure_gain name="damage/force-aero-lbs">
328 <input>forces/fbz-aero-lbs</input>
329 <gain>-1.0</gain>
330 </pure_gain>
331
332 <pure_gain name="damage/force-gear-lbs">
333 <input>forces/fbz-gear-lbs</input>
334 <gain>-1.0</gain>
335 </pure_gain>
336
337 <!-- Wings collapsed -->
338 <switch name="wings-collapsed">
339 <output>crash</output>
340 <default value="crash"/>
341
342 <!-- No damage -->
343 <test logic="OR" value="0.0">
344 settings/damage EQ 0
345 damage/repairing EQ 1
346 simulation/sim-time-sec LT 0.25
347 </test>
348
349 <test logic="AND" value="1.0">
350 contact/unit[6]/WOW EQ 1
351 contact/unit[7]/WOW EQ 1
352 contact/unit[8]/WOW EQ 1
353 damage/force-gear-lbs GT damage/limits-lift-high
354 wing-damage/left-wing LT 1.0
355 wing-damage/right-wing LT 1.0
356 </test>
357 </switch>
358
359 <!-- Left wing damage -->
360 <switch name="left-wing-damage">
361 <output>wing-damage/left-wing</output>
362 <default value="wing-damage/left-wing"/>
363
364 <!-- No damage -->
365 <test logic="OR" value="0.0">
366 settings/damage EQ 0
367 damage/repairing EQ 1
368 simulation/sim-time-sec LT 0.25
369 </test>
370
371 <!-- ================================================================== -->
372 <!-- Broken -->
373 <!-- ================================================================== -->
374
375 <!-- Break wing when its wing tip hits the ground or an object -->
376 <test logic="OR" value="1.0">
377 contact/unit[4]/compression-ft GT 0.005
378 crash EQ 1
379 </test>
380
381 <!-- Overspeed -->
382 <test logic="AND" value="1.0">
383 /velocities/airspeed-kt GT damage/limits-vne-high
384 </test>
385
386 <test logic="AND" value="1.0">
387 /velocities/airspeed-kt GT damage/limits-vne-medium
388 damage/roll-moment GT 12000.0
389 </test>
390
391 <!-- Over-g -->
392 <test logic="AND" value="1.0">
393 damage/force-aero-lbs GT damage/limits-lift-high
394 </test>
395
396 <test logic="AND" value="1.0">
397 damage/force-aero-lbs GT damage/limits-lift-medium
398 damage/roll-moment GT 8000.0
399 </test>
400
401 <!-- ================================================================== -->
402 <!-- Heavy damage -->
403 <!-- ================================================================== -->
404
405 <!-- Overspeed -->
406 <test logic="AND" value="0.3">
407 /velocities/airspeed-kt GT damage/limits-vne-medium
408 damage/roll-moment LT 12000.0
409 damage/roll-moment GT -12000.0
410 wing-damage/left-wing LT 0.3
411 </test>
412
413 <!-- Over-g -->
414 <test logic="AND" value="0.3">
415 damage/force-aero-lbs GT damage/limits-lift-medium
416 damage/roll-moment LT 8000.0
417 damage/roll-moment GT -8000.0
418 wing-damage/left-wing LT 0.3
419 </test>
420
421 <!-- ================================================================== -->
422 <!-- Light damage -->
423 <!-- ================================================================== -->
424
425 <!-- Overspeed -->
426 <test logic="AND" value="0.085">
427 /velocities/airspeed-kt GT damage/limits-vne-low
428 damage/roll-moment GT 8000.0
429 wing-damage/left-wing LT 0.085
430 </test>
431
432 <!-- Over-g -->
433 <test logic="AND" value="0.085">
434 damage/force-aero-lbs GT damage/limits-lift-low
435 damage/roll-moment GT 8000.0
436 wing-damage/left-wing LT 0.085
437 </test>
438 </switch>
439
440 <!-- Right wing damage -->
441 <switch name="right-wing-damage">
442 <output>wing-damage/right-wing</output>
443 <default value="wing-damage/right-wing"/>
444
445 <!-- No damage -->
446 <test logic="OR" value="0.0">
447 settings/damage EQ 0
448 damage/repairing EQ 1
449 simulation/sim-time-sec LT 0.25
450 </test>
451
452 <!-- ================================================================== -->
453 <!-- Broken -->
454 <!-- ================================================================== -->
455
456 <!-- Break wing when its wing tip hits the ground or an object -->
457 <test logic="OR" value="1.0">
458 contact/unit[5]/compression-ft GT 0.005
459 crash EQ 1
460 </test>
461
462 <!-- Overspeed -->
463 <test logic="AND" value="1.0">
464 /velocities/airspeed-kt GT damage/limits-vne-high
465 </test>
466
467 <test logic="AND" value="1.0">
468 /velocities/airspeed-kt GT damage/limits-vne-medium
469 damage/roll-moment LT -12000.0
470 </test>
471
472 <!-- Over-g -->
473 <test logic="AND" value="1.0">
474 damage/force-aero-lbs GT damage/limits-lift-high
475 </test>
476
477 <test logic="AND" value="1.0">
478 damage/force-aero-lbs GT damage/limits-lift-medium
479 damage/roll-moment LT -8000.0
480 </test>
481
482 <!-- ================================================================== -->
483 <!-- Heavy damage -->
484 <!-- ================================================================== -->
485
486 <!-- Overspeed -->
487 <test logic="AND" value="0.3">
488 /velocities/airspeed-kt GT damage/limits-vne-medium
489 damage/roll-moment LT 12000.0
490 damage/roll-moment GT -12000.0
491 wing-damage/right-wing LT 0.3
492 </test>
493
494 <!-- Over-g -->
495 <test logic="AND" value="0.3">
496 damage/force-aero-lbs GT damage/limits-lift-medium
497 damage/roll-moment LT 8000.0
498 damage/roll-moment GT -8000.0
499 wing-damage/right-wing LT 0.3
500 </test>
501
502 <!-- ================================================================== -->
503 <!-- Light damage -->
504 <!-- ================================================================== -->
505
506 <!-- Overspeed -->
507 <test logic="AND" value="0.085">
508 /velocities/airspeed-kt GT damage/limits-vne-low
509 damage/roll-moment LT -8000.0
510 wing-damage/right-wing LT 0.085
511 </test>
512
513 <!-- Over-g -->
514 <test logic="AND" value="0.085">
515 damage/force-aero-lbs GT damage/limits-lift-low
516 damage/roll-moment LT -8000.0
517 wing-damage/right-wing LT 0.085
518 </test>
519 </switch>
520
521 </channel>
522
523 <channel name="pontoon-damage">
524
525 <!-- Left pontoon damage -->
526 <switch name="left-pontoon-damage">
527 <output>pontoon-damage/left-pontoon</output>
528 <default value="pontoon-damage/left-pontoon"/>
529
530 <!-- No damage -->
531 <test logic="OR" value="0">
532 settings/damage EQ 0
533 damage/repairing EQ 1
534 damage/traversing EQ 1
535 simulation/sim-time-sec LT 0.25
536 </test>
537 <test logic="AND" value="0">
538 bushkit NE 3
539 bushkit NE 4
540 </test>
541
542 <!-- ================================================================== -->
543 <!-- Broken -->
544 <!-- ================================================================== -->
545
546 <test logic="OR" value="1">
547 contact/unit[13]/compression-ft GT 0.95
548 contact/unit[15]/compression-ft GT 0.95
549 contact/unit[17]/compression-ft GT 0.95
550 gear/unit[19]/compression-ft GT 0.95
551 gear/unit[21]/compression-ft GT 0.95
552 pontoon-damage/left-pontoon EQ 1
553 </test>
554
555 <!-- ================================================================== -->
556 <!-- Damaged -->
557 <!-- ================================================================== -->
558
559 <test logic="OR" value="2">
560 contact/unit[13]/compression-ft GT 0.75
561 contact/unit[15]/compression-ft GT 0.75
562 contact/unit[17]/compression-ft GT 0.75
563 gear/unit[19]/broken EQ 1
564 gear/unit[21]/broken EQ 1
565 </test>
566 </switch>
567
568 <!-- Right pontoon damage -->
569 <switch name="right-pontoon-damage">
570 <output>pontoon-damage/right-pontoon</output>
571 <default value="pontoon-damage/right-pontoon"/>
572
573 <!-- No damage -->
574 <test logic="OR" value="0">
575 settings/damage EQ 0
576 damage/repairing EQ 1
577 damage/traversing EQ 1
578 simulation/sim-time-sec LT 0.25
579 </test>
580 <test logic="AND" value="0">
581 bushkit NE 3
582 bushkit NE 4
583 </test>
584
585 <!-- ================================================================== -->
586 <!-- Broken -->
587 <!-- ================================================================== -->
588
589 <test logic="OR" value="1">
590 contact/unit[14]/compression-ft GT 0.95
591 contact/unit[16]/compression-ft GT 0.95
592 contact/unit[18]/compression-ft GT 0.95
593 gear/unit[20]/compression-ft GT 0.95
594 gear/unit[22]/compression-ft GT 0.95
595 pontoon-damage/right-pontoon EQ 1
596 </test>
597
598 <!-- ================================================================== -->
599 <!-- Damaged -->
600 <!-- ================================================================== -->
601
602 <test logic="OR" value="2">
603 contact/unit[14]/compression-ft GT 0.75
604 contact/unit[16]/compression-ft GT 0.75
605 contact/unit[18]/compression-ft GT 0.75
606 gear/unit[19]/broken EQ 1
607 gear/unit[21]/broken EQ 1
608 </test>
609 </switch>
610
611 </channel>
612
613 <channel name="upside-down">
614
615 <!-- Aircraft upside down -->
616 <switch name="upside-down">
617 <output>orientation/upside-down</output>
618 <default value="0"/>
619
620 <test logic="OR" value="1">
621 /orientation/pitch-deg GT 90
622 /orientation/pitch-deg LT -90
623 /orientation/roll-deg GT 90
624 /orientation/roll-deg LT -90
625 </test>
626 </switch>
627
628 </channel>
629
630 </system>