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; }
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); }