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 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 // For every term registered here there must be a corresponding handler in
70 // GetParameter() below that retrieves that parameter. Also, there must be an
71 // entry in the enum eParam definition in FGJSBBase.h. The ID is what must be used
72 // in any config file entry which references that item.
74 FGState::FGState(FGFDMExec* fdex)
83 Aircraft = FDMExec->GetAircraft();
84 Translation = FDMExec->GetTranslation();
85 Rotation = FDMExec->GetRotation();
86 Position = FDMExec->GetPosition();
87 FCS = FDMExec->GetFCS();
88 Output = FDMExec->GetOutput();
89 Atmosphere = FDMExec->GetAtmosphere();
90 Aerodynamics = FDMExec->GetAerodynamics();
91 GroundReactions = FDMExec->GetGroundReactions();
92 Propulsion = FDMExec->GetPropulsion();
93 PropertyManager = FDMExec->GetPropertyManager();
102 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110 //***************************************************************************
112 // Reset: Assume all angles READ FROM FILE IN DEGREES !!
115 bool FGState::Reset(string path, string acname, string fname)
121 double phi, tht, psi;
122 double latitude, longitude, h;
123 double wdir, wmag, wnorth, weast;
126 resetDef = path + "/" + acname + "/" + fname + ".xml";
128 resetDef = path + ";" + acname + ";" + fname + ".xml";
131 FGConfigFile resetfile(resetDef);
132 if (!resetfile.IsOpen()) return false;
134 resetfile.GetNextConfigLine();
135 token = resetfile.GetValue();
136 if (token != string("initialize")) {
137 cerr << "The reset file " << resetDef
138 << " does not appear to be a reset file" << endl;
141 resetfile.GetNextConfigLine();
143 cout << "Resetting using: " << token << endl << endl;
146 while (token != string("/initialize") && token != string("EOF")) {
147 if (token == "UBODY") resetfile >> U;
148 if (token == "VBODY") resetfile >> V;
149 if (token == "WBODY") resetfile >> W;
150 if (token == "LATITUDE") resetfile >> latitude;
151 if (token == "LONGITUDE") resetfile >> longitude;
152 if (token == "PHI") resetfile >> phi;
153 if (token == "THETA") resetfile >> tht;
154 if (token == "PSI") resetfile >> psi;
155 if (token == "ALTITUDE") resetfile >> h;
156 if (token == "WINDDIR") resetfile >> wdir;
157 if (token == "VWIND") resetfile >> wmag;
163 Position->SetLatitude(latitude*degtorad);
164 Position->SetLongitude(longitude*degtorad);
167 wnorth = wmag*ktstofps*cos(wdir*degtorad);
168 weast = wmag*ktstofps*sin(wdir*degtorad);
170 Initialize(U, V, W, phi*degtorad, tht*degtorad, psi*degtorad,
171 latitude*degtorad, longitude*degtorad, h, wnorth, weast, 0.0);
176 //***************************************************************************
178 // Initialize: Assume all angles GIVEN IN RADIANS !!
181 void FGState::Initialize(double U, double V, double W,
182 double phi, double tht, double psi,
183 double Latitude, double Longitude, double H,
184 double wnorth, double weast, double wdown)
188 FGColumnVector3 vAeroUVW;
190 Position->SetLatitude(Latitude);
191 Position->SetLongitude(Longitude);
196 vLocalEuler << phi << tht << psi;
197 Rotation->SetEuler(vLocalEuler);
199 InitMatrices(phi, tht, psi);
202 Translation->SetUVW(vUVW);
204 Atmosphere->SetWindNED(wnorth, weast, wdown);
206 vAeroUVW = vUVW + mTl2b*Atmosphere->GetWindNED();
208 if (vAeroUVW(eW) != 0.0)
209 alpha = vAeroUVW(eU)*vAeroUVW(eU) > 0.0 ? atan2(vAeroUVW(eW), vAeroUVW(eU)) : 0.0;
212 if (vAeroUVW(eV) != 0.0)
213 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;
217 Translation->SetAB(alpha, beta);
219 Vt = sqrt(U*U + V*V + W*W);
220 Translation->SetVt(Vt);
222 Translation->SetMach(Vt/Atmosphere->GetSoundSpeed());
224 qbar = 0.5*(U*U + V*V + W*W)*Atmosphere->GetDensity();
225 Translation->Setqbar(qbar);
227 vLocalVelNED = mTb2l*vUVW;
228 Position->SetvVel(vLocalVelNED);
231 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 void FGState::Initialize(FGInitialCondition *FGIC)
237 double latitude, longitude;
238 double wnorth,weast, wdown;
240 latitude = FGIC->GetLatitudeRadIC();
241 longitude = FGIC->GetLongitudeRadIC();
242 h = FGIC->GetAltitudeFtIC();
243 U = FGIC->GetUBodyFpsIC();
244 V = FGIC->GetVBodyFpsIC();
245 W = FGIC->GetWBodyFpsIC();
246 tht = FGIC->GetThetaRadIC();
247 phi = FGIC->GetPhiRadIC();
248 psi = FGIC->GetPsiRadIC();
249 wnorth = FGIC->GetWindNFpsIC();
250 weast = FGIC->GetWindEFpsIC();
251 wdown = FGIC->GetWindDFpsIC();
253 Position->SetSeaLevelRadius( FGIC->GetSeaLevelRadiusFtIC() );
254 Position->SetRunwayRadius( FGIC->GetSeaLevelRadiusFtIC() +
255 FGIC->GetTerrainAltitudeFtIC() );
257 // need to fix the wind speed args, here.
258 Initialize(U, V, W, phi, tht, psi, latitude, longitude, h, wnorth, weast, wdown);
261 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263 void FGState::InitMatrices(double phi, double tht, double psi)
265 double thtd2, psid2, phid2;
266 double Sthtd2, Spsid2, Sphid2;
267 double Cthtd2, Cpsid2, Cphid2;
285 Cphid2Cthtd2 = Cphid2*Cthtd2;
286 Cphid2Sthtd2 = Cphid2*Sthtd2;
287 Sphid2Sthtd2 = Sphid2*Sthtd2;
288 Sphid2Cthtd2 = Sphid2*Cthtd2;
290 vQtrn(1) = Cphid2Cthtd2*Cpsid2 + Sphid2Sthtd2*Spsid2;
291 vQtrn(2) = Sphid2Cthtd2*Cpsid2 - Cphid2Sthtd2*Spsid2;
292 vQtrn(3) = Cphid2Sthtd2*Cpsid2 + Sphid2Cthtd2*Spsid2;
293 vQtrn(4) = Cphid2Cthtd2*Spsid2 - Sphid2Sthtd2*Cpsid2;
298 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300 void FGState::CalcMatrices(void)
302 double Q0Q0, Q1Q1, Q2Q2, Q3Q3;
303 double Q0Q1, Q0Q2, Q0Q3, Q1Q2;
306 Q0Q0 = vQtrn(1)*vQtrn(1);
307 Q1Q1 = vQtrn(2)*vQtrn(2);
308 Q2Q2 = vQtrn(3)*vQtrn(3);
309 Q3Q3 = vQtrn(4)*vQtrn(4);
310 Q0Q1 = vQtrn(1)*vQtrn(2);
311 Q0Q2 = vQtrn(1)*vQtrn(3);
312 Q0Q3 = vQtrn(1)*vQtrn(4);
313 Q1Q2 = vQtrn(2)*vQtrn(3);
314 Q1Q3 = vQtrn(2)*vQtrn(4);
315 Q2Q3 = vQtrn(3)*vQtrn(4);
317 mTl2b(1,1) = Q0Q0 + Q1Q1 - Q2Q2 - Q3Q3;
318 mTl2b(1,2) = 2*(Q1Q2 + Q0Q3);
319 mTl2b(1,3) = 2*(Q1Q3 - Q0Q2);
320 mTl2b(2,1) = 2*(Q1Q2 - Q0Q3);
321 mTl2b(2,2) = Q0Q0 - Q1Q1 + Q2Q2 - Q3Q3;
322 mTl2b(2,3) = 2*(Q2Q3 + Q0Q1);
323 mTl2b(3,1) = 2*(Q1Q3 + Q0Q2);
324 mTl2b(3,2) = 2*(Q2Q3 - Q0Q1);
325 mTl2b(3,3) = Q0Q0 - Q1Q1 - Q2Q2 + Q3Q3;
331 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
333 void FGState::IntegrateQuat(FGColumnVector3 vPQR, int rate)
335 vQdot(1) = -0.5*(vQtrn(2)*vPQR(eP) + vQtrn(3)*vPQR(eQ) + vQtrn(4)*vPQR(eR));
336 vQdot(2) = 0.5*(vQtrn(1)*vPQR(eP) + vQtrn(3)*vPQR(eR) - vQtrn(4)*vPQR(eQ));
337 vQdot(3) = 0.5*(vQtrn(1)*vPQR(eQ) + vQtrn(4)*vPQR(eP) - vQtrn(2)*vPQR(eR));
338 vQdot(4) = 0.5*(vQtrn(1)*vPQR(eR) + vQtrn(2)*vPQR(eQ) - vQtrn(3)*vPQR(eP));
339 vQtrn += 0.5*dt*rate*(vlastQdot + vQdot);
346 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348 FGColumnVector3& FGState::CalcEuler(void)
350 if (mTl2b(3,3) == 0.0) mTl2b(3,3) = 0.0000001;
351 if (mTl2b(1,1) == 0.0) mTl2b(1,1) = 0.0000001;
353 vEuler(ePhi) = atan2(mTl2b(2,3), mTl2b(3,3));
354 vEuler(eTht) = asin(-mTl2b(1,3));
355 vEuler(ePsi) = atan2(mTl2b(1,2), mTl2b(1,1));
357 if (vEuler(ePsi) < 0.0) vEuler(ePsi) += 2*M_PI;
362 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 FGMatrix33& FGState::GetTs2b(void)
366 double ca, cb, sa, sb;
368 double alpha = Translation->Getalpha();
369 double beta = Translation->Getbeta();
389 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 FGMatrix33& FGState::GetTb2s(void)
394 float ca, cb, sa, sb;
396 alpha = Translation->Getalpha();
397 beta = Translation->Getbeta();
417 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419 void FGState::ReportState(void)
421 #if !defined(__BORLANDCPP__)
422 char out[80], flap[10], gear[12];
424 cout << endl << " JSBSim State" << endl;
425 snprintf(out,80," Weight: %7.0f lbs. CG: %5.1f, %5.1f, %5.1f inches\n",
426 FDMExec->GetMassBalance()->GetWeight(),
427 FDMExec->GetMassBalance()->GetXYZcg(1),
428 FDMExec->GetMassBalance()->GetXYZcg(2),
429 FDMExec->GetMassBalance()->GetXYZcg(3));
431 if ( FCS->GetDfPos() <= 0.01)
432 snprintf(flap,10,"Up");
434 snprintf(flap,10,"%2.0f",FCS->GetDfPos());
436 if (FCS->GetGearPos() < 0.01)
437 snprintf(gear,12,"Up");
438 else if (FCS->GetGearPos() > 0.99)
439 snprintf(gear,12,"Down");
441 snprintf(gear,12,"In Transit");
443 snprintf(out,80, " Flaps: %3s Gear: %12s\n",flap,gear);
445 snprintf(out,80, " Speed: %4.0f KCAS Mach: %5.2f\n",
446 FDMExec->GetAuxiliary()->GetVcalibratedKTS(),
447 Translation->GetMach() );
449 snprintf(out,80, " Altitude: %7.0f ft. AGL Altitude: %7.0f ft.\n",
451 Position->GetDistanceAGL() );
453 snprintf(out,80, " Angle of Attack: %6.2f deg Pitch Angle: %6.2f deg\n",
454 Translation->Getalpha()*radtodeg,
455 Rotation->Gettht()*radtodeg );
457 snprintf(out,80, " Flight Path Angle: %6.2f deg Climb Rate: %5.0f ft/min\n",
458 Position->GetGamma()*radtodeg,
459 Position->Gethdot()*60 );
461 snprintf(out,80, " Normal Load Factor: %4.2f g's Pitch Rate: %5.2f deg/s\n",
463 Rotation->GetPQR(2)*radtodeg );
465 snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg Yaw Rate: %5.2f deg/s\n",
466 Rotation->Getpsi()*radtodeg,
467 Translation->Getbeta()*radtodeg,
468 Rotation->GetPQR(3)*radtodeg );
470 snprintf(out,80, " Bank Angle: %5.2f deg Roll Rate: %5.2f deg/s\n",
471 Rotation->Getphi()*radtodeg,
472 Rotation->GetPQR(1)*radtodeg );
474 snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n",
475 FCS->GetDePos(ofRad)*radtodeg,
476 FCS->GetDaLPos(ofRad)*radtodeg,
477 FCS->GetDrPos(ofRad)*radtodeg );
479 snprintf(out,80, " Throttle: %5.2f%c\n",
480 FCS->GetThrottlePos(0)*100,'%' );
483 snprintf(out,80, " Wind Components: %5.2f kts head wind, %5.2f kts cross wind\n",
484 FDMExec->GetAuxiliary()->GetHeadWind()*fpstokts,
485 FDMExec->GetAuxiliary()->GetCrossWind()*fpstokts );
488 snprintf(out,80, " Ground Speed: %4.0f knots , Ground Track: %3.0f deg true\n",
489 Position->GetVground()*fpstokts,
490 Position->GetGroundTrack()*radtodeg );
495 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
497 void FGState::InitPropertyMaps(void)
499 ParamNameToProp[ "FG_TIME" ]="sim-time-sec";
500 ParamNameToProp[ "FG_QBAR" ]="aero/qbar-psf";
501 ParamNameToProp[ "FG_QBARUW" ]="aero/qbarUW-psf";
502 ParamNameToProp[ "FG_QBARUV" ]="aero/qbarUV-psf";
503 ParamNameToProp[ "FG_WINGAREA" ]="metrics/Sw-sqft";
504 ParamNameToProp[ "FG_WINGSPAN" ]="metrics/bw-ft";
505 ParamNameToProp[ "FG_CBAR" ]="metrics/cbarw-ft";
506 ParamNameToProp[ "FG_ALPHA" ]="aero/alpha-rad";
507 ParamNameToProp[ "FG_ALPHADOT" ]="aero/alphadot-rad_sec";
508 ParamNameToProp[ "FG_BETA" ]="aero/beta-rad";
509 ParamNameToProp[ "FG_ABETA" ]="aero/mag-beta-rad";
510 ParamNameToProp[ "FG_BETADOT" ]="aero/betadot-rad_sec";
511 ParamNameToProp[ "FG_PHI" ]="attitude/phi-rad";
512 ParamNameToProp[ "FG_THT" ]="attitude/theta-rad";
513 ParamNameToProp[ "FG_PSI" ]="attitude/psi-true-rad";
514 ParamNameToProp[ "FG_PITCHRATE" ]="velocities/q-rad_sec";
515 ParamNameToProp[ "FG_ROLLRATE" ]="velocities/p-rad_sec";
516 ParamNameToProp[ "FG_YAWRATE" ]="velocities/r-rad_sec";
517 ParamNameToProp[ "FG_AEROP" ]="velocities/p-aero-rad_sec";
518 ParamNameToProp[ "FG_AEROQ" ]="velocities/q-aero-rad_sec";
519 ParamNameToProp[ "FG_AEROR" ]="velocities/r-aero-rad_sec";
520 ParamNameToProp[ "FG_CL_SQRD" ]="aero/cl-squared-norm";
521 ParamNameToProp[ "FG_MACH" ]="velocities/mach-norm";
522 ParamNameToProp[ "FG_ALTITUDE" ]="position/h-sl-ft";
523 ParamNameToProp[ "FG_BI2VEL" ]="aero/bi2vel";
524 ParamNameToProp[ "FG_CI2VEL" ]="aero/ci2vel";
525 ParamNameToProp[ "FG_ELEVATOR_POS" ]="fcs/elevator-pos-rad";
526 ParamNameToProp[ "FG_AELEVATOR_POS" ]="fcs/mag-elevator-pos-rad";
527 ParamNameToProp[ "FG_NELEVATOR_POS" ]="fcs/elevator-pos-norm";
528 ParamNameToProp[ "FG_AILERON_POS" ]="fcs/left-aileron-pos-rad";
529 ParamNameToProp[ "FG_AAILERON_POS" ]="fcs/mag-aileron-pos-rad";
530 ParamNameToProp[ "FG_NAILERON_POS" ]="fcs/left-aileron-pos-norm";
531 ParamNameToProp[ "FG_LEFT_AILERON_POS" ]="fcs/left-aileron-pos-rad";
532 ParamNameToProp[ "FG_ALEFT_AILERON_POS" ]="fcs/mag-left-aileron-pos-rad";
533 ParamNameToProp[ "FG_NLEFT_AILERON_POS" ]="fcs/left-aileron-pos-norm";
534 ParamNameToProp[ "FG_RIGHT_AILERON_POS" ]="fcs/right-aileron-pos-rad";
535 ParamNameToProp[ "FG_ARIGHT_AILERON_POS" ]="fcs/mag-aileron-pos-rad";
536 ParamNameToProp[ "FG_NRIGHT_AILERON_POS" ]="fcs/right-aileron-pos-norm";
537 ParamNameToProp[ "FG_RUDDER_POS" ]="fcs/rudder-pos-rad";
538 ParamNameToProp[ "FG_ARUDDER_POS" ]="fcs/mag-rudder-pos-rad";
539 ParamNameToProp[ "FG_NRUDDER_POS" ]="fcs/rudder-pos-norm";
540 ParamNameToProp[ "FG_SPDBRAKE_POS" ]="fcs/speedbrake-pos-rad";
541 ParamNameToProp[ "FG_NSPDBRAKE_POS" ]="fcs/speedbrake-pos-norm";
542 ParamNameToProp[ "FG_SPOILERS_POS" ]="fcs/spoiler-pos-rad";
543 ParamNameToProp[ "FG_NSPOILERS_POS" ]="fcs/spoiler-pos-norm";
544 ParamNameToProp[ "FG_FLAPS_POS" ]="fcs/flap-pos-deg";
545 ParamNameToProp[ "FG_NFLAPS_POS" ]="fcs/flap-pos-norm";
546 ParamNameToProp[ "FG_ELEVATOR_CMD" ]="fcs/elevator-cmd-norm";
547 ParamNameToProp[ "FG_AILERON_CMD" ]="fcs/aileron-cmd-norm";
548 ParamNameToProp[ "FG_RUDDER_CMD" ]="fcs/rudder-cmd-norm";
549 ParamNameToProp[ "FG_SPDBRAKE_CMD" ]="fcs/speedbrake-cmd-norm";
550 ParamNameToProp[ "FG_SPOILERS_CMD" ]="fcs/spoiler-cmd-norm";
551 ParamNameToProp[ "FG_FLAPS_CMD" ]="fcs/flap-cmd-norm";
552 ParamNameToProp[ "FG_THROTTLE_CMD" ]="fcs/throttle-cmd-norm";
553 ParamNameToProp[ "FG_THROTTLE_POS" ]="fcs/throttle-pos-norm";
554 ParamNameToProp[ "FG_MIXTURE_CMD" ]="fcs/mixture-cmd-norm";
555 ParamNameToProp[ "FG_MIXTURE_POS" ]="fcs/mixture-pos-norm";
556 ParamNameToProp[ "FG_MAGNETO_CMD" ]="zero";
557 ParamNameToProp[ "FG_STARTER_CMD" ]="zero";
558 ParamNameToProp[ "FG_ACTIVE_ENGINE" ]="zero";
559 ParamNameToProp[ "FG_HOVERB" ]="aero/h_b-mac-ft";
560 ParamNameToProp[ "FG_PITCH_TRIM_CMD" ]="fcs/pitch-trim-cmd-norm";
561 ParamNameToProp[ "FG_YAW_TRIM_CMD" ]="fcs/yaw-trim-cmd-norm";
562 ParamNameToProp[ "FG_ROLL_TRIM_CMD" ]="fcs/roll-trim-cmd-norm";
563 ParamNameToProp[ "FG_LEFT_BRAKE_CMD" ]="zero";
564 ParamNameToProp[ "FG_CENTER_BRAKE_CMD" ]="zero";
565 ParamNameToProp[ "FG_RIGHT_BRAKE_CMD" ]="zero";
566 ParamNameToProp[ "FG_SET_LOGGING" ]="zero";
567 ParamNameToProp[ "FG_ALPHAH" ]="aero/alpha-rad";
568 ParamNameToProp[ "FG_ALPHAW" ]="aero/alpha-wing-rad";
569 ParamNameToProp[ "FG_LBARH" ]="metrics/lh-norm";
570 ParamNameToProp[ "FG_LBARV" ]="metrics/lv-norm";
571 ParamNameToProp[ "FG_HTAILAREA" ]="metrics/Sh-sqft";
572 ParamNameToProp[ "FG_VTAILAREA" ]="metrics/Sv-sqft";
573 ParamNameToProp[ "FG_VBARH" ]="metrics/vbarh-norm";
574 ParamNameToProp[ "FG_VBARV" ]="metrics/vbarv-norm";
575 ParamNameToProp[ "FG_GEAR_CMD" ]="gear/gear-cmd-norm";
576 ParamNameToProp[ "FG_GEAR_POS" ]="gear/gear-pos-norm";
577 ParamNameToProp[ "FG_HYSTPARM" ]="aero/stall-hyst-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;