Update of /cvsroot/jsbsim/JSBSim/src/initialization
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6575/src/initialization
Modified Files:
FGInitialCondition.cpp
Log Message:
Refactored code with the new method SetGeodLatitudeRadIC(). Also updated the comment for ComputeGeodAltitude(): it gives correct results as long as the altitude ASL is specified. However the routine will need further work for the case where the altitude AGL was specified.
Index: FGInitialCondition.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/initialization/FGInitialCondition.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -C2 -r1.112 -r1.113
*** FGInitialCondition.cpp 28 Aug 2016 12:13:09 -0000 1.112
--- FGInitialCondition.cpp 11 Sep 2016 11:31:00 -0000 1.113
***************
*** 710,717 ****
position.SetAltitudeASL(alt);
! if (lastLatitudeSet == setgeod) {
! double h = ComputeGeodAltitude(geodLatitude);
! position.SetPositionGeodetic(position.GetLongitude(), geodLatitude, h);
! }
soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
--- 710,717 ----
position.SetAltitudeASL(alt);
! // The call to SetAltitudeASL has most likely modified the geodetic latitude
! // so we need to restore it to its initial value.
! if (lastLatitudeSet == setgeod)
! SetGeodLatitudeRadIC(geodLatitude);
soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
***************
*** 932,945 ****
//******************************************************************************
! // Given an altitude above the sea level (or a position radius which is the
! // same) and a geodetic latitude, compute the geodetic altitude. It is assumed
! // that the terrain is a sphere and that the elevation is uniform all over the
! // Earth. Would that assumption fail, the computation below would need to be
! // adapted since the position radius would depend on the terrain elevation which
! // depends itself on the latitude.
//
! // This is an acceptable trade off because this routine is only used by
! // standalone JSBSim which uses FGDefaultGroundCallback which assumes that the
! // Earth is a sphere.
double FGInitialCondition::ComputeGeodAltitude(double geodLatitude)
--- 932,940 ----
//******************************************************************************
! // Given an altitude above the mean sea level (or a position radius which is the
! // same) and a geodetic latitude, compute the geodetic altitude.
//
! // TODO: extend the routine to the case where lastAltitudeSet is equal to
! // setagl.
double FGInitialCondition::ComputeGeodAltitude(double geodLatitude)
***************
*** 979,987 ****
string lat_type = latitude_el->GetAttributeValue("type");
! if (lat_type == "geod" || lat_type == "geodetic") {
! double h = ComputeGeodAltitude(latitude);
! position.SetPositionGeodetic(position.GetLongitude(), latitude, h);
! lastLatitudeSet = setgeod;
! }
else {
position.SetLatitude(latitude);
--- 974,979 ----
string lat_type = latitude_el->GetAttributeValue("type");
! if (lat_type == "geod" || lat_type == "geodetic")
! SetGeodLatitudeRadIC(latitude);
else {
position.SetLatitude(latitude);
|