namespace JSBSim {
-IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.163 2014/09/04 10:17:20 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.164 2014/11/30 12:35:32 bcoconni Exp $");
IDENT(IdHdr,ID_FDMEXEC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTrim trim(this, (JSBSim::TrimMode)mode);
if ( !trim.DoTrim() ) cerr << endl << "Trim Failed" << endl << endl;
trim.Report();
- sim_time = saved_time;
+ Setsim_time(saved_time);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
saved_time = sim_time;
FGSimplexTrim trim(this, (JSBSim::TrimMode)mode);
- sim_time = saved_time;
Setsim_time(saved_time);
std::cout << "dT: " << dT << std::endl;
}
if (Constructing) return;
saved_time = sim_time;
FGLinearization lin(this,mode);
- sim_time = saved_time;
Setsim_time(saved_time);
}
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.91 2014/05/17 15:35:53 jberndt Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.93 2014/11/30 13:06:05 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
- @version $Revision: 1.91 $
+ @version $Revision: 1.93 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@return the current simulation time. */
double Setsim_time(double cur_time) {
sim_time = cur_time;
+ GetGroundCallback()->SetTime(sim_time);
return sim_time;
}
@return the new simulation time. */
double IncrTime(void) {
if (!holding) sim_time += dT;
+ GetGroundCallback()->SetTime(sim_time);
Frame++;
return sim_time;
}
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.97 2014/11/15 11:57:37 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.98 2014/11/30 12:35:32 bcoconni Exp $");
IDENT(IdHdr,ID_INITIALCONDITION);
//******************************************************************************
position.SetLongitude(lonRad0);
position.SetLatitude(latRad0);
- position.SetAltitudeAGL(altAGLFt0, 0.0);
+ position.SetAltitudeAGL(altAGLFt0);
orientation = FGQuaternion(phi0, theta0, psi0);
const FGMatrix33& Tb2l = orientation.GetTInv();
double FGInitialCondition::GetAltitudeAGLFtIC(void) const
{
- return position.GetAltitudeAGL(0.0);
+ return position.GetAltitudeAGL();
}
//******************************************************************************
double FGInitialCondition::GetTerrainElevationFtIC(void) const
{
- return position.GetTerrainRadius(0.0) - position.GetSeaLevelRadius();
+ return position.GetTerrainRadius() - position.GetSeaLevelRadius();
}
//******************************************************************************
void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
{
- double terrainElevation = position.GetTerrainRadius(0.0)
+ double terrainElevation = position.GetTerrainRadius()
- position.GetSeaLevelRadius();
SetAltitudeASLFtIC(agl + terrainElevation);
lastAltitudeSet = setagl;
if (position_el->FindElement("radius")) {
position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT"));
} else if (position_el->FindElement("altitudeAGL")) {
- position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"),
- 0.0);
+ position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
} else if (position_el->FindElement("altitudeMSL")) {
position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
} else {
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.23 2014/05/01 18:32:54 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.24 2014/11/30 12:35:32 bcoconni Exp $");
IDENT(IdHdr,ID_TRIM);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3 normal, vDummy;
FGLocation lDummy;
- double height = gearLoc.GetContactPoint(fdmex->GetSimTime(), lDummy,
- normal, vDummy, vDummy);
+ double height = gearLoc.GetContactPoint(lDummy, normal, vDummy, vDummy);
c.normal = Tec2b * normal;
contacts.push_back(c);
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.17 2014/05/17 15:35:54 jberndt Exp $"
+#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.18 2014/11/30 12:35:32 bcoconni Exp $"
namespace JSBSim {
ball formed earth with an adjustable terrain elevation.
@author Mathias Froehlich
- @version $Id: FGGroundCallback.h,v 1.17 2014/05/17 15:35:54 jberndt Exp $
+ @version $Id: FGGroundCallback.h,v 1.18 2014/11/30 12:35:32 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
public:
- FGGroundCallback() {}
+ FGGroundCallback() : time(0.0) {}
virtual ~FGGroundCallback() {}
/** Compute the altitude above sealevel
FGColumnVector3& normal, FGColumnVector3& v,
FGColumnVector3& w) const = 0;
+ /** Compute the altitude above ground.
+ The altitude depends on location l.
+ @param l location
+ @param contact Contact point location below the location l
+ @param normal Normal vector at the contact point
+ @param v Linear velocity at the contact point
+ @param w Angular velocity at the contact point
+ @return altitude above ground
+ */
+ virtual double GetAGLevel(const FGLocation& location, FGLocation& contact,
+ FGColumnVector3& normal, FGColumnVector3& v,
+ FGColumnVector3& w) const
+ { return GetAGLevel(time, location, contact, normal, v, w); }
+
/** Compute the local terrain radius
@param t simulation time
@param location location
*/
virtual double GetTerrainGeoCentRadius(double t, const FGLocation& location) const = 0;
+ /** Compute the local terrain radius
+ @param location location
+ */
+ virtual double GetTerrainGeoCentRadius(const FGLocation& location) const
+ { return GetTerrainGeoCentRadius(time, location); }
+
/** Return the sea level radius
- @param t simulation time
@param location location
*/
virtual double GetSeaLevelRadius(const FGLocation& location) const = 0;
*/
virtual void SetSeaLevelRadius(double radius) { }
+ void SetTime(double _time) { time = _time; }
+
+private:
+ double time;
};
typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr;
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_LOCATION "$Id: FGLocation.h,v 1.33 2014/08/28 11:46:12 bcoconni Exp $"
+#define ID_LOCATION "$Id: FGLocation.h,v 1.34 2014/11/30 12:35:32 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2
@author Mathias Froehlich
- @version $Id: FGLocation.h,v 1.33 2014/08/28 11:46:12 bcoconni Exp $
+ @version $Id: FGLocation.h,v 1.34 2014/11/30 12:35:32 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@param altitudeASL altitude above Sea Level in feet.
@see SetGroundCallback */
void SetAltitudeASL(double altitudeASL)
- { SetRadius(GroundCallback->GetSeaLevelRadius(*this) + altitudeASL); }
+ { SetRadius(GetSeaLevelRadius() + altitudeASL); }
/** Set the altitude above ground level.
@param altitudeAGL altitude above Ground Level in feet.
@see SetGroundCallback */
- void SetAltitudeAGL(double altitudeAGL, double time)
- { SetRadius(GroundCallback->GetTerrainGeoCentRadius(time, *this) + altitudeAGL); }
+ void SetAltitudeAGL(double altitudeAGL)
+ { SetRadius(GetTerrainRadius() + altitudeAGL); }
/** Get the local sea level radius
@return the sea level radius at the location in feet.
/** Get the local terrain radius
@return the terrain level radius at the location in feet.
@see SetGroundCallback */
- double GetTerrainRadius(double time) const
- { ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(time, *this); }
+ double GetTerrainRadius(void) const
+ { ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(*this); }
/** Get the altitude above sea level.
@return the altitude ASL in feet.
@see SetGroundCallback */
- double GetAltitudeASL() const
+ double GetAltitudeASL(void) const
{ ComputeDerived(); return GroundCallback->GetAltitude(*this); }
/** Get the altitude above ground level.
@return the altitude AGL in feet.
@see SetGroundCallback */
- double GetAltitudeAGL(double time) const {
+ double GetAltitudeAGL(void) const {
FGLocation c;
FGColumnVector3 n,v,w;
- return GetContactPoint(time,c,n,v,w);
+ return GetContactPoint(c,n,v,w);
}
/** Get terrain contact point information below the current location.
- @param time Simulation time
@param contact Contact point location
@param normal Terrain normal vector in contact point (ECEF frame)
@param v Terrain linear velocity in contact point (ECEF frame)
@param w Terrain angular velocity in contact point (ECEF frame)
@return Location altitude above contact point (AGL) in feet.
@see SetGroundCallback */
- double GetContactPoint(double time,
- FGLocation& contact, FGColumnVector3& normal,
+ double GetContactPoint(FGLocation& contact, FGColumnVector3& normal,
FGColumnVector3& v, FGColumnVector3& w) const
- { ComputeDerived(); return GroundCallback->GetAGLevel(time, *this, contact, normal, v, w); }
+ { ComputeDerived(); return GroundCallback->GetAGLevel(*this, contact, normal, v, w); }
///@}
/** Sets the ground callback pointer. The FGGroundCallback instance will be
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGExternalForce.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdSrc,"$Id: FGExternalForce.cpp,v 1.15 2014/11/25 01:44:17 dpculp Exp $");
IDENT(IdHdr,ID_EXTERNALFORCE);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
location = location_element->FindElementTripletConvertTo("IN");
SetLocation(location);
}
+ PropertyManager->Tie( BasePropertyName + "/locx", (FGExternalForce*)this, &FGExternalForce::GetLocX, &FGExternalForce::SetLocX);
+ PropertyManager->Tie( BasePropertyName + "/locy", (FGExternalForce*)this, &FGExternalForce::GetLocY, &FGExternalForce::SetLocY);
+ PropertyManager->Tie( BasePropertyName + "/locz", (FGExternalForce*)this, &FGExternalForce::GetLocZ, &FGExternalForce::SetLocZ);
direction_element = el->FindElement("direction");
if (!direction_element) {
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.11 2012/12/23 14:56:58 bcoconni Exp $"
+#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.13 2014/11/25 01:44:17 dpculp Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
The force direction is not actually required to be specified as a unit
vector, but prior to the force vector being calculated, the direction
vector is normalized.
+
+ The location of the force vector, in structural coordinates, can be set at
+ runtime through the following properties:
+
+ @code
+ external_reactions/{force name}/locx
+ external_reactions/{force name}/locy
+ external_reactions/{force name}/locz
+ @endcode
*/
void SetX(double x) {vDirection(eX) = x;}
void SetY(double y) {vDirection(eY) = y;}
void SetZ(double z) {vDirection(eZ) = z;}
+ double GetLocX(void) const {return vActingXYZn(eX);}
+ double GetLocY(void) const {return vActingXYZn(eY);}
+ double GetLocZ(void) const {return vActingXYZn(eZ);}
+ void SetLocX(double x) {vXYZn(eX) = x; vActingXYZn(eX) = x;}
+ void SetLocY(double y) {vXYZn(eY) = y; vActingXYZn(eY) = y;}
+ void SetLocZ(double z) {vXYZn(eZ) = z; vActingXYZn(eZ) = z;}
private:
Purpose: Manages the External Forces
Called by: FGAircraft
- ------------- Copyright (C) 2006 David P. Culp (davidculp2@comcast.net) -------------
+ ------------- Copyright (C) 2006 David P. Culp (daveculp@cox.net) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-IDENT(IdSrc,"$Id: FGExternalReactions.cpp,v 1.18 2014/06/09 11:52:07 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGExternalReactions.cpp,v 1.19 2014/11/25 01:42:27 dpculp Exp $");
IDENT(IdHdr,ID_EXTERNALREACTIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Author: David P. Culp
Date started: 17/11/06
- ------------- Copyright (C) 2006 David P. Culp (davidculp2@comcast.net) -------------
+ ------------- Copyright (C) 2006 David P. Culp (daveculp@cox.net) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.15 2013/11/24 11:40:56 bcoconni Exp $"
+#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.16 2014/11/25 01:42:27 dpculp Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-IDENT(IdSrc,"$Id: FGLGear.cpp,v 1.117 2014/06/08 12:50:05 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGLGear.cpp,v 1.118 2014/11/30 12:35:32 bcoconni Exp $");
IDENT(IdHdr,ID_LGEAR);
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface)
{
double gearPos = 1.0;
- double t = fdmex->GetSimTime();
vFn.InitMatrix();
// Compute the height of the theoretical location of the wheel (if strut is
// not compressed) with respect to the ground level
- double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
+ double height = gearLoc.GetContactPoint(contact, normal, terrainVel, dummy);
// Does this surface contact point interact with another surface?
if (surface) {
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.50 2014/06/09 11:52:07 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.51 2014/11/29 13:47:19 bcoconni Exp $");
IDENT(IdHdr,ID_MASSBALANCE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGMassBalance::Load(Element* document)
+static FGMatrix33 ReadInertiaMatrix(Element* document)
{
- string element_name = "";
double bixx, biyy, bizz, bixy, bixz, biyz;
- Name = "Mass Properties Model: " + document->GetAttributeValue("name");
-
- // Perform base class Pre-Load
- if (!FGModel::Load(document))
- return false;
-
bixx = biyy = bizz = bixy = bixz = biyz = 0.0;
if (document->FindElement("ixx"))
bixx = document->FindElementValueAsNumberConvertTo("ixx", "SLUG*FT2");
bixz = document->FindElementValueAsNumberConvertTo("ixz", "SLUG*FT2");
if (document->FindElement("iyz"))
biyz = document->FindElementValueAsNumberConvertTo("iyz", "SLUG*FT2");
- SetAircraftBaseInertias(FGMatrix33( bixx, -bixy, bixz,
- -bixy, biyy, -biyz,
- bixz, -biyz, bizz ));
+
+ return FGMatrix33( bixx, -bixy, bixz,
+ -bixy, biyy, -biyz,
+ bixz, -biyz, bizz );
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGMassBalance::Load(Element* document)
+{
+ string element_name = "";
+
+ Name = "Mass Properties Model: " + document->GetAttributeValue("name");
+
+ // Perform base class Pre-Load
+ if (!FGModel::Load(document))
+ return false;
+
+ SetAircraftBaseInertias(ReadInertiaMatrix(document));
if (document->FindElement("emptywt")) {
EmptyWeight = document->FindElementValueAsNumberConvertTo("emptywt", "LBS");
}
} else {
}
}
+ else {
+ pm->SetPointMassShapeType(PointMass::esUnspecified);
+ pm->SetPointMassMoI(ReadInertiaMatrix(el));
+ }
pm->bind(PropertyManager, PointMasses.size());
PointMasses.push_back(pm);
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.31 2014/05/17 15:17:13 jberndt Exp $"
+#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.32 2014/11/29 13:47:19 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONSS
void SetRadius(double r) {Radius = r;}
void SetLength(double l) {Length = l;}
void SetName(string name) {Name = name;}
+ void SetPointMassMoI(const FGMatrix33& MoI) { mPMInertia = MoI; }
double GetPointMassMoI(int r, int c) {return mPMInertia(r,c);}
void bind(FGPropertyManager* PropertyManager, int num);
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.125 2014/05/17 15:15:53 jberndt Exp $");
+IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.126 2014/11/30 12:35:32 bcoconni Exp $");
IDENT(IdHdr,ID_PROPAGATE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// For initialization ONLY:
VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
- VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
+ VState.vLocation.SetAltitudeAGL(4.0);
VState.dqPQRidot.resize(5, FGColumnVector3(0.0,0.0,0.0));
VState.dqUVWidot.resize(5, FGColumnVector3(0.0,0.0,0.0));
{
FGLocation contact;
FGColumnVector3 normal;
- VState.vLocation.GetContactPoint(FDMExec->GetSimTime(), contact, normal,
- LocalTerrainVelocity, LocalTerrainAngularVelocity);
+ VState.vLocation.GetContactPoint(contact, normal, LocalTerrainVelocity,
+ LocalTerrainAngularVelocity);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetLocalTerrainRadius(void) const
{
- return VState.vLocation.GetTerrainRadius(FDMExec->GetSimTime());
+ return VState.vLocation.GetTerrainRadius();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGL(void) const
{
- return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime());
+ return VState.vLocation.GetAltitudeAGL();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGLKm(void) const
{
- return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime())*0.0003048;
+ return VState.vLocation.GetAltitudeAGL()*0.0003048;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetDistanceAGL(double tt)
{
- VState.vLocation.SetAltitudeAGL(tt, FDMExec->GetSimTime());
+ VState.vLocation.SetAltitudeAGL(tt);
UpdateVehicleState();
}
void FGPropagate::SetDistanceAGLKm(double tt)
{
- VState.vLocation.SetAltitudeAGL(tt*3280.8399, FDMExec->GetSimTime());
+ VState.vLocation.SetAltitudeAGL(tt*3280.8399);
UpdateVehicleState();
}
Date started: 03/11/2003
Purpose: This module models a turbine engine.
- ------------- Copyright (C) 2003 David Culp (davidculp2@comcast.net) ---------
+ ------------- Copyright (C) 2003 David Culp (daveculp@cox.net) ---------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
namespace JSBSim {
-IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.43 2014/06/08 12:50:05 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.44 2014/12/12 01:21:17 dpculp Exp $");
IDENT(IdHdr,ID_TURBINE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Augmented = AugMethod = Injected = 0;
BypassRatio = BleedDemand = 0.0;
IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 0;
- N1_spinup = 1.0; N2_spinup = 3.0;
+ N1_spinup = 1.0; N2_spinup = 3.0;
+ InjectionTime = 30.0;
+ InjectionTimer = InjWaterNorm = 0.0;
EPR = 1.0;
Load(exec, el);
FGEngine::ResetToIC();
- N1 = N2 = 0.0;
+ N1 = N2 = InjN1increment = InjN2increment = 0.0;
N2norm = 0.0;
correctedTSFC = TSFC;
- AugmentCmd = 0.0;
+ AugmentCmd = InjWaterNorm = 0.0;
InletPosition = NozzlePosition = 1.0;
Stalled = Seized = Overtemp = Fire = Augmentation = Injection = Reversed = false;
Cutoff = true;
if ((phase == tpTrim) && (in.TotalDeltaT > 0)) {
if (Running && !Starved) {
phase = tpRun;
+ N1_factor = MaxN1 - IdleN1;
+ N2_factor = MaxN2 - IdleN2;
N2 = IdleN2 + ThrottlePos * N2_factor;
N1 = IdleN1 + ThrottlePos * N1_factor;
OilTemp_degK = 366.0;
double n = N2norm + 0.1;
if (n > 1) n = 1;
spoolup = delay / (1 + 3 * (1-n)*(1-n)*(1-n) + (1 - sigma));
-
+ N1_factor = MaxN1 - IdleN1;
+ N2_factor = MaxN2 - IdleN2;
+ if ((Injected == 1) && Injection && (InjWaterNorm > 0)) {
+ N1_factor += InjN1increment;
+ N2_factor += InjN2increment;
+ }
N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, spoolup, spoolup * 3.0);
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, spoolup, spoolup * 2.4);
N2norm = (N2 - IdleN2) / N2_factor;
}
}
- if ((Injected == 1) && Injection) {
+ if ((Injected == 1) && Injection && (InjWaterNorm > 0.0)) {
InjectionTimer += in.TotalDeltaT;
if (InjectionTimer < InjectionTime) {
thrust = thrust * InjectionLookup->GetValue();
+ InjWaterNorm = 1.0 - (InjectionTimer/InjectionTime);
} else {
Injection = false;
+ InjWaterNorm = 0.0;
}
}
AugMethod = (int)el->FindElementValueAsNumber("augmethod");
if (el->FindElement("injected"))
Injected = (int)el->FindElementValueAsNumber("injected");
- if (el->FindElement("injection-time"))
+ if (el->FindElement("injection-time")){
InjectionTime = el->FindElementValueAsNumber("injection-time");
+ InjWaterNorm =1.0;
+ }
+ if (el->FindElement("injection-N1-inc"))
+ InjN1increment = el->FindElementValueAsNumber("injection-N1-inc");
+ if (el->FindElement("injection-N2-inc"))
+ InjN2increment = el->FindElementValueAsNumber("injection-N2-inc");
string property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
PropertyManager->Tie( property_name.c_str(), &Stalled);
property_name = base_property_name + "/bleed-factor";
PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this, &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand);
+ property_name = base_property_name + "/MaxN1";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetMaxN1, &FGTurbine::SetMaxN1);
+ property_name = base_property_name + "/MaxN2";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetMaxN2, &FGTurbine::SetMaxN2);
+ property_name = base_property_name + "/InjectionTimer";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetInjectionTimer, &FGTurbine::SetInjectionTimer);
+ property_name = base_property_name + "/InjWaterNorm";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetInjWaterNorm, &FGTurbine::SetInjWaterNorm);
+ property_name = base_property_name + "/InjN1increment";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetInjN1increment, &FGTurbine::SetInjN1increment);
+ property_name = base_property_name + "/InjN2increment";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
+ &FGTurbine::GetInjN2increment, &FGTurbine::SetInjN2increment);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FDMExec->SuspendIntegration();
Cutoff=false;
Running=true;
- N2=IdleN2;
+ N1_factor = MaxN1 - IdleN1;
+ N2_factor = MaxN2 - IdleN2;
+ N2 = IdleN2 + ThrottlePos * N2_factor;
+ N1 = IdleN1 + ThrottlePos * N1_factor;
Calculate();
FDMExec->ResumeIntegration();
return phase==tpRun;
Author: David Culp
Date started: 03/11/2003
- ------------- Copyright (C) 2003 David Culp (davidculp2@comcast.net)----------
+ ------------- Copyright (C) 2003 David Culp (daveculp@cox.net)----------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
#include "FGEngine.h"
-#define ID_TURBINE "$Id: FGTurbine.h,v 1.22 2011/08/04 13:45:42 jberndt Exp $"
+#define ID_TURBINE "$Id: FGTurbine.h,v 1.23 2014/12/12 01:21:17 dpculp Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
0 = Water injection not installed
1 = Water injection installed
injection-time - Time, in seconds, of water injection duration
+ InjN1increment - % increase in N1 when injection is taking place
+ InjN2increment - % increase in N2 when injection is taking place
</pre>
<h3>NOTES:</h3>
/engine/direct.xml
</pre>
@author David P. Culp
- @version "$Id: FGTurbine.h,v 1.22 2011/08/04 13:45:42 jberndt Exp $"
+ @version "$Id: FGTurbine.h,v 1.23 2014/12/12 01:21:17 dpculp Exp $"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double GetEPR(void) const {return EPR;}
double GetEGT(void) const {return EGT_degC;}
+ double GetMaxN1(void) const {return MaxN1;}
+ double GetMaxN2(void) const {return MaxN2;}
double getOilPressure_psi () const {return OilPressure_psi;}
double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
+ double GetInjectionTimer(void) const {return InjectionTimer;}
+ double GetInjWaterNorm(void) const {return InjWaterNorm;}
+ double GetInjN1increment(void) const {return InjN1increment;}
+ double GetInjN2increment(void) const {return InjN2increment;}
void SetInjection(bool injection) {Injection = injection;}
void SetIgnition(int ignition) {Ignition = ignition;}
void SetBleedDemand(double bleedDemand) {BleedDemand = bleedDemand;}
void SetReverse(bool reversed) { Reversed = reversed; }
void SetCutoff(bool cutoff) { Cutoff = cutoff; }
+ void SetMaxN1(double maxn1) {MaxN1 = maxn1;}
+ void SetMaxN2(double maxn2) {MaxN2 = maxn2;}
+ void SetInjectionTimer(double injtimer) {InjectionTimer = injtimer;}
+ void SetInjWaterNorm(double injwater) {InjWaterNorm = injwater;}
+ void SetInjN1increment(double injN1inc) {InjN1increment = injN1inc;}
+ void SetInjN2increment(double injN2inc) {InjN2increment = injN2inc;}
+
int InitRunning(void);
void ResetToIC(void);
double correctedTSFC;
double InjectionTimer;
double InjectionTime;
+ double InjWaterNorm;
+ double InjN1increment;
+ double InjN2increment;
double Off(void);
double Run();