1 /*******************************************************************************
3 Header: FGInitialCondition.cpp
7 ------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.net) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
28 --------------------------------------------------------------------------------
32 FUNCTIONAL DESCRIPTION
33 --------------------------------------------------------------------------------
35 The purpose of this class is to take a set of initial conditions and provide
36 a kinematically consistent set of body axis velocity components, euler
37 angles, and altitude. This class does not attempt to trim the model i.e.
38 the sim will most likely start in a very dynamic state (unless, of course,
39 you have chosen your IC's wisely) even after setting it up with this class.
41 ********************************************************************************
43 *******************************************************************************/
45 #include "FGInitialCondition.h"
46 #include "FGFDMExec.h"
48 #include "FGAtmosphere.h"
49 #include "FGAerodynamics.h"
51 #include "FGAircraft.h"
52 #include "FGTranslation.h"
53 #include "FGRotation.h"
54 #include "FGPosition.h"
55 #include "FGAuxiliary.h"
57 #include "FGConfigFile.h"
58 #include "FGPropertyManager.h"
62 static const char *IdSrc = "$Id$";
63 static const char *IdHdr = ID_INITIALCONDITION;
65 //******************************************************************************
67 FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec)
83 sea_level_radius = FDMExec->GetInertial()->RefRadius();
84 radius_to_vehicle = FDMExec->GetInertial()->RefRadius();
87 salpha=sbeta=stheta=sphi=spsi=sgamma=0;
88 calpha=cbeta=ctheta=cphi=cpsi=cgamma=1;
90 if(FDMExec != NULL ) {
92 fdmex->GetPosition()->Seth(altitude);
93 fdmex->GetAtmosphere()->Run();
94 PropertyManager=fdmex->GetPropertyManager();
97 cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
103 //******************************************************************************
105 FGInitialCondition::~FGInitialCondition()
111 //******************************************************************************
113 void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
115 if(getMachFromVcas(&mach,tt*ktstofps)) {
116 //cout << "Mach: " << mach << endl;
119 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
120 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
121 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
124 cout << "Failed to get Mach number for given Vc and altitude, Vc unchanged." << endl;
125 cout << "Please mail the set of initial conditions used to apeden@earthlink.net" << endl;
129 //******************************************************************************
131 void FGInitialCondition::SetVequivalentKtsIC(double tt) {
134 vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
135 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
139 //******************************************************************************
141 void FGInitialCondition::SetVgroundFpsIC(double tt) {
147 vnorth = vg*cos(psi); veast = vg*sin(psi); vdown = 0;
149 ua = u + uw; va = v + vw; wa = w + ww;
150 vt = sqrt( ua*ua + va*va + wa*wa );
152 vxz = sqrt( u*u + w*w );
153 if( w != 0 ) alpha = atan2( w, u );
154 if( vxz != 0 ) beta = atan2( v, vxz );
155 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
157 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
160 //******************************************************************************
162 void FGInitialCondition::SetVtrueFpsIC(double tt) {
165 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
167 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
170 //******************************************************************************
172 void FGInitialCondition::SetMachIC(double tt) {
174 lastSpeedSet=setmach;
175 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
177 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
178 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
181 //******************************************************************************
183 void FGInitialCondition::SetClimbRateFpmIC(double tt) {
184 SetClimbRateFpsIC(tt/60.0);
187 //******************************************************************************
189 void FGInitialCondition::SetClimbRateFpsIC(double tt) {
194 sgamma=sin(gamma); cgamma=cos(gamma);
198 //******************************************************************************
200 void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
202 sgamma=sin(gamma); cgamma=cos(gamma);
207 //******************************************************************************
209 void FGInitialCondition::SetAlphaRadIC(double tt) {
211 salpha=sin(alpha); calpha=cos(alpha);
215 //******************************************************************************
217 void FGInitialCondition::SetPitchAngleRadIC(double tt) {
219 stheta=sin(theta); ctheta=cos(theta);
223 //******************************************************************************
225 void FGInitialCondition::SetBetaRadIC(double tt) {
227 sbeta=sin(beta); cbeta=cos(beta);
232 //******************************************************************************
234 void FGInitialCondition::SetRollAngleRadIC(double tt) {
236 sphi=sin(phi); cphi=cos(phi);
240 //******************************************************************************
242 void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
244 spsi=sin(psi); cpsi=cos(psi);
248 //******************************************************************************
250 void FGInitialCondition::SetUBodyFpsIC(double tt) {
252 vt=sqrt(u*u + v*v + w*w);
256 //******************************************************************************
258 void FGInitialCondition::SetVBodyFpsIC(double tt) {
260 vt=sqrt(u*u + v*v + w*w);
264 //******************************************************************************
266 void FGInitialCondition::SetWBodyFpsIC(double tt) {
268 vt=sqrt( u*u + v*v + w*w );
272 //******************************************************************************
274 double FGInitialCondition::GetUBodyFpsIC(void) {
275 if(lastSpeedSet == setvg )
278 return vt*calpha*cbeta - uw;
281 //******************************************************************************
283 double FGInitialCondition::GetVBodyFpsIC(void) {
284 if( lastSpeedSet == setvg )
287 return vt*sbeta - vw;
291 //******************************************************************************
293 double FGInitialCondition::GetWBodyFpsIC(void) {
294 if( lastSpeedSet == setvg )
297 return vt*salpha*cbeta -ww;
300 //******************************************************************************
302 void FGInitialCondition::SetWindNEDFpsIC(double wN, double wE, double wD ) {
303 wnorth = wN; weast = wE; wdown = wD;
304 lastWindSet = setwned;
306 if(lastSpeedSet == setvg)
310 //******************************************************************************
312 // positive from left
313 void FGInitialCondition::SetHeadWindKtsIC(double head){
317 if(lastSpeedSet == setvg)
322 //******************************************************************************
324 void FGInitialCondition::SetCrossWindKtsIC(double cross){
325 wcross=cross*ktstofps;
328 if(lastSpeedSet == setvg)
333 //******************************************************************************
335 void FGInitialCondition::SetWindDownKtsIC(double wD) {
338 if(lastSpeedSet == setvg)
342 //******************************************************************************
344 void FGInitialCondition::SetWindMagKtsIC(double mag) {
348 if(lastSpeedSet == setvg)
352 //******************************************************************************
354 void FGInitialCondition::SetWindDirDegIC(double dir) {
358 if(lastSpeedSet == setvg)
363 //******************************************************************************
365 void FGInitialCondition::calcWindUVW(void) {
367 switch(lastWindSet) {
369 wnorth=wmag*cos(wdir);
370 weast=wmag*sin(wdir);
373 wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
374 weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
379 uw=wnorth*ctheta*cpsi +
382 vw=wnorth*( sphi*stheta*cpsi - cphi*spsi ) +
383 weast*( sphi*stheta*spsi + cphi*cpsi ) +
385 ww=wnorth*(cphi*stheta*cpsi + sphi*spsi) +
386 weast*(cphi*stheta*spsi - sphi*cpsi) +
390 /* cout << "FGInitialCondition::calcWindUVW: wnorth, weast, wdown "
391 << wnorth << ", " << weast << ", " << wdown << endl;
392 cout << "FGInitialCondition::calcWindUVW: theta, phi, psi "
393 << theta << ", " << phi << ", " << psi << endl;
394 cout << "FGInitialCondition::calcWindUVW: uw, vw, ww "
395 << uw << ", " << vw << ", " << ww << endl; */
399 //******************************************************************************
401 void FGInitialCondition::SetAltitudeFtIC(double tt) {
403 fdmex->GetPosition()->Seth(altitude);
404 fdmex->GetAtmosphere()->Run();
405 //lets try to make sure the user gets what they intended
407 switch(lastSpeedSet) {
411 SetVtrueKtsIC(vt*fpstokts);
414 SetVcalibratedKtsIC(vc*fpstokts);
417 SetVequivalentKtsIC(ve*fpstokts);
428 //******************************************************************************
430 void FGInitialCondition::SetAltitudeAGLFtIC(double tt) {
431 fdmex->GetPosition()->SetDistanceAGL(tt);
432 altitude=fdmex->GetPosition()->Geth();
433 SetAltitudeFtIC(altitude);
436 //******************************************************************************
438 void FGInitialCondition::SetSeaLevelRadiusFtIC(double tt) {
439 sea_level_radius = tt;
442 //******************************************************************************
444 void FGInitialCondition::SetTerrainAltitudeFtIC(double tt) {
448 //******************************************************************************
450 void FGInitialCondition::calcUVWfromNED(void) {
451 u=vnorth*ctheta*cpsi +
454 v=vnorth*( sphi*stheta*cpsi - cphi*spsi ) +
455 veast*( sphi*stheta*spsi + cphi*cpsi ) +
457 w=vnorth*( cphi*stheta*cpsi + sphi*spsi ) +
458 veast*( cphi*stheta*spsi - sphi*cpsi ) +
462 //******************************************************************************
464 void FGInitialCondition::SetVnorthFpsIC(double tt) {
467 vt=sqrt(u*u + v*v + w*w);
471 //******************************************************************************
473 void FGInitialCondition::SetVeastFpsIC(double tt) {
476 vt=sqrt(u*u + v*v + w*w);
480 //******************************************************************************
482 void FGInitialCondition::SetVdownFpsIC(double tt) {
485 vt=sqrt(u*u + v*v + w*w);
486 SetClimbRateFpsIC(-1*vdown);
490 //******************************************************************************
492 bool FGInitialCondition::getMachFromVcas(double *Mach,double vcas) {
498 sfunc=&FGInitialCondition::calcVcas;
499 if(findInterval(vcas,guess)) {
500 if(solve(&mach,vcas))
506 //******************************************************************************
508 bool FGInitialCondition::getAlpha(void) {
510 double guess=theta-gamma;
512 if(vt < 0.01) return 0;
515 xmin=fdmex->GetAerodynamics()->GetAlphaCLMin();
516 xmax=fdmex->GetAerodynamics()->GetAlphaCLMax();
517 sfunc=&FGInitialCondition::GammaEqOfAlpha;
518 if(findInterval(0,guess)){
529 //******************************************************************************
531 bool FGInitialCondition::getTheta(void) {
533 double guess=alpha+gamma;
535 if(vt < 0.01) return 0;
539 sfunc=&FGInitialCondition::GammaEqOfTheta;
540 if(findInterval(0,guess)){
551 //******************************************************************************
553 double FGInitialCondition::GammaEqOfTheta(double Theta) {
555 double sTheta,cTheta;
557 //theta=Theta; stheta=sin(theta); ctheta=cos(theta);
558 sTheta=sin(Theta); cTheta=cos(Theta);
560 a=wdown + vt*calpha*cbeta + uw;
561 b=vt*sphi*sbeta + vw*sphi;
562 c=vt*cphi*salpha*cbeta + ww*cphi;
563 return vt*sgamma - ( a*sTheta - (b+c)*cTheta);
566 //******************************************************************************
568 double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
570 double sAlpha,cAlpha;
571 sAlpha=sin(Alpha); cAlpha=cos(Alpha);
572 a=wdown + vt*cAlpha*cbeta + uw;
573 b=vt*sphi*sbeta + vw*sphi;
574 c=vt*cphi*sAlpha*cbeta + ww*cphi;
576 return vt*sgamma - ( a*stheta - (b+c)*ctheta );
579 //******************************************************************************
581 double FGInitialCondition::calcVcas(double Mach) {
583 double p=fdmex->GetAtmosphere()->GetPressure();
584 double psl=fdmex->GetAtmosphere()->GetPressureSL();
585 double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
586 double pt,A,B,D,vcas;
588 if(Mach < 1) //calculate total pressure assuming isentropic flow
589 pt=p*pow((1 + 0.2*Mach*Mach),3.5);
591 // shock in front of pitot tube, we'll assume its normal and use
592 // the Rayleigh Pitot Tube Formula, i.e. the ratio of total
593 // pressure behind the shock to the static pressure in front
596 //the normal shock assumption should not be a bad one -- most supersonic
597 //aircraft place the pitot probe out front so that it is the forward
598 //most point on the aircraft. The real shock would, of course, take
599 //on something like the shape of a rounded-off cone but, here again,
600 //the assumption should be good since the opening of the pitot probe
601 //is very small and, therefore, the effects of the shock curvature
602 //should be small as well. AFAIK, this approach is fairly well accepted
603 //within the aerospace community
605 B = 5.76*Mach*Mach/(5.6*Mach*Mach - 0.8);
607 // The denominator above is zero for Mach ~ 0.38, for which
608 // we'll never be here, so we're safe
610 D = (2.8*Mach*Mach-0.4)*0.4167;
614 A = pow(((pt-p)/psl+1),0.28571);
615 vcas = sqrt(7*psl/rhosl*(A-1));
616 //cout << "calcVcas: vcas= " << vcas*fpstokts << " mach= " << Mach << " pressure: " << pt << endl;
620 //******************************************************************************
622 bool FGInitialCondition::findInterval(double x,double guess) {
623 //void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
627 double flo,fhi,fguess;
630 fguess=(this->*sfunc)(guess)-x;
636 if(lo < xmin) lo=xmin;
637 if(hi > xmax) hi=xmax;
639 flo=(this->*sfunc)(lo)-x;
640 fhi=(this->*sfunc)(hi)-x;
641 if(flo*fhi <=0) { //found interval with root
643 if(flo*fguess <= 0) { //narrow interval down a bit
644 hi=lo+step; //to pass solver interval that is as
647 else if(fhi*fguess <= 0) {
651 //cout << "findInterval: i=" << i << " Lo= " << lo << " Hi= " << hi << endl;
653 while((found == 0) && (i <= 100));
659 //******************************************************************************
661 bool FGInitialCondition::solve(double *y,double x)
663 double x1,x2,x3,f1,f2,f3,d,d0;
665 double const relax =0.9;
673 f1=(this->*sfunc)(x1)-x;
674 f3=(this->*sfunc)(x3)-x;
679 while ((fabs(d) > eps) && (i < 100)) {
681 x2 = x1-d*d0*f1/(f3-f1);
683 f2=(this->*sfunc)(x2)-x;
684 //cout << "solve x1,x2,x3: " << x1 << "," << x2 << "," << x3 << endl;
685 //cout << " " << f1 << "," << f2 << "," << f3 << endl;
687 if(fabs(f2) <= 0.001) {
689 } else if(f1*f2 <= 0.0) {
693 } else if(f2*f3 <= 0) {
706 //cout << "Success= " << success << " Vcas: " << vcas*fpstokts << " Mach: " << x2 << endl;
710 //******************************************************************************
712 double FGInitialCondition::GetWindDirDegIC(void) {
714 return atan2(weast,wnorth)*radtodeg;
721 //******************************************************************************
723 bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
735 if( useStoredPath ) {
736 string acpath = fdmex->GetAircraftPath() + sep + fdmex->GetModelName();
737 resetDef = acpath + sep + rstfile + ".xml";
742 FGConfigFile resetfile(resetDef);
743 if (!resetfile.IsOpen()) {
744 cerr << "Failed to open reset file: " << resetDef << endl;
748 resetfile.GetNextConfigLine();
749 token = resetfile.GetValue();
750 if (token != string("initialize")) {
751 cerr << "The reset file " << resetDef
752 << " does not appear to be a reset file" << endl;
756 resetfile.GetNextConfigLine();
758 while (token != string("/initialize") && token != string("EOF")) {
759 if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
760 if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
761 if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }
762 if (token == "LATITUDE" ) { resetfile >> temp; SetLatitudeDegIC(temp); }
763 if (token == "LONGITUDE" ) { resetfile >> temp; SetLongitudeDegIC(temp); }
764 if (token == "PHI" ) { resetfile >> temp; SetRollAngleDegIC(temp); }
765 if (token == "THETA" ) { resetfile >> temp; SetPitchAngleDegIC(temp); }
766 if (token == "PSI" ) { resetfile >> temp; SetTrueHeadingDegIC(temp); }
767 if (token == "ALPHA" ) { resetfile >> temp; SetAlphaDegIC(temp); }
768 if (token == "BETA" ) { resetfile >> temp; SetBetaDegIC(temp); }
769 if (token == "GAMMA" ) { resetfile >> temp; SetFlightPathAngleDegIC(temp); }
770 if (token == "ROC" ) { resetfile >> temp; SetClimbRateFpmIC(temp); }
771 if (token == "ALTITUDE" ) { resetfile >> temp; SetAltitudeFtIC(temp); }
772 if (token == "WINDDIR" ) { resetfile >> temp; SetWindDirDegIC(temp); }
773 if (token == "VWIND" ) { resetfile >> temp; SetWindMagKtsIC(temp); }
774 if (token == "HWIND" ) { resetfile >> temp; SetHeadWindKtsIC(temp); }
775 if (token == "XWIND" ) { resetfile >> temp; SetCrossWindKtsIC(temp); }
776 if (token == "VC" ) { resetfile >> temp; SetVcalibratedKtsIC(temp); }
777 if (token == "MACH" ) { resetfile >> temp; SetMachIC(temp); }
778 if (token == "VGROUND" ) { resetfile >> temp; SetVgroundKtsIC(temp); }
787 //******************************************************************************
789 void FGInitialCondition::bind(void){
790 PropertyManager->Tie("ic/vc-kts", this,
791 &FGInitialCondition::GetVcalibratedKtsIC,
792 &FGInitialCondition::SetVcalibratedKtsIC,
794 PropertyManager->Tie("ic/ve-kts", this,
795 &FGInitialCondition::GetVequivalentKtsIC,
796 &FGInitialCondition::SetVequivalentKtsIC,
798 PropertyManager->Tie("ic/vg-kts", this,
799 &FGInitialCondition::GetVgroundKtsIC,
800 &FGInitialCondition::SetVgroundKtsIC,
802 PropertyManager->Tie("ic/vt-kts", this,
803 &FGInitialCondition::GetVtrueKtsIC,
804 &FGInitialCondition::SetVtrueKtsIC,
806 PropertyManager->Tie("ic/mach-norm", this,
807 &FGInitialCondition::GetMachIC,
808 &FGInitialCondition::SetMachIC,
810 PropertyManager->Tie("ic/roc-fpm", this,
811 &FGInitialCondition::GetClimbRateFpmIC,
812 &FGInitialCondition::SetClimbRateFpmIC,
814 PropertyManager->Tie("ic/gamma-deg", this,
815 &FGInitialCondition::GetFlightPathAngleDegIC,
816 &FGInitialCondition::SetFlightPathAngleDegIC,
818 PropertyManager->Tie("ic/alpha-deg", this,
819 &FGInitialCondition::GetAlphaDegIC,
820 &FGInitialCondition::SetAlphaDegIC,
822 PropertyManager->Tie("ic/beta-deg", this,
823 &FGInitialCondition::GetBetaDegIC,
824 &FGInitialCondition::SetBetaDegIC,
826 PropertyManager->Tie("ic/theta-deg", this,
827 &FGInitialCondition::GetPitchAngleDegIC,
828 &FGInitialCondition::SetPitchAngleDegIC,
830 PropertyManager->Tie("ic/phi-deg", this,
831 &FGInitialCondition::GetRollAngleDegIC,
832 &FGInitialCondition::SetRollAngleDegIC,
834 PropertyManager->Tie("ic/psi-true-deg", this,
835 &FGInitialCondition::GetHeadingDegIC );
836 PropertyManager->Tie("ic/lat-gc-deg", this,
837 &FGInitialCondition::GetLatitudeDegIC,
838 &FGInitialCondition::SetLatitudeDegIC,
840 PropertyManager->Tie("ic/long-gc-deg", this,
841 &FGInitialCondition::GetLongitudeDegIC,
842 &FGInitialCondition::SetLongitudeDegIC,
844 PropertyManager->Tie("ic/h-sl-ft", this,
845 &FGInitialCondition::GetAltitudeFtIC,
846 &FGInitialCondition::SetAltitudeFtIC,
848 PropertyManager->Tie("ic/h-agl-ft", this,
849 &FGInitialCondition::GetAltitudeAGLFtIC,
850 &FGInitialCondition::SetAltitudeAGLFtIC,
852 PropertyManager->Tie("ic/sea-level-radius-ft", this,
853 &FGInitialCondition::GetSeaLevelRadiusFtIC,
854 &FGInitialCondition::SetSeaLevelRadiusFtIC,
856 PropertyManager->Tie("ic/terrain-altitude-ft", this,
857 &FGInitialCondition::GetTerrainAltitudeFtIC,
858 &FGInitialCondition::SetTerrainAltitudeFtIC,
860 PropertyManager->Tie("ic/vg-fps", this,
861 &FGInitialCondition::GetVgroundFpsIC,
862 &FGInitialCondition::SetVgroundFpsIC,
864 PropertyManager->Tie("ic/vt-fps", this,
865 &FGInitialCondition::GetVtrueFpsIC,
866 &FGInitialCondition::SetVtrueFpsIC,
868 PropertyManager->Tie("ic/vw-bx-fps", this,
869 &FGInitialCondition::GetWindUFpsIC);
870 PropertyManager->Tie("ic/vw-by-fps", this,
871 &FGInitialCondition::GetWindVFpsIC);
872 PropertyManager->Tie("ic/vw-bz-fps", this,
873 &FGInitialCondition::GetWindWFpsIC);
874 PropertyManager->Tie("ic/vw-north-fps", this,
875 &FGInitialCondition::GetWindNFpsIC);
876 PropertyManager->Tie("ic/vw-east-fps", this,
877 &FGInitialCondition::GetWindEFpsIC);
878 PropertyManager->Tie("ic/vw-down-fps", this,
879 &FGInitialCondition::GetWindDFpsIC);
880 PropertyManager->Tie("ic/vw-mag-fps", this,
881 &FGInitialCondition::GetWindFpsIC);
882 /* PropertyManager->Tie("ic/vw-dir-deg", this,
883 &FGInitialCondition::GetWindDirDegIC,
884 &FGInitialCondition::SetWindDirDegIC,
887 PropertyManager->Tie("ic/roc-fps", this,
888 &FGInitialCondition::GetClimbRateFpsIC,
889 &FGInitialCondition::SetClimbRateFpsIC,
891 /* PropertyManager->Tie("ic/u-fps", this,
892 &FGInitialCondition::GetUBodyFpsIC,
893 &FGInitialCondition::SetUBodyFpsIC,
895 PropertyManager->Tie("ic/v-fps", this,
896 &FGInitialCondition::GetVBodyFpsIC,
897 &FGInitialCondition::SetVBodyFpsIC,
899 PropertyManager->Tie("ic/w-fps", this,
900 &FGInitialCondition::GetWBodyFpsIC,
901 &FGInitialCondition::SetWBodyFpsIC,
904 PropertyManager->Tie("ic/gamma-rad", this,
905 &FGInitialCondition::GetFlightPathAngleRadIC,
906 &FGInitialCondition::SetFlightPathAngleRadIC,
908 PropertyManager->Tie("ic/alpha-rad", this,
909 &FGInitialCondition::GetAlphaRadIC,
910 &FGInitialCondition::SetAlphaRadIC,
912 PropertyManager->Tie("ic/theta-rad", this,
913 &FGInitialCondition::GetPitchAngleRadIC,
914 &FGInitialCondition::SetPitchAngleRadIC,
916 PropertyManager->Tie("ic/beta-rad", this,
917 &FGInitialCondition::GetBetaRadIC,
918 &FGInitialCondition::SetBetaRadIC,
920 PropertyManager->Tie("ic/phi-rad", this,
921 &FGInitialCondition::GetRollAngleRadIC,
922 &FGInitialCondition::SetRollAngleRadIC,
924 PropertyManager->Tie("ic/psi-true-rad", this,
925 &FGInitialCondition::GetHeadingRadIC);
926 PropertyManager->Tie("ic/lat-gc-rad", this,
927 &FGInitialCondition::GetLatitudeRadIC,
928 &FGInitialCondition::SetLatitudeRadIC,
930 PropertyManager->Tie("ic/long-gc-rad", this,
931 &FGInitialCondition::GetLongitudeRadIC,
932 &FGInitialCondition::SetLongitudeRadIC,
936 //******************************************************************************
938 void FGInitialCondition::unbind(void){
939 PropertyManager->Untie("ic/vc-kts");
940 PropertyManager->Untie("ic/ve-kts");
941 PropertyManager->Untie("ic/vg-kts");
942 PropertyManager->Untie("ic/vt-kts");
943 PropertyManager->Untie("ic/mach-norm");
944 PropertyManager->Untie("ic/roc-fpm");
945 PropertyManager->Untie("ic/gamma-deg");
946 PropertyManager->Untie("ic/alpha-deg");
947 PropertyManager->Untie("ic/beta-deg");
948 PropertyManager->Untie("ic/theta-deg");
949 PropertyManager->Untie("ic/phi-deg");
950 PropertyManager->Untie("ic/psi-true-deg");
951 PropertyManager->Untie("ic/lat-gc-deg");
952 PropertyManager->Untie("ic/long-gc-deg");
953 PropertyManager->Untie("ic/h-sl-ft");
954 PropertyManager->Untie("ic/h-agl-ft");
955 PropertyManager->Untie("ic/sea-level-radius-ft");
956 PropertyManager->Untie("ic/terrain-altitude-ft");
957 PropertyManager->Untie("ic/vg-fps");
958 PropertyManager->Untie("ic/vt-fps");
959 PropertyManager->Untie("ic/vw-bx-fps");
960 PropertyManager->Untie("ic/vw-by-fps");
961 PropertyManager->Untie("ic/vw-bz-fps");
962 PropertyManager->Untie("ic/vw-north-fps");
963 PropertyManager->Untie("ic/vw-east-fps");
964 PropertyManager->Untie("ic/vw-down-fps");
965 PropertyManager->Untie("ic/vw-mag-fps");
966 /* PropertyManager->Untie("ic/vw-dir-deg"); */
968 PropertyManager->Untie("ic/roc-fps");
970 /* PropertyManager->Untie("ic/u-fps");
971 PropertyManager->Untie("ic/v-fps");
972 PropertyManager->Untie("ic/w-fps"); */
974 PropertyManager->Untie("ic/gamma-rad");
975 PropertyManager->Untie("ic/alpha-rad");
976 PropertyManager->Untie("ic/theta-rad");
977 PropertyManager->Untie("ic/beta-rad");
978 PropertyManager->Untie("ic/phi-rad");
979 PropertyManager->Untie("ic/psi-true-rad");
980 PropertyManager->Untie("ic/lat-gc-rad");
981 PropertyManager->Untie("ic/long-gc-rad");
984 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
985 // The bitmasked value choices are as follows:
986 // unset: In this case (the default) JSBSim would only print
987 // out the normally expected messages, essentially echoing
988 // the config files as they are read. If the environment
989 // variable is not set, debug_lvl is set to 1 internally
990 // 0: This requests JSBSim not to output any messages
992 // 1: This value explicity requests the normal JSBSim
994 // 2: This value asks for a message to be printed out when
995 // a class is instantiated
996 // 4: When this value is set, a message is displayed when a
997 // FGModel object executes its Run() method
998 // 8: When this value is set, various runtime state variables
999 // are printed out periodically
1000 // 16: When set various parameters are sanity checked and
1001 // a message is printed out when they go out of bounds
1003 void FGInitialCondition::Debug(int from)
1005 if (debug_lvl <= 0) return;
1007 if (debug_lvl & 1) { // Standard console startup message output
1009 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1010 if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
1011 if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
1013 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1015 if (debug_lvl & 8 ) { // Runtime state variables
1017 if (debug_lvl & 16) { // Sanity checking
1019 if (debug_lvl & 64) {
1020 if (from == 0) { // Constructor
1021 cout << IdSrc << endl;
1022 cout << IdHdr << endl;