1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 Called by: FGFDMExec and accessed by all models.
8 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 You should have received a copy of the GNU General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307, USA.
24 Further information about the GNU General Public License can also be found on
25 the world wide web at http://www.gnu.org.
27 FUNCTIONAL DESCRIPTION
28 --------------------------------------------------------------------------------
32 --------------------------------------------------------------------------------
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 # include <simgear/compiler.h>
43 # if defined(sgi) && !defined(__GNUC__)
51 #define snprintf _snprintf
56 static const char *IdSrc = "$Id$";
57 static const char *IdHdr = ID_STATE;
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 //#define RegisterVariable(ID,DEF) coeffdef[#ID] = ID; paramdef[ID] = DEF
64 #define RegisterVariable(ID,DEF) coeffdef[#ID] = ID;
66 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
70 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 // For every term registered here there must be a corresponding handler in
73 // GetParameter() below that retrieves that parameter. Also, there must be an
74 // entry in the enum eParam definition in FGJSBBase.h. The ID is what must be used
75 // in any config file entry which references that item.
77 FGState::FGState(FGFDMExec* fdex)
86 Aircraft = FDMExec->GetAircraft();
87 Translation = FDMExec->GetTranslation();
88 Rotation = FDMExec->GetRotation();
89 Position = FDMExec->GetPosition();
90 FCS = FDMExec->GetFCS();
91 Output = FDMExec->GetOutput();
92 Atmosphere = FDMExec->GetAtmosphere();
93 Aerodynamics = FDMExec->GetAerodynamics();
94 GroundReactions = FDMExec->GetGroundReactions();
95 Propulsion = FDMExec->GetPropulsion();
96 PropertyManager = FDMExec->GetPropertyManager();
105 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 //***************************************************************************
115 // Reset: Assume all angles READ FROM FILE IN DEGREES !!
118 bool FGState::Reset(string path, string acname, string fname)
124 double phi, tht, psi;
125 double latitude, longitude, h;
126 double wdir, wmag, wnorth, weast;
129 resetDef = path + "/" + acname + "/" + fname + ".xml";
131 resetDef = path + ";" + acname + ";" + fname + ".xml";
134 FGConfigFile resetfile(resetDef);
135 if (!resetfile.IsOpen()) return false;
137 resetfile.GetNextConfigLine();
138 token = resetfile.GetValue();
139 if (token != string("initialize")) {
140 cerr << "The reset file " << resetDef
141 << " does not appear to be a reset file" << endl;
144 resetfile.GetNextConfigLine();
146 cout << "Resetting using: " << token << endl << endl;
149 while (token != string("/initialize") && token != string("EOF")) {
150 if (token == "UBODY") resetfile >> U;
151 if (token == "VBODY") resetfile >> V;
152 if (token == "WBODY") resetfile >> W;
153 if (token == "LATITUDE") resetfile >> latitude;
154 if (token == "LONGITUDE") resetfile >> longitude;
155 if (token == "PHI") resetfile >> phi;
156 if (token == "THETA") resetfile >> tht;
157 if (token == "PSI") resetfile >> psi;
158 if (token == "ALTITUDE") resetfile >> h;
159 if (token == "WINDDIR") resetfile >> wdir;
160 if (token == "VWIND") resetfile >> wmag;
166 Position->SetLatitude(latitude*degtorad);
167 Position->SetLongitude(longitude*degtorad);
170 wnorth = wmag*ktstofps*cos(wdir*degtorad);
171 weast = wmag*ktstofps*sin(wdir*degtorad);
173 Initialize(U, V, W, phi*degtorad, tht*degtorad, psi*degtorad,
174 latitude*degtorad, longitude*degtorad, h, wnorth, weast, 0.0);
179 //***************************************************************************
181 // Initialize: Assume all angles GIVEN IN RADIANS !!
184 void FGState::Initialize(double U, double V, double W,
185 double phi, double tht, double psi,
186 double Latitude, double Longitude, double H,
187 double wnorth, double weast, double wdown)
191 FGColumnVector3 vAeroUVW;
193 Position->SetLatitude(Latitude);
194 Position->SetLongitude(Longitude);
199 vLocalEuler << phi << tht << psi;
200 Rotation->SetEuler(vLocalEuler);
202 InitMatrices(phi, tht, psi);
205 Translation->SetUVW(vUVW);
207 Atmosphere->SetWindNED(wnorth, weast, wdown);
209 vAeroUVW = vUVW + mTl2b*Atmosphere->GetWindNED();
211 if (vAeroUVW(eW) != 0.0)
212 alpha = vAeroUVW(eU)*vAeroUVW(eU) > 0.0 ? atan2(vAeroUVW(eW), vAeroUVW(eU)) : 0.0;
215 if (vAeroUVW(eV) != 0.0)
216 beta = vAeroUVW(eU)*vAeroUVW(eU)+vAeroUVW(eW)*vAeroUVW(eW) > 0.0 ? atan2(vAeroUVW(eV), (fabs(vAeroUVW(eU))/vAeroUVW(eU))*sqrt(vAeroUVW(eU)*vAeroUVW(eU) + vAeroUVW(eW)*vAeroUVW(eW))) : 0.0;
220 Translation->SetAB(alpha, beta);
222 Vt = sqrt(U*U + V*V + W*W);
223 Translation->SetVt(Vt);
225 Translation->SetMach(Vt/Atmosphere->GetSoundSpeed());
227 qbar = 0.5*(U*U + V*V + W*W)*Atmosphere->GetDensity();
228 Translation->Setqbar(qbar);
230 vLocalVelNED = mTb2l*vUVW;
231 Position->SetvVel(vLocalVelNED);
234 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236 void FGState::Initialize(FGInitialCondition *FGIC)
240 double latitude, longitude;
241 double wnorth,weast, wdown;
243 latitude = FGIC->GetLatitudeRadIC();
244 longitude = FGIC->GetLongitudeRadIC();
245 h = FGIC->GetAltitudeFtIC();
246 U = FGIC->GetUBodyFpsIC();
247 V = FGIC->GetVBodyFpsIC();
248 W = FGIC->GetWBodyFpsIC();
249 tht = FGIC->GetThetaRadIC();
250 phi = FGIC->GetPhiRadIC();
251 psi = FGIC->GetPsiRadIC();
252 wnorth = FGIC->GetWindNFpsIC();
253 weast = FGIC->GetWindEFpsIC();
254 wdown = FGIC->GetWindDFpsIC();
256 Position->SetSeaLevelRadius( FGIC->GetSeaLevelRadiusFtIC() );
257 Position->SetRunwayRadius( FGIC->GetSeaLevelRadiusFtIC() +
258 FGIC->GetTerrainAltitudeFtIC() );
260 // need to fix the wind speed args, here.
261 Initialize(U, V, W, phi, tht, psi, latitude, longitude, h, wnorth, weast, wdown);
264 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266 void FGState::InitMatrices(double phi, double tht, double psi)
268 double thtd2, psid2, phid2;
269 double Sthtd2, Spsid2, Sphid2;
270 double Cthtd2, Cpsid2, Cphid2;
288 Cphid2Cthtd2 = Cphid2*Cthtd2;
289 Cphid2Sthtd2 = Cphid2*Sthtd2;
290 Sphid2Sthtd2 = Sphid2*Sthtd2;
291 Sphid2Cthtd2 = Sphid2*Cthtd2;
293 vQtrn(1) = Cphid2Cthtd2*Cpsid2 + Sphid2Sthtd2*Spsid2;
294 vQtrn(2) = Sphid2Cthtd2*Cpsid2 - Cphid2Sthtd2*Spsid2;
295 vQtrn(3) = Cphid2Sthtd2*Cpsid2 + Sphid2Cthtd2*Spsid2;
296 vQtrn(4) = Cphid2Cthtd2*Spsid2 - Sphid2Sthtd2*Cpsid2;
301 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
303 void FGState::CalcMatrices(void)
305 double Q0Q0, Q1Q1, Q2Q2, Q3Q3;
306 double Q0Q1, Q0Q2, Q0Q3, Q1Q2;
309 Q0Q0 = vQtrn(1)*vQtrn(1);
310 Q1Q1 = vQtrn(2)*vQtrn(2);
311 Q2Q2 = vQtrn(3)*vQtrn(3);
312 Q3Q3 = vQtrn(4)*vQtrn(4);
313 Q0Q1 = vQtrn(1)*vQtrn(2);
314 Q0Q2 = vQtrn(1)*vQtrn(3);
315 Q0Q3 = vQtrn(1)*vQtrn(4);
316 Q1Q2 = vQtrn(2)*vQtrn(3);
317 Q1Q3 = vQtrn(2)*vQtrn(4);
318 Q2Q3 = vQtrn(3)*vQtrn(4);
320 mTl2b(1,1) = Q0Q0 + Q1Q1 - Q2Q2 - Q3Q3;
321 mTl2b(1,2) = 2*(Q1Q2 + Q0Q3);
322 mTl2b(1,3) = 2*(Q1Q3 - Q0Q2);
323 mTl2b(2,1) = 2*(Q1Q2 - Q0Q3);
324 mTl2b(2,2) = Q0Q0 - Q1Q1 + Q2Q2 - Q3Q3;
325 mTl2b(2,3) = 2*(Q2Q3 + Q0Q1);
326 mTl2b(3,1) = 2*(Q1Q3 + Q0Q2);
327 mTl2b(3,2) = 2*(Q2Q3 - Q0Q1);
328 mTl2b(3,3) = Q0Q0 - Q1Q1 - Q2Q2 + Q3Q3;
334 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
336 void FGState::IntegrateQuat(FGColumnVector3 vPQR, int rate)
338 vQdot(1) = -0.5*(vQtrn(2)*vPQR(eP) + vQtrn(3)*vPQR(eQ) + vQtrn(4)*vPQR(eR));
339 vQdot(2) = 0.5*(vQtrn(1)*vPQR(eP) + vQtrn(3)*vPQR(eR) - vQtrn(4)*vPQR(eQ));
340 vQdot(3) = 0.5*(vQtrn(1)*vPQR(eQ) + vQtrn(4)*vPQR(eP) - vQtrn(2)*vPQR(eR));
341 vQdot(4) = 0.5*(vQtrn(1)*vPQR(eR) + vQtrn(2)*vPQR(eQ) - vQtrn(3)*vPQR(eP));
342 vQtrn += 0.5*dt*rate*(vlastQdot + vQdot);
349 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
351 FGColumnVector3& FGState::CalcEuler(void)
353 if (mTl2b(3,3) == 0.0) mTl2b(3,3) = 0.0000001;
354 if (mTl2b(1,1) == 0.0) mTl2b(1,1) = 0.0000001;
356 vEuler(ePhi) = atan2(mTl2b(2,3), mTl2b(3,3));
357 vEuler(eTht) = asin(-mTl2b(1,3));
358 vEuler(ePsi) = atan2(mTl2b(1,2), mTl2b(1,1));
360 if (vEuler(ePsi) < 0.0) vEuler(ePsi) += 2*M_PI;
365 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367 FGMatrix33& FGState::GetTs2b(void)
369 double ca, cb, sa, sb;
371 double alpha = Translation->Getalpha();
372 double beta = Translation->Getbeta();
392 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 FGMatrix33& FGState::GetTb2s(void)
397 float ca, cb, sa, sb;
399 alpha = Translation->Getalpha();
400 beta = Translation->Getbeta();
420 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
422 void FGState::ReportState(void)
424 #if !defined(__BORLANDCPP__)
425 char out[80], flap[10], gear[12];
427 cout << endl << " JSBSim State" << endl;
428 snprintf(out,80," Weight: %7.0f lbs. CG: %5.1f, %5.1f, %5.1f inches\n",
429 FDMExec->GetMassBalance()->GetWeight(),
430 FDMExec->GetMassBalance()->GetXYZcg(1),
431 FDMExec->GetMassBalance()->GetXYZcg(2),
432 FDMExec->GetMassBalance()->GetXYZcg(3));
434 if ( FCS->GetDfPos() <= 0.01)
435 snprintf(flap,10,"Up");
437 snprintf(flap,10,"%2.0f",FCS->GetDfPos());
439 if (FCS->GetGearPos() < 0.01)
440 snprintf(gear,12,"Up");
441 else if (FCS->GetGearPos() > 0.99)
442 snprintf(gear,12,"Down");
444 snprintf(gear,12,"In Transit");
446 snprintf(out,80, " Flaps: %3s Gear: %12s\n",flap,gear);
448 snprintf(out,80, " Speed: %4.0f KCAS Mach: %5.2f\n",
449 FDMExec->GetAuxiliary()->GetVcalibratedKTS(),
450 Translation->GetMach() );
452 snprintf(out,80, " Altitude: %7.0f ft. AGL Altitude: %7.0f ft.\n",
454 Position->GetDistanceAGL() );
456 snprintf(out,80, " Angle of Attack: %6.2f deg Pitch Angle: %6.2f deg\n",
457 Translation->Getalpha()*radtodeg,
458 Rotation->Gettht()*radtodeg );
460 snprintf(out,80, " Flight Path Angle: %6.2f deg Climb Rate: %5.0f ft/min\n",
461 Position->GetGamma()*radtodeg,
462 Position->Gethdot()*60 );
464 snprintf(out,80, " Normal Load Factor: %4.2f g's Pitch Rate: %5.2f deg/s\n",
466 Rotation->GetPQR(2)*radtodeg );
468 snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg Yaw Rate: %5.2f deg/s\n",
469 Rotation->Getpsi()*radtodeg,
470 Translation->Getbeta()*radtodeg,
471 Rotation->GetPQR(3)*radtodeg );
473 snprintf(out,80, " Bank Angle: %5.2f deg Roll Rate: %5.2f deg/s\n",
474 Rotation->Getphi()*radtodeg,
475 Rotation->GetPQR(1)*radtodeg );
477 snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n",
478 FCS->GetDePos(ofRad)*radtodeg,
479 FCS->GetDaLPos(ofRad)*radtodeg,
480 FCS->GetDrPos(ofRad)*radtodeg );
482 snprintf(out,80, " Throttle: %5.2f%c\n",
483 FCS->GetThrottlePos(0)*100,'%' );
486 snprintf(out,80, " Wind Components: %5.2f kts head wind, %5.2f kts cross wind\n",
487 FDMExec->GetAuxiliary()->GetHeadWind()*fpstokts,
488 FDMExec->GetAuxiliary()->GetCrossWind()*fpstokts );
491 snprintf(out,80, " Ground Speed: %4.0f knots , Ground Track: %3.0f deg true\n",
492 Position->GetVground()*fpstokts,
493 Position->GetGroundTrack()*radtodeg );
498 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500 void FGState::InitPropertyMaps(void)
502 ParamNameToProp[ "FG_TIME" ]="sim-time-sec";
503 ParamNameToProp[ "FG_QBAR" ]="aero/qbar-psf";
504 ParamNameToProp[ "FG_WINGAREA" ]="metrics/Sw-sqft";
505 ParamNameToProp[ "FG_WINGSPAN" ]="metrics/bw-ft";
506 ParamNameToProp[ "FG_CBAR" ]="metrics/cbarw-ft";
507 ParamNameToProp[ "FG_ALPHA" ]="aero/alpha-rad";
508 ParamNameToProp[ "FG_ALPHADOT" ]="aero/alphadot-rad_sec";
509 ParamNameToProp[ "FG_BETA" ]="aero/beta-rad";
510 ParamNameToProp[ "FG_ABETA" ]="aero/mag-beta-rad";
511 ParamNameToProp[ "FG_BETADOT" ]="aero/betadot-rad_sec";
512 ParamNameToProp[ "FG_PHI" ]="attitude/phi-rad";
513 ParamNameToProp[ "FG_THT" ]="attitude/theta-rad";
514 ParamNameToProp[ "FG_PSI" ]="attitude/psi-true-rad";
515 ParamNameToProp[ "FG_PITCHRATE" ]="velocities/q-rad_sec";
516 ParamNameToProp[ "FG_ROLLRATE" ]="velocities/p-rad_sec";
517 ParamNameToProp[ "FG_YAWRATE" ]="velocities/r-rad_sec";
518 ParamNameToProp[ "FG_AEROP" ]="velocities/p-aero-rad_sec";
519 ParamNameToProp[ "FG_AEROQ" ]="velocities/q-aero-rad_sec";
520 ParamNameToProp[ "FG_AEROR" ]="velocities/r-aero-rad_sec";
521 ParamNameToProp[ "FG_CL_SQRD" ]="aero/cl-squared-norm";
522 ParamNameToProp[ "FG_MACH" ]="velocities/mach-norm";
523 ParamNameToProp[ "FG_ALTITUDE" ]="position/h-sl-ft";
524 ParamNameToProp[ "FG_BI2VEL" ]="aero/bi2vel";
525 ParamNameToProp[ "FG_CI2VEL" ]="aero/ci2vel";
526 ParamNameToProp[ "FG_ELEVATOR_POS" ]="fcs/elevator-pos-rad";
527 ParamNameToProp[ "FG_AELEVATOR_POS" ]="fcs/mag-elevator-pos-rad";
528 ParamNameToProp[ "FG_NELEVATOR_POS" ]="fcs/elevator-pos-norm";
529 ParamNameToProp[ "FG_AILERON_POS" ]="fcs/left-aileron-pos-rad";
530 ParamNameToProp[ "FG_AAILERON_POS" ]="fcs/mag-aileron-pos-rad";
531 ParamNameToProp[ "FG_NAILERON_POS" ]="fcs/left-aileron-pos-norm";
532 ParamNameToProp[ "FG_LEFT_AILERON_POS" ]="fcs/left-aileron-pos-rad";
533 ParamNameToProp[ "FG_ALEFT_AILERON_POS" ]="fcs/mag-left-aileron-pos-rad";
534 ParamNameToProp[ "FG_NLEFT_AILERON_POS" ]="fcs/left-aileron-pos-norm";
535 ParamNameToProp[ "FG_RIGHT_AILERON_POS" ]="fcs/right-aileron-pos-rad";
536 ParamNameToProp[ "FG_ARIGHT_AILERON_POS" ]="fcs/mag-aileron-pos-rad";
537 ParamNameToProp[ "FG_NRIGHT_AILERON_POS" ]="fcs/right-aileron-pos-norm";
538 ParamNameToProp[ "FG_RUDDER_POS" ]="fcs/rudder-pos-rad";
539 ParamNameToProp[ "FG_ARUDDER_POS" ]="fcs/mag-rudder-pos-rad";
540 ParamNameToProp[ "FG_NRUDDER_POS" ]="fcs/rudder-pos-norm";
541 ParamNameToProp[ "FG_SPDBRAKE_POS" ]="fcs/speedbrake-pos-rad";
542 ParamNameToProp[ "FG_NSPDBRAKE_POS" ]="fcs/speedbrake-pos-norm";
543 ParamNameToProp[ "FG_SPOILERS_POS" ]="fcs/spoiler-pos-rad";
544 ParamNameToProp[ "FG_NSPOILERS_POS" ]="fcs/spoiler-pos-norm";
545 ParamNameToProp[ "FG_FLAPS_POS" ]="fcs/flap-pos-deg";
546 ParamNameToProp[ "FG_NFLAPS_POS" ]="fcs/flap-pos-norm";
547 ParamNameToProp[ "FG_ELEVATOR_CMD" ]="fcs/elevator-cmd-norm";
548 ParamNameToProp[ "FG_AILERON_CMD" ]="fcs/aileron-cmd-norm";
549 ParamNameToProp[ "FG_RUDDER_CMD" ]="fcs/rudder-cmd-norm";
550 ParamNameToProp[ "FG_SPDBRAKE_CMD" ]="fcs/speedbrake-cmd-norm";
551 ParamNameToProp[ "FG_SPOILERS_CMD" ]="fcs/spoiler-cmd-norm";
552 ParamNameToProp[ "FG_FLAPS_CMD" ]="fcs/flap-cmd-norm";
553 ParamNameToProp[ "FG_THROTTLE_CMD" ]="fcs/throttle-cmd-norm";
554 ParamNameToProp[ "FG_THROTTLE_POS" ]="fcs/throttle-pos-norm";
555 ParamNameToProp[ "FG_MIXTURE_CMD" ]="fcs/mixture-cmd-norm";
556 ParamNameToProp[ "FG_MIXTURE_POS" ]="fcs/mixture-pos-norm";
557 ParamNameToProp[ "FG_MAGNETO_CMD" ]="zero";
558 ParamNameToProp[ "FG_STARTER_CMD" ]="zero";
559 ParamNameToProp[ "FG_ACTIVE_ENGINE" ]="zero";
560 ParamNameToProp[ "FG_HOVERB" ]="aero/h_b-mac-ft";
561 ParamNameToProp[ "FG_PITCH_TRIM_CMD" ]="fcs/pitch-trim-cmd-norm";
562 ParamNameToProp[ "FG_YAW_TRIM_CMD" ]="fcs/yaw-trim-cmd-norm";
563 ParamNameToProp[ "FG_ROLL_TRIM_CMD" ]="fcs/roll-trim-cmd-norm";
564 ParamNameToProp[ "FG_LEFT_BRAKE_CMD" ]="zero";
565 ParamNameToProp[ "FG_CENTER_BRAKE_CMD" ]="zero";
566 ParamNameToProp[ "FG_RIGHT_BRAKE_CMD" ]="zero";
567 ParamNameToProp[ "FG_SET_LOGGING" ]="zero";
568 ParamNameToProp[ "FG_ALPHAH" ]="aero/alpha-rad";
569 ParamNameToProp[ "FG_ALPHAW" ]="aero/alpha-wing-rad";
570 ParamNameToProp[ "FG_LBARH" ]="metrics/lh-norm";
571 ParamNameToProp[ "FG_LBARV" ]="metrics/lv-norm";
572 ParamNameToProp[ "FG_HTAILAREA" ]="metrics/Sh-sqft";
573 ParamNameToProp[ "FG_VTAILAREA" ]="metrics/Sv-sqft";
574 ParamNameToProp[ "FG_VBARH" ]="metrics/vbarh-norm";
575 ParamNameToProp[ "FG_VBARV" ]="metrics/vbarv-norm";
576 ParamNameToProp[ "FG_GEAR_CMD" ]="gear/gear-cmd-norm";
577 ParamNameToProp[ "FG_GEAR_POS" ]="gear/gear-pos-norm";
580 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
582 void FGState::bind(void)
584 PropertyManager->Tie("sim-time-sec",this,
585 &FGState::Getsim_time);
588 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
590 void FGState::unbind(void)
592 PropertyManager->Untie("sim-time-sec");
595 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
596 // The bitmasked value choices are as follows:
597 // unset: In this case (the default) JSBSim would only print
598 // out the normally expected messages, essentially echoing
599 // the config files as they are read. If the environment
600 // variable is not set, debug_lvl is set to 1 internally
601 // 0: This requests JSBSim not to output any messages
603 // 1: This value explicity requests the normal JSBSim
605 // 2: This value asks for a message to be printed out when
606 // a class is instantiated
607 // 4: When this value is set, a message is displayed when a
608 // FGModel object executes its Run() method
609 // 8: When this value is set, various runtime state variables
610 // are printed out periodically
611 // 16: When set various parameters are sanity checked and
612 // a message is printed out when they go out of bounds
614 void FGState::Debug(int from)
616 if (debug_lvl <= 0) return;
618 if (debug_lvl & 1) { // Standard console startup message output
619 if (from == 0) { // Constructor
623 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
624 if (from == 0) cout << "Instantiated: FGState" << endl;
625 if (from == 1) cout << "Destroyed: FGState" << endl;
627 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
629 if (debug_lvl & 8 ) { // Runtime state variables
631 if (debug_lvl & 16) { // Sanity checking
633 if (debug_lvl & 64) {
634 if (from == 0) { // Constructor
635 cout << IdSrc << endl;
636 cout << IdHdr << endl;