Exemplo n.º 1
0
AnalogInputs::ValueType TheveninMethod::calculateNewValue(bool isEndVout, AnalogInputs::ValueType oldValue)
{
    AnalogInputs::ValueType i;

    calculateRthVth(oldValue);
    storeOldValue(oldValue);

    i = calculateI();
    idebug_ = i;
    i = normalizeI(i, oldValue);

    //test if maximum output voltage reached
    switch(Ifalling_) {
    case NotFalling:
        if(!isEndVout)
            break;
        if(balance_) {
            Balancer::endBalancing();
            Balancer::done_ = false;
        }
        Ifalling_ = LastRthMesurment;
        //temporarily turn off
        i = 0;
        break;
    default:
        Ifalling_ = Falling;
        break;
    }
    return i;
}
Exemplo n.º 2
0
AnalogInputs::ValueType TheveninMethod::calculateNewValue(bool isEndVout, AnalogInputs::ValueType oldValue)
{
    AnalogInputs::ValueType i;

    //test for maximum output voltage reached
    if(isEndVout) {
        switch(Ifalling_) {
        case NotFalling:
            Ifalling_ = LastRthMesurment;
            //temporarily turn off
            storeOldValue(oldValue);
            return 0;
        default:
            Ifalling_ = Falling;
            break;
        }
    }

    calculateRthVth(oldValue);
    i = calculateI();
    return normalizeI(i, oldValue);
}