public void CheckOrientation() { string test = @"<?xml version=""1.0""?> <initialize name=""reset00""> <!-- This file sets up the mk82 to start off from altitude. --> <ubody unit=""FT/SEC""> 100.0 </ubody> <alpha unit=""DEG""> 10.0 </alpha> <beta unit=""DEG""> 20.0 </beta> </initialize>"; FDMExecutive fdm = new FDMExecutive(); XmlElement elem = BuildXmlConfig(test); InitialCondition IC = fdm.GetIC(); IC.Load(elem, false); if (log.IsDebugEnabled) { log.Debug("Testing JSBSim Initial Conditions: Orientation"); } //Checks values Assert.AreEqual(92.541657839832311, IC.GetUBodyFpsIC(), tolerance); Assert.AreEqual(10.0, IC.GetAlphaDegIC(), tolerance, "initial angle of attack"); Assert.AreEqual(20.0, IC.GetBetaDegIC(), tolerance, "initial sideslip angle"); }
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); }
public void TestBodyVelocity() { FDMExecutive fdmex = new FDMExecutive(); InitialCondition ic = new InitialCondition(fdmex); ic.SetUBodyFpsIC(100.0); Assert.AreEqual(100.0, ic.GetUBodyFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetVBodyFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetWBodyFpsIC(), tolerance); Assert.AreEqual(100.0, ic.GetVtrueFpsIC(), tolerance); Assert.AreEqual(100.0, ic.GetVgroundFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetAlphaDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetBetaDegIC(), tolerance); for (double theta = -90.0; theta <= 90.0; theta += 10.0) { ic.SetThetaDegIC(theta); Assert.AreEqual(100.0, ic.GetUBodyFpsIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetVBodyFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetWBodyFpsIC(), tolerance); Assert.AreEqual(100.0 * Math.Cos(theta * Math.PI / 180.0), ic.GetVNorthFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetVEastFpsIC(), tolerance); Assert.AreEqual(-100.0 * Math.Sin(theta * Math.PI / 180.0), ic.GetVDownFpsIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetAlphaDegIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetBetaDegIC(), tolerance); Assert.AreEqual(100.0, ic.GetVtrueFpsIC(), tolerance * 10.0); Assert.AreEqual(Math.Abs(100.0 * Math.Cos(theta * Math.PI / 180.0)), ic.GetVgroundFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetPhiDegIC(), tolerance); Assert.AreEqual(theta, ic.GetThetaDegIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetPsiDegIC(), tolerance); } ic.SetThetaRadIC(0.0); for (double phi = -180.0; phi <= 180.0; phi += 10.0) { ic.SetPhiDegIC(phi); Assert.AreEqual(100.0, ic.GetUBodyFpsIC(), tolerance * 100.0); Assert.AreEqual(0.0, ic.GetVBodyFpsIC(), tolerance); Assert.AreEqual(0.0, ic.GetWBodyFpsIC(), tolerance); Assert.AreEqual(100.0, ic.GetVtrueFpsIC(), tolerance * 100.0); Assert.AreEqual(100.0, ic.GetVgroundFpsIC(), tolerance * 100.0); Assert.AreEqual(0.0, ic.GetAlphaDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetBetaDegIC(), tolerance); Assert.AreEqual(phi, ic.GetPhiDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetThetaDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetPsiDegIC(), tolerance); } ic.SetPhiDegIC(0.0); for (double psi = 0.0; psi <= 360.0; psi += 10.0) { ic.SetPsiDegIC(psi); Assert.AreEqual(100.0, ic.GetUBodyFpsIC(), tolerance * 100.0); Assert.AreEqual(0.0, ic.GetVBodyFpsIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetWBodyFpsIC(), tolerance); Assert.AreEqual(100.0, ic.GetVtrueFpsIC(), tolerance * 100.0); Assert.AreEqual(100.0, ic.GetVgroundFpsIC(), tolerance * 100.0); Assert.AreEqual(0.0, ic.GetAlphaDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetBetaDegIC(), tolerance * 10.0); Assert.AreEqual(0.0, ic.GetPhiDegIC(), tolerance); Assert.AreEqual(0.0, ic.GetThetaDegIC(), tolerance); Assert.AreEqual(psi, ic.GetPsiDegIC(), tolerance * 10.0); } }