// 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.
//
//////////////////////////////////////////////////////////////////////
// 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
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
}
//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);
// 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
// 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
FG_USING_STD(ofstream);
-class FGEngine {
+class FGNewEngine {
private:
ofstream outfile;
//constructor
- FGEngine() {
+ FGNewEngine() {
// outfile.open("FGEngine.dat", ios::out|ios::trunc);
}
//destructor
- ~FGEngine() {
+ ~FGNewEngine() {
// outfile.close();
}
<< 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();
-
-
- 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;
+ 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;
+ }
FG_LOG( FG_FLIGHT, FG_INFO, " Trim complete." );
} else {
FG_LOG( FG_FLIGHT, FG_INFO, " Initializing without trim" );
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
#include <Aircraft/aircraft.hxx>
+#define ID_JSBSIMXX "$Header"
class FGJSBsim: public FGInterface {
class FGLaRCsim: public FGInterface {
- FGEngine eng;
+ FGNewEngine eng;
public:
#include "IO360.hxx"
int main() {
- FGEngine e;
+ FGNewEngine e;
e.init( 1.0 / 120.0 );