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