public void TestSetPositionAGL() { FDMExecutive fdmex = new FDMExecutive(); InitialCondition ic = new InitialCondition(fdmex); ic.SetTerrainElevationFtIC(2000.0); for (double lon = -180.0; lon <= 180.0; lon += 30.0) { ic.SetLongitudeDegIC(lon); // Altitude first, then latitude for (double agl = 1.0; agl <= 1000001.0; agl += 10000.0) { ic.SetAltitudeAGLFtIC(agl); for (double lat = -90.0; lat <= 90.0; lat += 10.0) { ic.SetLatitudeDegIC(lat); Assert.AreEqual(lon, ic.GetLongitudeDegIC(), tolerance * 100.0); Assert.AreEqual(lon * Math.PI / 180.0, ic.GetLongitudeRadIC(), tolerance); Assert.AreEqual(1.0, ic.GetAltitudeASLFtIC() / (agl + 2000.0), 2E-8); Assert.AreEqual(1.0, ic.GetAltitudeAGLFtIC() / agl, 2E-8); Assert.AreEqual(lat, ic.GetLatitudeDegIC(), tolerance * 10.0); Assert.AreEqual(lat * Math.PI / 180.0, ic.GetLatitudeRadIC(), tolerance); } } // Latitude first, then altitude for (double lat = -90.0; lat <= 90.0; lat += 10.0) { ic.SetLatitudeDegIC(lat); for (double agl = 1.0; agl <= 1000001.0; agl += 10000.0) { ic.SetAltitudeAGLFtIC(agl); Assert.AreEqual(lon, ic.GetLongitudeDegIC(), tolerance * 100.0); Assert.AreEqual(lon * Math.PI / 180.0, ic.GetLongitudeRadIC(), tolerance); Assert.AreEqual(1.0, ic.GetAltitudeASLFtIC() / (agl + 2000.0), 2E-8); Assert.AreEqual(1.0, ic.GetAltitudeAGLFtIC() / agl, 2E-8); Assert.AreEqual(lat, ic.GetLatitudeDegIC(), tolerance * 100.0); Assert.AreEqual(lat * Math.PI / 180.0, ic.GetLatitudeRadIC(), tolerance); } } } }
public void TestDefaultConstructor() { FDMExecutive fdmex = new FDMExecutive(); InitialCondition ic = new InitialCondition(fdmex); Assert.AreEqual(0.0, ic.GetLatitudeDegIC()); Assert.AreEqual(0.0, ic.GetLatitudeRadIC()); Assert.AreEqual(0.0, ic.GetLongitudeDegIC()); Assert.AreEqual(0.0, ic.GetLongitudeRadIC()); Assert.AreEqual(0.0, ic.GetGeodLatitudeDegIC()); Assert.AreEqual(0.0, ic.GetGeodLatitudeRadIC()); Assert.AreEqual(0.0, ic.GetThetaDegIC()); Assert.AreEqual(0.0, ic.GetThetaRadIC()); Assert.AreEqual(0.0, ic.GetPhiDegIC()); Assert.AreEqual(0.0, ic.GetPhiRadIC()); Assert.AreEqual(0.0, ic.GetPsiDegIC()); Assert.AreEqual(0.0, ic.GetPsiRadIC()); Assert.AreEqual(0.0, ic.GetAltitudeASLFtIC()); Assert.AreEqual(0.0, ic.GetAltitudeAGLFtIC()); Assert.AreEqual(0.0, ic.GetEarthPositionAngleIC()); Assert.AreEqual(0.0, ic.GetTerrainElevationFtIC()); Assert.AreEqual(0.0, ic.GetVcalibratedKtsIC()); Assert.AreEqual(0.0, ic.GetVequivalentKtsIC()); Assert.AreEqual(0.0, ic.GetVgroundFpsIC()); Assert.AreEqual(0.0, ic.GetVtrueFpsIC()); Assert.AreEqual(0.0, ic.GetMachIC()); Assert.AreEqual(0.0, ic.GetClimbRateFpsIC()); Assert.AreEqual(0.0, ic.GetFlightPathAngleDegIC()); Assert.AreEqual(0.0, ic.GetFlightPathAngleRadIC()); Assert.AreEqual(0.0, ic.GetAlphaDegIC()); Assert.AreEqual(0.0, ic.GetAlphaRadIC()); Assert.AreEqual(0.0, ic.GetBetaDegIC()); Assert.AreEqual(0.0, ic.GetBetaDegIC()); Assert.AreEqual(0.0, ic.GetBetaRadIC()); Assert.AreEqual(0.0, ic.GetWindFpsIC()); Assert.AreEqual(0.0, ic.GetWindDirDegIC()); Assert.AreEqual(0.0, ic.GetWindUFpsIC()); Assert.AreEqual(0.0, ic.GetWindVFpsIC()); Assert.AreEqual(0.0, ic.GetWindWFpsIC()); Assert.AreEqual(0.0, ic.GetWindNFpsIC()); Assert.AreEqual(0.0, ic.GetWindEFpsIC()); Assert.AreEqual(0.0, ic.GetWindDFpsIC()); Assert.AreEqual(0.0, ic.GetUBodyFpsIC()); Assert.AreEqual(0.0, ic.GetVBodyFpsIC()); Assert.AreEqual(0.0, ic.GetWBodyFpsIC()); Assert.AreEqual(0.0, ic.GetVNorthFpsIC()); Assert.AreEqual(0.0, ic.GetVEastFpsIC()); Assert.AreEqual(0.0, ic.GetVDownFpsIC()); Assert.AreEqual(0.0, ic.GetPRadpsIC()); Assert.AreEqual(0.0, ic.GetQRadpsIC()); Assert.AreEqual(0.0, ic.GetRRadpsIC()); // TS_ASSERT_VECTOR_EQUALS(ic.GetWindNEDFpsIC(), zero); //TS_ASSERT_VECTOR_EQUALS(ic.GetUVWFpsIC(), zero); //TS_ASSERT_VECTOR_EQUALS(ic.GetPQRRadpsIC(), zero); }