From: Bertrand <bco...@us...> - 2014-11-30 12:35:35
|
Update of /cvsroot/jsbsim/JSBSim/src/initialization In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8282/src/initialization Modified Files: FGInitialCondition.cpp FGTrim.cpp Log Message: Fixed an error where FGinitialCondition was assuming that ICs were always set at t=0.0. This is not always the case since FGInitialCondition is used by the trim routines and a trimming can take place at any time. Rather than passing the simulation time as an argument to each call to FGGroundCallback methods, FGFDMExec tells FGGroundCallback what the time is at every iteration and FGGroundCallback caches the value for later use. This saves the burden of passing the simulation time to each routine that needs to interrogate FGGroundCallback to get its job done. This change is keeping the FGGroundCallback API backward compatible and has compiled and run successfully with the last git revision of FlightGear as of the time at which this patch was committed. Index: FGInitialCondition.cpp =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/src/initialization/FGInitialCondition.cpp,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -r1.97 -r1.98 *** FGInitialCondition.cpp 15 Nov 2014 11:57:37 -0000 1.97 --- FGInitialCondition.cpp 30 Nov 2014 12:35:32 -0000 1.98 *************** *** 111,115 **** position.SetLongitude(lonRad0); position.SetLatitude(latRad0); ! position.SetAltitudeAGL(altAGLFt0, 0.0); orientation = FGQuaternion(phi0, theta0, psi0); --- 111,115 ---- position.SetLongitude(lonRad0); position.SetLatitude(latRad0); ! position.SetAltitudeAGL(altAGLFt0); orientation = FGQuaternion(phi0, theta0, psi0); *************** *** 667,671 **** double FGInitialCondition::GetAltitudeAGLFtIC(void) const { ! return position.GetAltitudeAGL(0.0); } --- 667,671 ---- double FGInitialCondition::GetAltitudeAGLFtIC(void) const { ! return position.GetAltitudeAGL(); } *************** *** 674,678 **** double FGInitialCondition::GetTerrainElevationFtIC(void) const { ! return position.GetTerrainRadius(0.0) - position.GetSeaLevelRadius(); } --- 674,678 ---- double FGInitialCondition::GetTerrainElevationFtIC(void) const { ! return position.GetTerrainRadius() - position.GetSeaLevelRadius(); } *************** *** 681,685 **** void FGInitialCondition::SetAltitudeAGLFtIC(double agl) { ! double terrainElevation = position.GetTerrainRadius(0.0) - position.GetSeaLevelRadius(); SetAltitudeASLFtIC(agl + terrainElevation); --- 681,685 ---- void FGInitialCondition::SetAltitudeAGLFtIC(double agl) { ! double terrainElevation = position.GetTerrainRadius() - position.GetSeaLevelRadius(); SetAltitudeASLFtIC(agl + terrainElevation); *************** *** 1056,1061 **** position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT")); } else if (position_el->FindElement("altitudeAGL")) { ! position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"), ! 0.0); } else if (position_el->FindElement("altitudeMSL")) { position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT")); --- 1056,1060 ---- position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT")); } else if (position_el->FindElement("altitudeAGL")) { ! position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT")); } else if (position_el->FindElement("altitudeMSL")) { position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT")); Index: FGTrim.cpp =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/src/initialization/FGTrim.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** FGTrim.cpp 1 May 2014 18:32:54 -0000 1.23 --- FGTrim.cpp 30 Nov 2014 12:35:32 -0000 1.24 *************** *** 400,405 **** FGColumnVector3 normal, vDummy; FGLocation lDummy; ! double height = gearLoc.GetContactPoint(fdmex->GetSimTime(), lDummy, ! normal, vDummy, vDummy); c.normal = Tec2b * normal; --- 400,404 ---- FGColumnVector3 normal, vDummy; FGLocation lDummy; ! double height = gearLoc.GetContactPoint(lDummy, normal, vDummy, vDummy); c.normal = Tec2b * normal; |