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"
47 #include "FGInertial.h"
48 #include "FGAtmosphere.h"
49 #include "FGAerodynamics.h"
50 #include "FGPosition.h"
51 #include "FGConfigFile.h"
52 #include "FGPropertyManager.h"
56 static const char *IdSrc = "$Id$";
57 static const char *IdHdr = ID_INITIALCONDITION;
59 //******************************************************************************
61 FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec)
77 sea_level_radius = FDMExec->GetInertial()->RefRadius();
78 radius_to_vehicle = FDMExec->GetInertial()->RefRadius();
81 salpha=sbeta=stheta=sphi=spsi=sgamma=0;
82 calpha=cbeta=ctheta=cphi=cpsi=cgamma=1;
84 if(FDMExec != NULL ) {
86 fdmex->GetPosition()->Seth(altitude);
87 fdmex->GetAtmosphere()->Run();
88 PropertyManager=fdmex->GetPropertyManager();
91 cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
97 //******************************************************************************
99 FGInitialCondition::~FGInitialCondition()
105 //******************************************************************************
107 void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
109 if(getMachFromVcas(&mach,tt*ktstofps)) {
110 //cout << "Mach: " << mach << endl;
113 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
114 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
115 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
118 cout << "Failed to get Mach number for given Vc and altitude, Vc unchanged." << endl;
119 cout << "Please mail the set of initial conditions used to apeden@earthlink.net" << endl;
123 //******************************************************************************
125 void FGInitialCondition::SetVequivalentKtsIC(double tt) {
128 vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
129 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
133 //******************************************************************************
135 void FGInitialCondition::SetVgroundFpsIC(double tt) {
141 vnorth = vg*cos(psi); veast = vg*sin(psi); vdown = 0;
143 ua = u + uw; va = v + vw; wa = w + ww;
144 vt = sqrt( ua*ua + va*va + wa*wa );
146 vxz = sqrt( u*u + w*w );
147 if( w != 0 ) alpha = atan2( w, u );
148 if( vxz != 0 ) beta = atan2( v, vxz );
149 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
151 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
154 //******************************************************************************
156 void FGInitialCondition::SetVtrueFpsIC(double tt) {
159 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
161 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
164 //******************************************************************************
166 void FGInitialCondition::SetMachIC(double tt) {
168 lastSpeedSet=setmach;
169 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
171 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
172 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
175 //******************************************************************************
177 void FGInitialCondition::SetClimbRateFpmIC(double tt) {
178 SetClimbRateFpsIC(tt/60.0);
181 //******************************************************************************
183 void FGInitialCondition::SetClimbRateFpsIC(double tt) {
188 sgamma=sin(gamma); cgamma=cos(gamma);
192 //******************************************************************************
194 void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
196 sgamma=sin(gamma); cgamma=cos(gamma);
201 //******************************************************************************
203 void FGInitialCondition::SetAlphaRadIC(double tt) {
205 salpha=sin(alpha); calpha=cos(alpha);
209 //******************************************************************************
211 void FGInitialCondition::SetPitchAngleRadIC(double tt) {
213 stheta=sin(theta); ctheta=cos(theta);
217 //******************************************************************************
219 void FGInitialCondition::SetBetaRadIC(double tt) {
221 sbeta=sin(beta); cbeta=cos(beta);
226 //******************************************************************************
228 void FGInitialCondition::SetRollAngleRadIC(double tt) {
230 sphi=sin(phi); cphi=cos(phi);
234 //******************************************************************************
236 void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
238 spsi=sin(psi); cpsi=cos(psi);
242 //******************************************************************************
244 void FGInitialCondition::SetUBodyFpsIC(double tt) {
246 vt=sqrt(u*u + v*v + w*w);
250 //******************************************************************************
252 void FGInitialCondition::SetVBodyFpsIC(double tt) {
254 vt=sqrt(u*u + v*v + w*w);
258 //******************************************************************************
260 void FGInitialCondition::SetWBodyFpsIC(double tt) {
262 vt=sqrt( u*u + v*v + w*w );
266 //******************************************************************************
268 double FGInitialCondition::GetUBodyFpsIC(void) {
269 if(lastSpeedSet == setvg )
272 return vt*calpha*cbeta - uw;
275 //******************************************************************************
277 double FGInitialCondition::GetVBodyFpsIC(void) {
278 if( lastSpeedSet == setvg )
281 return vt*sbeta - vw;
285 //******************************************************************************
287 double FGInitialCondition::GetWBodyFpsIC(void) {
288 if( lastSpeedSet == setvg )
291 return vt*salpha*cbeta -ww;
294 //******************************************************************************
296 void FGInitialCondition::SetWindNEDFpsIC(double wN, double wE, double wD ) {
297 wnorth = wN; weast = wE; wdown = wD;
298 lastWindSet = setwned;
300 if(lastSpeedSet == setvg)
304 //******************************************************************************
306 // positive from left
307 void FGInitialCondition::SetHeadWindKtsIC(double head){
311 if(lastSpeedSet == setvg)
316 //******************************************************************************
318 void FGInitialCondition::SetCrossWindKtsIC(double cross){
319 wcross=cross*ktstofps;
322 if(lastSpeedSet == setvg)
327 //******************************************************************************
329 void FGInitialCondition::SetWindDownKtsIC(double wD) {
332 if(lastSpeedSet == setvg)
336 //******************************************************************************
338 void FGInitialCondition::SetWindMagKtsIC(double mag) {
342 if(lastSpeedSet == setvg)
346 //******************************************************************************
348 void FGInitialCondition::SetWindDirDegIC(double dir) {
352 if(lastSpeedSet == setvg)
357 //******************************************************************************
359 void FGInitialCondition::calcWindUVW(void) {
361 switch(lastWindSet) {
363 wnorth=wmag*cos(wdir);
364 weast=wmag*sin(wdir);
367 wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
368 weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
373 uw=wnorth*ctheta*cpsi +
376 vw=wnorth*( sphi*stheta*cpsi - cphi*spsi ) +
377 weast*( sphi*stheta*spsi + cphi*cpsi ) +
379 ww=wnorth*(cphi*stheta*cpsi + sphi*spsi) +
380 weast*(cphi*stheta*spsi - sphi*cpsi) +
384 /* cout << "FGInitialCondition::calcWindUVW: wnorth, weast, wdown "
385 << wnorth << ", " << weast << ", " << wdown << endl;
386 cout << "FGInitialCondition::calcWindUVW: theta, phi, psi "
387 << theta << ", " << phi << ", " << psi << endl;
388 cout << "FGInitialCondition::calcWindUVW: uw, vw, ww "
389 << uw << ", " << vw << ", " << ww << endl; */
393 //******************************************************************************
395 void FGInitialCondition::SetAltitudeFtIC(double tt) {
397 fdmex->GetPosition()->Seth(altitude);
398 fdmex->GetAtmosphere()->Run();
399 //lets try to make sure the user gets what they intended
401 switch(lastSpeedSet) {
405 SetVtrueKtsIC(vt*fpstokts);
408 SetVcalibratedKtsIC(vc*fpstokts);
411 SetVequivalentKtsIC(ve*fpstokts);
422 //******************************************************************************
424 void FGInitialCondition::SetAltitudeAGLFtIC(double tt) {
425 fdmex->GetPosition()->SetDistanceAGL(tt);
426 altitude=fdmex->GetPosition()->Geth();
427 SetAltitudeFtIC(altitude);
430 //******************************************************************************
432 void FGInitialCondition::SetSeaLevelRadiusFtIC(double tt) {
433 sea_level_radius = tt;
436 //******************************************************************************
438 void FGInitialCondition::SetTerrainAltitudeFtIC(double tt) {
442 //******************************************************************************
444 void FGInitialCondition::calcUVWfromNED(void) {
445 u=vnorth*ctheta*cpsi +
448 v=vnorth*( sphi*stheta*cpsi - cphi*spsi ) +
449 veast*( sphi*stheta*spsi + cphi*cpsi ) +
451 w=vnorth*( cphi*stheta*cpsi + sphi*spsi ) +
452 veast*( cphi*stheta*spsi - sphi*cpsi ) +
456 //******************************************************************************
458 void FGInitialCondition::SetVnorthFpsIC(double tt) {
461 vt=sqrt(u*u + v*v + w*w);
465 //******************************************************************************
467 void FGInitialCondition::SetVeastFpsIC(double tt) {
470 vt=sqrt(u*u + v*v + w*w);
474 //******************************************************************************
476 void FGInitialCondition::SetVdownFpsIC(double tt) {
479 vt=sqrt(u*u + v*v + w*w);
480 SetClimbRateFpsIC(-1*vdown);
484 //******************************************************************************
486 bool FGInitialCondition::getMachFromVcas(double *Mach,double vcas) {
492 sfunc=&FGInitialCondition::calcVcas;
493 if(findInterval(vcas,guess)) {
494 if(solve(&mach,vcas))
500 //******************************************************************************
502 bool FGInitialCondition::getAlpha(void) {
504 double guess=theta-gamma;
506 if(vt < 0.01) return 0;
509 xmin=fdmex->GetAerodynamics()->GetAlphaCLMin();
510 xmax=fdmex->GetAerodynamics()->GetAlphaCLMax();
511 sfunc=&FGInitialCondition::GammaEqOfAlpha;
512 if(findInterval(0,guess)){
523 //******************************************************************************
525 bool FGInitialCondition::getTheta(void) {
527 double guess=alpha+gamma;
529 if(vt < 0.01) return 0;
533 sfunc=&FGInitialCondition::GammaEqOfTheta;
534 if(findInterval(0,guess)){
545 //******************************************************************************
547 double FGInitialCondition::GammaEqOfTheta(double Theta) {
549 double sTheta,cTheta;
551 //theta=Theta; stheta=sin(theta); ctheta=cos(theta);
552 sTheta=sin(Theta); cTheta=cos(Theta);
554 a=wdown + vt*calpha*cbeta + uw;
555 b=vt*sphi*sbeta + vw*sphi;
556 c=vt*cphi*salpha*cbeta + ww*cphi;
557 return vt*sgamma - ( a*sTheta - (b+c)*cTheta);
560 //******************************************************************************
562 double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
564 double sAlpha,cAlpha;
565 sAlpha=sin(Alpha); cAlpha=cos(Alpha);
566 a=wdown + vt*cAlpha*cbeta + uw;
567 b=vt*sphi*sbeta + vw*sphi;
568 c=vt*cphi*sAlpha*cbeta + ww*cphi;
570 return vt*sgamma - ( a*stheta - (b+c)*ctheta );
573 //******************************************************************************
575 double FGInitialCondition::calcVcas(double Mach) {
577 double p=fdmex->GetAtmosphere()->GetPressure();
578 double psl=fdmex->GetAtmosphere()->GetPressureSL();
579 double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
580 double pt,A,B,D,vcas;
582 if(Mach < 1) //calculate total pressure assuming isentropic flow
583 pt=p*pow((1 + 0.2*Mach*Mach),3.5);
585 // shock in front of pitot tube, we'll assume its normal and use
586 // the Rayleigh Pitot Tube Formula, i.e. the ratio of total
587 // pressure behind the shock to the static pressure in front
590 //the normal shock assumption should not be a bad one -- most supersonic
591 //aircraft place the pitot probe out front so that it is the forward
592 //most point on the aircraft. The real shock would, of course, take
593 //on something like the shape of a rounded-off cone but, here again,
594 //the assumption should be good since the opening of the pitot probe
595 //is very small and, therefore, the effects of the shock curvature
596 //should be small as well. AFAIK, this approach is fairly well accepted
597 //within the aerospace community
599 B = 5.76*Mach*Mach/(5.6*Mach*Mach - 0.8);
601 // The denominator above is zero for Mach ~ 0.38, for which
602 // we'll never be here, so we're safe
604 D = (2.8*Mach*Mach-0.4)*0.4167;
608 A = pow(((pt-p)/psl+1),0.28571);
609 vcas = sqrt(7*psl/rhosl*(A-1));
610 //cout << "calcVcas: vcas= " << vcas*fpstokts << " mach= " << Mach << " pressure: " << pt << endl;
614 //******************************************************************************
616 bool FGInitialCondition::findInterval(double x,double guess) {
617 //void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
621 double flo,fhi,fguess;
624 fguess=(this->*sfunc)(guess)-x;
630 if(lo < xmin) lo=xmin;
631 if(hi > xmax) hi=xmax;
633 flo=(this->*sfunc)(lo)-x;
634 fhi=(this->*sfunc)(hi)-x;
635 if(flo*fhi <=0) { //found interval with root
637 if(flo*fguess <= 0) { //narrow interval down a bit
638 hi=lo+step; //to pass solver interval that is as
641 else if(fhi*fguess <= 0) {
645 //cout << "findInterval: i=" << i << " Lo= " << lo << " Hi= " << hi << endl;
647 while((found == 0) && (i <= 100));
653 //******************************************************************************
655 bool FGInitialCondition::solve(double *y,double x)
657 double x1,x2,x3,f1,f2,f3,d,d0;
659 double const relax =0.9;
667 f1=(this->*sfunc)(x1)-x;
668 f3=(this->*sfunc)(x3)-x;
673 while ((fabs(d) > eps) && (i < 100)) {
675 x2 = x1-d*d0*f1/(f3-f1);
677 f2=(this->*sfunc)(x2)-x;
678 //cout << "solve x1,x2,x3: " << x1 << "," << x2 << "," << x3 << endl;
679 //cout << " " << f1 << "," << f2 << "," << f3 << endl;
681 if(fabs(f2) <= 0.001) {
683 } else if(f1*f2 <= 0.0) {
687 } else if(f2*f3 <= 0) {
700 //cout << "Success= " << success << " Vcas: " << vcas*fpstokts << " Mach: " << x2 << endl;
704 //******************************************************************************
706 double FGInitialCondition::GetWindDirDegIC(void) {
708 return atan2(weast,wnorth)*radtodeg;
715 //******************************************************************************
717 bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
719 string resetDef, acpath;
729 if( useStoredPath ) {
730 acpath = fdmex->GetAircraftPath() + sep + fdmex->GetModelName();
731 resetDef = acpath + sep + rstfile + ".xml";
736 FGConfigFile resetfile(resetDef);
737 if (!resetfile.IsOpen()) {
738 cerr << "Failed to open reset file: " << resetDef << endl;
742 resetfile.GetNextConfigLine();
743 token = resetfile.GetValue();
744 if (token != string("initialize")) {
745 cerr << "The reset file " << resetDef
746 << " does not appear to be a reset file" << endl;
750 resetfile.GetNextConfigLine();
752 while (token != string("/initialize") && token != string("EOF")) {
753 if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
754 if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
755 if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }
756 if (token == "LATITUDE" ) { resetfile >> temp; SetLatitudeDegIC(temp); }
757 if (token == "LONGITUDE" ) { resetfile >> temp; SetLongitudeDegIC(temp); }
758 if (token == "PHI" ) { resetfile >> temp; SetRollAngleDegIC(temp); }
759 if (token == "THETA" ) { resetfile >> temp; SetPitchAngleDegIC(temp); }
760 if (token == "PSI" ) { resetfile >> temp; SetTrueHeadingDegIC(temp); }
761 if (token == "ALPHA" ) { resetfile >> temp; SetAlphaDegIC(temp); }
762 if (token == "BETA" ) { resetfile >> temp; SetBetaDegIC(temp); }
763 if (token == "GAMMA" ) { resetfile >> temp; SetFlightPathAngleDegIC(temp); }
764 if (token == "ROC" ) { resetfile >> temp; SetClimbRateFpmIC(temp); }
765 if (token == "ALTITUDE" ) { resetfile >> temp; SetAltitudeFtIC(temp); }
766 if (token == "WINDDIR" ) { resetfile >> temp; SetWindDirDegIC(temp); }
767 if (token == "VWIND" ) { resetfile >> temp; SetWindMagKtsIC(temp); }
768 if (token == "HWIND" ) { resetfile >> temp; SetHeadWindKtsIC(temp); }
769 if (token == "XWIND" ) { resetfile >> temp; SetCrossWindKtsIC(temp); }
770 if (token == "VC" ) { resetfile >> temp; SetVcalibratedKtsIC(temp); }
771 if (token == "MACH" ) { resetfile >> temp; SetMachIC(temp); }
772 if (token == "VGROUND" ) { resetfile >> temp; SetVgroundKtsIC(temp); }
781 //******************************************************************************
783 void FGInitialCondition::bind(void){
784 PropertyManager->Tie("ic/vc-kts", this,
785 &FGInitialCondition::GetVcalibratedKtsIC,
786 &FGInitialCondition::SetVcalibratedKtsIC,
788 PropertyManager->Tie("ic/ve-kts", this,
789 &FGInitialCondition::GetVequivalentKtsIC,
790 &FGInitialCondition::SetVequivalentKtsIC,
792 PropertyManager->Tie("ic/vg-kts", this,
793 &FGInitialCondition::GetVgroundKtsIC,
794 &FGInitialCondition::SetVgroundKtsIC,
796 PropertyManager->Tie("ic/vt-kts", this,
797 &FGInitialCondition::GetVtrueKtsIC,
798 &FGInitialCondition::SetVtrueKtsIC,
800 PropertyManager->Tie("ic/mach-norm", this,
801 &FGInitialCondition::GetMachIC,
802 &FGInitialCondition::SetMachIC,
804 PropertyManager->Tie("ic/roc-fpm", this,
805 &FGInitialCondition::GetClimbRateFpmIC,
806 &FGInitialCondition::SetClimbRateFpmIC,
808 PropertyManager->Tie("ic/gamma-deg", this,
809 &FGInitialCondition::GetFlightPathAngleDegIC,
810 &FGInitialCondition::SetFlightPathAngleDegIC,
812 PropertyManager->Tie("ic/alpha-deg", this,
813 &FGInitialCondition::GetAlphaDegIC,
814 &FGInitialCondition::SetAlphaDegIC,
816 PropertyManager->Tie("ic/beta-deg", this,
817 &FGInitialCondition::GetBetaDegIC,
818 &FGInitialCondition::SetBetaDegIC,
820 PropertyManager->Tie("ic/theta-deg", this,
821 &FGInitialCondition::GetPitchAngleDegIC,
822 &FGInitialCondition::SetPitchAngleDegIC,
824 PropertyManager->Tie("ic/phi-deg", this,
825 &FGInitialCondition::GetRollAngleDegIC,
826 &FGInitialCondition::SetRollAngleDegIC,
828 PropertyManager->Tie("ic/psi-true-deg", this,
829 &FGInitialCondition::GetHeadingDegIC );
830 PropertyManager->Tie("ic/lat-gc-deg", this,
831 &FGInitialCondition::GetLatitudeDegIC,
832 &FGInitialCondition::SetLatitudeDegIC,
834 PropertyManager->Tie("ic/long-gc-deg", this,
835 &FGInitialCondition::GetLongitudeDegIC,
836 &FGInitialCondition::SetLongitudeDegIC,
838 PropertyManager->Tie("ic/h-sl-ft", this,
839 &FGInitialCondition::GetAltitudeFtIC,
840 &FGInitialCondition::SetAltitudeFtIC,
842 PropertyManager->Tie("ic/h-agl-ft", this,
843 &FGInitialCondition::GetAltitudeAGLFtIC,
844 &FGInitialCondition::SetAltitudeAGLFtIC,
846 PropertyManager->Tie("ic/sea-level-radius-ft", this,
847 &FGInitialCondition::GetSeaLevelRadiusFtIC,
848 &FGInitialCondition::SetSeaLevelRadiusFtIC,
850 PropertyManager->Tie("ic/terrain-altitude-ft", this,
851 &FGInitialCondition::GetTerrainAltitudeFtIC,
852 &FGInitialCondition::SetTerrainAltitudeFtIC,
854 PropertyManager->Tie("ic/vg-fps", this,
855 &FGInitialCondition::GetVgroundFpsIC,
856 &FGInitialCondition::SetVgroundFpsIC,
858 PropertyManager->Tie("ic/vt-fps", this,
859 &FGInitialCondition::GetVtrueFpsIC,
860 &FGInitialCondition::SetVtrueFpsIC,
862 PropertyManager->Tie("ic/vw-bx-fps", this,
863 &FGInitialCondition::GetWindUFpsIC);
864 PropertyManager->Tie("ic/vw-by-fps", this,
865 &FGInitialCondition::GetWindVFpsIC);
866 PropertyManager->Tie("ic/vw-bz-fps", this,
867 &FGInitialCondition::GetWindWFpsIC);
868 PropertyManager->Tie("ic/vw-north-fps", this,
869 &FGInitialCondition::GetWindNFpsIC);
870 PropertyManager->Tie("ic/vw-east-fps", this,
871 &FGInitialCondition::GetWindEFpsIC);
872 PropertyManager->Tie("ic/vw-down-fps", this,
873 &FGInitialCondition::GetWindDFpsIC);
874 PropertyManager->Tie("ic/vw-mag-fps", this,
875 &FGInitialCondition::GetWindFpsIC);
876 /* PropertyManager->Tie("ic/vw-dir-deg", this,
877 &FGInitialCondition::GetWindDirDegIC,
878 &FGInitialCondition::SetWindDirDegIC,
881 PropertyManager->Tie("ic/roc-fps", this,
882 &FGInitialCondition::GetClimbRateFpsIC,
883 &FGInitialCondition::SetClimbRateFpsIC,
885 /* PropertyManager->Tie("ic/u-fps", this,
886 &FGInitialCondition::GetUBodyFpsIC,
887 &FGInitialCondition::SetUBodyFpsIC,
889 PropertyManager->Tie("ic/v-fps", this,
890 &FGInitialCondition::GetVBodyFpsIC,
891 &FGInitialCondition::SetVBodyFpsIC,
893 PropertyManager->Tie("ic/w-fps", this,
894 &FGInitialCondition::GetWBodyFpsIC,
895 &FGInitialCondition::SetWBodyFpsIC,
898 PropertyManager->Tie("ic/gamma-rad", this,
899 &FGInitialCondition::GetFlightPathAngleRadIC,
900 &FGInitialCondition::SetFlightPathAngleRadIC,
902 PropertyManager->Tie("ic/alpha-rad", this,
903 &FGInitialCondition::GetAlphaRadIC,
904 &FGInitialCondition::SetAlphaRadIC,
906 PropertyManager->Tie("ic/theta-rad", this,
907 &FGInitialCondition::GetPitchAngleRadIC,
908 &FGInitialCondition::SetPitchAngleRadIC,
910 PropertyManager->Tie("ic/beta-rad", this,
911 &FGInitialCondition::GetBetaRadIC,
912 &FGInitialCondition::SetBetaRadIC,
914 PropertyManager->Tie("ic/phi-rad", this,
915 &FGInitialCondition::GetRollAngleRadIC,
916 &FGInitialCondition::SetRollAngleRadIC,
918 PropertyManager->Tie("ic/psi-true-rad", this,
919 &FGInitialCondition::GetHeadingRadIC);
920 PropertyManager->Tie("ic/lat-gc-rad", this,
921 &FGInitialCondition::GetLatitudeRadIC,
922 &FGInitialCondition::SetLatitudeRadIC,
924 PropertyManager->Tie("ic/long-gc-rad", this,
925 &FGInitialCondition::GetLongitudeRadIC,
926 &FGInitialCondition::SetLongitudeRadIC,
930 //******************************************************************************
932 void FGInitialCondition::unbind(void){
933 PropertyManager->Untie("ic/vc-kts");
934 PropertyManager->Untie("ic/ve-kts");
935 PropertyManager->Untie("ic/vg-kts");
936 PropertyManager->Untie("ic/vt-kts");
937 PropertyManager->Untie("ic/mach-norm");
938 PropertyManager->Untie("ic/roc-fpm");
939 PropertyManager->Untie("ic/gamma-deg");
940 PropertyManager->Untie("ic/alpha-deg");
941 PropertyManager->Untie("ic/beta-deg");
942 PropertyManager->Untie("ic/theta-deg");
943 PropertyManager->Untie("ic/phi-deg");
944 PropertyManager->Untie("ic/psi-true-deg");
945 PropertyManager->Untie("ic/lat-gc-deg");
946 PropertyManager->Untie("ic/long-gc-deg");
947 PropertyManager->Untie("ic/h-sl-ft");
948 PropertyManager->Untie("ic/h-agl-ft");
949 PropertyManager->Untie("ic/sea-level-radius-ft");
950 PropertyManager->Untie("ic/terrain-altitude-ft");
951 PropertyManager->Untie("ic/vg-fps");
952 PropertyManager->Untie("ic/vt-fps");
953 PropertyManager->Untie("ic/vw-bx-fps");
954 PropertyManager->Untie("ic/vw-by-fps");
955 PropertyManager->Untie("ic/vw-bz-fps");
956 PropertyManager->Untie("ic/vw-north-fps");
957 PropertyManager->Untie("ic/vw-east-fps");
958 PropertyManager->Untie("ic/vw-down-fps");
959 PropertyManager->Untie("ic/vw-mag-fps");
960 /* PropertyManager->Untie("ic/vw-dir-deg"); */
962 PropertyManager->Untie("ic/roc-fps");
964 /* PropertyManager->Untie("ic/u-fps");
965 PropertyManager->Untie("ic/v-fps");
966 PropertyManager->Untie("ic/w-fps"); */
968 PropertyManager->Untie("ic/gamma-rad");
969 PropertyManager->Untie("ic/alpha-rad");
970 PropertyManager->Untie("ic/theta-rad");
971 PropertyManager->Untie("ic/beta-rad");
972 PropertyManager->Untie("ic/phi-rad");
973 PropertyManager->Untie("ic/psi-true-rad");
974 PropertyManager->Untie("ic/lat-gc-rad");
975 PropertyManager->Untie("ic/long-gc-rad");
978 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
979 // The bitmasked value choices are as follows:
980 // unset: In this case (the default) JSBSim would only print
981 // out the normally expected messages, essentially echoing
982 // the config files as they are read. If the environment
983 // variable is not set, debug_lvl is set to 1 internally
984 // 0: This requests JSBSim not to output any messages
986 // 1: This value explicity requests the normal JSBSim
988 // 2: This value asks for a message to be printed out when
989 // a class is instantiated
990 // 4: When this value is set, a message is displayed when a
991 // FGModel object executes its Run() method
992 // 8: When this value is set, various runtime state variables
993 // are printed out periodically
994 // 16: When set various parameters are sanity checked and
995 // a message is printed out when they go out of bounds
997 void FGInitialCondition::Debug(int from)
999 if (debug_lvl <= 0) return;
1001 if (debug_lvl & 1) { // Standard console startup message output
1003 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1004 if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
1005 if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
1007 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1009 if (debug_lvl & 8 ) { // Runtime state variables
1011 if (debug_lvl & 16) { // Sanity checking
1013 if (debug_lvl & 64) {
1014 if (from == 0) { // Constructor
1015 cout << IdSrc << endl;
1016 cout << IdHdr << endl;