41 #include "models/FGModel.h" 42 #include "math/FGColumnVector3.h" 43 #include "math/FGLocation.h" 44 #include "math/FGQuaternion.h" 45 #include "math/FGMatrix33.h" 52 #define ID_PROPAGATE "$Id: FGPropagate.h,v 1.85 2016/04/16 12:24:39 bcoconni Exp $" 60 class FGInitialCondition;
142 std::deque <FGColumnVector3> dqPQRidot;
143 std::deque <FGColumnVector3> dqUVWidot;
144 std::deque <FGColumnVector3> dqInertialVelocity;
145 std::deque <FGQuaternion> dqQtrndot;
163 eAdamsBashforth3, eAdamsBashforth4, eBuss1, eBuss2, eLocalLinearization, eAdamsBashforth5};
170 void InitializeDerivatives();
179 bool Run(
bool Holding);
290 double GetUVW(
int idx)
const {
return VState.vUVW(idx); }
303 double GetVel(
int idx)
const {
return vVel(idx); }
357 double GetPQR(
int axis)
const {
return VState.vPQR(axis);}
370 double GetPQRi(
int axis)
const {
return VState.vPQRi(axis);}
382 double GetEuler(
int axis)
const {
return VState.qAttitudeLocal.GetEuler(axis); }
394 double GetEulerDeg(
int axis)
const {
return VState.qAttitudeLocal.GetEuler(axis) * radtodeg; }
406 double GetCosEuler(
int idx)
const {
return VState.qAttitudeLocal.GetCosEuler(idx); }
418 double GetSinEuler(
int idx)
const {
return VState.qAttitudeLocal.GetSinEuler(idx); }
425 double Gethdot(
void)
const {
return -vVel(eDown); }
435 double GetEarthPositionAngle(
void)
const {
return VState.vLocation.GetEPA(); }
437 double GetEarthPositionAngleDeg(
void)
const {
return GetEarthPositionAngle()*radtodeg;}
439 const FGColumnVector3& GetTerrainVelocity(
void)
const {
return LocalTerrainVelocity; }
440 const FGColumnVector3& GetTerrainAngularVelocity(
void)
const {
return LocalTerrainAngularVelocity; }
441 void RecomputeLocalTerrainVelocity();
443 double GetTerrainElevation(
void)
const {
return GetLocalTerrainRadius() - VState.vLocation.GetSeaLevelRadius(); }
444 double GetDistanceAGL(
void)
const;
445 double GetDistanceAGLKm(
void)
const;
446 double GetRadius(
void)
const {
447 if (VState.vLocation.GetRadius() == 0)
return 1.0;
448 else return VState.vLocation.GetRadius();
450 double GetLongitude(
void)
const {
return VState.vLocation.GetLongitude(); }
451 double GetLatitude(
void)
const {
return VState.vLocation.GetLatitude(); }
453 double GetGeodLatitudeRad(
void)
const {
return VState.vLocation.GetGeodLatitudeRad(); }
454 double GetGeodLatitudeDeg(
void)
const {
return VState.vLocation.GetGeodLatitudeDeg(); }
456 double GetGeodeticAltitude(
void)
const {
return VState.vLocation.GetGeodAltitude(); }
457 double GetGeodeticAltitudeKm(
void)
const {
return VState.vLocation.GetGeodAltitude()*0.0003048; }
459 double GetLongitudeDeg(
void)
const {
return VState.vLocation.GetLongitudeDeg(); }
460 double GetLatitudeDeg(
void)
const {
return VState.vLocation.GetLatitudeDeg(); }
461 const FGLocation& GetLocation(
void)
const {
return VState.vLocation; }
462 double GetLocation(
int i)
const {
return VState.vLocation(i); }
520 const VehicleState& GetVState(
void)
const {
return VState; }
524 void SetEarthPositionAngle(
double epa) {VState.vLocation.SetEarthPositionAngle(epa);}
539 void SetPQR(
unsigned int i,
double val) {
540 VState.vPQR(i) = val;
541 VState.vPQRi = VState.vPQR + Ti2b * in.vOmegaPlanet;
544 void SetUVW(
unsigned int i,
double val) {
545 VState.vUVW(i) = val;
546 CalculateInertialVelocity();
551 void SetLongitude(
double lon)
553 VState.vLocation.SetLongitude(lon);
554 UpdateVehicleState();
556 void SetLongitudeDeg(
double lon) { SetLongitude(lon*degtorad); }
557 void SetLatitude(
double lat)
559 VState.vLocation.SetLatitude(lat);
560 UpdateVehicleState();
562 void SetLatitudeDeg(
double lat) { SetLatitude(lat*degtorad); }
563 void SetRadius(
double r)
565 VState.vLocation.SetRadius(r);
566 VState.vInertialPosition = Tec2i * VState.vLocation;
569 void SetAltitudeASL(
double altASL)
571 VState.vLocation.SetAltitudeASL(altASL);
572 UpdateVehicleState();
574 void SetAltitudeASLmeters(
double altASL) { SetAltitudeASL(altASL/fttom); }
576 void SetSeaLevelRadius(
double tt);
577 void SetTerrainElevation(
double tt);
578 void SetDistanceAGL(
double tt);
579 void SetDistanceAGLKm(
double tt);
588 void SetPosition(
const double Lon,
const double Lat,
const double Radius)
595 VState.vInertialPosition -= Tb2i*deltaLoc;
596 VState.vLocation -= Tb2ec*deltaLoc;
605 void DumpState(
void);
645 void CalculateInertialVelocity(
void);
646 void CalculateUVW(
void);
647 void CalculateQuatdot(
void);
651 std::deque <FGColumnVector3>& ValDot,
657 std::deque <FGQuaternion>& ValDot,
661 void UpdateLocationMatrices(
void);
662 void UpdateBodyMatrices(
void);
663 void UpdateVehicleState(
void);
665 void WriteStateFile(
int num);
667 void Debug(
int from);
bool Run(bool Holding)
Runs the state propagation model; called by the Executive Can pass in a value indicating if the execu...
const FGMatrix33 & GetTec2b(void) const
Retrieves the ECEF-to-body transformation matrix.
Models the Quaternion representation of rotations.
double GetEuler(int axis) const
Retrieves a vehicle Euler angle component.
FGColumnVector3 vPQRi
The angular velocity vector for the vehicle body frame relative to the ECI frame, expressed in the bo...
double GetCosEuler(int idx) const
Retrieves the cosine of a vehicle Euler angle component.
~FGPropagate()
Destructor.
const FGMatrix33 & GetTl2b(void) const
Retrieves the local-to-body transformation matrix.
const FGMatrix33 & GetTl2i(void) const
Retrieves the local-to-inertial transformation matrix.
const FGQuaternion GetQuaternionECI(void) const
Returns the quaternion that goes from ECI to Body.
bool InitModel(void)
Initializes the FGPropagate class after instantiation and prior to first execution.
const FGColumnVector3 & GetPQRi(void) const
Retrieves the body angular rates vector, relative to the ECI (inertial) frame.
double GetNEDVelocityMagnitude(void) const
Retrieves the total local NED velocity in ft/sec.
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF)...
double GetAltitudeASLmeters(void) const
Returns the current altitude above sea level.
FGLocation vLocation
Represents the current location of the vehicle in Earth centered Earth fixed (ECEF) frame...
double GetAltitudeASL(void) const
Returns the current altitude above sea level.
double GetSinEuler(int idx) const
Retrieves the sine of a vehicle Euler angle component.
FGColumnVector3 GetEulerDeg(void) const
Retrieves the Euler angles (in degrees) that define the vehicle orientation.
FGColumnVector3 GetECEFVelocity(void) const
Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame...
const FGMatrix33 & GetTi2l(void) const
Retrieves the inertial-to-local transformation matrix.
const FGMatrix33 & GetTb2ec(void) const
Retrieves the body-to-ECEF transformation matrix.
The current vehicle state vector structure contains the translational and angular position...
const FGMatrix33 & GetTi2ec(void) const
Retrieves the ECI-to-ECEF transformation matrix.
const FGColumnVector3 & GetUVW(void) const
Retrieves the body frame vehicle velocity vector.
const FGColumnVector3 & GetPQR(void) const
Retrieves the body angular rates vector, relative to the ECEF frame.
double GetEulerDeg(int axis) const
Retrieves a vehicle Euler angle component in degrees.
double GetPQRi(int axis) const
Retrieves a body frame angular velocity component relative to the ECI (inertial) frame.
FGQuaternion qAttitudeLocal
The current orientation of the vehicle, that is, the orientation of the body frame relative to the lo...
FGColumnVector3 vPQR
The angular velocity vector for the vehicle relative to the ECEF frame, expressed in the body frame...
Models the EOM and integration/propagation of state.
const FGMatrix33 & GetTec2i(void) const
Retrieves the ECEF-to-ECI transformation matrix.
const FGMatrix33 & GetTb2i(void) const
Retrieves the body-to-ECI transformation matrix.
FGPropagate(FGFDMExec *Executive)
Constructor.
double GetLocalTerrainRadius(void) const
Returns the "constant" LocalTerrainRadius.
const FGMatrix33 & GetTec2l(void) const
Retrieves the ECEF-to-local transformation matrix.
Base class for all scheduled JSBSim models.
const FGMatrix33 & GetTb2l(void) const
Retrieves the body-to-local transformation matrix.
const FGColumnVector3 & GetVel(void) const
Retrieves the velocity vector.
const FGQuaternion & GetQuaterniondot(void) const
Retrieves the time derivative of the body orientation quaternion.
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles that define the vehicle orientation.
double GetInertialVelocityMagnitude(void) const
Retrieves the total inertial velocity in ft/sec.
This class implements a 3 element column vector.
const FGMatrix33 & GetTl2ec(void) const
Retrieves the local-to-ECEF transformation matrix.
FGQuaternion qAttitudeECI
The current orientation of the vehicle, that is, the orientation of the body frame relative to the in...
const FGColumnVector3 & GetInertialPosition(void) const
Retrieves the inertial position vector.
const FGQuaternion GetQuaternion(void) const
Returns the quaternion that goes from Local to Body.
Initializes the simulation run.
double Gethdot(void) const
Returns the current altitude rate.
const FGColumnVector3 & GetInertialVelocity(void) const
Retrieves the inertial velocity vector in ft/sec.
Handles matrix math operations.
double GetVel(int idx) const
Retrieves a Local frame velocity component.
eIntegrateType
These define the indices use to select the various integrators.
Encapsulates the JSBSim simulation executive.
double GetPQR(int axis) const
Retrieves a body frame angular velocity component relative to the ECEF frame.
double GetECEFVelocity(int idx) const
Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame ...
double GetUVW(int idx) const
Retrieves a body frame velocity component.
FGColumnVector3 vUVW
The velocity vector of the vehicle with respect to the ECEF frame, expressed in the body system...
const FGQuaternion GetQuaternionECEF(void) const
Returns the quaternion that goes from ECEF to Body.
const FGMatrix33 & GetTi2b(void) const
Retrieves the ECI-to-body transformation matrix.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.