Skip to content

Commit

Permalink
Method name change, unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcleod committed May 18, 2024
1 parent 190c060 commit 48ca104
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/initialization/FGInitialCondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ void FGInitialCondition::SetWindDownKtsIC(double wD)
calcAeroAngles(_vt_NED);
}

void FGInitialCondition::SetWindMagFpsIC(double mag)
{
SetWindMagKtsIC(mag*fpstokts);
}

//******************************************************************************
// Modifies the wind velocity (in knots) while keeping its direction unchanged.
// The vertical component (in local NED frame) is unmodified. The aircraft
Expand Down Expand Up @@ -941,7 +936,7 @@ FGColumnVector3 FGInitialCondition::GetWindNEDFpsIC(void) const {

//******************************************************************************

double FGInitialCondition::GetWindFpsIC(void) const
double FGInitialCondition::GetWindMagFpsIC(void) const
{
const FGMatrix33& Tb2l = orientation.GetTInv();
FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);
Expand Down Expand Up @@ -1524,7 +1519,7 @@ void FGInitialCondition::bind(FGPropertyManager* PropertyManager)
PropertyManager->Tie("ic/vw-down-fps", this,
&FGInitialCondition::GetWindDFpsIC);
PropertyManager->Tie("ic/vw-mag-fps", this,
&FGInitialCondition::GetWindFpsIC,
&FGInitialCondition::GetWindMagFpsIC,
&FGInitialCondition::SetWindMagFpsIC);
PropertyManager->Tie("ic/vw-dir-deg", this,
&FGInitialCondition::GetWindDirDegIC,
Expand Down
4 changes: 2 additions & 2 deletions src/initialization/FGInitialCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class JSBSIM_API FGInitialCondition : public FGJSBBase

/** Sets the initial total wind speed.
@param mag Initial wind velocity magnitude in feet/second */
void SetWindMagFpsIC(double mag);
void SetWindMagFpsIC(double mag) { SetWindMagKtsIC(mag * fpstokts); }

/** Sets the initial total wind speed.
@param mag Initial wind velocity magnitude in knots */
Expand Down Expand Up @@ -509,7 +509,7 @@ class JSBSIM_API FGInitialCondition : public FGJSBBase

/** Gets the initial total wind velocity in feet/sec.
@return Initial wind velocity in feet/second */
double GetWindFpsIC(void) const;
double GetWindMagFpsIC(void) const;

/** Gets the initial wind direction.
@return Initial wind direction in feet/second */
Expand Down
5 changes: 5 additions & 0 deletions tests/unit_tests/FGInitialConditionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,10 @@ class FGInitialConditionTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(ic.GetWindNFpsIC(), 3.5*sqrt(3.0)*ktstofps, epsilon);
TS_ASSERT_DELTA(ic.GetWindEFpsIC(), 3.5*ktstofps, epsilon);
TS_ASSERT_DELTA(ic.GetWindDFpsIC(), 3.0, epsilon);

ic.SetWindMagFpsIC(7.0);
TS_ASSERT_DELTA(ic.GetWindNFpsIC(), 3.5 * sqrt(3.0), epsilon);
TS_ASSERT_DELTA(ic.GetWindEFpsIC(), 3.5, epsilon);
TS_ASSERT_DELTA(ic.GetWindDFpsIC(), 3.0, epsilon);
}
};

0 comments on commit 48ca104

Please sign in to comment.