static void checkForEvents() {
    bool event = false;
    if(LuiEventManager_isWaitingForEvent()) {
        event |=updateRC();
        event |=updateBehaviors();
        if(event) {
            ase_printf("#play escape.wav 50 1\n");
            time_since_last_event = 0;
        }
    }
    else {
        event |= updateInputs();
        if(event) {
            time_since_last_event = 0;
            ase_printf("EVENT!:::\n");
            for(int i=0; i<LuiManager_getNumberOfInputDevices(); i++) {
                ase_printf("%i, ",LuiManager_getDeviceReadList()[i]);
            }
            ase_printf("\n");
        }
        else {
            time_since_last_event++;
        }
    }
    if(time_since_last_event>100) {
        time_since_last_event=100;
    }
}
Exemple #2
0
void Plog::validate(const std::string& equation)
{
    double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
    for (auto iter = pressures_.begin(); iter->first < 1000; iter++) {
        update_C(&iter->first);
        for (size_t i=0; i < 6; i++) {
            double k = updateRC(log(T[i]), 1.0/T[i]);
            if (!(k >= 0)) {
                // k is NaN. Increment the iterator so that the error
                // message will correctly indicate that the problematic rate
                // expression is at the higher of the adjacent pressures.
                throw CanteraError("Plog::validate",
                    "Invalid rate coefficient for reaction '{}'\nat P = {}, T = {}",
                    equation, std::exp((++iter)->first), T[i]);
            }
        }
    }
}
Exemple #3
0
void Plog::validate(const ReactionData& rdata)
{
    double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
    for (pressureIter iter = pressures_.begin();
            iter->first < 1000;
            iter++) {
        update_C(&iter->first);
        for (size_t i=0; i < 6; i++) {
            double k = updateRC(log(T[i]), 1.0/T[i]);
            if (!(k >= 0)) {
                // k is NaN. Increment the iterator so that the error
                // message will correctly indicate that the problematic rate
                // expression is at the higher of the adjacent pressures.
                throw CanteraError("Plog::validate",
                        "Invalid rate coefficient for reaction #" +
                        int2str(rdata.number) + ":\n" + rdata.equation + "\n" +
                        "at P = " + fp2str(std::exp((++iter)->first)) +
                        ", T = " + fp2str(T[i]));
            }
        }
    }
}
void LuiEventManager_waitForEvent() {
    updateRC(); //remove pending events
    updateBehaviors(); //remove pending events
    time_since_last_event=-1; //wait for event
}