Skip to content
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

Fix wind initial conditions #855

Merged
merged 3 commits into from
Mar 15, 2023
Merged

Conversation

bcoconni
Copy link
Member

This PR fixes a 12+ years old bug where the input value was not converted from kts to ft/s.

void FGInitialCondition::SetWindDownKtsIC(double wD)
{
  const FGMatrix33& Tb2l = orientation.GetTInv();
  FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);

-  _vt_NED(eW) = vUVW_NED(eW) + wD;
+  _vt_NED(eW) = vUVW_NED(eW) + wD * ktstofps;

The PR contains an update to the unit test FGInitialConditionsTest.h to prevent regressions. I also took this opportunity to fix a couple of details:

  • The constant ktstofps is computed to the floating point precision of double (thanks to the C++ constexpr feature, the computation is done at compile time, i.e. once for all)
  • The private method GetNEDWindFpsIC has been removed as it was redundant with GetWindNEDFpsIC.

@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Merging #855 (6cd73ed) into master (b2172a4) will increase coverage by 0.17%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #855      +/-   ##
==========================================
+ Coverage   22.43%   22.60%   +0.17%     
==========================================
  Files         167      167              
  Lines       19608    19602       -6     
==========================================
+ Hits         4400     4432      +32     
+ Misses      15208    15170      -38     
Impacted Files Coverage Δ
src/FGJSBBase.h 90.32% <ø> (ø)
src/initialization/FGInitialCondition.cpp 45.12% <100.00%> (+4.29%) ⬆️
src/initialization/FGInitialCondition.h 74.71% <100.00%> (-1.38%) ⬇️
src/input_output/FGXMLElement.cpp 47.33% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@agodemar agodemar merged commit 398c07c into JSBSim-Team:master Mar 15, 2023
@bcoconni bcoconni deleted the wind_IC_fix branch March 15, 2023 21:29
bcoconni added a commit to bcoconni/jsbsim that referenced this pull request Apr 8, 2023
* Fix Wind IC

* Add tests for Wind IC.

* Protect `atan2` against domain errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants