Example #1
0
void FGPropulsion::InitRunning(int n)
{
  if (n > 0) { // A specific engine is supposed to be initialized

    if (n >= (int)GetNumEngines() ) {
      cerr << "Tried to initialize a non-existent engine!" << endl;
      throw;
    }
    FCS->SetThrottleCmd(n,1);
    FCS->SetMixtureCmd(n,1);
    GetEngine(n)->InitRunning();
    GetSteadyState();

    InitializedEngines = 1 << n;
    HasInitializedEngines = true;

  } else if (n < 0) { // -1 refers to "All Engines"

    for (unsigned int i=0; i<GetNumEngines(); i++) {
      FCS->SetThrottleCmd(i,1);
      FCS->SetMixtureCmd(i,1);
      GetEngine(i)->InitRunning();
    }
    GetSteadyState();
    InitializedEngines = -1;
    HasInitializedEngines = true;

  } else if (n == 0) { // No engines are to be initialized
    // Do nothing
  }
}
Example #2
0
void FGPropulsion::InitRunning(int n)
{
  if (n >= 0) { // A specific engine is supposed to be initialized

    if (n >= (int)GetNumEngines() ) {
      throw(string("Tried to initialize a non-existent engine!"));
    }

    in.ThrottleCmd[n] = in.ThrottlePos[n] = 1; // Set the throttle command and position
    in.MixtureCmd[n] = in.MixturePos[n] = 1;   // Set the mixture command and position

    GetEngine(n)->InitRunning();
    GetSteadyState();

  } else if (n < 0) { // -1 refers to "All Engines"

    for (unsigned int i=0; i<GetNumEngines(); i++) {
      in.ThrottleCmd[i] = in.ThrottlePos[i] = 1; // Set the throttle command and position
      in.MixtureCmd[i] = in.MixturePos[i] = 1;   // Set the mixture command and position
      GetEngine(i)->InitRunning();
    }

    GetSteadyState();
  }
}