|
From: Jon S. B. <jb...@us...> - 2011-07-28 12:48:23
|
Update of /cvsroot/jsbsim/JSBSim/src/models
In directory vz-cvs-3.sog:/tmp/cvs-serv15987/src/models
Modified Files:
FGFCS.h FGMassBalance.h FGPropulsion.cpp FGPropulsion.h
Log Message:
Major modification that moves towards completely independent engine models
Index: FGFCS.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/FGFCS.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** FGFCS.h 10 Jul 2011 20:18:14 -0000 1.37
--- FGFCS.h 28 Jul 2011 12:48:19 -0000 1.38
***************
*** 244,247 ****
--- 244,249 ----
double GetThrottleCmd(int engine) const;
+ vector <double> GetThrottleCmd() const {return ThrottleCmd;}
+
/** Gets the mixture command.
@param engine engine ID number
***************
*** 249,252 ****
--- 251,256 ----
double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
+ vector <double> GetMixtureCmd() const {return MixtureCmd;}
+
/** Gets the prop pitch command.
@param engine engine ID number
***************
*** 319,322 ****
--- 323,328 ----
double GetThrottlePos(int engine) const;
+ vector <double> GetThrottlePos() const {return ThrottlePos;}
+
/** Gets the mixture position.
@param engine engine ID number
***************
*** 324,327 ****
--- 330,335 ----
double GetMixturePos(int engine) const { return MixturePos[engine]; }
+ vector <double> GetMixturePos() const {return MixturePos;}
+
/** Gets the steering position.
@return steering position in degrees */
***************
*** 345,352 ****
--- 353,364 ----
double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
+ vector <double> GetPropAdvance() const { return PropAdvance; }
+
/** Gets the prop feather position.
@param engine engine ID number
@return prop fether for the given engine (on / off)*/
bool GetPropFeather(int engine) const { return PropFeather[engine]; }
+
+ vector <bool> GetPropFeather() const { return PropFeather; }
//@}
Index: FGMassBalance.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/FGMassBalance.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** FGMassBalance.h 10 Jul 2011 20:18:14 -0000 1.24
--- FGMassBalance.h 28 Jul 2011 12:48:19 -0000 1.25
***************
*** 139,149 ****
should be for the mass in slug and the vector in the structural
frame as usual in inches.
! @param slugs the mass of this single pointmass given in slugs
@param r the location of this single pointmass in the structural frame
*/
! FGMatrix33 GetPointmassInertia(double slugs, const FGColumnVector3& r) const
{
FGColumnVector3 v = StructuralToBody( r );
! FGColumnVector3 sv = slugs*v;
double xx = sv(1)*v(1);
double yy = sv(2)*v(2);
--- 139,149 ----
should be for the mass in slug and the vector in the structural
frame as usual in inches.
! @param mass_sl the mass of this single pointmass given in slugs
@param r the location of this single pointmass in the structural frame
*/
! FGMatrix33 GetPointmassInertia(double mass_sl, const FGColumnVector3& r) const
{
FGColumnVector3 v = StructuralToBody( r );
! FGColumnVector3 sv = mass_sl*v;
double xx = sv(1)*v(1);
double yy = sv(2)*v(2);
Index: FGPropulsion.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/FGPropulsion.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** FGPropulsion.cpp 20 Jul 2011 12:26:41 -0000 1.48
--- FGPropulsion.cpp 28 Jul 2011 12:48:19 -0000 1.49
***************
*** 50,54 ****
#include <iomanip>
#include "FGPropulsion.h"
- #include "models/FGFCS.h"
#include "models/FGMassBalance.h"
#include "models/propulsion/FGThruster.h"
--- 50,53 ----
***************
*** 160,165 ****
RunPreFunctions();
- double dt = FDMExec->GetDeltaT();
-
vForces.InitMatrix();
vMoments.InitMatrix();
--- 159,162 ----
***************
*** 173,177 ****
TotalFuelQuantity = 0.0;
for (i=0; i<numTanks; i++) {
! Tanks[i]->Calculate( dt * rate );
if (Tanks[i]->GetType() == FGTank::ttFUEL) {
TotalFuelQuantity += Tanks[i]->GetContents();
--- 170,174 ----
TotalFuelQuantity = 0.0;
for (i=0; i<numTanks; i++) {
! Tanks[i]->Calculate( in.TotalDeltaT );
if (Tanks[i]->GetType() == FGTank::ttFUEL) {
TotalFuelQuantity += Tanks[i]->GetContents();
***************
*** 179,184 ****
}
! if (refuel) DoRefuel( dt * rate );
! if (dump) DumpFuel( dt * rate );
RunPostFunctions();
--- 176,181 ----
}
! if (refuel) DoRefuel( in.TotalDeltaT );
! if (dump) DumpFuel( in.TotalDeltaT );
RunPostFunctions();
***************
*** 203,207 ****
for (unsigned int i=0; i<numEngines; i++) {
- // cout << " Finding steady state for engine " << i << endl;
steady=false;
steady_count=0;
--- 200,203 ----
***************
*** 215,219 ****
if (steady_count > 120) {
steady=true;
- // cout << " Steady state found at thrust: " << currentThrust << " lbs." << endl;
}
} else {
--- 211,214 ----
***************
*** 222,228 ****
j++;
}
- // if (j >= 6000) {
- // cout << " Could not find a steady state for this engine." << endl;
- // }
vForces += Engines[i]->GetBodyForces(); // sum body frame forces
vMoments += Engines[i]->GetMoments(); // sum body frame moments
--- 217,220 ----
***************
*** 246,251 ****
throw(string("Tried to initialize a non-existent engine!"));
}
! FDMExec->GetFCS()->SetThrottleCmd(n,1);
! FDMExec->GetFCS()->SetMixtureCmd(n,1);
GetEngine(n)->InitRunning();
GetSteadyState();
--- 238,245 ----
throw(string("Tried to initialize a non-existent engine!"));
}
!
! in.ThrottleCmd[n] = in.ThrottlePos[n] = 1; // Set the throttle command and position
! in.MixtureCmd[n] = in.MixturePos[n] = 1; // Set the mixture command and position
!
GetEngine(n)->InitRunning();
GetSteadyState();
***************
*** 257,268 ****
for (unsigned int i=0; i<GetNumEngines(); i++) {
! FDMExec->GetFCS()->SetThrottleCmd(i,1);
! FDMExec->GetFCS()->SetMixtureCmd(i,1);
GetEngine(i)->InitRunning();
}
GetSteadyState();
InitializedEngines = -1;
HasInitializedEngines = true;
-
}
}
--- 251,262 ----
for (unsigned int i=0; i<GetNumEngines(); i++) {
! in.ThrottleCmd[i] = in.ThrottlePos[i] = 1; // Set the throttle command and position
! in.MixtureCmd[i] = in.MixturePos[i] = 1; // Set the mixture command and position
GetEngine(i)->InitRunning();
}
+
GetSteadyState();
InitializedEngines = -1;
HasInitializedEngines = true;
}
}
***************
*** 316,336 ****
HavePistonEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGPiston(FDMExec, document, numEngines));
} else if (type == "turbine_engine") {
HaveTurbineEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGTurbine(FDMExec, document, numEngines));
} else if (type == "turboprop_engine") {
HaveTurboPropEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGTurboProp(FDMExec, document, numEngines));
} else if (type == "rocket_engine") {
HaveRocketEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGRocket(FDMExec, document, numEngines));
} else if (type == "electric_engine") {
HaveElectricEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGElectric(FDMExec, document, numEngines));
} else {
cerr << "Unknown engine type: " << type << endl;
--- 310,330 ----
HavePistonEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGPiston(FDMExec, document, numEngines, in));
} else if (type == "turbine_engine") {
HaveTurbineEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGTurbine(FDMExec, document, numEngines, in));
} else if (type == "turboprop_engine") {
HaveTurboPropEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGTurboProp(FDMExec, document, numEngines, in));
} else if (type == "rocket_engine") {
HaveRocketEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGRocket(FDMExec, document, numEngines, in));
} else if (type == "electric_engine") {
HaveElectricEngine = true;
if (!IsBound) bind();
! Engines.push_back(new FGElectric(FDMExec, document, numEngines, in));
} else {
cerr << "Unknown engine type: " << type << endl;
***************
*** 342,348 ****
}
- FDMExec->GetFCS()->AddThrottle();
- ThrottleAdded = true;
-
numEngines++;
--- 336,339 ----
***************
*** 352,356 ****
CalculateTankInertias();
- if (!ThrottleAdded) FDMExec->GetFCS()->AddThrottle(); // need to have at least one throttle
// Process fuel dump rate
--- 343,346 ----
Index: FGPropulsion.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/FGPropulsion.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** FGPropulsion.h 10 Jul 2011 20:18:14 -0000 1.28
--- FGPropulsion.h 28 Jul 2011 12:48:19 -0000 1.29
***************
*** 43,46 ****
--- 43,47 ----
#include "FGModel.h"
+ #include "propulsion/FGEngine.h"
#include "math/FGMatrix33.h"
#include "input_output/FGXMLFileRead.h"
***************
*** 196,199 ****
--- 197,202 ----
FGMatrix33& CalculateTankInertias(void);
+ struct FGEngine::Inputs in;
+
private:
std::vector <FGEngine*> Engines;
|