Wire up a "gear-ratio" attribute for geared propeller aircraft
This commit is contained in:
parent
f845aa9b2a
commit
5af1e589de
3 changed files with 6 additions and 1 deletions
|
@ -623,6 +623,8 @@ void FGFDM::parsePropeller(XMLAttributes* a)
|
|||
prop->setManualPitch();
|
||||
}
|
||||
|
||||
thruster->setGearRatio(attrf(a, "gear-ratio", 1));
|
||||
|
||||
char buf[64];
|
||||
sprintf(buf, "/engines/engine[%d]", _nextEngine++);
|
||||
EngRec* er = new EngRec();
|
||||
|
|
|
@ -11,6 +11,7 @@ PropEngine::PropEngine(Propeller* prop, PistonEngine* eng, float moment)
|
|||
_dir[0] = 1; _dir[1] = 0; _dir[2] = 0;
|
||||
|
||||
_variable = false;
|
||||
_gearRatio = 1;
|
||||
|
||||
_prop = prop;
|
||||
_eng = eng;
|
||||
|
@ -154,7 +155,7 @@ void PropEngine::integrate(float dt)
|
|||
_eng->setMixture(_mixture);
|
||||
_eng->setFuelState(_fuel);
|
||||
|
||||
_prop->calc(_rho, speed, _omega, &thrust, &propTorque);
|
||||
_prop->calc(_rho, speed, _omega * _gearRatio, &thrust, &propTorque);
|
||||
_eng->calc(_pressure, _temp, _omega);
|
||||
engTorque = _eng->getTorque();
|
||||
_fuelFlow = _eng->getFuelFlow();
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
void setAdvance(float advance);
|
||||
void setPropPitch(float proppitch);
|
||||
void setVariableProp(float min, float max);
|
||||
void setGearRatio(float ratio) { _gearRatio = ratio; }
|
||||
|
||||
virtual PropEngine* getPropEngine() { return this; }
|
||||
virtual PistonEngine* getPistonEngine() { return _eng; }
|
||||
|
@ -45,6 +46,7 @@ private:
|
|||
|
||||
bool _variable;
|
||||
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
||||
float _gearRatio;
|
||||
float _advance; // control input, 0-1
|
||||
float _maxOmega;
|
||||
float _minOmega;
|
||||
|
|
Loading…
Reference in a new issue