-
Notifications
You must be signed in to change notification settings - Fork 459
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
Use gamma to help trim solver? #360
Comments
Yeah, that's a pain. I have always attributed this to the limited abilities of the default trim solver. As you are pointing out, each time the Short S23 trim fails, I tweak the initial value of The mere fact that trim convergence breaks following minor modifications to the code has strenghtened over the time my feeling that the default trim solver is not robust. So each time the Short S23 broke I jumped to the conclusion that the cause was the trim solver brittleness rather than the code modifications I made. I may have been wrong, I don't know.
That's the kind of result that makes me uneasy about the exact cause of the trim convergence issues. Does the trim solver fail because its numerical algorithms are not robust enough ? Or does it fail because the code modifications I made were incorrect ? However the 737 should not be affected by the recent changes to the propeller code. So this problem with the 737 might have been existing for quite some time. Have you tried to bisect the code changes to find at which point it has started to converge to a climb of 2 degrees ?
That's interesting ! Could you please provide an example of an XML file Theta 0.0 Gamma 0.0
Trim successful
Trim Results:
Angle of Attack: -1.26 wdot: 6.85e-04 Tolerance: 1e-03 Passed
[...]
Neither have I. However I suspect the specification of |
Yep, I left <?xml version="1.0"?>
<initialize name="reset01">
<!--
This file sets up the aircraft to cruise at 143kt indicated at 3000 ft.
-->
<ubody unit="KTS"> 150.0 </ubody>
<vbody unit="FT/SEC"> 0.0 </vbody>
<wbody unit="FT/SEC"> 0.0 </wbody>
<latitude unit="DEG"> 37.86 </latitude>
<longitude unit="DEG">-122.34 </longitude>
<phi unit="DEG"> 0.0 </phi>
<theta unit="DEG"> 0.0 </theta>
<gamma unit="DEG"> 0.0 </gamma>
<psi unit="DEG"> 180.0 </psi>
<altitude unit="FT"> 3000.0 </altitude>
</initialize>
Yep, sorry it was a typo.
I haven't tried that (yet?). The original JSBSim code is from late 2014 that I'm using with my VSS sim and I'm in the process of updating to the latest JSBSim code. I did glance at the FGTrim code from 2014 and the latest and set some breakpoints and stepped through it to see if I could see any obvious differences that may account for the difference I was seeing but didn't spot any at the time. But I didn't spend too much time on it, partly since I had been planning on adding a flight path angle option to the VSS sim anyway. Did wonder if the code from 2014 was defaulting to a gamma of 0 and using it even if it wasn't specified in the initialization file whereas the latest code wasn't using it at all unless explicitly listed in the initialization file. |
Following your findings, I have checked if jsbsim/aircraft/737/cruise_init.xml Line 9 in 6475102
and a couple of them use a value for gamma which is not zero.
jsbsim/aircraft/c172p/reset01.xml Line 19 in 6475102
jsbsim/aircraft/c172r/reset01.xml Line 19 in 6475102
According to the code in FGInitialCondition , setting gamma to 0 is equivalent to setting the vertical component of the velocity to 0.0. This may be equivalent to setting theta to 0 and α to 0 (but I need to understand what does FGInitialCondition::calcThetaBeta exactly do to be sure).jsbsim/src/initialization/FGInitialCondition.cpp Lines 284 to 306 in 6475102
Regarding your last example 'Theta 0.0 Gamma 0.0', I have tried theta to 0.0 (without specifying gamma at all) and the trim solver converges. So this might be an indication that only the vertical component of the velocity needs to be zero.
|
I took a quick look with my 737 example, using the following initialization file with <?xml version="1.0"?>
<initialize name="Sortie_1_-_Task_1-ic">
<ubody unit="KTS"> 194 </ubody>
<vbody unit="KTS"> 0.0 </vbody>
<wbody unit="KTS"> 0.0 </wbody>
<latitude unit="DEG"> -33.9873333333333 </latitude>
<longitude unit="DEG"> 18.6086666666667 </longitude>
<phi unit="DEG"> 0.0 </phi>
<theta unit="DEG"> 4.1 </theta>
<psi unit="DEG"> 0 </psi>
<gamma unit="DEG"> 0.0 </gamma>
<altitude unit="FT"> 5000 </altitude>
<winddir unit="DEG"> 0.0 </winddir>
<vwind unit="FT/SEC"> 0.0 </vwind>
<running> -1 </running>
</initialize> Setting a breakpoint in Gamma = 0, Theta 4.1vUVW_NED: {327.43513999999982, 0.0000000000000000, -3.5527136788005009e-15}
vt: 327.43513999999982
alpha: -3.2550388563675582e-17 Gamma not specified, Theta=4.1vUVW_NED: {326.59716240070310, 0.0000000000000000, -23.410775694715209}
vt: 327.43513999999993
alpha: 2.1700259042450376e-17 So yes with With |
As you may have noticed, I had to change yet another time the files I tried adding |
@bcoconni I'd noticed you periodically having to change the initial theta angle in the initialization file for the Short S23 aircraft in order to ensure that the trim solver found a solution - e0f1449
When I was debugging the trim differences I was seeing with the 737 model (negative elevator drag etc.) I noticed fairly different trim results depending on the initial theta value specified. In a much older (many years) version of JSBSm I had specified an initial theta of 4.1 degrees and the trim solution was level flight with a theta of ~ -0.5 degrees.
But with the latest JSBSim it results in a climb of ~2 degrees with a similar value of ~ -0.5 theta degrees. But if I specified an initial gamma value of 0 degrees then the initial value of theta appears to be ignored and I get a trim result very close to the older version of JSBSim.
So I tested out using gamma with
Short_S23\reset01.xml
and the scriptscripts\Short_S23_2.xml
.Theta -1.5
Using the currently comitted version of
reset01.xml
Theta -1.0
Theta -1.0 Gamma 0.0
Theta -10.0 Gamma 0.0
Theta 0.0 Gamma 0.0
I haven't double-checked the trim source code and logic, but it appears based on these handful of tests if we specify the required gamma that the trim solver might not be as brittle/fragile and we won't have to periodically tweak the initial theta value.
The text was updated successfully, but these errors were encountered: