Board index FlightGear Development Aircraft Flight dynamics model

Tu-95, YASim and 32 bit vs. 64 bit FG

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

Tu-95, YASim and 32 bit vs. 64 bit FG

Postby helijah » Wed May 20, 2015 11:46 am

Split off from the topic YASim Guide.

Hey Gary,

Since the last update TU95 (in my shed and SVN) we noticed with Edward (aka bugman) a significant problem. You may not do much because it is in the sources, but it is important to note.

tu95-yasim on FG 3.5.0 GIT 64bit
Code: Select all
[edward@localhost flightgear-fgaddon]$ yasim Aircraft/TU-95/tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 15.734649
       Lift Ratio: 161.826202
       Cruise AoA: 2.318302
   Tail Incidence: -3.204615
Approach Elevator: 0.000000
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


Now tu95-yasim on FG 3.5.0 GIT 32bit
Code: Select all
[helijah@localhost TU-95]$ yasim tu95-yasim.xml
Solution results:       Iterations: 1136
 Drag Coefficient: 14.207833
       Lift Ratio: 187.240402
       Cruise AoA: 2.553360
   Tail Incidence: -9.761394
Approach Elevator: -0.005927
               CG: x:3.209, y:-0.000, z:-1.988

  Inertia tensor : 4620186.500, -0.029, 814539.375
        [kg*m^2]   -0.029, 12267473.000, 0.004
     Origo at CG   814539.375, 0.004, 16535335.000
 


As you can see, the version of FG is the same (very recement compiled in both cases), the version of tu95 is the same (we checked, it is that of SVN) but the results are different from 64 32 bit.

We continue our research, but it seems that the calculations do not have the same result in 32 bit and 64 bit. This is highly annoying. Indeed, 2 + 2 always equals 4, which is either 32 or 64 bit (I simplify :)). If this is not the case, this is extrèmenent untoward.

Regards Emmanuel

P.S. This currently means that the Tu95 flies well in 32 bit, but can not be used in 64 bit :(
Last edited by Johan G on Wed May 20, 2015 7:57 pm, edited 1 time in total.
Reason: Split off from the topic 'YASim Guide'
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1001
Joined: Wed Dec 27, 2006 12:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: YASim Guide

Postby Buckaroo » Wed May 20, 2015 2:23 pm

Emmanuel,

Oddly, in my older 32-bit system with an older version of FG, I get results more similar to the 64-bit result. That's a bit weird.

I wonder: In the TU-95, the 32-bit Approach Elevator value of -0.005927 is extremely small. This indicates the aircraft needs 0.59% deflection to hold the approach attitude. Typical values are 2 orders of magnitude larger. The 64-bit Approach Elevator result is curiously 0, which makes me wonder if the results are related. You are right, they should be the same or similar. Yet I am curious what happens if the approach elevator is 100x greater, in the range of approximately -0.59.

If you have a little time and are willing to experiment, could you please test the 32 and 64 bit solutions with the following TU-95 changes:

approach settings:

<approach speed="130" aoa="2" fuel="0.3">
change to:
<approach speed="130" aoa="4" fuel="0.3">

wing:

<stall aoa="22" width="1" peak="1.5"/>
<flap0 start="0.02" end="0.55" lift="1.8" drag="1.6"/>
change to:
<stall aoa="15" width="5" peak="1.5"/>
<flap0 start="0.02" end="0.55" lift="1.3" drag="1.6"/>

hstab:

<stall aoa="22" width="1" peak="1.5"/>
<flap0 start="0" end="0.95" lift="1.6" drag="1.3"/>
change to:
<stall aoa="18" width="3" peak="1.5"/>
<flap0 start="0" end="0.95" lift="1.4" drag="1.3"/>

These settings are not meant to be correct, only to get solution numbers in a different range for the test. I'm especially interested in solutions where Approach Elevator is -0.25 or greater.

I would be very interested in your findings, and it might help us post a specific warning to developers.

-Buck/Gary
Callsign: Buckaro(o)
Author: Lockheed 1049H Constellation, Grumman Goose, MD-81, Edgley Optica, Velocity XL RG, YASim Guide
User avatar
Buckaroo
 
Posts: 475
Joined: Fri Jan 18, 2008 6:45 am
Location: Bloomington IN USA
Callsign: Buckaro(o)
Version: 2.10
OS: Windows & Linux

Re: YASim Guide

Postby bugman » Wed May 20, 2015 2:56 pm

I see rather strange results with YASim for this 'tu95-yasim.xml' file. For reference, I ran a number of tests on my Mageia 4 Linux system using FAddon r669:

FG 3.5.0 (simgear 0369d1f, flightgear 076f61f, fgdata 11066a5), Mageia 4 Linux 64-bit:

Code: Select all
[edward@localhost flightgear-fgaddon]$ yasim Aircraft/TU-95/tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 15.734649
       Lift Ratio: 161.826202
       Cruise AoA: 2.318302
   Tail Incidence: -3.204615
Approach Elevator: 0.000000
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


FG 3.2.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.2.0//drive_c/Program Files/FlightGear 3.2.0/bin/yasim.exe" tu95-yasim.xml 2> /dev/null
Solution results:       Iterations: 1069
 Drag Coefficient: 14.207831
       Lift Ratio: 187.240463
       Cruise AoA: 2.553359
   Tail Incidence: -9.761393
Approach Elevator: -0.005927
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.4.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.0/drive_c/Program Files/FlightGear 3.4.0/bin/yasim.exe" tu95-yasim.xml 2> /dev/null
Solution results:       Iterations: 1069
 Drag Coefficient: 14.207831
       Lift Ratio: 187.240463
       Cruise AoA: 2.553359
   Tail Incidence: -9.761393
Approach Elevator: -0.005927
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.4.1, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.1/drive_c/Program Files/FlightGear 3.4.1/bin/yasim.exe" tu95-yasim.xml 2> /dev/null
Solution results:       Iterations: 1069
 Drag Coefficient: 14.207831
       Lift Ratio: 187.240463
       Cruise AoA: 2.553359
   Tail Incidence: -9.761393
Approach Elevator: -0.005927
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.5.0 nightly (2015-05-19), Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg_nightly_2015-05-20/drive_c/Program Files/FlightGear 3.5.0/bin/yasim.exe" tu95-yasim.xml 2> /dev/null
Solution results:       Iterations: 1069
 Drag Coefficient: 14.207831
       Lift Ratio: 187.240463
       Cruise AoA: 2.553359
   Tail Incidence: -9.761393
Approach Elevator: -0.005927
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.2.0, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/lib64 /flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/bin/yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 15.734649
       Lift Ratio: 161.826202
       Cruise AoA: 2.318302
   Tail Incidence: -3.204615
Approach Elevator: 0.000000
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


FG 3.2.0, Mageia Linux 4 32-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/lib/ /flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/bin/yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 15.732868
       Lift Ratio: 161.867722
       Cruise AoA: 2.321278
   Tail Incidence: -3.355914
Approach Elevator: 0.000000
               CG: x:3.209, y:-0.000, z:-1.988

  Inertia tensor : 4620186.500, -0.029, 814539.375
        [kg*m^2]   -0.029, 12267473.000, 0.004
     Origo at CG   814539.375, 0.004, 16535335.000


FG 2.12.1, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/bin/yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 20.604675
       Lift Ratio: 124.416389
       Cruise AoA: 2.339031
   Tail Incidence: -3.209457
Approach Elevator: 0.000000
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.10.0, Mageia Linux 4 64-bit, mga3 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/bin/yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 20.604675
       Lift Ratio: 124.416389
       Cruise AoA: 2.339031
   Tail Incidence: -3.209457
Approach Elevator: 0.000000
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.6.0, Mageia Linux 4 64-bit, mga2 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/bin/yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 10000 iterations
Solution results:       Iterations: 10002
 Drag Coefficient: 20.604675
       Lift Ratio: 124.416389
       Cruise AoA: 2.339031
   Tail Incidence: -3.209457
Approach Elevator: 0.000000
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.0.0, Mageia Linux 4 64-bit, mga1 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/games/yasim tu95-yasim.xml
Solution results:       Iterations: 806
 Drag Coefficient: 23.481804
       Lift Ratio: 114.278542
       Cruise AoA: 2.579713
   Tail Incidence: -9.833370
Approach Elevator: -0.006269
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


I really do not understand why there is so much variability! The approach elevator of 0.0 looks suspiciously like this is an optimisation problem which is stuck (maybe the singular matrix problem). But I have no idea what YASim is doing yet. Or if there are external shared libraries which could be to blame. I should read the guide!

Regards,

Edward
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: YASim Guide

Postby bugman » Wed May 20, 2015 3:11 pm

Maybe a moderator should spin this YASim problem off into its own topic?

For reference I installed the Windows versions on Linux+wine into dedicated directories with, for example:

Code: Select all
$ WINEPREFIX=$PWD/wine-fg3.2.0 wine Setup\ FlightGear\ 3.2.0.exe


And the old rpms from Rpmfind with, for example:

Code: Select all
$ mkdir flightgear-2.10.0-1.3.mga3.x86_64
$ cd !$
$ rpm2cpio ../flightgear-2.10.0-1.3.mga3.x86_64.rpm | cpio -idmv
$ rpm2cpio ../simgear-2.10.0-2.mga3.x86_64.rpm | cpio -idvm
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: YASim Guide

Postby Buckaroo » Wed May 20, 2015 4:16 pm

bugman wrote:I really do not understand why there is so much variability! The approach elevator of 0.0 looks suspiciously like this is an optimisation problem which is stuck (maybe the singular matrix problem). But I have no idea what YASim is doing yet. Or if there are external shared libraries which could be to blame.


The approach elevator issue is very likely a symptom of a number of FDM configuration problems. The very small approach elevator values shown above are well out of range of a YASim norm. Approach elevator, though not directly set by the developer, is fundamentally derived from developer configuration settings, particularly those that affect moments.

To find an elevator incidence that works for both approach and cruise, YASim makes many very small changes to approach elevator. In a good configuration, the delta value is several orders of magnitude smaller than the resulting approach configuration value. In the above situations, the delta value is on the same order as many of the approach elevator values shown above. The relative delta is likely not sufficiently small to fine-tune a result. I have no idea what that will do, but we may be seeing the effect on floating point calculations. Other solution results are based on this outcome, so they are not of much interest until approach elevator is in reasonable bounds, at least something like -0.3 and preferably significantly greater.

I hope that helps work through your findings. In my opinion, the first thing to do is make sure the FDM configuration is reasonable as a whole. When approach elevator begins to show a plausible result, then I think a study of the variability becomes more beneficial.

Just my $.02 of course.


bugman wrote:Maybe a moderator should spin this YASim problem off into its own topic?

Yep, makes sense to me. Maybe Johan will kindly move this somewhere else.

-Buck
Callsign: Buckaro(o)
Author: Lockheed 1049H Constellation, Grumman Goose, MD-81, Edgley Optica, Velocity XL RG, YASim Guide
User avatar
Buckaroo
 
Posts: 475
Joined: Fri Jan 18, 2008 6:45 am
Location: Bloomington IN USA
Callsign: Buckaro(o)
Version: 2.10
OS: Windows & Linux

Re: YASim Guide

Postby LesterBoffo » Wed May 20, 2015 4:23 pm

Just as a quick question is the latest Windows build finally working for Windows XP 32 bit users?
User avatar
LesterBoffo
 
Posts: 2101
Joined: Sun Oct 02, 2011 4:02 pm
Location: Western USA
Callsign: LesBof
Version: 2016.1
OS: WinXP 32 bit

Re: YASim Guide

Postby bugman » Wed May 20, 2015 4:33 pm

Buckaroo wrote in Wed May 20, 2015 2:23 pm:These settings are not meant to be correct, only to get solution numbers in a different range for the test. I'm especially interested in solutions where Approach Elevator is -0.25 or greater.

I would be very interested in your findings, and it might help us post a specific warning to developers.


I changed the values as you suggested and blasted the new 'tu95-yasim_buck.xml' through all the YASim executables I have set up. I'll split this up for easier reading, rather than using one large code block.

FG 3.5.0 (simgear 0369d1f, flightgear 076f61f, fgdata 11066a5), Mageia 4 Linux 64-bit:

Code: Select all
[edward@localhost TU-95]$ yasim tu95-yasim_buck.xml
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359592
       Lift Ratio: 156.847305
       Cruise AoA: 1.359258
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


FG 3.2.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.2.0//drive_c/Program Files/FlightGear 3.2.0/bin/yasim.exe" tu95-yasim_buck.xml 2> /dev/null
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359594
       Lift Ratio: 156.847305
       Cruise AoA: 1.359257
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.4.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.0/drive_c/Program Files/FlightGear 3.4.0/bin/yasim.exe" tu95-yasim_buck.xml 2> /dev/null
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359594
       Lift Ratio: 156.847305
       Cruise AoA: 1.359257
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.4.1, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.1/drive_c/Program Files/FlightGear 3.4.1/bin/yasim.exe" tu95-yasim_buck.xml 2> /dev/null
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359594
       Lift Ratio: 156.847305
       Cruise AoA: 1.359257
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.5.0 nightly (2015-05-19), Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg_nightly_2015-05-20/drive_c/Program Files/FlightGear 3.5.0/bin/yasim.exe" tu95-yasim_buck.xml 2> /dev/null
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359594
       Lift Ratio: 156.847305
       Cruise AoA: 1.359257
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


FG 3.2.0, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/lib64 /flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/bin/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359592
       Lift Ratio: 156.847305
       Cruise AoA: 1.359258
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


FG 3.2.0, Mageia Linux 4 32-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/lib/ /flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/bin/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 1732
 Drag Coefficient: 16.359592
       Lift Ratio: 156.847244
       Cruise AoA: 1.359257
   Tail Incidence: -4.127071
Approach Elevator: -0.325711
               CG: x:3.209, y:-0.000, z:-1.988

  Inertia tensor : 4620186.500, -0.029, 814539.375
        [kg*m^2]   -0.029, 12267473.000, 0.004
     Origo at CG   814539.375, 0.004, 16535335.000


FG 2.12.1, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/bin/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.10.0, Mageia Linux 4 64-bit, mga3 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/bin/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.6.0, Mageia Linux 4 64-bit, mga2 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/bin/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.0.0, Mageia Linux 4 64-bit, mga1 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/games/yasim tu95-yasim_buck.xml
Solution results:       Iterations: 1017
 Drag Coefficient: 23.201963
       Lift Ratio: 111.631470
       Cruise AoA: 1.348199
   Tail Incidence: -4.116395
Approach Elevator: -0.330565
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000
[edward@localhost TU-95]$


Edit: This is clearly an edge case floating point issue with differences between certain 32-bit vs. 64-bit systems, as well as Linux vs. Windows (and I guess Macs will give a different result as well).
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: YASim Guide

Postby LesterBoffo » Wed May 20, 2015 4:43 pm

Also I'd like to add that in piston engine entries, for the engine, you can add a min-throttle="x.x" option which effectively lowers the engine idle and provides engine-propeller braking for engines so equipped with throttles, which I assume is most of them.
User avatar
LesterBoffo
 
Posts: 2101
Joined: Sun Oct 02, 2011 4:02 pm
Location: Western USA
Callsign: LesBof
Version: 2016.1
OS: WinXP 32 bit

Re: YASim Guide

Postby Buckaroo » Wed May 20, 2015 5:27 pm

bugman wrote in Wed May 20, 2015 4:33 pm:[This is clearly an edge case floating point issue with differences between certain 32-bit vs. 64-bit systems, as well as Linux vs. Windows (and I guess Macs will give a different result as well).


Thanks much Edward! Yeah, I'm with you, I think it's an edge case.

I'm guessing the differences between the older and the 3.2+ cases are due to the YASim version changes that happened around that period, since this aircraft uses the "YASIM_VERSION_CURRENT" attribute. I suspect if that was removed, the findings would generally agree for all cases. Frankly I'm not up to date on the 3.0+ YASim version changes-- I have not been able to put much time into this in the last year or so. I need to document that stuff to keep current.

Cheers!
-Buck
Callsign: Buckaro(o)
Author: Lockheed 1049H Constellation, Grumman Goose, MD-81, Edgley Optica, Velocity XL RG, YASim Guide
User avatar
Buckaroo
 
Posts: 475
Joined: Fri Jan 18, 2008 6:45 am
Location: Bloomington IN USA
Callsign: Buckaro(o)
Version: 2.10
OS: Windows & Linux

Re: YASim Guide

Postby bugman » Wed May 20, 2015 6:26 pm

Buckaroo wrote in Wed May 20, 2015 5:27 pm:I'm guessing the differences between the older and the 3.2+ cases are due to the YASim version changes that happened around that period, since this aircraft uses the "YASIM_VERSION_CURRENT" attribute. I suspect if that was removed, the findings would generally agree for all cases.


You asked for it ;)

Code: Select all
[edward@localhost TU-95]$ diff -u tu95-yasim.xml tu95-yasim_buck_original.xml
--- tu95-yasim.xml      2015-05-20 18:22:37.884395228 +0200
+++ tu95-yasim_buck_original.xml        2015-05-20 20:14:34.409071216 +0200
@@ -15,9 +15,9 @@
      Maximum speed   : 480 km/h  ( 260 kt    ) at 25000 ft
 -->
 
-<airplane mass="145100" version="YASIM_VERSION_CURRENT">
+<airplane mass="145100" version="YASIM_VERSION_ORIGINAL">
 
-  <approach speed="130" aoa="2" fuel="0.3">
+  <approach speed="130" aoa="4" fuel="0.3">
     <control-setting axis="/controls/engines/engine[0]/throttle" value="0.7"/>
     <control-setting axis="/controls/engines/engine[0]/condition" value="1"/>
     <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0"/>
@@ -82,8 +82,8 @@
         twist="-2"
         dihedral="-2.5"
         camber="0.05">
-        <stall aoa="22" width="1" peak="1.5"/>
-        <flap0 start="0.02" end="0.55" lift="1.8" drag="1.6"/>
+        <stall aoa="15" width="5" peak="1.5"/>
+        <flap0 start="0.02" end="0.55" lift="1.3" drag="1.6"/>
         <flap1 start="0.70" end="0.98" lift="1.4" drag="1.1"/>
 
         <control-input axis="/controls/flight/flaps" control="FLAP0"/>
@@ -104,8 +104,8 @@
          taper="0.40"
          dihedral="-2"
          sweep="34">
-         <stall aoa="22" width="1" peak="1.5"/>
-         <flap0 start="0" end="0.95" lift="1.6" drag="1.3"/>
+         <stall aoa="18" width="3" peak="1.5"/>
+         <flap0 start="0" end="0.95" lift="1.4" drag="1.3"/>
 
          <control-input axis="/controls/flight/elevator" control="FLAP0"/>
          <control-input axis="/controls/flight/elevator-trim" control="FLAP0"/>


FG 3.5.0 (simgear 0369d1f, flightgear 076f61f, fgdata 11066a5), Mageia 4 Linux 64-bit:

Code: Select all
[edward@localhost TU-95]$ yasim tu95-yasim_buck_original.xml
This aircraft does not use the latest yasim configuration version.
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 3.2.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.2.0//drive_c/Program Files/FlightGear 3.2.0/bin/yasim.exe" tu95-yasim_buck_original.xml 2> /dev/null
Solution results:       Iterations: 977
 Drag Coefficient: 23.201973
       Lift Ratio: 111.631485
       Cruise AoA: 1.348194
   Tail Incidence: -4.116385
Approach Elevator: -0.330568
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620202.500, -0.022, 814955.188
        [kg*m^2]   -0.022, 12274946.000, 0.008
     Origo at CG   814955.188, 0.008, 16542795.000


FG 3.4.0, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.0/drive_c/Program Files/FlightGear 3.4.0/bin/yasim.exe" tu95-yasim_buck_original.xml 2> /dev/null
Solution results:       Iterations: 977
 Drag Coefficient: 23.201973
       Lift Ratio: 111.631485
       Cruise AoA: 1.348194
   Tail Incidence: -4.116385
Approach Elevator: -0.330568
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620202.500, -0.022, 814955.188
        [kg*m^2]   -0.022, 12274946.000, 0.008
     Origo at CG   814955.188, 0.008, 16542795.000


FG 3.4.1, Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.1/drive_c/Program Files/FlightGear 3.4.1/bin/yasim.exe" tu95-yasim_buck_original.xml 2> /dev/null
Solution results:       Iterations: 977
 Drag Coefficient: 23.201973
       Lift Ratio: 111.631485
       Cruise AoA: 1.348194
   Tail Incidence: -4.116385
Approach Elevator: -0.330568
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620202.500, -0.022, 814955.188
        [kg*m^2]   -0.022, 12274946.000, 0.008
     Origo at CG   814955.188, 0.008, 16542795.000


FG 3.5.0 nightly (2015-05-19), Windows 32-bit, Linux+wine:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg_nightly_2015-05-20/drive_c/Program Files/FlightGear 3.5.0/bin/yasim.exe" tu95-yasim_buck_original.xml 2> /dev/null
Solution results:       Iterations: 977
 Drag Coefficient: 23.201973
       Lift Ratio: 111.631485
       Cruise AoA: 1.348194
   Tail Incidence: -4.116385
Approach Elevator: -0.330568
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620202.500, -0.022, 814955.188
        [kg*m^2]   -0.022, 12274946.000, 0.008
     Origo at CG   814955.188, 0.008, 16542795.000


FG 3.2.0, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/lib64 /flightgear/src/releases/flightgear-3.2.0-1.mga4.x86_64/usr/bin/yasim tu95-yasim_buck_original.xml
This aircraft does not use the latest yasim configuration version.
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 3.2.0, Mageia Linux 4 32-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/lib/ /flightgear/src/releases/flightgear-3.2.0-1.mga4.i586/usr/bin/yasim tu95-yasim_buck_original.xml
This aircraft does not use the latest yasim configuration version.
Solution results:       Iterations: 977
 Drag Coefficient: 23.201970
       Lift Ratio: 111.631462
       Cruise AoA: 1.348194
   Tail Incidence: -4.116385
Approach Elevator: -0.330568
               CG: x:3.212, y:-0.000, z:-1.988

  Inertia tensor : 4620202.500, -0.045, 814955.188
        [kg*m^2]   -0.045, 12274948.000, 0.006
     Origo at CG   814955.188, 0.006, 16542796.000


FG 2.12.1, Mageia Linux 4 64-bit, mga4 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.12.1-1.mga4.x86_64/usr/bin/yasim tu95-yasim_buck_original.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.10.0, Mageia Linux 4 64-bit, mga3 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.10.0-1.3.mga3.x86_64/usr/bin/yasim tu95-yasim_buck_original.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.6.0, Mageia Linux 4 64-bit, mga2 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.6.0-2.3.mga2.x86_64/usr/bin/yasim tu95-yasim_buck_original.xml
Solution results:       Iterations: 975
 Drag Coefficient: 23.201946
       Lift Ratio: 111.630905
       Cruise AoA: 1.348228
   Tail Incidence: -4.116459
Approach Elevator: -0.330536
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


FG 2.0.0, Mageia Linux 4 64-bit, mga1 rpms:

Code: Select all
[edward@localhost TU-95]$ LD_LIBRARY_PATH=/flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/lib64/ /flightgear/src/releases/flightgear-2.0.0-4.mga1.x86_64/usr/games/yasim tu95-yasim_buck_original.xml
Solution results:       Iterations: 1017
 Drag Coefficient: 23.201963
       Lift Ratio: 111.631470
       Cruise AoA: 1.348199
   Tail Incidence: -4.116395
Approach Elevator: -0.330565
               CG: x:3.212, y:0.000, z:-1.988

  Inertia tensor : 4620203.000, -0.031, 814955.250
        [kg*m^2]   -0.031, 12274947.000, 0.006
     Origo at CG   814955.250, 0.006, 16542793.000


Strange that the Windows FG 3.5 nightly version doesn't say "This aircraft does not use the latest yasim configuration version."! Anyway, the results are all very similar and seem to only be minor floating point truncation errors (this could probably be minimised by changing the STHRESH epsilons in the code for higher precision, if a significant difference is found one day). Not sure why FG v2.0.0 requires more iterations to reach the same solution though. Oh, I also tested with the code maximum of one million iterations to see if the optimisation is really stuck in one place, which it is:

Code: Select all
[edward@localhost TU-95]$ yasim tu95-yasim.xml
SOLUTION FAILURE: Solution failed to converge after 1000000 iterations
Solution results:       Iterations: 1000002
 Drag Coefficient: 15.741075
       Lift Ratio: 161.708374
       Cruise AoA: 2.302459
   Tail Incidence: -4.088566
Approach Elevator: 0.000000
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: YASim Guide

Postby bugman » Wed May 20, 2015 6:40 pm

Hmmm, this is an optimisation termination tolerance bug! The tolerances are just too imprecise for this edge case:

Code: Select all
diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp
index 2665eb1..3ff6783 100644
--- a/src/FDM/YASim/Airplane.cpp
+++ b/src/FDM/YASim/Airplane.cpp
@@ -1009,8 +1009,8 @@ void Airplane::solve()
     _failureMsg = 0;
 
     while(1) {
-        if(_solutionIterations++ > 10000) {
-            _failureMsg = "Solution failed to converge after 10000 iterations";
+        if(_solutionIterations++ > 1000000) {
+            _failureMsg = "Solution failed to converge after 1000000 iterations";
             return;
         }
 
@@ -1092,8 +1092,8 @@ void Airplane::solve()
        applyLiftRatio(liftFactor);
 
        // DON'T do the following until the above are sane
-       if(normFactor(dragFactor) > STHRESH*1.0001
-          || normFactor(liftFactor) > STHRESH*1.0001)
+       if(normFactor(dragFactor) > STHRESH*1.000001
+          || normFactor(liftFactor) > STHRESH*1.000001)
        {
            continue;
        }
@@ -1105,13 +1105,13 @@ void Airplane::solve()
        _cruiseAoA = clamp(_cruiseAoA, -0.175f, 0.175f);
        _tailIncidence = clamp(_tailIncidence, -0.175f, 0.175f);
 
-        if(abs(xforce/_cruiseWeight) < STHRESH*0.0001 &&
-           abs(alift/_approachWeight) < STHRESH*0.0001 &&
-           abs(aoaDelta) < STHRESH*.000017 &&
-           abs(tailDelta) < STHRESH*.000017)
+        if(abs(xforce/_cruiseWeight) < STHRESH*0.000001 &&
+           abs(alift/_approachWeight) < STHRESH*0.000001 &&
+           abs(aoaDelta) < STHRESH*.00000017 &&
+           abs(tailDelta) < STHRESH*.00000017)
         {
             // If this finaly value is OK, then we're all done
-            if(abs(elevDelta) < STHRESH*0.0001)
+            if(abs(elevDelta) < STHRESH*0.000001)
                 break;
 
             // Otherwise, adjust and do the next iteration


Then I see:

Code: Select all
[edward@localhost TU-95]$ yasim tu95-yasim.xml
Solution results:       Iterations: 4780
 Drag Coefficient: 14.209175
       Lift Ratio: 187.227310
       Cruise AoA: 2.552980
   Tail Incidence: -9.760089
Approach Elevator: -0.006055
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.023, 814539.250
        [kg*m^2]   -0.023, 12267472.000, 0.006
     Origo at CG   814539.250, 0.006, 16535332.000


Compared to Win32:

Code: Select all
[edward@localhost TU-95]$ wine "/flightgear/src/releases/wine-fg3.4.1/drive_c/Program Files/FlightGear 3.4.1/bin/yasim.exe" tu95-yasim.xml 2> /dev/null
Solution results:       Iterations: 1069
 Drag Coefficient: 14.207831
       Lift Ratio: 187.240463
       Cruise AoA: 2.553359
   Tail Incidence: -9.761393
Approach Elevator: -0.005927
               CG: x:3.209, y:0.000, z:-1.988

  Inertia tensor : 4620186.000, -0.022, 814539.250
        [kg*m^2]   -0.022, 12267472.000, 0.004
     Origo at CG   814539.250, 0.004, 16535334.000


The results would probably be even closer if the higher precision tolerances were in the Windows binaries. It's not ideal that it requires far more iterations to find the solution - I'm guessing that the optimisation algorithm could be improved (I have some experience in this area) - but at least the same solution is now being found.
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: YASim Guide

Postby bugman » Wed May 20, 2015 6:43 pm

Note that when I run optimisations, I usually use cutoff tolerances of around 1e-25.

Edit: This is just to say that tiny tolerances can lead to huge final differences, as this edge case demonstrates.
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: Tu-95, YASim and 32 bit vs. 64 bit FG

Postby helijah » Fri May 22, 2015 10:25 am

Wow ! Thanx Edward :)

I have not taken the time to check out Gary's answers and here I discover that this is a new maitnenant specific discussion with lots of research :)

Sorry, but now I am very busy with the corrections (3D, XML etc ...) for the Antonov An 12, but I will follow from afar

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1001
Joined: Wed Dec 27, 2006 12:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: Tu-95, YASim and 32 bit vs. 64 bit FG

Postby bugman » Sun Jun 14, 2015 10:14 pm

Unfortunately, the higher precision tolerance fix is not suitable for adding to FG, as it causes the solution finder to fail for many FGAddon YASim files*. There will be no fix in time for FG v3.6, so the TU-95 will remain broken for 64-bit systems. This requires a lot more research to improve the convergence properties of the YASim solver.

Regards,

Edward


* Edit: due to poor and slow (maybe linear) convergence of the solver as precision is increased.
bugman
Moderator
 
Posts: 1630
Joined: Thu Mar 19, 2015 9:01 am
Version: next


Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 1 guest