fdm.do_trim(1) and fdm['ic/gamma-deg'] #608
Replies: 10 comments
-
How sure are you that the trim succeeds for this case? For example take a look at my code at - #519 (comment) In addition to checking for a trim exception you'll also see the trim results in the console like below. Particularly if you follow the thread of the comment link above you'll see that at some point at higher beta values it runs out of aileron power. I haven't double-checked, but maybe Full Trim
Trim successful
Trim Results:
Angle of Attack: 6.46 wdot: 9.05e-05 Tolerance: 1.000000e-03 Passed
Throttle: 0.56 udot: -9.00e-05 Tolerance: 1.000000e-03 Passed
Pitch Trim: -0.41 qdot: -1.25e-10 Tolerance: 1.000000e-04 Passed
Roll Angle: 0.00 vdot: -4.34e-16 Tolerance: 1.000000e-03 Passed
Ailerons: 0.00 pdot: 9.18e-18 Tolerance: 1.000000e-04 Passed
Rudder: 0.00 rdot: -4.53e-32 Tolerance: 1.000000e-04 Passed Full Trim
Trim failed
Trim Results:
Angle of Attack: 5.56 wdot: 2.36e+01 Tolerance: 1.000000e-03 Failed
Throttle: 0.48 udot: 1.42e+00 Tolerance: 1.000000e-03 Failed
Pitch Trim: -0.37 qdot: 1.24e-01 Tolerance: 1.000000e-04 Failed
Roll Angle: 26.21 vdot: -1.42e+01 Tolerance: 1.000000e-03 Failed
Ailerons: 0.00 pdot: -1.50e-01 Tolerance: 1.000000e-04 Failed
Rudder: 0.00 rdot: 8.60e-02 Tolerance: 1.000000e-04 Failed |
Beta Was this translation helpful? Give feedback.
-
Well, it looks like the trimming was successful. When it is not successful I do not get any results here. The funny thing is, if I ask for gamma=5.5°, then it returns a gamma=0°: fdm['ic/beta-deg']=14.7 fdm['flight-path/gamma-deg'] fdm['aero/beta-deg'] |
Beta Was this translation helpful? Give feedback.
-
Take my code from the comment and cut and paste it into a file, e.g. Then run it like this:
You'll definitely then see the console output with the trim results etc. Also people generally post so little of their code that it's often a guessing game. So post a full example like I have in the comment I referenced and show us the console output. For example I'm not sure if your code snippets above include a call to |
Beta Was this translation helpful? Give feedback.
-
Sorry for not providing the full code before. Here it is: fdm = jsbsim.FGFDMExec('my_model_path')
aircraft = f'my_aircraft'
fdm.load_model(f'{aircraft}')
fdm['aero/alpha-max-rad'] = math.radians(20.0)
fdm['aero/alpha-min-rad'] = math.radians(-16.0)
fdm['ic/h-agl-ft'] = 10000
fdm['ic/h-sl-ft'] = 10000
fdm['ic/vt-kts'] = 233.8
fdm['ic/beta-deg'] = 14.7
fdm['ic/gamma-deg'] = 5.5
fdm['fcs/TrimWithHTorEle'] = 0.0 # Trim with HT (0 for HT; 1 for Elev)
fdm.do_trim(1) # Do Trim
gamma_final = fdm['flight-path/gamma-deg']
beta_final = fdm['aero/beta-deg']
print(f'Gamma_final={gamma_final} , Beta_final = {beta_final}') Output: Full Trim
Trim successful
Trim Results:
Angle of Attack: 1.61 wdot: -5.30e-05 Tolerance: 1e-03 Passed
Throttle: 0.57 udot: -5.76e-06 Tolerance: 1e-03 Passed
Pitch Trim: -0.15 qdot: 6.88e-07 Tolerance: 1e-04 Passed
Roll Angle: 22.56 vdot: 7.13e-05 Tolerance: 1e-03 Passed
Ailerons: -0.43 pdot: 5.49e-06 Tolerance: 1e-04 Passed
Rudder: 0.99 rdot: -2.45e-09 Tolerance: 1e-04 Passed
Gamma_final=0.07857117367558498 , Beta_final = 14.783379940721945 If I change fdm['ic/gamma-deg'] = 5.5 to fdm['ic/gamma-deg'] = 0.0: Full Trim
Trim successful
Trim Results:
Angle of Attack: 1.64 wdot: -2.83e-05 Tolerance: 1e-03 Passed
Throttle: 0.34 udot: -2.02e-05 Tolerance: 1e-03 Passed
Pitch Trim: -0.14 qdot: 6.79e-07 Tolerance: 1e-04 Passed
Roll Angle: 22.47 vdot: 7.73e-05 Tolerance: 1e-03 Passed
Ailerons: -0.44 pdot: 6.05e-06 Tolerance: 1e-04 Passed
Rudder: 1.00 rdot: -5.62e-10 Tolerance: 1e-04 Passed
Gamma_final=-5.4639108956964595 , Beta_final = 14.853259764192138 No difference arose when I added "fdm.run_ic()" before the fdm.do_trim(1) |
Beta Was this translation helpful? Give feedback.
-
Hmm, seeing a gamma final of -5.5 almost sounds like the sign issue that we fixed in this commit 95b4c86 a while ago. Although you're saying setting |
Beta Was this translation helpful? Give feedback.
-
Yes, I am saying setting ic/gamma = 0 is ending up with a gamma of -5.5. |
Beta Was this translation helpful? Give feedback.
-
So I modified my 737 example and set for beta in np.arange(0, 14, 1):
fdm['ic/h-sl-ft'] = 1000
fdm['ic/vc-kts'] = 200
fdm['ic/gamma-deg'] = 5
fdm['ic/beta-deg'] = beta
...
...
# Trim
try:
fdm['simulation/do_simple_trim'] = 1
betas.append(fdm['aero/beta-deg'])
bankAngle.append(fdm['attitude/phi-deg'])
ailerons.append(fdm['fcs/aileron-cmd-norm'])
rudder.append(fdm['fcs/rudder-cmd-norm'])
gammas.append(fdm['flight-path/gamma-deg']) So there is something going on in terms of the trim with the combination of gamma and bank angle. |
Beta Was this translation helpful? Give feedback.
-
And the result with |
Beta Was this translation helpful? Give feedback.
-
That is what I am observing with my aircraft... It does not seem physical for me. |
Beta Was this translation helpful? Give feedback.
-
Take a look at the trim code. The trim code will adjust the following in order to achieve case tFull:
if (debug_lvl > 0)
cout << " Full Trim" << endl;
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tWdot,tAlpha));
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tUdot,tThrottle ));
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tPitchTrim ));
//TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tHmgt,tBeta ));
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tVdot,tPhi ));
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tPdot,tAileron ));
TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tRdot,tRudder ));
break; |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I am trying to trim my aircraft with a sideslip angle of beta=14.7° which corresponds to a bank angle of phi=22°.
As inputs I use beta and gamma. I ask for gamma = 0°.
However after using fdm.do_trim(1), I end up with a gamma of -5°.
I expected to have a gamma of 0.0°.
Do you have any thoughts on this?
fdm['ic/beta-deg']=14.7
fdm['ic/gamma-deg'] = 0.0
fdm.do_trim(1)
fdm['flight-path/gamma-deg']
Out[5]: -5.466039161541537
fdm['aero/beta-deg']
Out[6]: 14.853146650331803
Beta Was this translation helpful? Give feedback.
All reactions