FGInitialCondition¶
- class jsbsim.FGInitialCondition¶
Initializes the simulation run.
Takes a set of initial conditions (IC) and provide a kinematically consistent set of body axis velocity components, euler angles, and altitude. This class does not attempt to trim the model i.e. the sim will most likely start in a very dynamic state (unless, of course, you have chosen your IC’s wisely, or started on the ground) even after setting it up with this class.
Usage Notes
With a valid object of FGFDMExec and an aircraft model loaded:
FGInitialCondition* fgic = FDMExec->GetIC(); // Reset the initial conditions and set VCAS and altitude fgic->InitializeIC(); fgic->SetVcalibratedKtsIC(vcas); fgic->SetAltitudeAGLFtIC(altitude); // directly into Run FDMExec->GetPropagate()->SetInitialState(fgic); delete fgic; FDMExec->Run(); //or to loop the sim w/o integrating FDMExec->RunIC();
Alternatively, you can load initial conditions from an XML file:
FGInitialCondition* fgic = FDMExec->GetIC(); fgic->Load(IC_file);
Speed
Since vc, ve, vt, and mach all represent speed, the remaining three are recalculated each time one of them is set (using the current altitude). The most recent speed set is remembered so that if and when altitude is reset, the last set speed is used to recalculate the remaining three. Setting any of the body components forces a recalculation of vt and vt then becomes the most recent speed set.
Alpha,Gamma, and Theta
This class assumes that it will be used to set up the sim for a steady, zero pitch rate condition. Since any two of those angles specifies the third gamma (flight path angle) is favored when setting alpha and theta and alpha is favored when setting gamma. i.e.
set alpha : recalculate theta using gamma as currently set
set theta : recalculate alpha using gamma as currently set
set gamma : recalculate theta using alpha as currently set
The idea being that gamma is most interesting to pilots (since it is indicative of climb rate).
Setting climb rate is, for the purpose of this discussion, considered equivalent to setting gamma.
These are the items that can be set in an initialization file:
ubody (velocity, ft/sec)
vbody (velocity, ft/sec)
wbody (velocity, ft/sec)
vnorth (velocity, ft/sec)
veast (velocity, ft/sec)
vdown (velocity, ft/sec)
latitude (position, degrees)
longitude (position, degrees)
phi (orientation, degrees)
theta (orientation, degrees)
psi (orientation, degrees)
alpha (angle, degrees)
beta (angle, degrees)
gamma (angle, degrees)
roc (vertical velocity, ft/sec)
elevation (local terrain elevation, ft)
altitude (altitude AGL, ft)
altitudeAGL (altitude AGL, ft)
altitudeMSL (altitude MSL, ft)
winddir (wind from-angle, degrees)
vwind (magnitude wind speed, ft/sec)
hwind (headwind speed, knots)
xwind (crosswind speed, knots)
vc (calibrated airspeed, ft/sec)
mach (mach)
vground (ground speed, ft/sec)
trim (0 for no trim, 1 for ground trim, ‘Longitudinal’, ‘Full’, ‘Ground’, ‘Pullup’, ‘Custom’, ‘Turn’)
running (-1 for all engines, 0 … n-1 for specific engines)
Properties
ic/vc-kts (read/write) Calibrated airspeed initial condition in knots
ic/ve-kts (read/write) Knots equivalent airspeed initial condition
ic/vg-kts (read/write) Ground speed initial condition in knots
ic/vt-kts (read/write) True airspeed initial condition in knots
ic/mach (read/write) Mach initial condition
ic/roc-fpm (read/write) Rate of climb initial condition in feet/minute
ic/gamma-deg (read/write) Flightpath angle initial condition in degrees
ic/alpha-deg (read/write) Angle of attack initial condition in degrees
ic/beta-deg (read/write) Angle of sideslip initial condition in degrees
ic/theta-deg (read/write) Pitch angle initial condition in degrees
ic/phi-deg (read/write) Roll angle initial condition in degrees
ic/psi-true-deg (read/write) Heading angle initial condition in degrees
ic/lat-gc-deg (read/write) Latitude initial condition in degrees
ic/long-gc-deg (read/write) Longitude initial condition in degrees
ic/h-sl-ft (read/write) Height above sea level initial condition in feet
ic/h-agl-ft (read/write) Height above ground level initial condition in feet
ic/sea-level-radius-ft (read/write) Radius of planet at sea level in feet
ic/terrain-elevation-ft (read/write) Terrain elevation above sea level in feet
ic/vg-fps (read/write) Ground speed initial condition in feet/second
ic/vt-fps (read/write) True airspeed initial condition in feet/second
ic/vw-bx-fps (read/write) Wind velocity initial condition in Body X frame in feet/second
ic/vw-by-fps (read/write) Wind velocity initial condition in Body Y frame in feet/second
ic/vw-bz-fps (read/write) Wind velocity initial condition in Body Z frame in feet/second
ic/vw-north-fps (read/write) Wind northward velocity initial condition in feet/second
ic/vw-east-fps (read/write) Wind eastward velocity initial condition in feet/second
ic/vw-down-fps (read/write) Wind downward velocity initial condition in feet/second
ic/vw-mag-fps (read/write) Wind velocity magnitude initial condition in feet/sec.
ic/vw-dir-deg (read/write) Wind direction initial condition, in degrees from north
ic/roc-fps (read/write) Rate of climb initial condition, in feet/second
ic/u-fps (read/write) Body frame x-axis velocity initial condition in feet/second
ic/v-fps (read/write) Body frame y-axis velocity initial condition in feet/second
ic/w-fps (read/write) Body frame z-axis velocity initial condition in feet/second
ic/vn-fps (read/write) Local frame x-axis (north) velocity initial condition in feet/second
ic/ve-fps (read/write) Local frame y-axis (east) velocity initial condition in feet/second
ic/vd-fps (read/write) Local frame z-axis (down) velocity initial condition in feet/second
ic/gamma-rad (read/write) Flight path angle initial condition in radians
ic/alpha-rad (read/write) Angle of attack initial condition in radians
ic/theta-rad (read/write) Pitch angle initial condition in radians
ic/beta-rad (read/write) Angle of sideslip initial condition in radians
ic/phi-rad (read/write) Roll angle initial condition in radians
ic/psi-true-rad (read/write) Heading angle initial condition in radians
ic/lat-gc-rad (read/write) Geocentric latitude initial condition in radians
ic/long-gc-rad (read/write) Longitude initial condition in radians
ic/p-rad_sec (read/write) Roll rate initial condition in radians/second
ic/q-rad_sec (read/write) Pitch rate initial condition in radians/second
ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
- load(rstfile: str, useAircraftPath: bool = True) bool¶
Loads the initial conditions.
- Parameters:
rstname – The name of an initial conditions file
useAircraftPath – true if path is given relative to the aircraft path.
- Returns:
true if successful