X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGPropagate.h;h=1a683b218044722831d71f2ace54aed67d74bc72;hb=1575fad886a0b18825363d41d53a287e8d36b9c8;hp=f262d1fb15167aac691a4024375bfef3ff23b3cc;hpb=312447c565ec410f52353ba22d305cf470e9ba33;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGPropagate.h b/src/FDM/JSBSim/models/FGPropagate.h index f262d1fb1..1a683b218 100644 --- a/src/FDM/JSBSim/models/FGPropagate.h +++ b/src/FDM/JSBSim/models/FGPropagate.h @@ -49,7 +49,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.63 2011/08/21 15:35:39 bcoconni Exp $" +#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.69 2012/04/29 13:27:51 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -69,18 +69,18 @@ CLASS DOCUMENTATION state of the vehicle given the forces and moments that act on it. The integration accounts for a rotating Earth. - Integration of rotational and translation position and rate can be + Integration of rotational and translation position and rate can be customized as needed or frozen by the selection of no integrator. The - selection of which integrator to use is done through the setting of + selection of which integrator to use is done through the setting of the associated property. There are four properties which can be set: - + @code simulation/integrator/rate/rotational simulation/integrator/rate/translational simulation/integrator/position/rotational simulation/integrator/position/translational @endcode - + Each of the integrators listed above can be set to one of the following values: @code @@ -93,7 +93,7 @@ CLASS DOCUMENTATION @endcode @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier - @version $Id: FGPropagate.h,v 1.63 2011/08/21 15:35:39 bcoconni Exp $ + @version $Id: FGPropagate.h,v 1.69 2012/04/29 13:27:51 bcoconni Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -156,12 +156,13 @@ public: /// Destructor ~FGPropagate(); - + /// These define the indices use to select the various integrators. - enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3, eAdamsBashforth4}; + enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, + eAdamsBashforth3, eAdamsBashforth4, eBuss1, eBuss2, eLocalLinearization}; /** Initializes the FGPropagate class after instantiation and prior to first execution. - The base class FGModel::InitModel is called first, initializing pointers to the + The base class FGModel::InitModel is called first, initializing pointers to the other FGModel objects (and others). */ bool InitModel(void); @@ -169,7 +170,7 @@ public: /** Runs the state propagation model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold. - @param Holding if true, the executive has been directed to hold the sim from + @param Holding if true, the executive has been directed to hold the sim from advancing time. Some models may ignore this flag, such as the Input model, which may need to be active to listen on a socket for the "Resume" command to be given. @@ -188,7 +189,7 @@ public: expressed in Local horizontal frame. */ const FGColumnVector3& GetVel(void) const { return vVel; } - + /** Retrieves the body frame vehicle velocity vector. The vector returned is represented by an FGColumnVector reference. The vector for the velocity in Body frame is organized (Vx, Vy, Vz). The vector @@ -200,7 +201,7 @@ public: @return The body frame vehicle velocity vector in ft/sec. */ const FGColumnVector3& GetUVW(void) const { return VState.vUVW; } - + /** Retrieves the body angular rates vector, relative to the ECEF frame. Retrieves the body angular rates (p, q, r), which are calculated by integration of the angular acceleration. @@ -214,7 +215,7 @@ public: @return The body frame angular rates in rad/sec. */ const FGColumnVector3& GetPQR(void) const {return VState.vPQR;} - + /** Retrieves the body angular rates vector, relative to the ECI (inertial) frame. Retrieves the body angular rates (p, q, r), which are calculated by integration of the angular acceleration. @@ -257,7 +258,7 @@ public: @param idx the index of the velocity component desired (1-based). @return The body frame velocity component. */ - double GetUVW (int idx) const { return VState.vUVW(idx); } + double GetUVW(int idx) const { return VState.vUVW(idx); } /** Retrieves a Local frame velocity component. Retrieves a Local frame velocity component. The velocity returned is @@ -286,14 +287,14 @@ public: /** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame. */ - const FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; } + FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; } /** Returns the current altitude above sea level. This function returns the altitude above sea level. units ft @return The current altitude above sea level in feet. */ - double GetAltitudeASL(void) const { return VState.vLocation.GetRadius() - SeaLevelRadius; } + double GetAltitudeASL(void) const { return VState.vLocation.GetAltitudeASL(); } /** Returns the current altitude above sea level. This function returns the altitude above sea level. @@ -377,7 +378,7 @@ public: units feet @return distance of the local terrain from the center of the earth. */ - double GetLocalTerrainRadius(void) const { return LocalTerrainRadius; } + double GetLocalTerrainRadius(void) const; double GetEarthPositionAngle(void) const { return VState.vLocation.GetEPA(); } @@ -385,7 +386,9 @@ public: const FGColumnVector3& GetTerrainVelocity(void) const { return LocalTerrainVelocity; } const FGColumnVector3& GetTerrainAngularVelocity(void) const { return LocalTerrainAngularVelocity; } - double GetTerrainElevation(void) const; + void RecomputeLocalTerrainVelocity(); + + double GetTerrainElevation(void) const { return GetLocalTerrainRadius() - VState.vLocation.GetSeaLevelRadius(); } double GetDistanceAGL(void) const; double GetRadius(void) const { if (VState.vLocation.GetRadius() == 0) return 1.0; @@ -465,21 +468,21 @@ public: void SetEarthPositionAngle(double epa) {VState.vLocation.SetEarthPositionAngle(epa);} - void SetInertialOrientation(FGQuaternion Qi); - void SetInertialVelocity(FGColumnVector3 Vi); - void SetInertialRates(FGColumnVector3 vRates); + void SetInertialOrientation(const FGQuaternion& Qi); + void SetInertialVelocity(const FGColumnVector3& Vi); + void SetInertialRates(const FGColumnVector3& vRates); const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; } const FGQuaternion GetQuaternionECI(void) const { return VState.qAttitudeECI; } void SetPQR(unsigned int i, double val) { - if ((i>=1) && (i<=3) ) - VState.vPQR(i) = val; + VState.vPQR(i) = val; + VState.vPQRi = VState.vPQR + Ti2b * in.vOmegaPlanet; } void SetUVW(unsigned int i, double val) { - if ((i>=1) && (i<=3) ) - VState.vUVW(i) = val; + VState.vUVW(i) = val; + CalculateInertialVelocity(); } // SET functions @@ -502,11 +505,18 @@ public: VehicleRadius = r; VState.vInertialPosition = Tec2i * VState.vLocation; } - void SetAltitudeASL(double altASL) { SetRadius(altASL + SeaLevelRadius); } - void SetAltitudeASLmeters(double altASL) { SetRadius(altASL/fttom + SeaLevelRadius); } - void SetSeaLevelRadius(double tt) { SeaLevelRadius = tt; } + + void SetAltitudeASL(double altASL) + { + VState.vLocation.SetAltitudeASL(altASL); + UpdateVehicleState(); + } + void SetAltitudeASLmeters(double altASL) { SetAltitudeASL(altASL/fttom); } + + void SetSeaLevelRadius(double tt); void SetTerrainElevation(double tt); - void SetDistanceAGL(double tt) { SetRadius(tt + LocalTerrainRadius); } + void SetDistanceAGL(double tt); + void SetInitialState(const FGInitialCondition *); void SetLocation(const FGLocation& l); void SetLocation(const FGColumnVector3& lv) @@ -520,9 +530,7 @@ public: SetLocation(l); } - void RecomputeLocalTerrainRadius(void); - - void NudgeBodyLocation(FGColumnVector3 deltaLoc) { + void NudgeBodyLocation(const FGColumnVector3& deltaLoc) { VState.vInertialPosition -= Tb2i*deltaLoc; VState.vLocation -= Tb2ec*deltaLoc; } @@ -549,7 +557,6 @@ private: FGColumnVector3 vVel; FGColumnVector3 vInertialVelocity; FGColumnVector3 vLocation; - FGColumnVector3 vDeltaXYZEC; FGMatrix33 Tec2b; FGMatrix33 Tb2ec; FGMatrix33 Tl2b; // local to body frame matrix copy for immediate local use @@ -562,9 +569,10 @@ private: FGMatrix33 Tb2i; // body to ECI frame rotation matrix FGMatrix33 Ti2l; FGMatrix33 Tl2i; - - double LocalTerrainRadius, SeaLevelRadius, VehicleRadius; + + double VehicleRadius; FGColumnVector3 LocalTerrainVelocity, LocalTerrainAngularVelocity; + eIntegrateType integrator_rotational_rate; eIntegrateType integrator_translational_rate; eIntegrateType integrator_rotational_position;