1
0
Fork 0

Added a post-solver "initEngines()" call to return the engines to a sane

initial state.  No more starting up at cruise RPM.
This commit is contained in:
andy 2002-02-27 00:41:57 +00:00
parent d3cca375dc
commit df9069a224
6 changed files with 19 additions and 1 deletions

View file

@ -650,6 +650,14 @@ void Airplane::solveGear()
} }
} }
void Airplane::initEngines()
{
for(int i=0; i<_thrusters.size(); i++) {
ThrustRec* tr = (ThrustRec*)_thrusters.get(i);
tr->thruster->init();
}
}
void Airplane::stabilizeThrust() void Airplane::stabilizeThrust()
{ {
int i; int i;

View file

@ -59,6 +59,7 @@ public:
float getFuelDensity(int tank); // kg/m^3 float getFuelDensity(int tank); // kg/m^3
void compile(); // generate point masses & such, then solve void compile(); // generate point masses & such, then solve
void initEngines();
void stabilizeThrust(); void stabilizeThrust();
// Solution output values // Solution output values

View file

@ -123,6 +123,13 @@ void PropEngine::stabilize()
_eng->setRunning(false); _eng->setRunning(false);
} }
void PropEngine::init()
{
_omega = 0.01;
_eng->setStarter(false);
_eng->setMagnetos(0);
}
void PropEngine::integrate(float dt) void PropEngine::integrate(float dt)
{ {
float speed = -Math::dot3(_wind, _dir); float speed = -Math::dot3(_wind, _dir);

View file

@ -30,6 +30,7 @@ public:
virtual float getFuelFlow(); virtual float getFuelFlow();
// Runtime instructions // Runtime instructions
virtual void init();
virtual void integrate(float dt); virtual void integrate(float dt);
virtual void stabilize(); virtual void stabilize();

View file

@ -43,6 +43,7 @@ public:
// Runtime instructions // Runtime instructions
void setWind(float* wind); void setWind(float* wind);
void setAir(float pressure, float temp); void setAir(float pressure, float temp);
virtual void init() {}
virtual void integrate(float dt)=0; virtual void integrate(float dt)=0;
virtual void stabilize()=0; virtual void stabilize()=0;

View file

@ -189,7 +189,7 @@ void YASim::init()
copyToYASim(true); copyToYASim(true);
_fdm->getExternalInput(); _fdm->getExternalInput();
_fdm->getAirplane()->stabilizeThrust(); _fdm->getAirplane()->initEngines();
set_inited(true); set_inited(true);
} }