Skip to content

Wrong calculation of vPQRdot in FGAccelerations class #1034

@mathieuflament

Description

@mathieuflament

I'm submitting a ...

  • bug report
  • feature request
  • support request

Describe the issue

As far as we understand, the vector vPQRdot in FGAccelerations class is the derivative of the angular velocity of the body w.r.t the ECEF frame, expressed in body frame coordinates, and the vector vPQRidot 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 variable vPQRdot is derived from vPQRidot using the expression :

vPQRdot = vPQRidot - in.vPQRi * (in.Ti2b * in.vOmegaPlanet);

It should be vPQRdot = vPQRidot + in.vPQRi * (in.Ti2b * in.vOmegaPlanet) instead.

Proof :

2022-04-09_122409

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 of vPQRi=[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, namely vPQR, 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, and vPQRdot vector, straight from the BallOut.csv output file produced by the JSBSim program :
BallOut_orig

The sign error on vPQRdot is obvious.

Fortunately, as the equation of motion are integrated in the ECI frame using vPQRidot in FGPropagate class, this error has a limited effect on trajectory computations:

  • the calculation of vPQRidot is OK,
  • the calculation of vPQRi by integrating vPQRidot is OK,
  • the calculation of vPQR from vPQRi is OK,
  • the attitude computations are 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 in FGAccelerations::CalculatePQRdot (l.158 and l.162) and FGAccelerations::SetHoldDown (l.214), consistent results are restored, as shown by the following figure:
BallOut_corrected

All the other output variables in the BallOut.csv file have remained exactly the same, confirming that a change in vPQRdot values has no adverse side-effect on the simulation loop.

Please tell us about your environment:

  • OS : Linux Debian 12
  • JSBSim 1.2.0
  • Language C++

Other information
We would like to thank the JSBSim developer team for their invaluable contribution to the flight dynamics simulation community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions