From cf7f829130141b982952db740a0bd3e6e0b49125 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 14 Jan 2002 14:23:53 +0000 Subject: [PATCH] Added ability to set engine RPM from FlightGear. --- src/FDM/JSBSim.cxx | 1 + src/FDM/JSBSim/FGThruster.h | 1 + src/FDM/flight.cxx | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 0475d214d..b71439e85 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -333,6 +333,7 @@ bool FGJSBsim::copy_to_JSBsim() { FCS->SetThrottleCmd(i, globals->get_controls()->get_throttle(i)); FCS->SetMixtureCmd(i, globals->get_controls()->get_mixture(i)); FCS->SetPropAdvanceCmd(i, globals->get_controls()->get_prop_advance(i)); + Propulsion->GetThruster(i)->SetRPM(get_engine(i)->get_RPM()); } Position->SetSeaLevelRadius( get_Sea_level_radius() ); diff --git a/src/FDM/JSBSim/FGThruster.h b/src/FDM/JSBSim/FGThruster.h index d46956e0c..d62a3c455 100644 --- a/src/FDM/JSBSim/FGThruster.h +++ b/src/FDM/JSBSim/FGThruster.h @@ -77,6 +77,7 @@ public: virtual double Calculate(double) {return 0.0;} void SetName(string name) {Name = name;} void SetThrusterNumber(int nn) {ThrusterNumber = nn;} + virtual void SetRPM(double rpm) {}; virtual double GetPowerRequired(void) {return 0.0;} virtual void SetdeltaT(double dt) {deltaT = dt;} double GetThrust(void) {return Thrust;} diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index ed670fa8b..a0a1ebec3 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -392,7 +392,9 @@ FGInterface::bind () char buf[64]; sprintf(buf, "/engines/engine[%d]/rpm", i); - fgTie(buf, get_engine(i), &FGEngInterface::get_RPM); + fgTie(buf, get_engine(i), + &FGEngInterface::get_RPM, &FGEngInterface::set_RPM); + fgSetArchivable(buf); sprintf(buf, "/engines/engine[%d]/egt-degf", i); fgTie(buf, get_engine(i), &FGEngInterface::get_EGT);