Fix drag when engine is shut down, by avoiding negative RPM.
The Propeller class ignored negative RPM but still returned a torque value, which ratcheted up a higher and higher negative RPM until drag overwhelmed the aircraft. In reality, the propeller should windmill at a reasonable postive RPM, introducing a constant drag on the aircraft -- the propeller should *not* stop unless the plane is flying very slowly. That's a future project.
This commit is contained in:
parent
c2684e9bc6
commit
1d4a7659fc
1 changed files with 3 additions and 0 deletions
|
@ -161,6 +161,9 @@ void PropEngine::integrate(float dt)
|
||||||
// Runge-Kutta stuff.
|
// Runge-Kutta stuff.
|
||||||
float rotacc = (engTorque-propTorque)/Math::abs(_moment);
|
float rotacc = (engTorque-propTorque)/Math::abs(_moment);
|
||||||
_omega += dt * rotacc;
|
_omega += dt * rotacc;
|
||||||
|
if (_omega < 0)
|
||||||
|
_omega = 0 - _omega; // don't allow negative RPM
|
||||||
|
// FIXME: introduce proper windmilling
|
||||||
|
|
||||||
// Store the total angular momentum into _gyro
|
// Store the total angular momentum into _gyro
|
||||||
Math::mul3(_omega*_moment, _dir, _gyro);
|
Math::mul3(_omega*_moment, _dir, _gyro);
|
||||||
|
|
Loading…
Add table
Reference in a new issue