From 137da58a70a6caca205f829eb8a547e72b68f9e7 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 29 Sep 2000 03:27:21 +0000 Subject: [PATCH] Working on putting engine data on "the bus" --- Thanks | 4 +++ src/FDM/LaRCsim.cxx | 24 ++++++++++++++---- src/FDM/LaRCsim.hxx | 8 ++++++ src/FDM/flight.hxx | 62 +++++++++++++++++++++++++++++++++++++++++++++ src/Main/main.cxx | 37 ++++++++++++++++++++++++--- 5 files changed, 127 insertions(+), 8 deletions(-) diff --git a/Thanks b/Thanks index d4d20de4f..c8d67d40e 100644 --- a/Thanks +++ b/Thanks @@ -177,6 +177,10 @@ Bob Kuehne Redid the Makefile system so it is simpler and more robust. +David Luff + Contributed heavily to the IO360 piston engine model. + + Christian Mayer Working on a multi-lingual conversion tools for fgfs as a demonstration of technology ;-) diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 35fcb9d58..0188276ef 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -35,10 +35,6 @@ #include "LaRCsim.hxx" -#define USE_NEW_ENGINE_CODE 1 -FGEngine eng; - - // Initialize the LaRCsim flight model, dt is the time increment for // each subsequent iteration through the EOM int FGLaRCsim::init( double dt ) { @@ -48,6 +44,10 @@ int FGLaRCsim::init( double dt ) { eng.init(dt); // dcl - in passing dt to init rather than update I am assuming // that the LaRCsim dt is fixed at one value (yes it is 120hz CLO) + + // update the engines interface + FGEngInterface e; + add_engine( e ); #endif // cout << "FGLaRCsim::init()" << endl; @@ -88,13 +88,27 @@ int FGLaRCsim::update( int multiloop ) { // cout << "FGLaRCsim::update()" << endl; #ifdef USE_NEW_ENGINE_CODE - // update simple engine model + // set control inputs eng.set_IAS( V_calibrated_kts ); eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 ); eng.set_Propeller_Lever_Pos( 100 ); eng.set_Mixture_Lever_Pos( 80 ); + + // update engine model eng.update(); + // copy engine state values onto "bus" + FGEngInterface *e = get_engine( 0 ); + e->set_Throttle( controls.get_throttle( 0 ) * 100.0 ); + e->set_Mixture( 80 ); + e->set_Prop_Advance( 100 ); + e->set_RPM( eng.get_RPM() ); + e->set_Manifold_Pressure( eng.get_Manifold_Pressure() ); + e->set_MaxHP( eng.get_MaxHP() ); + e->set_Percentage_Power( eng.get_Percentage_Power() ); + e->set_EGT( eng.get_EGT() ); + e->set_prop_thrust( eng.get_prop_thrust_SI() ); + #if 0 cout << "Throttle = " << controls.get_throttle( 0 ) * 100.0; cout << " Mixture = " << 80; diff --git a/src/FDM/LaRCsim.hxx b/src/FDM/LaRCsim.hxx index d08db68b3..068cb8f21 100644 --- a/src/FDM/LaRCsim.hxx +++ b/src/FDM/LaRCsim.hxx @@ -27,11 +27,19 @@ #define _LARCSIM_HXX +#include "IO360.hxx" #include "flight.hxx" +#define USE_NEW_ENGINE_CODE 1 + + class FGLaRCsim: public FGInterface { +#ifdef USE_NEW_ENGINE_CODE + FGEngine eng; +#endif + public: // copy FDM state to LaRCsim structures diff --git a/src/FDM/flight.hxx b/src/FDM/flight.hxx index 727ecbfab..99e916b80 100644 --- a/src/FDM/flight.hxx +++ b/src/FDM/flight.hxx @@ -86,15 +86,61 @@ #include #include +#include #include