Support for a new "contra" attribute on propellers, which properly
models them as contra-rotating pairs.
This commit is contained in:
parent
8214364414
commit
28f50df1d5
3 changed files with 14 additions and 4 deletions
|
@ -717,6 +717,9 @@ void FGFDM::parsePropeller(XMLAttributes* a)
|
||||||
thruster->setVariableProp(min, max);
|
thruster->setVariableProp(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(attrb(a, "contra"))
|
||||||
|
thruster->setContraPair(true);
|
||||||
|
|
||||||
if(a->hasAttribute("manual-pitch")) {
|
if(a->hasAttribute("manual-pitch")) {
|
||||||
prop->setManualPitch();
|
prop->setManualPitch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ PropEngine::PropEngine(Propeller* prop, Engine* eng, float moment)
|
||||||
_eng = eng;
|
_eng = eng;
|
||||||
_moment = moment;
|
_moment = moment;
|
||||||
_fuel = true;
|
_fuel = true;
|
||||||
|
_contra = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropEngine::~PropEngine()
|
PropEngine::~PropEngine()
|
||||||
|
@ -192,16 +193,20 @@ void PropEngine::integrate(float dt)
|
||||||
_omega = 0 - _omega; // don't allow negative RPM
|
_omega = 0 - _omega; // don't allow negative RPM
|
||||||
// FIXME: introduce proper windmilling
|
// FIXME: introduce proper windmilling
|
||||||
|
|
||||||
// Store the total angular momentum into _gyro
|
// Store the total angular momentum into _gyro, unless the
|
||||||
Math::mul3(_omega*momt, _dir, _gyro);
|
// propeller is a counter-rotating pair (which has zero net
|
||||||
|
// angular momentum, even though it *does* have an MoI for
|
||||||
|
// acceleration purposes).
|
||||||
|
Math::mul3(_contra ? 0 : _omega*momt, _dir, _gyro);
|
||||||
|
|
||||||
// Accumulate the engine torque, it acts on the body as a whole.
|
// Accumulate the engine torque, it acts on the body as a whole.
|
||||||
// (Note: engine torque, not propeller torque. They can be
|
// (Note: engine torque, not propeller torque. They can be
|
||||||
// different, but the difference goes to accelerating the
|
// different, but the difference goes to accelerating the
|
||||||
// rotation. It is the engine torque that is felt at the shaft
|
// rotation. It is the engine torque that is felt at the shaft
|
||||||
// and works on the body.)
|
// and works on the body.) (Note 2: contra-rotating propellers do
|
||||||
|
// not exert net torque on the aircraft).
|
||||||
float tau = _moment < 0 ? engTorque : -engTorque;
|
float tau = _moment < 0 ? engTorque : -engTorque;
|
||||||
Math::mul3(tau, _dir, _torque);
|
Math::mul3(_contra ? 0 : tau, _dir, _torque);
|
||||||
|
|
||||||
// Iterate the propeller governor, if we have one. Since engine
|
// Iterate the propeller governor, if we have one. Since engine
|
||||||
// torque is basically constant with RPM, we want to make the
|
// torque is basically constant with RPM, we want to make the
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
void setVariableProp(float min, float max);
|
void setVariableProp(float min, float max);
|
||||||
void setPropFeather(int state);
|
void setPropFeather(int state);
|
||||||
void setGearRatio(float ratio) { _gearRatio = ratio; }
|
void setGearRatio(float ratio) { _gearRatio = ratio; }
|
||||||
|
void setContraPair(bool contra) { _contra = contra; }
|
||||||
|
|
||||||
virtual PropEngine* getPropEngine() { return this; }
|
virtual PropEngine* getPropEngine() { return this; }
|
||||||
virtual Engine* getEngine() { return _eng; }
|
virtual Engine* getEngine() { return _eng; }
|
||||||
|
@ -48,6 +49,7 @@ private:
|
||||||
Engine* _eng;
|
Engine* _eng;
|
||||||
|
|
||||||
bool _variable;
|
bool _variable;
|
||||||
|
bool _contra; // contra-rotating propeller pair
|
||||||
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
||||||
float _gearRatio;
|
float _gearRatio;
|
||||||
float _advance; // control input, 0-1
|
float _advance; // control input, 0-1
|
||||||
|
|
Loading…
Add table
Reference in a new issue