Beispiel #1
0
int JSBSimModel::getEngPLA(LCreal* const pla, const int max) const
{
    if (fdmex == 0) return 0;
    JSBSim::FGPropulsion* Propulsion = fdmex->GetPropulsion();
    if (Propulsion == 0) return 0;
    JSBSim::FGFCS* FCS = fdmex->GetFCS();
    if (FCS == 0) return 0;

    // return throttle PLA (percent)
    if (pla == 0 || max <= 0) {
        return 0;
    }
    int num = getNumberOfEngines();
    if (max < num) {
        num = max;
    }
    for (int i = 0; i < num; i++) {
        JSBSim::FGEngine* eng = Propulsion->GetEngine(i);
        double t = FCS->GetThrottlePos(i);
        double tmin = eng->GetThrottleMin();
        double tmax = eng->GetThrottleMax();
        double throttle = (t - tmin) / (tmax - tmin) * 100.0;
        pla[i] = (LCreal)throttle;
    }
    return num;
}