Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AeromatiC++ Segmentation fault #400

Closed
kwanzapili opened this issue Mar 19, 2021 · 17 comments
Closed

AeromatiC++ Segmentation fault #400

kwanzapili opened this issue Mar 19, 2021 · 17 comments
Assignees

Comments

@kwanzapili
Copy link

I downloaded jsbsim-1.1.5 and built on an opensuse linux platform so that I could run aeromatic. The consistent problem I am facing is a segmentation fault at the same step every time I run it. I go through the Q/A session and as soon as I enter "Systems", it fails. The last few of the session are as follows:

Htail` arm [ft] (0): 
Vtail area [ft2] (0): 150.76
Vtail arm [ft] (0): 

** Systems **

Segmentation fault (core dumped)

A brief look at the backtrace shows that it fails at:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055cfc4444441 in Aeromatic::Propulsion::param_reset() ()

Could someone please advise on what is going on?
Thanks.

@kwanzapili
Copy link
Author

kwanzapili commented Mar 20, 2021

I took a closer look at the code and found that the offending lines are the two commented out lines in the file utils/aeromatic++/Systems/Propulsion.cpp

void Propulsion::param_reset()
{
    _param = 0;
//    _propulsion[_ptype]->param_reset();
//    _propulsion[_ptype]->_thruster->param_reset();
}

With this modification, I can get the program to run without crashing. Is this the right thing to do, please?

@bcoconni
Copy link
Member

bcoconni commented Mar 21, 2021

@kwanzapili thanks for reporting the issue.

Aeromatic++ is Erik Hofman's area of expertise. @ermarch could you please review this issue and @kwanzapili's fix ?

@ermarch
Copy link
Contributor

ermarch commented Mar 21, 2021

Personally I think _propulsion[_ptype]->_thruster is NULL somehow and causes the segmentation fault.
It would be interesting to know which parameters you parsed to cause this.

@ermarch
Copy link
Contributor

ermarch commented Mar 21, 2021

Okay, I can only trigger this when I select an aircraft type number which is not listed.
The types range from 0..4 and only when I select 5 this bug is triggered.

@kwanzapili
Copy link
Author

For me the effect was very consistent regardless of the parameters I entered. For reference, by session was as follows:


** AeromatiC++ version 3.3.12
Aeromatiic is a JSBSim configuration file generation utility.
Please enter aircraft data when prompted.

You can always enter 'h' to get verbose help

** General Information **

Output directory [] (/home/kwanza): /home/kwanza/SR71
Create a subdirectory? [] (yes): 
Overwrite? [] (yes): 
Aircraft name [] (my_aircraft): SR71
Use dedicates System files? [] (yes): 
Select a system of measurement [] (no): 
 0: English (feet, pounds)
 1: Metric (meters, kilograms)
0
Type of aircraft [] (0): 
 0: Light General Aviation (Glider, Small Commuter)
 1: High Performance (WWII Fighter, Military Trainer, Aerobatic, Air Racer)
 2: Fighter Jet
 3: Jet Transport (Passenger Jet Airliner, Transonic Jet Transport)
 4: Propeller Transport (Propeller Airliner, Propeller Transport)
2

** Weight and Balance **

Stall speed VS1 (clean, no flaps) [kt] (0): 130
Maximum takeoff weight [lbs] (10000): 172000
Empty weight [lbs] (0): 67500
Inertia Ixx [slug/ft2] (0): 
Inertia Iyy [slug/ft2] (0): 
Inertia Izz [slug/ft2] (0): 

** Geometry **

Length [ft] (40): 107.41666667
Select a wing shape [] (0): 
 0: Straight
 1: Elliptical
 2: Delta
2
Wing span [ft] (40): 55.58333333
Wing area [ft2] (0): 1795
Wing aspect ratio [] (0): 1.939
Wing taper ratio [] (1): 
Wing root chord [ft] (0): 60.533
Wing incidence [] (2): 
Wing dihedral [] (0): 0
Wing sweep (quarter chord) [] (0): 52.629
Htail area [ft2] (0): 
Htail arm [ft] (0): 
Vtail area [ft2] (0): 150.76
Vtail arm [ft] (0): 

** Systems **

Then the crash. With the code commented out, I can proceed further.

Thanks.

@ermarch
Copy link
Contributor

ermarch commented Mar 22, 2021

I've got valgrind reporting an error when entering those numbers, so no doubt it will get triggered by other input as well.
I'll investigate, thanks for the report.

bcoconni pushed a commit that referenced this issue Mar 22, 2021
Use std::vector where possible, check whether parameters are out of bounds.
This fixes issue #400
@kwanzapili
Copy link
Author

kwanzapili commented Mar 23, 2021

Incidentally, the program also produces some curious output for "Drag due to alpha", which leads to the simulator crashing/ I got the following:

        <function name="aero/force/Drag_alpha">
            <description>Drag due to alpha</description>
            <product>
                <property>aero/qbar-psf</property>
                <property>metrics/Sw-sqft</property>
                <table>
                    <independentVar lookup="row">aero/alpha-rad</independentVar>
                    <tableData>
                        -1.57    1.4082
                        -1.72    0.0246
                        0.00    0.0000
                        1.72    0.0246
                        1.57    1.4082
                    </tableData>
                </table>
            </product>
        </function>

Clearing the 1.72 and 1.57 are not is the proper sequence. Looking at some other configurations, I was tempted to infer that the -+1.72 should be closer to -+1.26, but I have no real estimate for this. Am I mistaken here?
Thanks.

@ermarch
Copy link
Contributor

ermarch commented Mar 24, 2021

Yes, that shouldn't have happened. So far I´ve not seen it with any of my test models but the SR-71 is rather extreme in every way. Is there a chance you could run aeromatic again with the option "-l sr71.param" and post the param file?

This also comes handy when you want to rerun with a new version of aeromatic because you can then run "aeromatic -i sr71.param"

@kwanzapili
Copy link
Author

kwanzapili commented Mar 24, 2021

So I have run "aeromatic -l sr71.param" to get the following output. Please note that I am using AeromatiC++ version 3.3.12 without the commits you have made, but with the two lines I mentioned before commented out. So the aero file is this:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://jsbsim.sourceforge.net/JSBSim.xsl"?>

<fdm_config name="SR71" version="2.0" release="ALPHA"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">

 <fileheader>
  <author> Aeromatic v 3.3.12 </author>
  <filecreationdate> 24 Mar 2021 </filecreationdate>
  <version>$Revision: 1.80 $</version>
  <description> Models a SR71. </description>
 </fileheader>

<!--
  File:     SR71.xml
  Inputs:
    name:          SR71
    type:          Multi-engine Fighter Jet
    stall speed:   unspecified
    max weight:    172000.00 lb
    length:        107.42 ft
    wing: 
     span:         55.58 ft
     area:         1795.00 sq-ft
     mean chord:   60.53 ft
     aspect ratio: 1.94:1
     taper ratio:  1.00:1
     incidence:    2.00 degrees
     dihedral:     0.00 degrees
     sweep:        52.63 degrees

    no. engines:   2
    engine type:   Turbine Engine
    engine layout: wings

    control type:   Conventional with Yaw Damper

    gear type:     tricycle
    steering type: steering
    retractable?:  yes

  Outputs:
    wing loading:       95.82 lb/sq-ft
     - thickness ratio: 15.00%
    payload:            68896.00 lbs
    CL-alpha:           0.54 per radian
    CL-0:               0.08
    CL-max:             1.00
    CD-0:               0.01
    K:                  0.12
    Mcrit:              0.81

    min. turn radius    -nan ft
    max. turn rate:     -nan deg/s
-->
 <metrics>
   <wingarea  unit="FT2">  1795.00 </wingarea>
   <wingspan  unit="FT" >    55.58 </wingspan>
   <wing_incidence unit="DEG"> 2.00 </wing_incidence>
   <chord     unit="FT" >    60.53 </chord>
   <htailarea unit="FT2">   359.00 </htailarea>
   <htailarm  unit="FT" >    42.97 </htailarm>
   <vtailarea  unit="FT2">  150.76 </vtailarea>
   <vtailarm  unit="FT" >    42.97 </vtailarm>
   <location name="AERORP" unit="IN">
     <x>   773.40 </x>
     <y>     0.00 </y>
     <z>     0.00 </z>
   </location>
   <location name="EYEPOINT" unit="IN">
     <x>   257.80 </x>
     <y>     0.00 </y>
     <z>    38.00 </z>
   </location>
   <location name="VRP" unit="IN">
     <x>     0.0 </x>
     <y>     0.0 </y>
     <z>     0.0 </z>
   </location>
 </metrics>

 <mass_balance>
   <ixx unit="SLUG*FT2">  136167.34 </ixx>
   <iyy unit="SLUG*FT2">  699019.12 </iyy>
   <izz unit="SLUG*FT2">  585154.88 </izz>
   <emptywt unit="LBS" >  67500.00 </emptywt>
   <location name="CG" unit="IN">
     <x>   811.67 </x>
     <y>     0.00 </y>
     <z>   -32.22 </z>
   </location>
   <pointmass name="Payload">
    <description> 68896.00 LBS should bring model up to entered max weight </description>
    <weight unit="LBS"> 34448.00 </weight>
    <location name="POINTMASS" unit="IN">
     <x>   811.67 </x>
     <y>     0.00 </y>
     <z>   -32.22 </z>
   </location>
  </pointmass>
 </mass_balance>
 <propulsion>

   <engine file="J58">
    <location unit="IN">
      <x>   811.67 </x>
      <y>  -111.17 </y>
      <z>   -40.00 </z>
    </location>
    <orient unit="DEG">
      <pitch>     0.00 </pitch>
       <roll>    -0.00 </roll>
        <yaw>     0.00 </yaw>
    </orient>
    <feed> 0 </feed>

    <thruster file="direct">
     <sense> 1 </sense>
     <location unit="IN">
       <x>   811.67 </x>
       <y>  -111.17 </y>
       <z>   -40.00 </z>
     </location>
     <orient unit="DEG">
       <pitch>     0.00 </pitch>
        <roll>     0.00 </roll>
         <yaw>     0.00 </yaw>
     </orient>
    </thruster>
  </engine>

   <engine file="J58">
    <location unit="IN">
      <x>   811.67 </x>
      <y>   111.17 </y>
      <z>   -40.00 </z>
    </location>
    <orient unit="DEG">
      <pitch>     0.00 </pitch>
       <roll>    -0.00 </roll>
        <yaw>     0.00 </yaw>
    </orient>
    <feed> 1 </feed>

    <thruster file="direct">
     <sense> 1 </sense>
     <location unit="IN">
       <x>   811.67 </x>
       <y>   111.17 </y>
       <z>   -40.00 </z>
     </location>
     <orient unit="DEG">
       <pitch>     0.00 </pitch>
        <roll>     0.00 </roll>
         <yaw>     0.00 </yaw>
     </orient>
    </thruster>
  </engine>

  <tank type="FUEL" number="0">
     <location unit="IN">
       <x>   811.67 </x>
       <y>     0.00 </y>
       <z>   -32.22 </z>
     </location>
     <capacity unit="LBS"> 11868.00 </capacity>
     <contents unit="LBS"> 5934.00 </contents>
  </tank>
  <tank type="FUEL" number="1">
     <location unit="IN">
       <x>   811.67 </x>
       <y>     0.00 </y>
       <z>   -32.22 </z>
     </location>
     <capacity unit="LBS"> 11868.00 </capacity>
     <contents unit="LBS"> 5934.00 </contents>
  </tank>
  <tank type="FUEL" number="2">
     <location unit="IN">
       <x>   811.67 </x>
       <y>     0.00 </y>
       <z>   -32.22 </z>
     </location>
     <capacity unit="LBS"> 11868.00 </capacity>
     <contents unit="LBS"> 5934.00 </contents>
  </tank>

 </propulsion>
 <ground_reactions>

  <contact type="BOGEY" name="NOSE">
    <location unit="IN">
      <x>   167.57 </x>
      <y>     0.00 </y>
      <z>  -154.68 </z>
    </location>
    <static_friction>  0.80 </static_friction>
    <dynamic_friction> 0.50 </dynamic_friction>
    <rolling_friction> 0.02 </rolling_friction>
    <spring_coeff  unit="LBS/FT">     51600.00 </spring_coeff>
    <damping_coeff unit="LBS/FT/SEC"> 25800.00 </damping_coeff>
    <max_steer unit="DEG"> 5.00 </max_steer>
    <brake_group> NONE </brake_group>
    <retractable> 1 </retractable>
  </contact>

  <contact type="BOGEY" name="LEFT_MAIN">
    <location unit="IN">
      <x>   844.13 </x>
      <y>   -60.03 </y>
      <z>  -154.68 </z>
    </location>
    <static_friction>  0.80 </static_friction>
    <dynamic_friction> 0.50 </dynamic_friction>
    <rolling_friction> 0.02 </rolling_friction>
    <spring_coeff  unit="LBS/FT">     172000.00 </spring_coeff>
    <damping_coeff unit="LBS/FT/SEC"> 86000.00 </damping_coeff>
    <max_steer unit="DEG">0</max_steer>
    <brake_group> LEFT </brake_group>
    <retractable> 1 </retractable>
  </contact>

  <contact type="BOGEY" name="RIGHT_MAIN">
    <location unit="IN">
      <x>   844.13 </x>
      <y>    60.03 </y>
      <z>  -154.68 </z>
    </location>
    <static_friction>  0.80 </static_friction>
    <dynamic_friction> 0.50 </dynamic_friction>
    <rolling_friction> 0.02 </rolling_friction>
    <spring_coeff  unit="LBS/FT">     172000.00 </spring_coeff>
    <damping_coeff unit="LBS/FT/SEC"> 86000.00 </damping_coeff>
    <max_steer unit="DEG">0</max_steer>
    <brake_group> RIGHT </brake_group>
    <retractable> 1 </retractable>
  </contact>

  <contact type="STRUCTURE" name="LEFT_WING">
    <location unit="IN">
     <x>   811.67 </x>
     <y>  -333.50 </y>
     <z>   -32.22 </z>
    </location>
   <static_friction>  1 </static_friction>
   <dynamic_friction> 1 </dynamic_friction>
   <spring_coeff unit="LBS/FT">      172000.00 </spring_coeff>
   <damping_coeff unit="LBS/FT/SEC"> 172000.00 </damping_coeff>
  </contact>

  <contact type="STRUCTURE" name="RIGHT_WING">
    <location unit="IN">
     <x>   811.67 </x>
     <y>   333.50 </y>
     <z>   -32.22 </z>
    </location>
   <static_friction>  1 </static_friction>
   <dynamic_friction> 1 </dynamic_friction>
   <spring_coeff unit="LBS/FT">      172000.00 </spring_coeff>
   <damping_coeff unit="LBS/FT/SEC"> 172000.00 </damping_coeff>
  </contact>

 </ground_reactions>
 <system file="Propulsion.xml"/>
 <system file="Aircraft control.xml"/>
 <system file="Landing Gear.xml"/>
 <system file="Drag Chute.xml"/>

 <flight_control name="FCS: SR71">

 </flight_control>

 <aerodynamics>

  <axis name="LIFT">

    <!-- Lift above 0.85 and below -0.85 is generalised -->
    <function name="aero/force/Lift_alpha">
      <description>Lift due to alpha</description>
      <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <table>
            <independentVar lookup="row">aero/alpha-rad</independentVar>
            <tableData>
              -1.57  0.0000
              -1.22 -0.5464
              -1.05 -0.7361
              -0.88 -0.8500
              -0.75 -0.3680
              -1.86 -0.9200
               0.00  0.0800
               1.72  1.0000
               0.60  0.4480
               0.88  1.1500
               1.05  0.9959
               1.22  0.7392
               1.57  0.0000
            </tableData>
          </table>
      </product>
    </function>

    <function name="aero/force/Lift_pitch_rate">
        <description>Lift due to pitch rate</description>
        <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <property>velocities/q-aero-rad_sec</property>
          <property>aero/ci2vel</property>
          <value> 1.1738 </value>
        </product>
      </function>

      <function name="aero/force/Lift_alpha_rate">
        <description>Lift due to alpha rate</description>
        <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>aero/alphadot-rad_sec</property>
           <property>aero/ci2vel</property>
           <value> 1.1920 </value>
        </product>
      </function>

    <function name="aero/force/Lift_elevator">
       <description>Lift due to Elevator Deflection</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>fcs/elevator-pos-rad</property>
           <value> 0.5364 </value>
       </product>
    </function>

  </axis>

  <axis name="DRAG">

    <!-- CD0 is based on fuselage, wing, horizontal- en vertical tail -->
    <!-- Antennas, struts and wires are not taken into account        -->
    <!-- CD for gear (fixed and retractable) is defined below         -->
    <function name="aero/force/Drag_minimum">
       <description>Minimum drag</description>
       <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <value> 0.0104 </value>
       </product>
    </function>

    <function name="aero/force/Drag_alpha">
       <description>Drag due to alpha</description>
       <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <table>
            <independentVar lookup="row">aero/alpha-rad</independentVar>
            <tableData>
             -1.57    1.4082
             -1.72    0.0246
              0.00    0.0000
              1.72    0.0246
              1.57    1.4082
            </tableData>
          </table>
       </product>
    </function>

    <function name="aero/force/Drag_induced">
       <description>Induced drag</description>
         <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>aero/cl-squared</property>
           <value> 0.1674 </value>
         </product>
    </function>

    <function name="aero/force/Drag_mach">
       <description>Drag due to mach</description>
        <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <table>
            <independentVar lookup="row">velocities/mach</independentVar>
            <tableData>
                0.00    0.0000
                0.81    0.0000
                1.10    0.0230
                1.80    0.0150
            </tableData>
          </table>
        </product>
    </function>

    <function name="aero/force/Drag_beta">
       <description>Drag due to sideslip</description>
       <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <table>
            <independentVar lookup="row">aero/beta-rad</independentVar>
            <tableData>
              -1.57    1.2300
              -0.26    0.0500
               0.00    0.0000
               0.26    0.0500
               1.57    1.2300
            </tableData>
          </table>
       </product>
    </function>

    <function name="aero/force/Drag_elevator">
       <description>Drag due to Elevator Deflection</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <abs><property>fcs/elevator-pos-rad</property></abs>
           <value> 0.0400 </value>
       </product>
    </function>

    <function name="aero/force/Drag_gear">
       <description>Drag due to gear</description>
         <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>gear/gear-pos-norm</property>
           <value> 0.0200 </value>
         </product>
    </function>

  </axis>

  <axis name="SIDE">

    <function name="aero/force/Side_beta">
       <description>Side force due to beta</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>aero/beta-rad</property>
           <value> -0.3963 </value>
       </product>
    </function>
    <function name="aero/force/Side_roll_rate">
       <description>Side force due to roll rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>aero/bi2vel</property>
           <property>velocities/p-aero-rad_sec</property>
           <value> 0.001500 </value>
       </product>
    </function>

    <function name="aero/force/Side_yaw_rate">
       <description>Side force due to yaw rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>aero/bi2vel</property>
           <property>velocities/r-aero-rad_sec</property>
           <value> 0.6127 </value>
       </product>
    </function>

    <function name="aero/force/Side_rudder">
       <description>Side force due to rudder</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>fcs/rudder-pos-rad</property>
           <value> 0.1181 </value>
       </product>
    </function>

  </axis>

  <axis name="PITCH">

    <function name="aero/moment/Pitch_alpha">
       <description>Pitch moment due to alpha</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/cbarw-ft</property>
           <property>aero/alpha-rad</property>
           <value> -0.0246 </value>
       </product>
    </function>

    <function name="aero/moment/Pitch_elevator">
       <description>Pitch moment due to elevator</description>
       <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <property>metrics/cbarw-ft</property>
          <property>fcs/elevator-pos-rad</property>
          <table>
            <independentVar lookup="row">velocities/mach</independentVar>
            <tableData>
              0.0    -0.3415
              2.0    -0.0854
            </tableData>
          </table>
       </product>
    </function>

    <function name="aero/moment/Pitch_damp">
       <description>Pitch moment due to pitch rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/cbarw-ft</property>
           <property>aero/ci2vel</property>
           <property>velocities/q-aero-rad_sec</property>
           <value> -0.8332 </value>
       </product>
    </function>

    <function name="aero/moment/Pitch_alphadot">
       <description>Pitch moment due to alpha rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/cbarw-ft</property>
           <property>aero/ci2vel</property>
           <property>aero/alphadot-rad_sec</property>
           <value> -0.8461 </value>
       </product>
    </function>

  </axis>

  <axis name="ROLL">

    <function name="aero/moment/Roll_beta">
       <description>Roll moment due to beta</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/beta-rad</property>
           <property>fcs/gear-no-wow</property>
           <value> -0.066188 </value>
       </product>
    </function>

    <function name="aero/moment/Roll_damp">
       <description>Roll moment due to roll rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/bi2vel</property>
           <property>velocities/p-aero-rad_sec</property>
           <value> 0.0825 </value>
       </product>
    </function>

    <function name="aero/moment/Roll_yaw">
       <description>Roll moment due to yaw rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/bi2vel</property>
           <property>velocities/r-aero-rad_sec</property>
           <value> 0.004297 </value>
       </product>
    </function>

    <function name="aero/moment/Roll_aileron">
       <description>Roll moment due to aileron</description>
       <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <property>metrics/bw-ft</property>
          <property>fcs/left-aileron-pos-rad</property>
           <table>
            <independentVar lookup="row">velocities/mach</independentVar>
            <tableData>
              0.0    0.1200
              2.0    0.0300
            </tableData>
          </table>
       </product>
    </function>

    <function name="aero/moment/Roll_rudder">
       <description>Roll moment due to rudder</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>fcs/rudder-pos-rad</property>
           <value> 0.0100 </value>
       </product>
    </function>

  </axis>

  <axis name="YAW">

    <function name="aero/moment/Yaw_beta">
       <description>Yaw moment due to beta</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/beta-rad</property>
           <value> 0.147207 </value>
       </product>
    </function>

    <function name="aero/moment/Yaw_roll_rate">
       <description>Yaw moment due to roll rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/bi2vel</property>
           <property>velocities/p-rad_sec</property>
           <value> -0.001159 </value>
       </product>
    </function>

    <function name="aero/moment/Yaw_damp">
       <description>Yaw moment due to yaw rate</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>aero/bi2vel</property>
           <property>velocities/r-aero-rad_sec</property>
           <value> -0.229859 </value>
       </product>
    </function>

    <function name="aero/moment/Yaw_rudder">
       <description>Yaw moment due to rudder</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>fcs/rudder-pos-rad</property>
           <value> -0.0913172 </value>
       </product>
    </function>

    <function name="aero/moment/Yaw_aileron">
       <description>Adverse yaw</description>
       <product>
           <property>aero/qbar-psf</property>
           <property>metrics/Sw-sqft</property>
           <property>metrics/bw-ft</property>
           <property>fcs/left-aileron-pos-rad</property>
           <value> 0 </value>
       </product>
    </function>

  </axis>

 </aerodynamics>

 <external_reactions>
  <property value="0">systems/chute/chute-reef-pos-norm</property>
  <property value="0">systems/chute/chute-size-factor</property>

  <force name="chute" frame="WIND">
   <function>
    <product>
     <property>aero/qbar-psf</property>
     <property>systems/chute/chute-reef-pos-norm</property>
     <property>systems/chute/chute-size-factor</property>
     <value> 0.9 </value>
     <value> 115 </value>
    </product>
   </function>
   <location unit="FT">
    <x> 97.7492 </x>
    <y> 0 </y>
    <z> 0 </z>
   </location>
   <direction>
    <x>-1 </x>
    <y> 0 </y>
    <z> 0 </z>
   </direction>
  </force>

 </external_reactions>

</fdm_config>

@ermarch
Copy link
Contributor

ermarch commented Mar 25, 2021

Oh I was hoping to get the created sr71.param file so I could reproduce your inputs locally.

@kwanzapili
Copy link
Author

I am sorry I misunderstood you completely. I didn't even realise that Aeromatic created this file until looked for it. Here it is.

SR71

SR71

0
2                             ; Type of aircraft
                              ; Stall speed VS1 (clean, no flaps)
172000                        ; Maximum takeoff weight
67500                         ; Empty weight
                              ; Inertia Ixx
                              ; Inertia Iyy
                              ; Inertia Izz
107.41666667                  ; Length
2                             ; Select a wing shape
55.58333333                   ; Wing span
1795                          ; Wing area
1.939                         ; Wing aspect ratio
                              ; Wing taper ratio
60.533                        ; Wing root chord
                              ; Wing incidence
0                             ; Wing dihedral
52.629                        ; Wing sweep (quarter chord)
                              ; Htail area
                              ; Htail arm
150.76                        ; Vtail area
                              ; Vtail arm

J58
2                             ; Number of engines
3                             ; Engine layout
2                             ; Engine type
25000                         ; Engine mil. thrust
0                             ; Bypass ratio
8.8                           ; Overall pressure ratio
yes

1                             ; Control system


0                             ; Nose or tail wheel type

no
no


yes

@ermarch
Copy link
Contributor

ermarch commented Mar 26, 2021

Great, thanks.
I'll do some investigation.

@ermarch
Copy link
Contributor

ermarch commented Mar 26, 2021

The problem comes from calculating CLalpha for delta-wings. And I think the real problem is the fact that vortex lift is not taken into account.

bcoconni pushed a commit that referenced this issue Mar 26, 2021
Fix a delta-wing Lift_alpha and Drag_alpha problem where the values of alpha increase improperly. (issue #400)
Fix a bug introduced by the previous pull request.
Convert more code to C++11
@bcoconni
Copy link
Member

A new fix (commit 375f5be) has been pushed to master.
@kwanzapili could you please check ?

bcoconni pushed a commit that referenced this issue Mar 26, 2021
Use std::vector where possible, check whether parameters are out of bounds.
This fixes issue #400
bcoconni pushed a commit that referenced this issue Mar 26, 2021
Fix a delta-wing Lift_alpha and Drag_alpha problem where the values of alpha increase improperly. (issue #400)
Fix a bug introduced by the previous pull request.
Convert more code to C++11
@kwanzapili
Copy link
Author

Thanks a lot. I revised the configuration and tested. My first observation was this key changes in the parameters:

* payload: 68896 lbs -> 104500 lbs
* CL-alpha: 0.54 -> 1.80 per radian

* htailarea 0 -> 359.00

* mass balance:
x: 136167.34 -> 118033.33
y: 699019.12 -> 740742.56
z: 585154.88 -> 556958.88
  • Now, I am not clear what "htail-" is but I assume horizontal tail. I am not sure that the S-71 had a horizontal tail per se.
  • For "aero/moment/Pitch_alphadot" should we not be using 'qbarUW-psf' instead of 'qbar-psf'? I had lots of problems with random wild oscillations when the plane was at standstill and the parking brakes on.
  • The flying experience is very different now. The take-off is easier but slower. Previously, the transition to lift-off was very sudden taking the plane from 0 - 20 pitch instantly with elevators at about 40%. With the new configuration is is gentler but it also requires the plane to fly at over 10 degrees just for a very slow climb rate. This means I can never hit the target climb rate of over 9000 fpm.
  • My take it that the lift it too low in the new configuration or something else is not quite right

@bcoconni
Copy link
Member

@kwanzapili Thanks for the bug report and testing !

Issues are dedicated to bug reports and feature requests: if you confirm that the bug you initially reported is now fixed then I suggest this issue should be closed and that the discussion should continue in JSBSim Discussions.

Thanks.

@kwanzapili
Copy link
Author

Sure, thanks a lot for fixing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants