1
0
Fork 0

Renamed new FGEngine to FGNewEngine to avoid conflict with stuff in JSBSim.

This commit is contained in:
curt 2000-10-16 20:01:23 +00:00
parent e178af50f0
commit 0750b9d34f
6 changed files with 32 additions and 29 deletions

View file

@ -67,8 +67,8 @@
// but it is by no means currently at a completed stage - DCL 15/9/00
//
// DCL 28/9/00 - Added estimate of engine and prop inertia and changed engine speed calculation to be calculated from Angular acceleration = Torque / Inertia.
// Requires a timestep to be passed to FGEngine::init and currently assumes this timestep does not change.
// Could easily be altered to pass a variable timestep to FGEngine::update every step instead if required.
// Requires a timestep to be passed to FGNewEngine::init and currently assumes this timestep does not change.
// Could easily be altered to pass a variable timestep to FGNewEngine::update every step instead if required.
//
//////////////////////////////////////////////////////////////////////
@ -88,7 +88,7 @@ FG_USING_STD(cout);
// Calculate Engine RPM based on Propellor Lever Position
float FGEngine::Calc_Engine_RPM (float LeverPosition)
float FGNewEngine::Calc_Engine_RPM (float LeverPosition)
{
// Calculate RPM as set by Prop Lever Position. Assumes engine
// will run at 1000 RPM at full course
@ -104,7 +104,7 @@ float FGEngine::Calc_Engine_RPM (float LeverPosition)
return RPM;
}
float FGEngine::Lookup_Combustion_Efficiency(float thi_actual)
float FGNewEngine::Lookup_Combustion_Efficiency(float thi_actual)
{
float thi[11]; //array of equivalence ratio values
float neta_comb[11]; //corresponding array of combustion efficiency values
@ -165,12 +165,12 @@ float FGEngine::Lookup_Combustion_Efficiency(float thi_actual)
}
//if we get here something has gone badly wrong
cout << "ERROR: error in FGEngine::Lookup_Combustion_Efficiency\n";
cout << "ERROR: error in FGNewEngine::Lookup_Combustion_Efficiency\n";
//exit(-1);
return neta_comb_actual; //keeps the compiler happy
}
/*
float FGEngine::Calculate_Delta_T_Exhaust(void)
float FGNewEngine::Calculate_Delta_T_Exhaust(void)
{
float dT_exhaust;
heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
@ -201,7 +201,7 @@ static float Calc_Manifold_Pressure ( float LeverPosn, float MaxMan, float MinMa
// set initial default values
void FGEngine::init(double dt) {
void FGNewEngine::init(double dt) {
CONVERT_CUBIC_INCHES_TO_METERS_CUBED = 1.638706e-5;
// Control and environment inputs
@ -346,7 +346,7 @@ static float IAS_to_FPS (float x)
// update the engine model based on current control positions
void FGEngine::update() {
void FGNewEngine::update() {
// Declare local variables
int num = 0;
// const int num2 = 500; // default is 100, number if iterations to run

View file

@ -64,7 +64,7 @@
FG_USING_STD(ofstream);
class FGEngine {
class FGNewEngine {
private:
@ -194,12 +194,12 @@ public:
ofstream outfile;
//constructor
FGEngine() {
FGNewEngine() {
// outfile.open("FGEngine.dat", ios::out|ios::trunc);
}
//destructor
~FGEngine() {
~FGNewEngine() {
// outfile.close();
}

View file

@ -147,23 +147,25 @@ bool FGJSBsim::init( double dt ) {
<< current_options.get_altitude() );
//must check > 0, != 0 will give bad result if --notrim set
if(current_options.get_trim_mode() > 0) {
FDMExec.RunIC(fgic);
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
FGTrim *fgtrim=new FGTrim(&FDMExec,fgic,tLongitudinal);
fgtrim->DoTrim();
fgtrim->Report();
fgtrim->TrimStats();
fgtrim->ReportState();
if(fgic->GetVcalibratedKtsIC() > 50) {
FDMExec.RunIC(fgic);
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
FGTrim *fgtrim=new FGTrim(&FDMExec,fgic,tLongitudinal);
fgtrim->DoTrim();
fgtrim->Report();
fgtrim->TrimStats();
fgtrim->ReportState();
controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
trimmed=true;
trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
//the trimming routine only knows how to get 1 value for throttle
delete fgtrim;
controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
trimmed=true;
trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
//the trimming routine only knows how to get 1 value for throttle
delete fgtrim;
}
FG_LOG( FG_FLIGHT, FG_INFO, " Trim complete." );
} else {
FG_LOG( FG_FLIGHT, FG_INFO, " Initializing without trim" );
@ -247,7 +249,7 @@ bool FGJSBsim::copy_to_JSBsim() {
FDMExec.GetFCS()->SetDaCmd( controls.get_aileron());
FDMExec.GetFCS()->SetDeCmd( controls.get_elevator());
FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim());
FDMExec.GetFCS()->SetDrCmd( controls.get_rudder());
FDMExec.GetFCS()->SetDrCmd( -1*controls.get_rudder());
FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers

View file

@ -29,6 +29,7 @@
#include <Aircraft/aircraft.hxx>
#define ID_JSBSIMXX "$Header"
class FGJSBsim: public FGInterface {

View file

@ -33,7 +33,7 @@
class FGLaRCsim: public FGInterface {
FGEngine eng;
FGNewEngine eng;
public:

View file

@ -3,7 +3,7 @@
#include "IO360.hxx"
int main() {
FGEngine e;
FGNewEngine e;
e.init( 1.0 / 120.0 );