1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGInitialCondition.h
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 Lesser 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 Lesser General Public License for more
19 You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 FUNCTIONAL DESCRIPTION
31 --------------------------------------------------------------------------------
33 The purpose of this class is to take a set of initial conditions and provide
34 a kinematically consistent set of body axis velocity components, euler
35 angles, and altitude. This class does not attempt to trim the model i.e.
36 the sim will most likely start in a very dynamic state (unless, of course,
37 you have chosen your IC's wisely) even after setting it up with this class.
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43 #ifndef FGINITIALCONDITION_H
44 #define FGINITIALCONDITION_H
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 #include <FGFDMExec.h>
51 #include <FGJSBBase.h>
52 #include <math/FGColumnVector3.h>
53 #include <input_output/FGXMLFileRead.h>
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 #define ID_INITIALCONDITION "$Id$"
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
68 typedef enum { setwned, setwmd, setwhc } windset;
70 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74 /** Initializes the simulation run.
75 Takes a set of initial conditions (IC) and provide a kinematically consistent set
76 of body axis velocity components, euler angles, and altitude. This class
77 does not attempt to trim the model i.e. the sim will most likely start in a
78 very dynamic state (unless, of course, you have chosen your IC's wisely, or
79 started on the ground) even after setting it up with this class.
83 With a valid object of FGFDMExec and an aircraft model loaded:
86 FGInitialCondition fgic=new FGInitialCondition(FDMExec);
87 fgic->SetVcalibratedKtsIC()
88 fgic->SetAltitudeAGLFtIC();
91 FDMExec->GetState()->Initialize(fgic)
95 //or to loop the sim w/o integrating
101 Since vc, ve, vt, and mach all represent speed, the remaining
102 three are recalculated each time one of them is set (using the
103 current altitude). The most recent speed set is remembered so
104 that if and when altitude is reset, the last set speed is used
105 to recalculate the remaining three. Setting any of the body
106 components forces a recalculation of vt and vt then becomes the
107 most recent speed set.
109 <h3>Alpha,Gamma, and Theta</h3>
111 This class assumes that it will be used to set up the sim for a
112 steady, zero pitch rate condition. Since any two of those angles
113 specifies the third gamma (flight path angle) is favored when setting
114 alpha and theta and alpha is favored when setting gamma. i.e.
116 - set alpha : recalculate theta using gamma as currently set
117 - set theta : recalculate alpha using gamma as currently set
118 - set gamma : recalculate theta using alpha as currently set
120 The idea being that gamma is most interesting to pilots (since it
121 is indicative of climb rate).
123 Setting climb rate is, for the purpose of this discussion,
124 considered equivalent to setting gamma.
126 These are the items that can be set in an initialization file:
128 - ubody (velocity, ft/sec)
129 - vbody (velocity, ft/sec)
130 - wbody (velocity, ft/sec)
131 - vnorth (velocity, ft/sec)
132 - veast (velocity, ft/sec)
133 - vdown (velocity, ft/sec)
134 - latitude (position, degrees)
135 - longitude (position, degrees)
136 - phi (orientation, degrees)
137 - theta (orientation, degrees)
138 - psi (orientation, degrees)
139 - alpha (angle, degrees)
140 - beta (angle, degrees)
141 - gamma (angle, degrees)
142 - roc (vertical velocity, ft/sec)
143 - elevation (local terrain elevation, ft)
144 - altitude (altitude AGL, ft)
145 - altitudeAGL (altitude AGL, ft)
146 - altitudeMSL (altitude MSL, ft)
147 - winddir (wind from-angle, degrees)
148 - vwind (magnitude wind speed, ft/sec)
149 - hwind (headwind speed, knots)
150 - xwind (crosswind speed, knots)
151 - vc (calibrated airspeed, ft/sec)
153 - vground (ground speed, ft/sec)
157 @property ic/vc-kts (read/write) Calibrated airspeed initial condition in knots
158 @property ic/ve-kts (read/write) Knots equivalent airspeed initial condition
159 @property ic/vg-kts (read/write) Ground speed initial condition in knots
160 @property ic/vt-kts (read/write) True airspeed initial condition in knots
161 @property ic/mach (read/write) Mach initial condition
162 @property ic/roc-fpm (read/write) Rate of climb initial condition in feet/minute
163 @property ic/gamma-deg (read/write) Flightpath angle initial condition in degrees
164 @property ic/alpha-deg (read/write) Angle of attack initial condition in degrees
165 @property ic/beta-deg (read/write) Angle of sideslip initial condition in degrees
166 @property ic/theta-deg (read/write) Pitch angle initial condition in degrees
167 @property ic/phi-deg (read/write) Roll angle initial condition in degrees
168 @property ic/psi-true-deg (read/write) Heading angle initial condition in degrees
169 @property ic/lat-gc-deg (read/write) Latitude initial condition in degrees
170 @property ic/long-gc-deg (read/write) Longitude initial condition in degrees
171 @property ic/h-sl-ft (read/write) Height above sea level initial condition in feet
172 @property ic/h-agl-ft (read/write) Height above ground level initial condition in feet
173 @property ic/sea-level-radius-ft (read/write) Radius of planet at sea level in feet
174 @property ic/terrain-elevation-ft (read/write) Terrain elevation above sea level in feet
175 @property ic/vg-fps (read/write) Ground speed initial condition in feet/second
176 @property ic/vt-fps (read/write) True airspeed initial condition in feet/second
177 @property ic/vw-bx-fps (read/write) Wind velocity initial condition in Body X frame in feet/second
178 @property ic/vw-by-fps (read/write) Wind velocity initial condition in Body Y frame in feet/second
179 @property ic/vw-bz-fps (read/write) Wind velocity initial condition in Body Z frame in feet/second
180 @property ic/vw-north-fps (read/write) Wind northward velocity initial condition in feet/second
181 @property ic/vw-east-fps (read/write) Wind eastward velocity initial condition in feet/second
182 @property ic/vw-down-fps (read/write) Wind downward velocity initial condition in feet/second
183 @property ic/vw-mag-fps (read/write) Wind velocity magnitude initial condition in feet/sec.
184 @property ic/vw-dir-deg (read/write) Wind direction initial condition, in degrees from north
185 @property ic/roc-fps (read/write) Rate of climb initial condition, in feet/second
186 @property ic/u-fps (read/write) Body frame x-axis velocity initial condition in feet/second
187 @property ic/v-fps (read/write) Body frame y-axis velocity initial condition in feet/second
188 @property ic/w-fps (read/write) Body frame z-axis velocity initial condition in feet/second
189 @property ic/vn-fps (read/write) Local frame x-axis (north) velocity initial condition in feet/second
190 @property ic/ve-fps (read/write) Local frame y-axis (east) velocity initial condition in feet/second
191 @property ic/vd-fps (read/write) Local frame z-axis (down) velocity initial condition in feet/second
192 @property ic/gamma-rad (read/write) Flight path angle initial condition in radians
193 @property ic/alpha-rad (read/write) Angle of attack initial condition in radians
194 @property ic/theta-rad (read/write) Pitch angle initial condition in radians
195 @property ic/beta-rad (read/write) Angle of sideslip initial condition in radians
196 @property ic/phi-rad (read/write) Roll angle initial condition in radians
197 @property ic/psi-true-rad (read/write) Heading angle initial condition in radians
198 @property ic/lat-gc-rad (read/write) Geocentric latitude initial condition in radians
199 @property ic/long-gc-rad (read/write) Longitude initial condition in radians
200 @property ic/p-rad_sec (read/write) Roll rate initial condition in radians/second
201 @property ic/q-rad_sec (read/write) Pitch rate initial condition in radians/second
202 @property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
208 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
212 class FGInitialCondition : public FGJSBBase, public FGXMLFileRead
216 FGInitialCondition(FGFDMExec *fdmex);
218 ~FGInitialCondition();
220 /** Set calibrated airspeed initial condition in knots.
221 @param vc Calibrated airspeed in knots */
222 void SetVcalibratedKtsIC(double vc);
224 /** Set equivalent airspeed initial condition in knots.
225 @param ve Equivalent airspeed in knots */
226 void SetVequivalentKtsIC(double ve);
228 /** Set true airspeed initial condition in knots.
229 @param vt True airspeed in knots */
230 inline void SetVtrueKtsIC(double vt) { SetVtrueFpsIC(vt*ktstofps); }
232 /** Set ground speed initial condition in knots.
233 @param vg Ground speed in knots */
234 inline void SetVgroundKtsIC(double vg) { SetVgroundFpsIC(vg*ktstofps); }
236 /** Set mach initial condition.
237 @param mach Mach number */
238 void SetMachIC(double mach);
240 /** Sets angle of attack initial condition in degrees.
241 @param a Alpha in degrees */
242 inline void SetAlphaDegIC(double a) { SetAlphaRadIC(a*degtorad); }
244 /** Sets angle of sideslip initial condition in degrees.
245 @param B Beta in degrees */
246 inline void SetBetaDegIC(double B) { SetBetaRadIC(B*degtorad);}
248 /** Sets pitch angle initial condition in degrees.
249 @param theta Theta (pitch) angle in degrees */
250 inline void SetThetaDegIC(double theta) { SetThetaRadIC(theta*degtorad); }
252 /** Resets the IC data structure to new values
253 @param u, v, w, ... **/
254 void ResetIC(double u0, double v0, double w0, double p0, double q0, double r0,
255 double alpha0, double beta0, double phi0, double theta0, double psi0,
256 double latitudeRad0, double longitudeRad0, double altitudeAGL0,
259 /** Sets the roll angle initial condition in degrees.
260 @param phi roll angle in degrees */
261 inline void SetPhiDegIC(double phi) { SetPhiRadIC(phi*degtorad);}
263 /** Sets the heading angle initial condition in degrees.
264 @param psi Heading angle in degrees */
265 inline void SetPsiDegIC(double psi){ SetPsiRadIC(psi*degtorad); }
267 /** Sets the climb rate initial condition in feet/minute.
268 @param roc Rate of Climb in feet/minute */
269 void SetClimbRateFpmIC(double roc);
271 /** Sets the flight path angle initial condition in degrees.
272 @param gamma Flight path angle in degrees */
273 inline void SetFlightPathAngleDegIC(double gamma) { SetFlightPathAngleRadIC(gamma*degtorad); }
275 /** Sets the altitude above sea level initial condition in feet.
276 @param altitudeASL Altitude above sea level in feet */
277 void SetAltitudeASLFtIC(double altitudeASL);
279 /** Sets the initial Altitude above ground level.
280 @param agl Altitude above ground level in feet */
281 void SetAltitudeAGLFtIC(double agl);
283 /** Sets the initial sea level radius from planet center
284 @param sl_rad sea level radius in feet */
285 void SetSeaLevelRadiusFtIC(double sl_rad);
287 /** Sets the initial terrain elevation.
288 @param elev Initial terrain elevation in feet */
289 void SetTerrainElevationFtIC(double elev);
291 /** Sets the initial latitude.
292 @param lat Initial latitude in degrees */
293 inline void SetLatitudeDegIC(double lat) { latitude=lat*degtorad; }
295 /** Sets the initial longitude.
296 @param lon Initial longitude in degrees */
297 inline void SetLongitudeDegIC(double lon) { longitude=lon*degtorad; }
299 /** Gets the initial calibrated airspeed.
300 @return Initial calibrated airspeed in knots */
301 inline double GetVcalibratedKtsIC(void) const { return vc*fpstokts; }
303 /** Gets the initial equivalent airspeed.
304 @return Initial equivalent airspeed in knots */
305 inline double GetVequivalentKtsIC(void) const { return ve*fpstokts; }
307 /** Gets the initial ground speed.
308 @return Initial ground speed in knots */
309 inline double GetVgroundKtsIC(void) const { return vg*fpstokts; }
311 /** Gets the initial true velocity.
312 @return Initial true airspeed in knots. */
313 inline double GetVtrueKtsIC(void) const { return vt*fpstokts; }
315 /** Gets the initial mach.
316 @return Initial mach number */
317 inline double GetMachIC(void) const { return mach; }
319 /** Gets the initial climb rate.
320 @return Initial climb rate in feet/minute */
321 inline double GetClimbRateFpmIC(void) const { return hdot*60; }
323 /** Gets the initial flight path angle.
324 @return Initial flight path angle in degrees */
325 inline double GetFlightPathAngleDegIC(void)const { return gamma*radtodeg; }
327 /** Gets the initial angle of attack.
328 @return Initial alpha in degrees */
329 inline double GetAlphaDegIC(void) const { return alpha*radtodeg; }
331 /** Gets the initial sideslip angle.
332 @return Initial beta in degrees */
333 inline double GetBetaDegIC(void) const { return beta*radtodeg; }
335 /** Gets the initial pitch angle.
336 @return Initial pitch angle in degrees */
337 inline double GetThetaDegIC(void) const { return theta*radtodeg; }
339 /** Gets the initial roll angle.
340 @return Initial phi in degrees */
341 inline double GetPhiDegIC(void) const { return phi*radtodeg; }
343 /** Gets the initial heading angle.
344 @return Initial psi in degrees */
345 inline double GetPsiDegIC(void) const { return psi*radtodeg; }
347 /** Gets the initial latitude.
348 @return Initial geocentric latitude in degrees */
349 inline double GetLatitudeDegIC(void) const { return latitude*radtodeg; }
351 /** Gets the initial longitude.
352 @return Initial longitude in degrees */
353 inline double GetLongitudeDegIC(void) const { return longitude*radtodeg; }
355 /** Gets the initial altitude above sea level.
356 @return Initial altitude in feet. */
357 inline double GetAltitudeASLFtIC(void) const { return altitudeASL; }
359 /** Gets the initial altitude above ground level.
360 @return Initial altitude AGL in feet */
361 inline double GetAltitudeAGLFtIC(void) const { return altitudeASL - terrain_elevation; }
363 /** Gets the initial sea level radius.
364 @return Initial sea level radius */
365 inline double GetSeaLevelRadiusFtIC(void) const { return sea_level_radius; }
367 /** Gets the initial terrain elevation.
368 @return Initial terrain elevation in feet */
369 inline double GetTerrainElevationFtIC(void) const { return terrain_elevation; }
371 /** Sets the initial ground speed.
372 @param vg Initial ground speed in feet/second */
373 void SetVgroundFpsIC(double vg);
375 /** Sets the initial true airspeed.
376 @param vt Initial true airspeed in feet/second */
377 void SetVtrueFpsIC(double vt);
379 /** Sets the initial body axis X velocity.
380 @param ubody Initial X velocity in feet/second */
381 void SetUBodyFpsIC(double ubody);
383 /** Sets the initial body axis Y velocity.
384 @param vbody Initial Y velocity in feet/second */
385 void SetVBodyFpsIC(double vbody);
387 /** Sets the initial body axis Z velocity.
388 @param wbody Initial Z velocity in feet/second */
389 void SetWBodyFpsIC(double wbody);
391 /** Sets the initial local axis north velocity.
392 @param vn Initial north velocity in feet/second */
393 void SetVNorthFpsIC(double vn);
395 /** Sets the initial local axis east velocity.
396 @param ve Initial east velocity in feet/second */
397 void SetVEastFpsIC(double ve);
399 /** Sets the initial local axis down velocity.
400 @param vd Initial down velocity in feet/second */
401 void SetVDownFpsIC(double vd);
403 /** Sets the initial roll rate.
404 @param P Initial roll rate in radians/second */
405 void SetPRadpsIC(double P) { p = P; }
407 /** Sets the initial pitch rate.
408 @param Q Initial pitch rate in radians/second */
409 void SetQRadpsIC(double Q) { q = Q; }
411 /** Sets the initial yaw rate.
412 @param R initial yaw rate in radians/second */
413 void SetRRadpsIC(double R) { r = R; }
415 /** Sets the initial wind velocity.
416 @param wN Initial wind velocity in local north direction, feet/second
417 @param wE Initial wind velocity in local east direction, feet/second
418 @param wD Initial wind velocity in local down direction, feet/second */
419 void SetWindNEDFpsIC(double wN, double wE, double wD);
421 /** Sets the initial total wind speed.
422 @param mag Initial wind velocity magnitude in knots */
423 void SetWindMagKtsIC(double mag);
425 /** Sets the initial wind direction.
426 @param dir Initial direction wind is coming from in degrees */
427 void SetWindDirDegIC(double dir);
429 /** Sets the initial headwind velocity.
430 @param head Initial headwind speed in knots */
431 void SetHeadWindKtsIC(double head);
433 /** Sets the initial crosswind speed.
434 @param cross Initial crosswind speed, positive from left to right */
435 void SetCrossWindKtsIC(double cross);
437 /** Sets the initial wind downward speed.
438 @param wD Initial downward wind speed in knots*/
439 void SetWindDownKtsIC(double wD);
441 /** Sets the initial climb rate.
442 @param roc Initial Rate of climb in feet/second */
443 void SetClimbRateFpsIC(double roc);
445 /** Gets the initial ground velocity.
446 @return Initial ground velocity in feet/second */
447 inline double GetVgroundFpsIC(void) const { return vg; }
449 /** Gets the initial true velocity.
450 @return Initial true velocity in feet/second */
451 inline double GetVtrueFpsIC(void) const { return vt; }
453 /** Gets the initial body axis X wind velocity.
454 @return Initial body axis X wind velocity in feet/second */
455 inline double GetWindUFpsIC(void) const { return uw; }
457 /** Gets the initial body axis Y wind velocity.
458 @return Initial body axis Y wind velocity in feet/second */
459 inline double GetWindVFpsIC(void) const { return vw; }
461 /** Gets the initial body axis Z wind velocity.
462 @return Initial body axis Z wind velocity in feet/second */
463 inline double GetWindWFpsIC(void) const { return ww; }
465 /** Gets the initial wind velocity in local frame.
466 @return Initial wind velocity toward north in feet/second */
467 inline double GetWindNFpsIC(void) const { return wnorth; }
469 /** Gets the initial wind velocity in local frame.
470 @return Initial wind velocity eastwards in feet/second */
471 inline double GetWindEFpsIC(void) const { return weast; }
473 /** Gets the initial wind velocity in local frame.
474 @return Initial wind velocity downwards in feet/second */
475 inline double GetWindDFpsIC(void) const { return wdown; }
477 /** Gets the initial total wind velocity in feet/sec.
478 @return Initial wind velocity in feet/second */
479 inline double GetWindFpsIC(void) const { return sqrt(wnorth*wnorth + weast*weast); }
481 /** Gets the initial wind direction.
482 @return Initial wind direction in feet/second */
483 double GetWindDirDegIC(void) const;
485 /** Gets the initial climb rate.
486 @return Initial rate of climb in feet/second */
487 inline double GetClimbRateFpsIC(void) const { return hdot; }
489 /** Gets the initial body axis X velocity.
490 @return Initial body axis X velocity in feet/second. */
491 double GetUBodyFpsIC(void) const;
493 /** Gets the initial body axis Y velocity.
494 @return Initial body axis Y velocity in feet/second. */
495 double GetVBodyFpsIC(void) const;
497 /** Gets the initial body axis Z velocity.
498 @return Initial body axis Z velocity in feet/second. */
499 double GetWBodyFpsIC(void) const;
501 /** Gets the initial local frame X (North) velocity.
502 @return Initial local frame X (North) axis velocity in feet/second. */
503 double GetVNorthFpsIC(void) const {return vnorth;};
505 /** Gets the initial local frame Y (East) velocity.
506 @return Initial local frame Y (East) axis velocity in feet/second. */
507 double GetVEastFpsIC(void) const {return veast;};
509 /** Gets the initial local frame Z (Down) velocity.
510 @return Initial local frame Z (Down) axis velocity in feet/second. */
511 double GetVDownFpsIC(void) const {return vdown;};
513 /** Gets the initial body axis roll rate.
514 @return Initial body axis roll rate in radians/second */
515 double GetPRadpsIC() const { return p; }
517 /** Gets the initial body axis pitch rate.
518 @return Initial body axis pitch rate in radians/second */
519 double GetQRadpsIC() const { return q; }
521 /** Gets the initial body axis yaw rate.
522 @return Initial body axis yaw rate in radians/second */
523 double GetRRadpsIC() const { return r; }
525 /** Sets the initial flight path angle.
526 @param gamma Initial flight path angle in radians */
527 void SetFlightPathAngleRadIC(double gamma);
529 /** Sets the initial angle of attack.
530 @param alpha Initial angle of attack in radians */
531 void SetAlphaRadIC(double alpha);
533 /** Sets the initial pitch angle.
534 @param theta Initial pitch angle in radians */
535 void SetThetaRadIC(double theta);
537 /** Sets the initial sideslip angle.
538 @param beta Initial angle of sideslip in radians. */
539 void SetBetaRadIC(double beta);
541 /** Sets the initial roll angle.
542 @param phi Initial roll angle in radians */
543 void SetPhiRadIC(double phi);
545 /** Sets the initial heading angle.
546 @param psi Initial heading angle in radians */
547 void SetPsiRadIC(double psi);
549 /** Sets the initial latitude.
550 @param lat Initial latitude in radians */
551 inline void SetLatitudeRadIC(double lat) { latitude=lat; }
553 /** Sets the initial longitude.
554 @param lon Initial longitude in radians */
555 inline void SetLongitudeRadIC(double lon) { longitude=lon; }
557 /** Sets the target normal load factor.
558 @param nlf Normal load factor*/
559 inline void SetTargetNlfIC(double nlf) { targetNlfIC=nlf; }
561 /** Gets the initial flight path angle.
562 @return Initial flight path angle in radians */
563 inline double GetFlightPathAngleRadIC(void) const { return gamma; }
565 /** Gets the initial angle of attack.
566 @return Initial alpha in radians */
567 inline double GetAlphaRadIC(void) const { return alpha; }
569 /** Gets the initial angle of sideslip.
570 @return Initial sideslip angle in radians */
571 inline double GetBetaRadIC(void) const { return beta; }
573 /** Gets the initial roll angle.
574 @return Initial roll angle in radians */
575 inline double GetPhiRadIC(void) const { return phi; }
577 /** Gets the initial latitude.
578 @return Initial latitude in radians */
579 inline double GetLatitudeRadIC(void) const { return latitude; }
581 /** Gets the initial longitude.
582 @return Initial longitude in radians */
583 inline double GetLongitudeRadIC(void) const { return longitude; }
585 /** Gets the initial pitch angle.
586 @return Initial pitch angle in radians */
587 inline double GetThetaRadIC(void) const { return theta; }
589 /** Gets the initial heading angle.
590 @return Initial heading angle in radians */
591 inline double GetPsiRadIC(void) const { return psi; }
593 /** Gets the initial speedset.
594 @return Initial speedset */
595 inline speedset GetSpeedSet(void) { return lastSpeedSet; }
597 /** Gets the initial windset.
598 @return Initial windset */
599 inline windset GetWindSet(void) { return lastWindSet; }
601 /** Gets the target normal load factor set from IC.
602 @return target normal load factor set from IC*/
603 inline double GetTargetNlfIC(void) { return targetNlfIC; }
605 /** Loads the initial conditions.
606 @param rstname The name of an initial conditions file
607 @param useStoredPath true if the stored path to the IC file should be used
608 @return true if successful */
609 bool Load(string rstname, bool useStoredPath = true );
611 /** Get init-file name
613 string GetInitFile(void) {return init_file_name;}
614 /** Set init-file name
616 void SetInitFile(string f) { init_file_name = f;}
617 void WriteStateFile(int num);
622 double altitudeASL,hdot;
623 double latitude,longitude;
627 double vnorth,veast,vdown;
628 double wnorth,weast,wdown;
629 double whead, wcross, wdir, wmag;
630 double sea_level_radius;
631 double terrain_elevation;
632 double radius_to_vehicle;
635 double alpha, beta, theta, phi, psi, gamma;
636 double salpha,sbeta,stheta,sphi,spsi,sgamma;
637 double calpha,cbeta,ctheta,cphi,cpsi,cgamma;
639 double xlo, xhi,xmin,xmax;
641 typedef double (FGInitialCondition::*fp)(double x);
644 speedset lastSpeedSet;
648 FGPropertyManager *PropertyManager;
653 bool getMachFromVcas(double *Mach,double vcas);
655 double GammaEqOfTheta(double Theta);
656 void InitializeIC(void);
657 double GammaEqOfAlpha(double Alpha);
658 double calcVcas(double Mach);
659 void calcUVWfromNED(void);
660 void calcWindUVW(void);
662 bool findInterval(double x,double guess);
663 bool solve(double *y, double x);
665 void Debug(int from);
667 string init_file_name;