]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/initialization/FGInitialCondition.h
Sync. w. JSBSim CVS
[flightgear.git] / src / FDM / JSBSim / initialization / FGInitialCondition.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGInitialCondition.h
4  Author:       Tony Peden
5  Date started: 7/1/99
6
7  ------------- Copyright (C) 1999  Anthony K. Peden (apeden@earthlink.net) -------------
8
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
12  version.
13
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
17  details.
18
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.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26  HISTORY
27 --------------------------------------------------------------------------------
28 7/1/99   TP   Created
29
30 FUNCTIONAL DESCRIPTION
31 --------------------------------------------------------------------------------
32
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.
38
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 SENTRY
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43 #ifndef FGINITIALCONDITION_H
44 #define FGINITIALCONDITION_H
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 INCLUDES
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 #include <FGFDMExec.h>
51 #include <FGJSBBase.h>
52 #include <math/FGColumnVector3.h>
53
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 DEFINITIONS
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57
58 #define ID_INITIALCONDITION "$Id$"
59
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 FORWARD DECLARATIONS
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63
64 namespace JSBSim {
65
66 typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
67 typedef enum { setwned, setwmd, setwhc } windset;
68
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 CLASS DOCUMENTATION
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72
73 /** Takes a set of initial conditions and provide a kinematically consistent set
74     of body axis velocity components, euler angles, and altitude.  This class
75     does not attempt to trim the model i.e. the sim will most likely start in a
76     very dynamic state (unless, of course, you have chosen your IC's wisely, or
77     started on the ground) even after setting it up with this class.
78
79    <h2>Usage Notes</h2>
80
81    With a valid object of FGFDMExec and an aircraft model loaded:
82
83    @code
84    FGInitialCondition fgic=new FGInitialCondition(FDMExec);
85    fgic->SetVcalibratedKtsIC()
86    fgic->SetAltitudeFtIC();
87
88    // directly into Run
89    FDMExec->GetState()->Initialize(fgic)
90    delete fgic;
91    FDMExec->Run()
92
93    //or to loop the sim w/o integrating
94    FDMExec->RunIC(fgic)
95    @endcode
96
97    <h2>Speed</h2>
98
99    Since vc, ve, vt, and mach all represent speed, the remaining
100    three are recalculated each time one of them is set (using the
101    current altitude).  The most recent speed set is remembered so
102    that if and when altitude is reset, the last set speed is used
103    to recalculate the remaining three. Setting any of the body
104    components forces a recalculation of vt and vt then becomes the
105    most recent speed set.
106
107    <h2>Alpha,Gamma, and Theta</h2>
108
109    This class assumes that it will be used to set up the sim for a
110    steady, zero pitch rate condition. Since any two of those angles
111    specifies the third gamma (flight path angle) is favored when setting
112    alpha and theta and alpha is favored when setting gamma. i.e.
113
114    - set alpha : recalculate theta using gamma as currently set
115    - set theta : recalculate alpha using gamma as currently set
116    - set gamma : recalculate theta using alpha as currently set
117
118    The idea being that gamma is most interesting to pilots (since it
119    is indicative of climb rate).
120
121    Setting climb rate is, for the purpose of this discussion,
122    considered equivalent to setting gamma.
123
124    These are the items that can be set in an initialization file:
125
126    - ubody (velocity, ft/sec)
127    - vbody (velocity, ft/sec)
128    - wbody (velocity, ft/sec)
129    - latitude (position, degrees)
130    - longitude (position, degrees)
131    - phi (orientation, degrees)
132    - theta (orientation, degrees)
133    - psi (orientation, degrees)
134    - alpha (angle, degrees)
135    - beta (angle, degrees)
136    - gamma (angle, degrees)
137    - roc (vertical velocity, ft/sec)
138    - altitude (altitude, ft)
139    - winddir (wind from-angle, degrees)
140    - vwind (magnitude wind speed, ft/sec)
141    - hwind (headwind speed, knots)
142    - xwind (crosswind speed, knots)
143    - vc (calibrated airspeed, ft/sec)
144    - mach (mach)
145    - vground (ground speed, ft/sec)
146    - running (0 or 1)
147
148    <h2>Properties</h2>
149    @property ic/vc-kts (read/write) Calibrated airspeed initial condition in knots
150    @property ic/ve-kts (read/write) Knots equivalent airspeed initial condition
151    @property ic/vg-kts (read/write) Ground speed initial condition in knots
152    @property ic/vt-kts (read/write) True airspeed initial condition in knots
153    @property ic/mach (read/write) Mach initial condition
154    @property ic/roc-fpm (read/write) Rate of climb initial condition in feet/minute
155    @property ic/gamma-deg (read/write) Flightpath angle initial condition in degrees
156    @property ic/alpha-deg (read/write) Angle of attack initial condition in degrees
157    @property ic/beta-deg (read/write) Angle of sideslip initial condition in degrees
158    @property ic/theta-deg (read/write) Pitch angle initial condition in degrees
159    @property ic/phi-deg (read/write) Roll angle initial condition in degrees
160    @property ic/psi-true-deg (read/write) Heading angle initial condition in degrees
161    @property ic/lat-gc-deg (read/write) Latitude initial condition in degrees
162    @property ic/long-gc-deg (read/write) Longitude initial condition in degrees
163    @property ic/h-sl-ft (read/write) Height above sea level initial condition in feet
164    @property ic/h-agl-ft (read/write) Height above ground level initial condition in feet
165    @property ic/sea-level-radius-ft (read/write) Radius of planet at sea level in feet
166    @property ic/terrain-altitude-ft (read/write) Terrain elevation above sea level in feet
167    @property ic/vg-fps (read/write) Ground speed initial condition in feet/second
168    @property ic/vt-fps (read/write) True airspeed initial condition in feet/second
169    @property ic/vw-bx-fps (read/write) Wind velocity initial condition in Body X frame in feet/second
170    @property ic/vw-by-fps (read/write) Wind velocity initial condition in Body Y frame in feet/second
171    @property ic/vw-bz-fps (read/write) Wind velocity initial condition in Body Z frame in feet/second
172    @property ic/vw-north-fps (read/write) Wind northward velocity initial condition in feet/second
173    @property ic/vw-east-fps (read/write) Wind eastward velocity initial condition in feet/second
174    @property ic/vw-down-fps (read/write) Wind downward velocity initial condition in feet/second
175    @property ic/vw-mag-fps (read/write) Wind velocity magnitude initial condition in feet/sec.
176    @property ic/vw-dir-deg (read/write) Wind direction initial condition, in degrees from north
177    @property ic/roc-fps (read/write) Rate of climb initial condition, in feet/second
178    @property ic/u-fps (read/write) Body frame x-axis velocity initial condition in feet/second
179    @property ic/v-fps (read/write) Body frame y-axis velocity initial condition in feet/second
180    @property ic/w-fps (read/write) Body frame z-axis velocity initial condition in feet/second
181    @property ic/gamma-rad (read/write) Flight path angle initial condition in radians
182    @property ic/alpha-rad (read/write) Angle of attack initial condition in radians
183    @property ic/theta-rad (read/write) Pitch angle initial condition in radians
184    @property ic/beta-rad (read/write) Angle of sideslip initial condition in radians
185    @property ic/phi-rad (read/write) Roll angle initial condition in radians
186    @property ic/psi-true-rad (read/write) Heading angle initial condition in radians
187    @property ic/lat-gc-rad (read/write) Geocentric latitude initial condition in radians
188    @property ic/long-gc-rad (read/write) Longitude initial condition in radians
189    @property ic/p-rad_sec (read/write) Roll rate initial condition in radians/second
190    @property ic/q-rad_sec (read/write) Pitch rate initial condition in radians/second
191    @property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
192
193    @author Tony Peden
194    @version "$Id$"
195 */
196
197 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198 CLASS DECLARATION
199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
200
201 class FGInitialCondition : public FGJSBBase
202 {
203 public:
204   /// Constructor
205   FGInitialCondition(FGFDMExec *fdmex);
206   /// Destructor
207   ~FGInitialCondition();
208
209   /** Set calibrated airspeed initial condition in knots.
210       @param vc Calibrated airspeed in knots  */
211   void SetVcalibratedKtsIC(double vc);
212
213   /** Set equivalent airspeed initial condition in knots.
214       @param ve Equivalent airspeed in knots  */
215   void SetVequivalentKtsIC(double ve);
216
217   /** Set true airspeed initial condition in knots.
218       @param vt True airspeed in knots  */
219   inline void SetVtrueKtsIC(double vt)   { SetVtrueFpsIC(vt*ktstofps);   }
220
221   /** Set ground speed initial condition in knots.
222       @param vg Ground speed in knots  */
223   inline void SetVgroundKtsIC(double vg) { SetVgroundFpsIC(vg*ktstofps); }
224
225   /** Set mach initial condition.
226       @param mach Mach number  */
227   void SetMachIC(double mach);
228
229   /** Sets angle of attack initial condition in degrees.
230       @param a Alpha in degrees */
231   inline void SetAlphaDegIC(double a)      { SetAlphaRadIC(a*degtorad); }
232
233   /** Sets angle of sideslip initial condition in degrees.
234       @param B Beta in degrees */
235   inline void SetBetaDegIC(double B)       { SetBetaRadIC(B*degtorad);}
236
237   /** Sets pitch angle initial condition in degrees.
238       @param theta Theta (pitch) angle in degrees */
239   inline void SetThetaDegIC(double theta) { SetThetaRadIC(theta*degtorad); }
240
241   /** Sets the roll angle initial condition in degrees.
242       @param phi roll angle in degrees */
243   inline void SetPhiDegIC(double phi)  { SetPhiRadIC(phi*degtorad);}
244
245   /** Sets the heading angle initial condition in degrees.
246       @param psi Heading angle in degrees */
247   inline void SetPsiDegIC(double psi){ SetPsiRadIC(psi*degtorad); }
248
249   /** Sets the climb rate initial condition in feet/minute.
250       @param roc Rate of Climb in feet/minute  */
251   void SetClimbRateFpmIC(double roc);
252
253   /** Sets the flight path angle initial condition in degrees.
254       @param gamma Flight path angle in degrees  */
255   inline void SetFlightPathAngleDegIC(double gamma) { SetFlightPathAngleRadIC(gamma*degtorad); }
256
257   /** Sets the altitude initial condition in feet.
258       @param alt Altitude in feet */
259   void SetAltitudeFtIC(double alt);
260
261   /** Sets the initial Altitude above ground level.
262       @param agl Altitude above ground level in feet */
263   void SetAltitudeAGLFtIC(double agl);
264
265   /** Sets the initial sea level radius from planet center
266       @param sl_rad sea level radius in feet */
267   void SetSeaLevelRadiusFtIC(double sl_rad);
268
269   /** Sets the initial terrain elevation.
270       @param elev Initial terrain elevation in feet */
271   void SetTerrainAltitudeFtIC(double elev);
272
273   /** Sets the initial latitude.
274       @param lat Initial latitude in degrees */
275   inline void SetLatitudeDegIC(double lat)  { latitude=lat*degtorad; }
276
277   /** Sets the initial longitude.
278       @param lon Initial longitude in degrees */
279   inline void SetLongitudeDegIC(double lon) { longitude=lon*degtorad; }
280
281   /** Gets the initial calibrated airspeed.
282       @return Initial calibrated airspeed in knots */
283   inline double GetVcalibratedKtsIC(void) const { return vc*fpstokts; }
284
285   /** Gets the initial equivalent airspeed.
286       @return Initial equivalent airspeed in knots */
287   inline double GetVequivalentKtsIC(void) const { return ve*fpstokts; }
288
289   /** Gets the initial ground speed.
290       @return Initial ground speed in knots */
291   inline double GetVgroundKtsIC(void) const { return vg*fpstokts; }
292
293   /** Gets the initial true velocity.
294       @return Initial true airspeed in knots. */
295   inline double GetVtrueKtsIC(void) const { return vt*fpstokts; }
296
297   /** Gets the initial mach.
298       @return Initial mach number */
299   inline double GetMachIC(void) const { return mach; }
300
301   /** Gets the initial climb rate.
302       @return Initial climb rate in feet/minute */
303   inline double GetClimbRateFpmIC(void) const { return hdot*60; }
304
305   /** Gets the initial flight path angle.
306       @return Initial flight path angle in degrees */
307   inline double GetFlightPathAngleDegIC(void)const  { return gamma*radtodeg; }
308
309   /** Gets the initial angle of attack.
310       @return Initial alpha in degrees */
311   inline double GetAlphaDegIC(void) const { return alpha*radtodeg; }
312
313   /** Gets the initial sideslip angle.
314       @return Initial beta in degrees */
315   inline double GetBetaDegIC(void) const  { return beta*radtodeg; }
316
317   /** Gets the initial pitch angle.
318       @return Initial pitch angle in degrees */
319   inline double GetThetaDegIC(void) const { return theta*radtodeg; }
320
321   /** Gets the initial roll angle.
322       @return Initial phi in degrees */
323   inline double GetPhiDegIC(void) const { return phi*radtodeg; }
324
325   /** Gets the initial heading angle.
326       @return Initial psi in degrees */
327   inline double GetPsiDegIC(void) const { return psi*radtodeg; }
328
329   /** Gets the initial latitude.
330       @return Initial geocentric latitude in degrees */
331   inline double GetLatitudeDegIC(void) const { return latitude*radtodeg; }
332
333   /** Gets the initial longitude.
334       @return Initial longitude in degrees */
335   inline double GetLongitudeDegIC(void) const { return longitude*radtodeg; }
336
337   /** Gets the initial altitude.
338       @return Initial altitude in feet. */
339   inline double GetAltitudeFtIC(void) const { return altitude; }
340
341   /** Gets the initial altitude above ground level.
342       @return Initial altitude AGL in feet */
343   inline double GetAltitudeAGLFtIC(void) const { return altitude - terrain_altitude; }
344
345   /** Gets the initial sea level radius.
346       @return Initial sea level radius */
347   inline double GetSeaLevelRadiusFtIC(void) const { return sea_level_radius; }
348
349   /** Gets the initial terrain elevation.
350       @return Initial terrain elevation in feet */
351   inline double GetTerrainAltitudeFtIC(void) const { return terrain_altitude; }
352
353   /** Sets the initial ground speed.
354       @param vg Initial ground speed in feet/second */
355   void SetVgroundFpsIC(double vg);
356
357   /** Sets the initial true airspeed.
358       @param vt Initial true airspeed in feet/second */
359   void SetVtrueFpsIC(double vt);
360
361   /** Sets the initial body axis X velocity.
362       @param ubody Initial X velocity in feet/second */
363   void SetUBodyFpsIC(double ubody);
364
365   /** Sets the initial body axis Y velocity.
366       @param vbody Initial Y velocity in feet/second */
367   void SetVBodyFpsIC(double vbody);
368
369   /** Sets the initial body axis Z velocity.
370       @param wbody Initial Z velocity in feet/second */
371   void SetWBodyFpsIC(double wbody);
372
373   /** Sets the initial local axis north velocity.
374       @param vn Initial north velocity in feet/second */
375   void SetVnorthFpsIC(double vn);
376
377   /** Sets the initial local axis east velocity.
378       @param ve Initial east velocity in feet/second */
379   void SetVeastFpsIC(double ve);
380
381   /** Sets the initial local axis down velocity.
382       @param vd Initial down velocity in feet/second */
383   void SetVdownFpsIC(double vd);
384
385   /** Sets the initial roll rate.
386       @param P Initial roll rate in radians/second */
387   void SetPRadpsIC(double P)  { p = P; }
388
389   /** Sets the initial pitch rate.
390       @param Q Initial pitch rate in radians/second */
391   void SetQRadpsIC(double Q) { q = Q; }
392
393   /** Sets the initial yaw rate.
394       @param R initial yaw rate in radians/second */
395   void SetRRadpsIC(double R) { r = R; }
396
397   /** Sets the initial wind velocity.
398       @param wN Initial wind velocity in local north direction, feet/second
399       @param wE Initial wind velocity in local east direction, feet/second
400       @param wD Initial wind velocity in local down direction, feet/second   */
401   void SetWindNEDFpsIC(double wN, double wE, double wD);
402
403   /** Sets the initial total wind speed.
404       @param mag Initial wind velocity magnitude in knots */
405   void SetWindMagKtsIC(double mag);
406
407   /** Sets the initial wind direction.
408       @param dir Initial direction wind is coming from in degrees */
409   void SetWindDirDegIC(double dir);
410
411   /** Sets the initial headwind velocity.
412       @param head Initial headwind speed in knots */
413   void SetHeadWindKtsIC(double head);
414
415   /** Sets the initial crosswind speed.
416       @param cross Initial crosswind speed, positive from left to right */
417   void SetCrossWindKtsIC(double cross);
418
419   /** Sets the initial wind downward speed.
420       @param wD Initial downward wind speed in knots*/
421   void SetWindDownKtsIC(double wD);
422
423   /** Sets the initial climb rate.
424       @param roc Initial Rate of climb in feet/second */
425   void SetClimbRateFpsIC(double roc);
426
427   /** Gets the initial ground velocity.
428       @return Initial ground velocity in feet/second */
429   inline double GetVgroundFpsIC(void) const  { return vg; }
430
431   /** Gets the initial true velocity.
432       @return Initial true velocity in feet/second */
433   inline double GetVtrueFpsIC(void) const { return vt; }
434
435   /** Gets the initial body axis X wind velocity.
436       @return Initial body axis X wind velocity in feet/second */
437   inline double GetWindUFpsIC(void) const { return uw; }
438
439   /** Gets the initial body axis Y wind velocity.
440       @return Initial body axis Y wind velocity in feet/second */
441   inline double GetWindVFpsIC(void) const { return vw; }
442
443   /** Gets the initial body axis Z wind velocity.
444       @return Initial body axis Z wind velocity in feet/second */
445   inline double GetWindWFpsIC(void) const { return ww; }
446
447   /** Gets the initial wind velocity in local frame.
448       @return Initial wind velocity toward north in feet/second */
449   inline double GetWindNFpsIC(void) const { return wnorth; }
450
451   /** Gets the initial wind velocity in local frame.
452       @return Initial wind velocity toward north in feet/second */
453   inline double GetWindEFpsIC(void) const { return weast; }
454
455   /** Gets the initial wind velocity in local frame.
456       @return Initial wind velocity toward north in feet/second */
457   inline double GetWindDFpsIC(void) const { return wdown; }
458
459   /** Gets the initial total wind velocity in feet/sec.
460       @return Initial wind velocity in feet/second */
461   inline double GetWindFpsIC(void)  const { return sqrt(wnorth*wnorth + weast*weast); }
462
463   /** Gets the initial wind direction.
464       @return Initial wind direction in feet/second */
465   double GetWindDirDegIC(void) const;
466
467   /** Gets the initial climb rate.
468       @return Initial rate of climb in feet/second */
469   inline double GetClimbRateFpsIC(void) const { return hdot; }
470
471   /** Gets the initial body axis X velocity.
472       @return Initial body axis X velocity in feet/second. */
473   double GetUBodyFpsIC(void) const;
474
475   /** Gets the initial body axis Y velocity.
476       @return Initial body axis Y velocity in feet/second. */
477   double GetVBodyFpsIC(void) const;
478
479   /** Gets the initial body axis Z velocity.
480       @return Initial body axis Z velocity in feet/second. */
481   double GetWBodyFpsIC(void) const;
482
483   /** Gets the initial body axis roll rate.
484       @return Initial body axis roll rate in radians/second */
485   double GetPRadpsIC() const { return p; }
486
487   /** Gets the initial body axis pitch rate.
488       @return Initial body axis pitch rate in radians/second */
489   double GetQRadpsIC() const { return q; }
490
491   /** Gets the initial body axis yaw rate.
492       @return Initial body axis yaw rate in radians/second */
493   double GetRRadpsIC() const { return r; }
494
495   /** Sets the initial flight path angle.
496       @param gamma Initial flight path angle in radians */
497   void SetFlightPathAngleRadIC(double gamma);
498
499   /** Sets the initial angle of attack.
500       @param alpha Initial angle of attack in radians */
501   void SetAlphaRadIC(double alpha);
502
503   /** Sets the initial pitch angle.
504       @param theta Initial pitch angle in radians */
505   void SetThetaRadIC(double theta);
506
507   /** Sets the initial sideslip angle.
508       @param beta Initial angle of sideslip in radians. */
509   void SetBetaRadIC(double beta);
510
511   /** Sets the initial roll angle.
512       @param phi Initial roll angle in radians */
513   void SetPhiRadIC(double phi);
514
515   /** Sets the initial heading angle.
516       @param psi Initial heading angle in radians */
517   void SetPsiRadIC(double psi);
518
519   /** Sets the initial latitude.
520       @param lat Initial latitude in radians */
521   inline void SetLatitudeRadIC(double lat) { latitude=lat; }
522
523   /** Sets the initial longitude.
524       @param lon Initial longitude in radians */
525   inline void SetLongitudeRadIC(double lon) { longitude=lon; }
526
527   /** Gets the initial flight path angle.
528       @return Initial flight path angle in radians */
529   inline double GetFlightPathAngleRadIC(void) const { return gamma; }
530
531   /** Gets the initial angle of attack.
532       @return Initial alpha in radians */
533   inline double GetAlphaRadIC(void) const      { return alpha; }
534
535   /** Gets the initial angle of sideslip.
536       @return Initial sideslip angle in radians */
537   inline double GetBetaRadIC(void) const       { return beta; }
538
539   /** Gets the initial roll angle.
540       @return Initial roll angle in radians */
541   inline double GetPhiRadIC(void) const  { return phi; }
542
543   /** Gets the initial latitude.
544       @return Initial latitude in radians */
545   inline double GetLatitudeRadIC(void) const { return latitude; }
546
547   /** Gets the initial longitude.
548       @return Initial longitude in radians */
549   inline double GetLongitudeRadIC(void) const { return longitude; }
550
551   /** Gets the initial pitch angle.
552       @return Initial pitch angle in radians */
553   inline double GetThetaRadIC(void) const { return theta; }
554
555   /** Gets the initial heading angle.
556       @return Initial heading angle in radians */
557   inline double GetPsiRadIC(void) const   { return psi; }
558
559   /** Gets the initial speedset.
560       @return Initial speedset */
561   inline speedset GetSpeedSet(void) { return lastSpeedSet; }
562
563   /** Gets the initial windset.
564       @return Initial windset */
565   inline windset GetWindSet(void) { return lastWindSet; }
566
567   /** Loads the initial conditions.
568       @param rstname The name of an initial conditions file
569       @param useStoredPath true if the stored path to the IC file should be used
570       @return true if successful */
571   bool Load(string rstname, bool useStoredPath = true );
572
573 private:
574   double vt,vc,ve,vg;
575   double mach;
576   double altitude,hdot;
577   double latitude,longitude;
578   double u,v,w;
579   double p,q,r;
580   double uw,vw,ww;
581   double vnorth,veast,vdown;
582   double wnorth,weast,wdown;
583   double whead, wcross, wdir, wmag;
584   double sea_level_radius;
585   double terrain_altitude;
586   double radius_to_vehicle;
587
588   double  alpha, beta, theta, phi, psi, gamma;
589   double salpha,sbeta,stheta,sphi,spsi,sgamma;
590   double calpha,cbeta,ctheta,cphi,cpsi,cgamma;
591
592   double xlo, xhi,xmin,xmax;
593
594   typedef double (FGInitialCondition::*fp)(double x);
595   fp sfunc;
596
597   speedset lastSpeedSet;
598   windset lastWindSet;
599
600   FGFDMExec *fdmex;
601   FGPropertyManager *PropertyManager;
602
603   bool getAlpha(void);
604   bool getTheta(void);
605   bool getMachFromVcas(double *Mach,double vcas);
606
607   double GammaEqOfTheta(double Theta);
608   double GammaEqOfAlpha(double Alpha);
609   double calcVcas(double Mach);
610   void calcUVWfromNED(void);
611   void calcWindUVW(void);
612
613   bool findInterval(double x,double guess);
614   bool solve(double *y, double x);
615   void bind(void);
616   void unbind(void);
617   void Debug(int from);
618 };
619 }
620 #endif
621