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 "FGPropagate.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)
78 sea_level_radius = FDMExec->GetInertial()->RefRadius();
79 radius_to_vehicle = FDMExec->GetInertial()->RefRadius();
82 salpha=sbeta=stheta=sphi=spsi=sgamma=0;
83 calpha=cbeta=ctheta=cphi=cpsi=cgamma=1;
85 if(FDMExec != NULL ) {
87 fdmex->GetPropagate()->Seth(altitude);
88 fdmex->GetAtmosphere()->Run();
89 PropertyManager=fdmex->GetPropertyManager();
92 cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
98 //******************************************************************************
100 FGInitialCondition::~FGInitialCondition()
106 //******************************************************************************
108 void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
110 if(getMachFromVcas(&mach,tt*ktstofps)) {
111 //cout << "Mach: " << mach << endl;
114 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
115 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
116 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
119 cout << "Failed to get Mach number for given Vc and altitude, Vc unchanged." << endl;
120 cout << "Please mail the set of initial conditions used to apeden@earthlink.net" << endl;
124 //******************************************************************************
126 void FGInitialCondition::SetVequivalentKtsIC(double tt) {
129 vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
130 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
134 //******************************************************************************
136 void FGInitialCondition::SetVgroundFpsIC(double tt) {
142 vnorth = vg*cos(psi); veast = vg*sin(psi); vdown = 0;
144 ua = u + uw; va = v + vw; wa = w + ww;
145 vt = sqrt( ua*ua + va*va + wa*wa );
147 vxz = sqrt( u*u + w*w );
148 if( w != 0 ) alpha = atan2( w, u );
149 if( vxz != 0 ) beta = atan2( v, vxz );
150 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
152 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
155 //******************************************************************************
157 void FGInitialCondition::SetVtrueFpsIC(double tt) {
160 mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
162 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
165 //******************************************************************************
167 void FGInitialCondition::SetMachIC(double tt) {
169 lastSpeedSet=setmach;
170 vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
172 ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
173 //cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
176 //******************************************************************************
178 void FGInitialCondition::SetClimbRateFpmIC(double tt) {
179 SetClimbRateFpsIC(tt/60.0);
182 //******************************************************************************
184 void FGInitialCondition::SetClimbRateFpsIC(double tt) {
189 sgamma=sin(gamma); cgamma=cos(gamma);
193 //******************************************************************************
195 void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
197 sgamma=sin(gamma); cgamma=cos(gamma);
202 //******************************************************************************
204 void FGInitialCondition::SetAlphaRadIC(double tt) {
206 salpha=sin(alpha); calpha=cos(alpha);
210 //******************************************************************************
212 void FGInitialCondition::SetPitchAngleRadIC(double tt) {
214 stheta=sin(theta); ctheta=cos(theta);
218 //******************************************************************************
220 void FGInitialCondition::SetBetaRadIC(double tt) {
222 sbeta=sin(beta); cbeta=cos(beta);
227 //******************************************************************************
229 void FGInitialCondition::SetRollAngleRadIC(double tt) {
231 sphi=sin(phi); cphi=cos(phi);
235 //******************************************************************************
237 void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
239 spsi=sin(psi); cpsi=cos(psi);
243 //******************************************************************************
245 void FGInitialCondition::SetUBodyFpsIC(double tt) {
247 vt=sqrt(u*u + v*v + w*w);
251 //******************************************************************************
253 void FGInitialCondition::SetVBodyFpsIC(double tt) {
255 vt=sqrt(u*u + v*v + w*w);
259 //******************************************************************************
261 void FGInitialCondition::SetWBodyFpsIC(double tt) {
263 vt=sqrt( u*u + v*v + w*w );
267 //******************************************************************************
269 double FGInitialCondition::GetUBodyFpsIC(void) const {
270 if(lastSpeedSet == setvg )
273 return vt*calpha*cbeta - uw;
276 //******************************************************************************
278 double FGInitialCondition::GetVBodyFpsIC(void) const {
279 if( lastSpeedSet == setvg )
282 return vt*sbeta - vw;
286 //******************************************************************************
288 double FGInitialCondition::GetWBodyFpsIC(void) const {
289 if( lastSpeedSet == setvg )
292 return vt*salpha*cbeta -ww;
295 //******************************************************************************
297 void FGInitialCondition::SetWindNEDFpsIC(double wN, double wE, double wD ) {
298 wnorth = wN; weast = wE; wdown = wD;
299 lastWindSet = setwned;
301 if(lastSpeedSet == setvg)
305 //******************************************************************************
307 // positive from left
308 void FGInitialCondition::SetHeadWindKtsIC(double head){
312 if(lastSpeedSet == setvg)
317 //******************************************************************************
319 void FGInitialCondition::SetCrossWindKtsIC(double cross){
320 wcross=cross*ktstofps;
323 if(lastSpeedSet == setvg)
328 //******************************************************************************
330 void FGInitialCondition::SetWindDownKtsIC(double wD) {
333 if(lastSpeedSet == setvg)
337 //******************************************************************************
339 void FGInitialCondition::SetWindMagKtsIC(double mag) {
343 if(lastSpeedSet == setvg)
347 //******************************************************************************
349 void FGInitialCondition::SetWindDirDegIC(double dir) {
353 if(lastSpeedSet == setvg)
358 //******************************************************************************
360 void FGInitialCondition::calcWindUVW(void) {
362 switch(lastWindSet) {
364 wnorth=wmag*cos(wdir);
365 weast=wmag*sin(wdir);
368 wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
369 weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
374 uw=wnorth*ctheta*cpsi +
377 vw=wnorth*( sphi*stheta*cpsi - cphi*spsi ) +
378 weast*( sphi*stheta*spsi + cphi*cpsi ) +
380 ww=wnorth*(cphi*stheta*cpsi + sphi*spsi) +
381 weast*(cphi*stheta*spsi - sphi*cpsi) +
385 /* cout << "FGInitialCondition::calcWindUVW: wnorth, weast, wdown "
386 << wnorth << ", " << weast << ", " << wdown << endl;
387 cout << "FGInitialCondition::calcWindUVW: theta, phi, psi "
388 << theta << ", " << phi << ", " << psi << endl;
389 cout << "FGInitialCondition::calcWindUVW: uw, vw, ww "
390 << uw << ", " << vw << ", " << ww << endl; */
394 //******************************************************************************
396 void FGInitialCondition::SetAltitudeFtIC(double tt) {
398 fdmex->GetPropagate()->Seth(altitude);
399 fdmex->GetAtmosphere()->Run();
400 //lets try to make sure the user gets what they intended
402 switch(lastSpeedSet) {
406 SetVtrueKtsIC(vt*fpstokts);
409 SetVcalibratedKtsIC(vc*fpstokts);
412 SetVequivalentKtsIC(ve*fpstokts);
423 //******************************************************************************
425 void FGInitialCondition::SetAltitudeAGLFtIC(double tt) {
426 SetAltitudeFtIC(terrain_altitude + tt);
429 //******************************************************************************
431 void FGInitialCondition::SetSeaLevelRadiusFtIC(double tt) {
432 sea_level_radius = tt;
435 //******************************************************************************
437 void FGInitialCondition::SetTerrainAltitudeFtIC(double tt) {
441 //******************************************************************************
443 void FGInitialCondition::calcUVWfromNED(void) {
444 u=vnorth*ctheta*cpsi +
447 v=vnorth*( sphi*stheta*cpsi - cphi*spsi ) +
448 veast*( sphi*stheta*spsi + cphi*cpsi ) +
450 w=vnorth*( cphi*stheta*cpsi + sphi*spsi ) +
451 veast*( cphi*stheta*spsi - sphi*cpsi ) +
455 //******************************************************************************
457 void FGInitialCondition::SetVnorthFpsIC(double tt) {
460 vt=sqrt(u*u + v*v + w*w);
464 //******************************************************************************
466 void FGInitialCondition::SetVeastFpsIC(double tt) {
469 vt=sqrt(u*u + v*v + w*w);
473 //******************************************************************************
475 void FGInitialCondition::SetVdownFpsIC(double tt) {
478 vt=sqrt(u*u + v*v + w*w);
479 SetClimbRateFpsIC(-1*vdown);
483 //******************************************************************************
485 bool FGInitialCondition::getMachFromVcas(double *Mach,double vcas) {
491 sfunc=&FGInitialCondition::calcVcas;
492 if(findInterval(vcas,guess)) {
493 if(solve(&mach,vcas))
499 //******************************************************************************
501 bool FGInitialCondition::getAlpha(void) {
503 double guess=theta-gamma;
505 if(vt < 0.01) return 0;
508 xmin=fdmex->GetAerodynamics()->GetAlphaCLMin();
509 xmax=fdmex->GetAerodynamics()->GetAlphaCLMax();
510 sfunc=&FGInitialCondition::GammaEqOfAlpha;
511 if(findInterval(0,guess)){
522 //******************************************************************************
524 bool FGInitialCondition::getTheta(void) {
526 double guess=alpha+gamma;
528 if(vt < 0.01) return 0;
532 sfunc=&FGInitialCondition::GammaEqOfTheta;
533 if(findInterval(0,guess)){
544 //******************************************************************************
546 double FGInitialCondition::GammaEqOfTheta(double Theta) {
548 double sTheta,cTheta;
550 //theta=Theta; stheta=sin(theta); ctheta=cos(theta);
551 sTheta=sin(Theta); cTheta=cos(Theta);
553 a=wdown + vt*calpha*cbeta + uw;
554 b=vt*sphi*sbeta + vw*sphi;
555 c=vt*cphi*salpha*cbeta + ww*cphi;
556 return vt*sgamma - ( a*sTheta - (b+c)*cTheta);
559 //******************************************************************************
561 double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
563 double sAlpha,cAlpha;
564 sAlpha=sin(Alpha); cAlpha=cos(Alpha);
565 a=wdown + vt*cAlpha*cbeta + uw;
566 b=vt*sphi*sbeta + vw*sphi;
567 c=vt*cphi*sAlpha*cbeta + ww*cphi;
569 return vt*sgamma - ( a*stheta - (b+c)*ctheta );
572 //******************************************************************************
574 double FGInitialCondition::calcVcas(double Mach) {
576 double p=fdmex->GetAtmosphere()->GetPressure();
577 double psl=fdmex->GetAtmosphere()->GetPressureSL();
578 double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
579 double pt,A,B,D,vcas;
581 if(Mach < 1) //calculate total pressure assuming isentropic flow
582 pt=p*pow((1 + 0.2*Mach*Mach),3.5);
584 // shock in front of pitot tube, we'll assume its normal and use
585 // the Rayleigh Pitot Tube Formula, i.e. the ratio of total
586 // pressure behind the shock to the static pressure in front
589 //the normal shock assumption should not be a bad one -- most supersonic
590 //aircraft place the pitot probe out front so that it is the forward
591 //most point on the aircraft. The real shock would, of course, take
592 //on something like the shape of a rounded-off cone but, here again,
593 //the assumption should be good since the opening of the pitot probe
594 //is very small and, therefore, the effects of the shock curvature
595 //should be small as well. AFAIK, this approach is fairly well accepted
596 //within the aerospace community
598 B = 5.76*Mach*Mach/(5.6*Mach*Mach - 0.8);
600 // The denominator above is zero for Mach ~ 0.38, for which
601 // we'll never be here, so we're safe
603 D = (2.8*Mach*Mach-0.4)*0.4167;
607 A = pow(((pt-p)/psl+1),0.28571);
608 vcas = sqrt(7*psl/rhosl*(A-1));
609 //cout << "calcVcas: vcas= " << vcas*fpstokts << " mach= " << Mach << " pressure: " << pt << endl;
613 //******************************************************************************
615 bool FGInitialCondition::findInterval(double x,double guess) {
616 //void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
620 double flo,fhi,fguess;
623 fguess=(this->*sfunc)(guess)-x;
629 if(lo < xmin) lo=xmin;
630 if(hi > xmax) hi=xmax;
632 flo=(this->*sfunc)(lo)-x;
633 fhi=(this->*sfunc)(hi)-x;
634 if(flo*fhi <=0) { //found interval with root
636 if(flo*fguess <= 0) { //narrow interval down a bit
637 hi=lo+step; //to pass solver interval that is as
640 else if(fhi*fguess <= 0) {
644 //cout << "findInterval: i=" << i << " Lo= " << lo << " Hi= " << hi << endl;
646 while((found == 0) && (i <= 100));
652 //******************************************************************************
654 bool FGInitialCondition::solve(double *y,double x)
656 double x1,x2,x3,f1,f2,f3,d,d0;
658 double const relax =0.9;
666 f1=(this->*sfunc)(x1)-x;
667 f3=(this->*sfunc)(x3)-x;
672 while ((fabs(d) > eps) && (i < 100)) {
674 x2 = x1-d*d0*f1/(f3-f1);
676 f2=(this->*sfunc)(x2)-x;
677 //cout << "solve x1,x2,x3: " << x1 << "," << x2 << "," << x3 << endl;
678 //cout << " " << f1 << "," << f2 << "," << f3 << endl;
680 if(fabs(f2) <= 0.001) {
682 } else if(f1*f2 <= 0.0) {
686 } else if(f2*f3 <= 0) {
699 //cout << "Success= " << success << " Vcas: " << vcas*fpstokts << " Mach: " << x2 << endl;
703 //******************************************************************************
705 double FGInitialCondition::GetWindDirDegIC(void) {
707 return atan2(weast,wnorth)*radtodeg;
714 //******************************************************************************
716 bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
718 string resetDef, acpath;
728 if( useStoredPath ) {
729 acpath = fdmex->GetAircraftPath() + sep + fdmex->GetModelName();
730 resetDef = acpath + sep + rstfile + ".xml";
735 FGConfigFile resetfile(resetDef);
736 if (!resetfile.IsOpen()) {
737 cerr << "Failed to open reset file: " << resetDef << endl;
741 resetfile.GetNextConfigLine();
742 token = resetfile.GetValue();
743 if (token != string("initialize")) {
744 cerr << "The reset file " << resetDef
745 << " does not appear to be a reset file" << endl;
749 resetfile.GetNextConfigLine();
751 while (token != string("/initialize") && token != string("EOF")) {
752 if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
753 if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
754 if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }
755 if (token == "LATITUDE" ) { resetfile >> temp; SetLatitudeDegIC(temp); }
756 if (token == "LONGITUDE" ) { resetfile >> temp; SetLongitudeDegIC(temp); }
757 if (token == "PHI" ) { resetfile >> temp; SetRollAngleDegIC(temp); }
758 if (token == "THETA" ) { resetfile >> temp; SetPitchAngleDegIC(temp); }
759 if (token == "PSI" ) { resetfile >> temp; SetTrueHeadingDegIC(temp); }
760 if (token == "ALPHA" ) { resetfile >> temp; SetAlphaDegIC(temp); }
761 if (token == "BETA" ) { resetfile >> temp; SetBetaDegIC(temp); }
762 if (token == "GAMMA" ) { resetfile >> temp; SetFlightPathAngleDegIC(temp); }
763 if (token == "ROC" ) { resetfile >> temp; SetClimbRateFpmIC(temp); }
764 if (token == "ALTITUDE" ) { resetfile >> temp; SetAltitudeFtIC(temp); }
765 if (token == "WINDDIR" ) { resetfile >> temp; SetWindDirDegIC(temp); }
766 if (token == "VWIND" ) { resetfile >> temp; SetWindMagKtsIC(temp); }
767 if (token == "HWIND" ) { resetfile >> temp; SetHeadWindKtsIC(temp); }
768 if (token == "XWIND" ) { resetfile >> temp; SetCrossWindKtsIC(temp); }
769 if (token == "VC" ) { resetfile >> temp; SetVcalibratedKtsIC(temp); }
770 if (token == "MACH" ) { resetfile >> temp; SetMachIC(temp); }
771 if (token == "VGROUND" ) { resetfile >> temp; SetVgroundKtsIC(temp); }
780 //******************************************************************************
782 void FGInitialCondition::bind(void){
783 PropertyManager->Tie("ic/vc-kts", this,
784 &FGInitialCondition::GetVcalibratedKtsIC,
785 &FGInitialCondition::SetVcalibratedKtsIC,
787 PropertyManager->Tie("ic/ve-kts", this,
788 &FGInitialCondition::GetVequivalentKtsIC,
789 &FGInitialCondition::SetVequivalentKtsIC,
791 PropertyManager->Tie("ic/vg-kts", this,
792 &FGInitialCondition::GetVgroundKtsIC,
793 &FGInitialCondition::SetVgroundKtsIC,
795 PropertyManager->Tie("ic/vt-kts", this,
796 &FGInitialCondition::GetVtrueKtsIC,
797 &FGInitialCondition::SetVtrueKtsIC,
799 PropertyManager->Tie("ic/mach-norm", this,
800 &FGInitialCondition::GetMachIC,
801 &FGInitialCondition::SetMachIC,
803 PropertyManager->Tie("ic/roc-fpm", this,
804 &FGInitialCondition::GetClimbRateFpmIC,
805 &FGInitialCondition::SetClimbRateFpmIC,
807 PropertyManager->Tie("ic/gamma-deg", this,
808 &FGInitialCondition::GetFlightPathAngleDegIC,
809 &FGInitialCondition::SetFlightPathAngleDegIC,
811 PropertyManager->Tie("ic/alpha-deg", this,
812 &FGInitialCondition::GetAlphaDegIC,
813 &FGInitialCondition::SetAlphaDegIC,
815 PropertyManager->Tie("ic/beta-deg", this,
816 &FGInitialCondition::GetBetaDegIC,
817 &FGInitialCondition::SetBetaDegIC,
819 PropertyManager->Tie("ic/theta-deg", this,
820 &FGInitialCondition::GetPitchAngleDegIC,
821 &FGInitialCondition::SetPitchAngleDegIC,
823 PropertyManager->Tie("ic/phi-deg", this,
824 &FGInitialCondition::GetRollAngleDegIC,
825 &FGInitialCondition::SetRollAngleDegIC,
827 PropertyManager->Tie("ic/psi-true-deg", this,
828 &FGInitialCondition::GetHeadingDegIC );
829 PropertyManager->Tie("ic/lat-gc-deg", this,
830 &FGInitialCondition::GetLatitudeDegIC,
831 &FGInitialCondition::SetLatitudeDegIC,
833 PropertyManager->Tie("ic/long-gc-deg", this,
834 &FGInitialCondition::GetLongitudeDegIC,
835 &FGInitialCondition::SetLongitudeDegIC,
837 PropertyManager->Tie("ic/h-sl-ft", this,
838 &FGInitialCondition::GetAltitudeFtIC,
839 &FGInitialCondition::SetAltitudeFtIC,
841 PropertyManager->Tie("ic/h-agl-ft", this,
842 &FGInitialCondition::GetAltitudeAGLFtIC,
843 &FGInitialCondition::SetAltitudeAGLFtIC,
845 PropertyManager->Tie("ic/sea-level-radius-ft", this,
846 &FGInitialCondition::GetSeaLevelRadiusFtIC,
847 &FGInitialCondition::SetSeaLevelRadiusFtIC,
849 PropertyManager->Tie("ic/terrain-altitude-ft", this,
850 &FGInitialCondition::GetTerrainAltitudeFtIC,
851 &FGInitialCondition::SetTerrainAltitudeFtIC,
853 PropertyManager->Tie("ic/vg-fps", this,
854 &FGInitialCondition::GetVgroundFpsIC,
855 &FGInitialCondition::SetVgroundFpsIC,
857 PropertyManager->Tie("ic/vt-fps", this,
858 &FGInitialCondition::GetVtrueFpsIC,
859 &FGInitialCondition::SetVtrueFpsIC,
861 PropertyManager->Tie("ic/vw-bx-fps", this,
862 &FGInitialCondition::GetWindUFpsIC);
863 PropertyManager->Tie("ic/vw-by-fps", this,
864 &FGInitialCondition::GetWindVFpsIC);
865 PropertyManager->Tie("ic/vw-bz-fps", this,
866 &FGInitialCondition::GetWindWFpsIC);
867 PropertyManager->Tie("ic/vw-north-fps", this,
868 &FGInitialCondition::GetWindNFpsIC);
869 PropertyManager->Tie("ic/vw-east-fps", this,
870 &FGInitialCondition::GetWindEFpsIC);
871 PropertyManager->Tie("ic/vw-down-fps", this,
872 &FGInitialCondition::GetWindDFpsIC);
873 PropertyManager->Tie("ic/vw-mag-fps", this,
874 &FGInitialCondition::GetWindFpsIC);
875 /* PropertyManager->Tie("ic/vw-dir-deg", this,
876 &FGInitialCondition::GetWindDirDegIC,
877 &FGInitialCondition::SetWindDirDegIC,
880 PropertyManager->Tie("ic/roc-fps", this,
881 &FGInitialCondition::GetClimbRateFpsIC,
882 &FGInitialCondition::SetClimbRateFpsIC,
884 /* PropertyManager->Tie("ic/u-fps", this,
885 &FGInitialCondition::GetUBodyFpsIC,
886 &FGInitialCondition::SetUBodyFpsIC,
888 PropertyManager->Tie("ic/v-fps", this,
889 &FGInitialCondition::GetVBodyFpsIC,
890 &FGInitialCondition::SetVBodyFpsIC,
892 PropertyManager->Tie("ic/w-fps", this,
893 &FGInitialCondition::GetWBodyFpsIC,
894 &FGInitialCondition::SetWBodyFpsIC,
897 PropertyManager->Tie("ic/gamma-rad", this,
898 &FGInitialCondition::GetFlightPathAngleRadIC,
899 &FGInitialCondition::SetFlightPathAngleRadIC,
901 PropertyManager->Tie("ic/alpha-rad", this,
902 &FGInitialCondition::GetAlphaRadIC,
903 &FGInitialCondition::SetAlphaRadIC,
905 PropertyManager->Tie("ic/theta-rad", this,
906 &FGInitialCondition::GetPitchAngleRadIC,
907 &FGInitialCondition::SetPitchAngleRadIC,
909 PropertyManager->Tie("ic/beta-rad", this,
910 &FGInitialCondition::GetBetaRadIC,
911 &FGInitialCondition::SetBetaRadIC,
913 PropertyManager->Tie("ic/phi-rad", this,
914 &FGInitialCondition::GetRollAngleRadIC,
915 &FGInitialCondition::SetRollAngleRadIC,
917 PropertyManager->Tie("ic/psi-true-rad", this,
918 &FGInitialCondition::GetHeadingRadIC);
919 PropertyManager->Tie("ic/lat-gc-rad", this,
920 &FGInitialCondition::GetLatitudeRadIC,
921 &FGInitialCondition::SetLatitudeRadIC,
923 PropertyManager->Tie("ic/long-gc-rad", this,
924 &FGInitialCondition::GetLongitudeRadIC,
925 &FGInitialCondition::SetLongitudeRadIC,
927 PropertyManager->Tie("ic/p-rad_sec", this,
928 &FGInitialCondition::GetPRadpsIC,
929 &FGInitialCondition::SetPRadpsIC,
931 PropertyManager->Tie("ic/q-rad_sec", this,
932 &FGInitialCondition::GetQRadpsIC,
933 &FGInitialCondition::SetQRadpsIC,
935 PropertyManager->Tie("ic/r-rad_sec", this,
936 &FGInitialCondition::GetRRadpsIC,
937 &FGInitialCondition::SetRRadpsIC,
942 //******************************************************************************
944 void FGInitialCondition::unbind(void){
945 PropertyManager->Untie("ic/vc-kts");
946 PropertyManager->Untie("ic/ve-kts");
947 PropertyManager->Untie("ic/vg-kts");
948 PropertyManager->Untie("ic/vt-kts");
949 PropertyManager->Untie("ic/mach-norm");
950 PropertyManager->Untie("ic/roc-fpm");
951 PropertyManager->Untie("ic/gamma-deg");
952 PropertyManager->Untie("ic/alpha-deg");
953 PropertyManager->Untie("ic/beta-deg");
954 PropertyManager->Untie("ic/theta-deg");
955 PropertyManager->Untie("ic/phi-deg");
956 PropertyManager->Untie("ic/psi-true-deg");
957 PropertyManager->Untie("ic/lat-gc-deg");
958 PropertyManager->Untie("ic/long-gc-deg");
959 PropertyManager->Untie("ic/h-sl-ft");
960 PropertyManager->Untie("ic/h-agl-ft");
961 PropertyManager->Untie("ic/sea-level-radius-ft");
962 PropertyManager->Untie("ic/terrain-altitude-ft");
963 PropertyManager->Untie("ic/vg-fps");
964 PropertyManager->Untie("ic/vt-fps");
965 PropertyManager->Untie("ic/vw-bx-fps");
966 PropertyManager->Untie("ic/vw-by-fps");
967 PropertyManager->Untie("ic/vw-bz-fps");
968 PropertyManager->Untie("ic/vw-north-fps");
969 PropertyManager->Untie("ic/vw-east-fps");
970 PropertyManager->Untie("ic/vw-down-fps");
971 PropertyManager->Untie("ic/vw-mag-fps");
972 /* PropertyManager->Untie("ic/vw-dir-deg"); */
974 PropertyManager->Untie("ic/roc-fps");
976 /* PropertyManager->Untie("ic/u-fps");
977 PropertyManager->Untie("ic/v-fps");
978 PropertyManager->Untie("ic/w-fps"); */
980 PropertyManager->Untie("ic/gamma-rad");
981 PropertyManager->Untie("ic/alpha-rad");
982 PropertyManager->Untie("ic/theta-rad");
983 PropertyManager->Untie("ic/beta-rad");
984 PropertyManager->Untie("ic/phi-rad");
985 PropertyManager->Untie("ic/psi-true-rad");
986 PropertyManager->Untie("ic/lat-gc-rad");
987 PropertyManager->Untie("ic/long-gc-rad");
988 PropertyManager->Untie("ic/p-rad_sec");
989 PropertyManager->Untie("ic/q-rad_sec");
990 PropertyManager->Untie("ic/r-rad_sec");
994 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995 // The bitmasked value choices are as follows:
996 // unset: In this case (the default) JSBSim would only print
997 // out the normally expected messages, essentially echoing
998 // the config files as they are read. If the environment
999 // variable is not set, debug_lvl is set to 1 internally
1000 // 0: This requests JSBSim not to output any messages
1002 // 1: This value explicity requests the normal JSBSim
1004 // 2: This value asks for a message to be printed out when
1005 // a class is instantiated
1006 // 4: When this value is set, a message is displayed when a
1007 // FGModel object executes its Run() method
1008 // 8: When this value is set, various runtime state variables
1009 // are printed out periodically
1010 // 16: When set various parameters are sanity checked and
1011 // a message is printed out when they go out of bounds
1013 void FGInitialCondition::Debug(int from)
1015 if (debug_lvl <= 0) return;
1017 if (debug_lvl & 1) { // Standard console startup message output
1019 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1020 if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
1021 if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
1023 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1025 if (debug_lvl & 8 ) { // Runtime state variables
1027 if (debug_lvl & 16) { // Sanity checking
1029 if (debug_lvl & 64) {
1030 if (from == 0) { // Constructor
1031 cout << IdSrc << endl;
1032 cout << IdHdr << endl;