Skip to content

Commit

Permalink
Merge pull request #472 from HHS81/Issue463-FlapsDamage-2
Browse files Browse the repository at this point in the history
Implement Flap damage due to overspeed
  • Loading branch information
hbeni authored Dec 22, 2021
2 parents a5e7e6e + 7780dd8 commit dc84700
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 30 deletions.
4 changes: 3 additions & 1 deletion Nasal/damage.nas
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ setlistener("/sim/signals/fdm-initialized", func {
{id:"/fdm/jsbsim/gear/unit[2]/broken", name:"Right main gear"},

{id:"/fdm/jsbsim/wing-damage/left-wing", name:"Left wing"},
{id:"/fdm/jsbsim/wing-damage/right-wing", name:"Right wing"}
{id:"/fdm/jsbsim/wing-damage/right-wing", name:"Right wing"},

{id:"/fdm/jsbsim/wing-damage/flaps", name:"Flaps"}
];

var dmgdelayInit = 0.15; # delay in seconds; should be before init of aircraft states (it might repair the plane)
Expand Down
63 changes: 63 additions & 0 deletions Systems/damage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,43 @@
<gain>3.8</gain> <!-- 3.8 g's -->
</pure_gain>

<!-- Flaps stuck means the actuar push rod was bent due to overstress, preventing further movement.
Note: According to our research (see https://github.com/HHS81/c182s/issues/463), this is the
most probable cause of flap problem caused by flying error. Especially a rip off of the rod,
which causes loose flap (ie. instant 0° flaps) is very uncommon and thus not modelled here.
Also, a loose flap is usually caused by corrosion of the connecting rod between the two flaps,
which is caused by wrong or lack of maintenance. This may be modelled in the future.
-->
<fcs_function name="damage/limits-flaps-stuck">
<function>
<product>
<table>
<independentVar lookup="row">fcs/flap-pos-deg</independentVar>
<tableData breakPoint="0">
<!-- limits for flapDeg to KIAS, from POH 2-4, +sqrt(1.5) (KIAS: 10°=140, 20°=120, full=100) -->
0 999
10 175
20 147
38 122
</tableData>
</table>
<difference>
<value>1.0</value>
<table>
<!-- reduce speed limits depending on roll factor -->
<independentVar lookup="row">damage/roll-moment</independentVar>
<tableData breakPoint="0">
-8000 0.20
-2000 0.00
2000 0.00
8000 0.20
</tableData>
</table>
</difference>
</product>
</function>
</fcs_function>

<pure_gain name="damage/force-aero-lbs">
<input>forces/fbz-aero-lbs</input>
<gain>-1.0</gain>
Expand Down Expand Up @@ -387,7 +424,33 @@
wing-damage/right-wing LT 0.085
</test>
</switch>



<!-- Flaps damage -->
<switch name="flaps-damage">
<output>wing-damage/flaps</output>
<default value="wing-damage/flaps"/>

<!-- restore saved damage on sim startup -->
<test logic="AND" value="wing-damage/flaps-saved">
/sim/time/elapsed-sec LT 0.25
wing-damage/flaps-saved GT 0
</test>

<!-- Reset to no damage when repairing -->
<test logic="OR" value="0.0">
settings/damage EQ 0
damage/repairing EQ 1
</test>

<!-- Overspeed -->
<test logic="AND" value="0.25">
/velocities/airspeed-kt GT damage/limits-flaps-stuck
wing-damage/flaps LT 0.25
</test>
</switch>

</channel>

<channel name="upside-down">
Expand Down
14 changes: 2 additions & 12 deletions c182s-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
<path>/fdm/jsbsim/gear/unit[2]/broken-saved</path> <!-- right main gear -->
<path>/fdm/jsbsim/wing-damage/left-wing-saved</path>
<path>/fdm/jsbsim/wing-damage/right-wing-saved</path>
<path>/fdm/jsbsim/wing-damage/flaps-saved</path>

<path>/fdm/jsbsim/systems/propulsion/sparkplugs/left/fouling-savedrestore</path>
<path>/fdm/jsbsim/systems/propulsion/sparkplugs/right/fouling-savedrestore</path>
Expand Down Expand Up @@ -1361,18 +1362,7 @@
</payload>

<limits>
<max-flap-extension-speed>
<flaps>0.26315</flaps>
<speed>140</speed>
</max-flap-extension-speed>
<max-flap-extension-speed>
<flaps>0.52</flaps>
<speed>120</speed>
</max-flap-extension-speed>
<max-flap-extension-speed>
<flaps>1.0</flaps>
<speed>100</speed>
</max-flap-extension-speed>
<!-- Flap extension limits: in damage.xml -->
<max-positive-g>3.5</max-positive-g>
<max-negative-g>-1.52</max-negative-g>
<vne>175</vne>
Expand Down
1 change: 0 additions & 1 deletion c182s-sound.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
</crash>



<squeal1>
<name>squeal1</name>
<path>Sounds/touchdown-screach2.wav</path>
Expand Down
22 changes: 20 additions & 2 deletions c182s.xml
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,11 @@
<test logic="AND" value="fcs/flap-pos-norm">
/systems/electrical/outputs/flaps le 16
</test>

<!-- make flaps stuck when overspeed damage occured -->
<test logic="OR" value="fcs/flap-pos-norm">
wing-damage/flaps GE 0.25
</test>
</switch>
<kinematic name="Flaps Control">
<input>fcs/flap-input-norm</input>
Expand All @@ -1003,8 +1008,19 @@
<output>fcs/flap-pos-norm</output>
</kinematic>

<!-- select flaps command source -->
<switch name="Flaps Command selector">
<output>fcs/flap-input-norm-selected</output>
<default value="fcs/flap-pos-norm"/>

<!-- flaps rod breakage: instantly 0° -->
<test logic="OR" value="0">
wing-damage/flaps EQ 1.00
</test>
</switch>

<aerosurface_scale name="Flap Position Normalizer">
<input>fcs/flap-pos-norm</input>
<input>fcs/flap-input-norm-selected</input>
<domain>
<min>0</min>
<max>1</max>
Expand Down Expand Up @@ -1325,7 +1341,6 @@
<value>3.9</value>
</product>
</function>
</axis>

<!--taken from SenecaII by Torsten Dreyer-->
<function name="aero/coefficient/CLicew">
Expand All @@ -1344,6 +1359,9 @@
</product>
</function>

</axis>


<axis name="DRAG">
<function name="aero/coefficient/CDo">
<description>Drag_at_zero_lift</description>
Expand Down
14 changes: 2 additions & 12 deletions c182t-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@
<path>/fdm/jsbsim/gear/unit[2]/broken-saved</path> <!-- right main gear -->
<path>/fdm/jsbsim/wing-damage/left-wing-saved</path>
<path>/fdm/jsbsim/wing-damage/right-wing-saved</path>
<path>/fdm/jsbsim/wing-damage/flaps-saved</path>

<path>/consumables/fuel/tank[0]/level-gal_us</path>
<path>/consumables/fuel/tank[1]/level-gal_us</path>
Expand Down Expand Up @@ -1260,18 +1261,7 @@
</payload>

<limits>
<max-flap-extension-speed>
<flaps>0.26315</flaps>
<speed>140</speed>
</max-flap-extension-speed>
<max-flap-extension-speed>
<flaps>0.52</flaps>
<speed>120</speed>
</max-flap-extension-speed>
<max-flap-extension-speed>
<flaps>1.0</flaps>
<speed>100</speed>
</max-flap-extension-speed>
<!-- Flap extension limits: in damage.xml -->
<max-positive-g>3.5</max-positive-g>
<max-negative-g>-1.52</max-negative-g>
<vne>175</vne>
Expand Down
20 changes: 18 additions & 2 deletions c182t.xml
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,11 @@
<test logic="AND" value="fcs/flap-pos-norm">
/systems/electrical/outputs/flaps le 16
</test>

<!-- make flaps stuck when overspeed damage occured -->
<test logic="OR" value="fcs/flap-pos-norm">
wing-damage/flaps GE 0.25
</test>
</switch>
<kinematic name="Flaps Control">
<input>fcs/flap-input-norm</input>
Expand All @@ -1003,8 +1008,18 @@
<output>fcs/flap-pos-norm</output>
</kinematic>

<!-- select flaps command source -->
<switch name="Flaps Command selector">
<output>fcs/flap-input-norm-selected</output>
<default value="fcs/flap-pos-norm"/>

<!-- flaps rod breakage: instantly 0° -->
<test logic="OR" value="0">
wing-damage/flaps EQ 1.00
</test>
</switch>
<aerosurface_scale name="Flap Position Normalizer">
<input>fcs/flap-pos-norm</input>
<input>fcs/flap-input-norm-selected</input>
<domain>
<min>0</min>
<max>1</max>
Expand Down Expand Up @@ -1326,7 +1341,6 @@
<value>3.9</value>
</product>
</function>
</axis>

<!--taken from SenecaII by Torsten Dreyer-->
<function name="aero/coefficient/CLicew">
Expand All @@ -1345,6 +1359,8 @@
</product>
</function>

</axis>

<axis name="DRAG">
<function name="aero/coefficient/CDo">
<description>Drag_at_zero_lift</description>
Expand Down

0 comments on commit dc84700

Please sign in to comment.