-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Wrong calculation of vPQRdot in FGAccelerations class #1034
Comments
Hi, Mathieu, Thanks for this detailed report. JSBSim is where it is today in part due to continuous feedback from the larger community. This issue got my attention - it's a very interesting issue. I was initially surprised to read of it partially due to the fact that JSBSim has been involved in comparisons against a number of other high-fidelity simulations and fared very well. But, as you pointed out, "this error has a limited effect on trajectory computations" so that could be why it has gone unnoticed if it is indeed an error. I'll take a closer look at this myself (this one is going to need some quiet time and a few cups of coffee ;-), and I'm sure that Bertrand and Sean and others may also take a close look. I just wanted to post a note of appreciation for the thoughtful report. |
Indeed, thank you for the excellent bug report @mathieuflament 👍 Clear and thorough. I agree with your analysis, and while investigating the code history, I discovered that the error was introduced almost 13 years ago by myself via commit fdf7cf7. However as you mentioned the side effects are very limited as jsbsim/src/input_output/FGOutputTextFile.cpp Line 280 in d2d8f61
which writes the value of vPQRdot to a CSV file.
jsbsim/src/initialization/FGTrim.cpp Line 436 in d2d8f61
where vPQRdot is used to determine the position at which the aircraft will sit on the ground at the simulation start.
jsbsim/src/models/FGAccelerations.cpp Lines 271 to 273 in d2d8f61
where vPQRdot is used to compute the friction forces between the landing gears and the ground. Most likely the sign error has a small effect on this computation as the norm of in.vOmegaPlanet is very small (≈7.3e-5 rad/s).
This is most likely why the error remained unnoticed for such a long time. Anyway the bug must be fixed so you could perhaps submit a pull request (referencing this issue) to fix it ? Thanks. |
…the commit ac3de2a (issue JSBSim-Team#1034)
The PR #1036 that fixes the bug reported in this issue has been merged in |
Closing this issue as the bug has been fixed in PR #1036. |
I'm submitting a ...
Describe the issue
As far as we understand, the vector
vPQRdot
inFGAccelerations
class is the derivative of the angular velocity of the body w.r.t the ECEF frame, expressed in body frame coordinates, and the vectorvPQRidot
is the derivative of the angular velocity of the body w.r.t the ECI frame, also expressed in body frame coordinates.In method
FGAccelerations::CalculatePQRdot
, the variablevPQRdot
is derived fromvPQRidot
using the expression :jsbsim/src/models/FGAccelerations.cpp
Line 162 in 0176553
It should be
vPQRdot = vPQRidot + in.vPQRi * (in.Ti2b * in.vOmegaPlanet)
instead.Proof :
The correct expression is the last equation above, expressed in body frame coordinates.
What is the current behavior?
To highlight the problem, we have slightly modified the
orbit
check-case, with an initial angular rate w.r.t the ECI frame ofvPQRi=[15deg/s, 0., 0.]
. The body is a spinning ball around its X-axis (pointing to the East), orbiting the Earth in the equatorial plane. In this scenario, the body X-axis and the angular velocity vector are constant in the ECI frame, i.e.vPQRidot
is null. The angular velocity vector w.r.t ECEF frame, namelyvPQR
, is then simply equal to the Earth sidereal rate vector projected on the (rotating) Y-Z plane of the body frame.The following graph shows the Q and R components of the
vPQR
vector, andvPQRdot
vector, straight from theBallOut.csv
output file produced by the JSBSim program :The sign error on
vPQRdot
is obvious.Fortunately, as the equation of motion are integrated in the ECI frame using
vPQRidot
inFGPropagate
class, this error has a limited effect on trajectory computations:vPQRidot
is OK,vPQRi
by integratingvPQRidot
is OK,vPQR
fromvPQRi
is OK,Only the outputs and further computations based on
vPQRdot
are affected by a (small) error.What is the expected behavior?
Once the sign error on the term
in.vPQRi * (in.Ti2b * in.vOmegaPlanet)
is corrected inFGAccelerations::CalculatePQRdot
(l.158 and l.162) andFGAccelerations::SetHoldDown
(l.214), consistent results are restored, as shown by the following figure:All the other output variables in the
BallOut.csv
file have remained exactly the same, confirming that a change invPQRdot
values has no adverse side-effect on the simulation loop.Please tell us about your environment:
Other information
We would like to thank the JSBSim developer team for their invaluable contribution to the flight dynamics simulation community.
The text was updated successfully, but these errors were encountered: