1
0
Fork 0

Synced JSBSim. Adds the following new features:

- Ability to modify the location of external forces via the property tree
- Ability to specify manually the inertia matrix of "point masses"
- Improvements of the water injection feature in the turbine code
This commit is contained in:
bcoconni 2014-12-15 20:12:18 +01:00
parent a4ab1dae38
commit a1df1fb70a
16 changed files with 183 additions and 77 deletions

View file

@ -76,7 +76,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_FDMEXEC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1201,7 +1201,7 @@ void FGFDMExec::DoTrim(int mode)
FGTrim trim(this, (JSBSim::TrimMode)mode); FGTrim trim(this, (JSBSim::TrimMode)mode);
if ( !trim.DoTrim() ) cerr << endl << "Trim Failed" << endl << endl; if ( !trim.DoTrim() ) cerr << endl << "Trim Failed" << endl << endl;
trim.Report(); trim.Report();
sim_time = saved_time; Setsim_time(saved_time);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1216,7 +1216,6 @@ void FGFDMExec::DoSimplexTrim(int mode)
} }
saved_time = sim_time; saved_time = sim_time;
FGSimplexTrim trim(this, (JSBSim::TrimMode)mode); FGSimplexTrim trim(this, (JSBSim::TrimMode)mode);
sim_time = saved_time;
Setsim_time(saved_time); Setsim_time(saved_time);
std::cout << "dT: " << dT << std::endl; std::cout << "dT: " << dT << std::endl;
} }
@ -1229,7 +1228,6 @@ void FGFDMExec::DoLinearization(int mode)
if (Constructing) return; if (Constructing) return;
saved_time = sim_time; saved_time = sim_time;
FGLinearization lin(this,mode); FGLinearization lin(this,mode);
sim_time = saved_time;
Setsim_time(saved_time); Setsim_time(saved_time);
} }

View file

@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONS
@ -178,7 +178,7 @@ CLASS DOCUMENTATION
property actually maps toa function call of DoTrim(). property actually maps toa function call of DoTrim().
@author Jon S. Berndt @author Jon S. Berndt
@version $Revision: 1.91 $ @version $Revision: 1.93 $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -550,6 +550,7 @@ public:
@return the current simulation time. */ @return the current simulation time. */
double Setsim_time(double cur_time) { double Setsim_time(double cur_time) {
sim_time = cur_time; sim_time = cur_time;
GetGroundCallback()->SetTime(sim_time);
return sim_time; return sim_time;
} }
@ -570,6 +571,7 @@ public:
@return the new simulation time. */ @return the new simulation time. */
double IncrTime(void) { double IncrTime(void) {
if (!holding) sim_time += dT; if (!holding) sim_time += dT;
GetGroundCallback()->SetTime(sim_time);
Frame++; Frame++;
return sim_time; return sim_time;
} }

View file

@ -66,7 +66,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_INITIALCONDITION);
//****************************************************************************** //******************************************************************************
@ -110,7 +110,7 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
position.SetLongitude(lonRad0); position.SetLongitude(lonRad0);
position.SetLatitude(latRad0); position.SetLatitude(latRad0);
position.SetAltitudeAGL(altAGLFt0, 0.0); position.SetAltitudeAGL(altAGLFt0);
orientation = FGQuaternion(phi0, theta0, psi0); orientation = FGQuaternion(phi0, theta0, psi0);
const FGMatrix33& Tb2l = orientation.GetTInv(); const FGMatrix33& Tb2l = orientation.GetTInv();
@ -666,21 +666,21 @@ void FGInitialCondition::SetTerrainElevationFtIC(double elev)
double FGInitialCondition::GetAltitudeAGLFtIC(void) const double FGInitialCondition::GetAltitudeAGLFtIC(void) const
{ {
return position.GetAltitudeAGL(0.0); return position.GetAltitudeAGL();
} }
//****************************************************************************** //******************************************************************************
double FGInitialCondition::GetTerrainElevationFtIC(void) const double FGInitialCondition::GetTerrainElevationFtIC(void) const
{ {
return position.GetTerrainRadius(0.0) - position.GetSeaLevelRadius(); return position.GetTerrainRadius() - position.GetSeaLevelRadius();
} }
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetAltitudeAGLFtIC(double agl) void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
{ {
double terrainElevation = position.GetTerrainRadius(0.0) double terrainElevation = position.GetTerrainRadius()
- position.GetSeaLevelRadius(); - position.GetSeaLevelRadius();
SetAltitudeASLFtIC(agl + terrainElevation); SetAltitudeASLFtIC(agl + terrainElevation);
lastAltitudeSet = setagl; lastAltitudeSet = setagl;
@ -1055,8 +1055,7 @@ bool FGInitialCondition::Load_v2(Element* document)
if (position_el->FindElement("radius")) { if (position_el->FindElement("radius")) {
position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT")); position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT"));
} else if (position_el->FindElement("altitudeAGL")) { } else if (position_el->FindElement("altitudeAGL")) {
position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"), position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
0.0);
} else if (position_el->FindElement("altitudeMSL")) { } else if (position_el->FindElement("altitudeMSL")) {
position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT")); position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
} else { } else {

View file

@ -57,7 +57,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_TRIM);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -399,8 +399,7 @@ void FGTrim::trimOnGround(void)
FGColumnVector3 normal, vDummy; FGColumnVector3 normal, vDummy;
FGLocation lDummy; FGLocation lDummy;
double height = gearLoc.GetContactPoint(fdmex->GetSimTime(), lDummy, double height = gearLoc.GetContactPoint(lDummy, normal, vDummy, vDummy);
normal, vDummy, vDummy);
c.normal = Tec2b * normal; c.normal = Tec2b * normal;
contacts.push_back(c); contacts.push_back(c);

View file

@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS 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 { namespace JSBSim {
@ -62,7 +62,7 @@ CLASS DOCUMENTATION
ball formed earth with an adjustable terrain elevation. ball formed earth with an adjustable terrain elevation.
@author Mathias Froehlich @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 $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -73,7 +73,7 @@ class FGGroundCallback : public SGReferenced
{ {
public: public:
FGGroundCallback() {} FGGroundCallback() : time(0.0) {}
virtual ~FGGroundCallback() {} virtual ~FGGroundCallback() {}
/** Compute the altitude above sealevel /** Compute the altitude above sealevel
@ -96,14 +96,33 @@ public:
FGColumnVector3& normal, FGColumnVector3& v, FGColumnVector3& normal, FGColumnVector3& v,
FGColumnVector3& w) const = 0; 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 /** Compute the local terrain radius
@param t simulation time @param t simulation time
@param location location @param location location
*/ */
virtual double GetTerrainGeoCentRadius(double t, const FGLocation& location) const = 0; 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 /** Return the sea level radius
@param t simulation time
@param location location @param location location
*/ */
virtual double GetSeaLevelRadius(const FGLocation& location) const = 0; virtual double GetSeaLevelRadius(const FGLocation& location) const = 0;
@ -120,6 +139,10 @@ public:
*/ */
virtual void SetSeaLevelRadius(double radius) { } virtual void SetSeaLevelRadius(double radius) { }
void SetTime(double _time) { time = _time; }
private:
double time;
}; };
typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr; typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr;

View file

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONS
@ -150,7 +150,7 @@ CLASS DOCUMENTATION
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2 @see W. C. Durham "Aircraft Dynamics & Control", section 2.2
@author Mathias Froehlich @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 $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -333,13 +333,13 @@ public:
@param altitudeASL altitude above Sea Level in feet. @param altitudeASL altitude above Sea Level in feet.
@see SetGroundCallback */ @see SetGroundCallback */
void SetAltitudeASL(double altitudeASL) void SetAltitudeASL(double altitudeASL)
{ SetRadius(GroundCallback->GetSeaLevelRadius(*this) + altitudeASL); } { SetRadius(GetSeaLevelRadius() + altitudeASL); }
/** Set the altitude above ground level. /** Set the altitude above ground level.
@param altitudeAGL altitude above Ground Level in feet. @param altitudeAGL altitude above Ground Level in feet.
@see SetGroundCallback */ @see SetGroundCallback */
void SetAltitudeAGL(double altitudeAGL, double time) void SetAltitudeAGL(double altitudeAGL)
{ SetRadius(GroundCallback->GetTerrainGeoCentRadius(time, *this) + altitudeAGL); } { SetRadius(GetTerrainRadius() + altitudeAGL); }
/** Get the local sea level radius /** Get the local sea level radius
@return the sea level radius at the location in feet. @return the sea level radius at the location in feet.
@ -350,36 +350,34 @@ public:
/** Get the local terrain radius /** Get the local terrain radius
@return the terrain level radius at the location in feet. @return the terrain level radius at the location in feet.
@see SetGroundCallback */ @see SetGroundCallback */
double GetTerrainRadius(double time) const double GetTerrainRadius(void) const
{ ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(time, *this); } { ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(*this); }
/** Get the altitude above sea level. /** Get the altitude above sea level.
@return the altitude ASL in feet. @return the altitude ASL in feet.
@see SetGroundCallback */ @see SetGroundCallback */
double GetAltitudeASL() const double GetAltitudeASL(void) const
{ ComputeDerived(); return GroundCallback->GetAltitude(*this); } { ComputeDerived(); return GroundCallback->GetAltitude(*this); }
/** Get the altitude above ground level. /** Get the altitude above ground level.
@return the altitude AGL in feet. @return the altitude AGL in feet.
@see SetGroundCallback */ @see SetGroundCallback */
double GetAltitudeAGL(double time) const { double GetAltitudeAGL(void) const {
FGLocation c; FGLocation c;
FGColumnVector3 n,v,w; 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. /** Get terrain contact point information below the current location.
@param time Simulation time
@param contact Contact point location @param contact Contact point location
@param normal Terrain normal vector in contact point (ECEF frame) @param normal Terrain normal vector in contact point (ECEF frame)
@param v Terrain linear velocity 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) @param w Terrain angular velocity in contact point (ECEF frame)
@return Location altitude above contact point (AGL) in feet. @return Location altitude above contact point (AGL) in feet.
@see SetGroundCallback */ @see SetGroundCallback */
double GetContactPoint(double time, double GetContactPoint(FGLocation& contact, FGColumnVector3& normal,
FGLocation& contact, FGColumnVector3& normal,
FGColumnVector3& v, FGColumnVector3& w) const 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 /** Sets the ground callback pointer. The FGGroundCallback instance will be

5
src/FDM/JSBSim/models/FGExternalForce.cpp Normal file → Executable file
View file

@ -60,7 +60,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_EXTERNALFORCE);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -124,6 +124,9 @@ FGExternalForce::FGExternalForce(FGFDMExec *FDMExec, Element *el, int index)
location = location_element->FindElementTripletConvertTo("IN"); location = location_element->FindElementTripletConvertTo("IN");
SetLocation(location); 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"); direction_element = el->FindElement("direction");
if (!direction_element) { if (!direction_element) {

17
src/FDM/JSBSim/models/FGExternalForce.h Normal file → Executable file
View file

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONS
@ -122,6 +122,15 @@ CLASS DOCUMENTATION
vector, but prior to the force vector being calculated, the direction vector, but prior to the force vector being calculated, the direction
vector is normalized. 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
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -163,6 +172,12 @@ public:
void SetX(double x) {vDirection(eX) = x;} void SetX(double x) {vDirection(eX) = x;}
void SetY(double y) {vDirection(eY) = y;} void SetY(double y) {vDirection(eY) = y;}
void SetZ(double z) {vDirection(eZ) = z;} 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: private:

4
src/FDM/JSBSim/models/FGExternalReactions.cpp Normal file → Executable file
View file

@ -6,7 +6,7 @@
Purpose: Manages the External Forces Purpose: Manages the External Forces
Called by: FGAircraft 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 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -54,7 +54,7 @@ DEFINITIONS
GLOBAL DATA 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); IDENT(IdHdr,ID_EXTERNALREACTIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4
src/FDM/JSBSim/models/FGExternalReactions.h Normal file → Executable file
View file

@ -4,7 +4,7 @@
Author: David P. Culp Author: David P. Culp
Date started: 17/11/06 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 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -46,7 +46,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONS

View file

@ -63,7 +63,7 @@ DEFINITIONS
GLOBAL DATA 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); IDENT(IdHdr,ID_LGEAR);
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
@ -270,7 +270,6 @@ void FGLGear::ResetToIC(void)
const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface) const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface)
{ {
double gearPos = 1.0; double gearPos = 1.0;
double t = fdmex->GetSimTime();
vFn.InitMatrix(); vFn.InitMatrix();
@ -286,7 +285,7 @@ const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface)
// Compute the height of the theoretical location of the wheel (if strut is // Compute the height of the theoretical location of the wheel (if strut is
// not compressed) with respect to the ground level // 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? // Does this surface contact point interact with another surface?
if (surface) { if (surface) {

View file

@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_MASSBALANCE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -102,17 +102,10 @@ bool FGMassBalance::InitModel(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGMassBalance::Load(Element* document) static FGMatrix33 ReadInertiaMatrix(Element* document)
{ {
string element_name = "";
double bixx, biyy, bizz, bixy, bixz, biyz; 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; bixx = biyy = bizz = bixy = bixz = biyz = 0.0;
if (document->FindElement("ixx")) if (document->FindElement("ixx"))
bixx = document->FindElementValueAsNumberConvertTo("ixx", "SLUG*FT2"); bixx = document->FindElementValueAsNumberConvertTo("ixx", "SLUG*FT2");
@ -126,9 +119,25 @@ bool FGMassBalance::Load(Element* document)
bixz = document->FindElementValueAsNumberConvertTo("ixz", "SLUG*FT2"); bixz = document->FindElementValueAsNumberConvertTo("ixz", "SLUG*FT2");
if (document->FindElement("iyz")) if (document->FindElement("iyz"))
biyz = document->FindElementValueAsNumberConvertTo("iyz", "SLUG*FT2"); biyz = document->FindElementValueAsNumberConvertTo("iyz", "SLUG*FT2");
SetAircraftBaseInertias(FGMatrix33( bixx, -bixy, bixz,
-bixy, biyy, -biyz, return FGMatrix33( bixx, -bixy, bixz,
bixz, -biyz, bizz )); -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")) { if (document->FindElement("emptywt")) {
EmptyWeight = document->FindElementValueAsNumberConvertTo("emptywt", "LBS"); EmptyWeight = document->FindElementValueAsNumberConvertTo("emptywt", "LBS");
} }
@ -291,6 +300,10 @@ void FGMassBalance::AddPointMass(Element* el)
} else { } else {
} }
} }
else {
pm->SetPointMassShapeType(PointMass::esUnspecified);
pm->SetPointMassMoI(ReadInertiaMatrix(el));
}
pm->bind(PropertyManager, PointMasses.size()); pm->bind(PropertyManager, PointMasses.size());
PointMasses.push_back(pm); PointMasses.push_back(pm);

View file

@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONSS
@ -267,6 +267,7 @@ private:
void SetRadius(double r) {Radius = r;} void SetRadius(double r) {Radius = r;}
void SetLength(double l) {Length = l;} void SetLength(double l) {Length = l;}
void SetName(string name) {Name = name;} void SetName(string name) {Name = name;}
void SetPointMassMoI(const FGMatrix33& MoI) { mPMInertia = MoI; }
double GetPointMassMoI(int r, int c) {return mPMInertia(r,c);} double GetPointMassMoI(int r, int c) {return mPMInertia(r,c);}
void bind(FGPropertyManager* PropertyManager, int num); void bind(FGPropertyManager* PropertyManager, int num);

View file

@ -79,7 +79,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_PROPAGATE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -125,7 +125,7 @@ bool FGPropagate::InitModel(void)
// For initialization ONLY: // For initialization ONLY:
VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor); 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.dqPQRidot.resize(5, FGColumnVector3(0.0,0.0,0.0));
VState.dqUVWidot.resize(5, FGColumnVector3(0.0,0.0,0.0)); VState.dqUVWidot.resize(5, FGColumnVector3(0.0,0.0,0.0));
@ -485,8 +485,8 @@ void FGPropagate::RecomputeLocalTerrainVelocity()
{ {
FGLocation contact; FGLocation contact;
FGColumnVector3 normal; FGColumnVector3 normal;
VState.vLocation.GetContactPoint(FDMExec->GetSimTime(), contact, normal, VState.vLocation.GetContactPoint(contact, normal, LocalTerrainVelocity,
LocalTerrainVelocity, LocalTerrainAngularVelocity); LocalTerrainAngularVelocity);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -509,28 +509,28 @@ void FGPropagate::SetSeaLevelRadius(double tt)
double FGPropagate::GetLocalTerrainRadius(void) const double FGPropagate::GetLocalTerrainRadius(void) const
{ {
return VState.vLocation.GetTerrainRadius(FDMExec->GetSimTime()); return VState.vLocation.GetTerrainRadius();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGL(void) const double FGPropagate::GetDistanceAGL(void) const
{ {
return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime()); return VState.vLocation.GetAltitudeAGL();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGLKm(void) const double FGPropagate::GetDistanceAGLKm(void) const
{ {
return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime())*0.0003048; return VState.vLocation.GetAltitudeAGL()*0.0003048;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetDistanceAGL(double tt) void FGPropagate::SetDistanceAGL(double tt)
{ {
VState.vLocation.SetAltitudeAGL(tt, FDMExec->GetSimTime()); VState.vLocation.SetAltitudeAGL(tt);
UpdateVehicleState(); UpdateVehicleState();
} }
@ -538,7 +538,7 @@ void FGPropagate::SetDistanceAGL(double tt)
void FGPropagate::SetDistanceAGLKm(double tt) void FGPropagate::SetDistanceAGLKm(double tt)
{ {
VState.vLocation.SetAltitudeAGL(tt*3280.8399, FDMExec->GetSimTime()); VState.vLocation.SetAltitudeAGL(tt*3280.8399);
UpdateVehicleState(); UpdateVehicleState();
} }

View file

@ -5,7 +5,7 @@
Date started: 03/11/2003 Date started: 03/11/2003
Purpose: This module models a turbine engine. 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 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_TURBINE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -74,6 +74,8 @@ FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number, struct Inp
BypassRatio = BleedDemand = 0.0; BypassRatio = BleedDemand = 0.0;
IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 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; EPR = 1.0;
Load(exec, el); Load(exec, el);
@ -94,10 +96,10 @@ void FGTurbine::ResetToIC(void)
FGEngine::ResetToIC(); FGEngine::ResetToIC();
N1 = N2 = 0.0; N1 = N2 = InjN1increment = InjN2increment = 0.0;
N2norm = 0.0; N2norm = 0.0;
correctedTSFC = TSFC; correctedTSFC = TSFC;
AugmentCmd = 0.0; AugmentCmd = InjWaterNorm = 0.0;
InletPosition = NozzlePosition = 1.0; InletPosition = NozzlePosition = 1.0;
Stalled = Seized = Overtemp = Fire = Augmentation = Injection = Reversed = false; Stalled = Seized = Overtemp = Fire = Augmentation = Injection = Reversed = false;
Cutoff = true; Cutoff = true;
@ -131,6 +133,8 @@ void FGTurbine::Calculate(void)
if ((phase == tpTrim) && (in.TotalDeltaT > 0)) { if ((phase == tpTrim) && (in.TotalDeltaT > 0)) {
if (Running && !Starved) { if (Running && !Starved) {
phase = tpRun; phase = tpRun;
N1_factor = MaxN1 - IdleN1;
N2_factor = MaxN2 - IdleN2;
N2 = IdleN2 + ThrottlePos * N2_factor; N2 = IdleN2 + ThrottlePos * N2_factor;
N1 = IdleN1 + ThrottlePos * N1_factor; N1 = IdleN1 + ThrottlePos * N1_factor;
OilTemp_degK = 366.0; OilTemp_degK = 366.0;
@ -209,7 +213,12 @@ double FGTurbine::Run()
double n = N2norm + 0.1; double n = N2norm + 0.1;
if (n > 1) n = 1; if (n > 1) n = 1;
spoolup = delay / (1 + 3 * (1-n)*(1-n)*(1-n) + (1 - sigma)); 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); N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, spoolup, spoolup * 3.0);
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, spoolup, spoolup * 2.4); N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, spoolup, spoolup * 2.4);
N2norm = (N2 - IdleN2) / N2_factor; N2norm = (N2 - IdleN2) / N2_factor;
@ -250,12 +259,14 @@ double FGTurbine::Run()
} }
} }
if ((Injected == 1) && Injection) { if ((Injected == 1) && Injection && (InjWaterNorm > 0.0)) {
InjectionTimer += in.TotalDeltaT; InjectionTimer += in.TotalDeltaT;
if (InjectionTimer < InjectionTime) { if (InjectionTimer < InjectionTime) {
thrust = thrust * InjectionLookup->GetValue(); thrust = thrust * InjectionLookup->GetValue();
InjWaterNorm = 1.0 - (InjectionTimer/InjectionTime);
} else { } else {
Injection = false; Injection = false;
InjWaterNorm = 0.0;
} }
} }
@ -455,8 +466,14 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
AugMethod = (int)el->FindElementValueAsNumber("augmethod"); AugMethod = (int)el->FindElementValueAsNumber("augmethod");
if (el->FindElement("injected")) if (el->FindElement("injected"))
Injected = (int)el->FindElementValueAsNumber("injected"); Injected = (int)el->FindElementValueAsNumber("injected");
if (el->FindElement("injection-time")) if (el->FindElement("injection-time")){
InjectionTime = el->FindElementValueAsNumber("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); string property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
@ -522,6 +539,24 @@ void FGTurbine::bindmodel()
PropertyManager->Tie( property_name.c_str(), &Stalled); PropertyManager->Tie( property_name.c_str(), &Stalled);
property_name = base_property_name + "/bleed-factor"; property_name = base_property_name + "/bleed-factor";
PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this, &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand); 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);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -531,7 +566,10 @@ int FGTurbine::InitRunning(void)
FDMExec->SuspendIntegration(); FDMExec->SuspendIntegration();
Cutoff=false; Cutoff=false;
Running=true; Running=true;
N2=IdleN2; N1_factor = MaxN1 - IdleN1;
N2_factor = MaxN2 - IdleN2;
N2 = IdleN2 + ThrottlePos * N2_factor;
N1 = IdleN1 + ThrottlePos * N1_factor;
Calculate(); Calculate();
FDMExec->ResumeIntegration(); FDMExec->ResumeIntegration();
return phase==tpRun; return phase==tpRun;

View file

@ -4,7 +4,7 @@
Author: David Culp Author: David Culp
Date started: 03/11/2003 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 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -42,7 +42,7 @@ INCLUDES
#include "FGEngine.h" #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 FORWARD DECLARATIONS
@ -130,6 +130,8 @@ CLASS DOCUMENTATION
0 = Water injection not installed 0 = Water injection not installed
1 = Water injection installed 1 = Water injection installed
injection-time - Time, in seconds, of water injection duration 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> </pre>
<h3>NOTES:</h3> <h3>NOTES:</h3>
@ -150,7 +152,7 @@ CLASS DOCUMENTATION
/engine/direct.xml /engine/direct.xml
</pre> </pre>
@author David P. Culp @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 $"
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -199,8 +201,14 @@ public:
double GetEPR(void) const {return EPR;} double GetEPR(void) const {return EPR;}
double GetEGT(void) const {return EGT_degC;} 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 getOilPressure_psi () const {return OilPressure_psi;}
double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);} 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 SetInjection(bool injection) {Injection = injection;}
void SetIgnition(int ignition) {Ignition = ignition;} void SetIgnition(int ignition) {Ignition = ignition;}
@ -210,6 +218,13 @@ public:
void SetBleedDemand(double bleedDemand) {BleedDemand = bleedDemand;} void SetBleedDemand(double bleedDemand) {BleedDemand = bleedDemand;}
void SetReverse(bool reversed) { Reversed = reversed; } void SetReverse(bool reversed) { Reversed = reversed; }
void SetCutoff(bool cutoff) { Cutoff = cutoff; } 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); int InitRunning(void);
void ResetToIC(void); void ResetToIC(void);
@ -264,6 +279,9 @@ private:
double correctedTSFC; double correctedTSFC;
double InjectionTimer; double InjectionTimer;
double InjectionTime; double InjectionTime;
double InjWaterNorm;
double InjN1increment;
double InjN2increment;
double Off(void); double Off(void);
double Run(); double Run();