Strategy::statusType TheveninChargeStrategy::doStrategy()
{
    bool isendVout = isEndVout();
    AnalogInputs::ValueType I = SMPS::getIout();

    //balance, test if charge complete
    if(TheveninMethod::balance_isComplete(isendVout, I)) {
        SMPS::powerOff(SMPS::CHARGING_COMPLETE);
        return Strategy::COMPLETE;
    }
    AnalogInputs::ValueType newI = TheveninMethod::calculateNewI(isendVout, I);
    SMPS::trySetIout(newI);

    return Strategy::RUNNING;
}
Strategy::statusType TheveninDischargeStrategy::doStrategy()
{
    bool isendVout = isEndVout();
    AnalogInputs::ValueType I = Discharger::getIout();

    //test for charge complete
    bool end = isendVout;
    if(endOnTheveninMethodComplete_) {
        end = TheveninMethod::balance_isComplete(isendVout, I);
    }
    if(end) {
        return Strategy::COMPLETE;
    }

    AnalogInputs::ValueType newI = TheveninMethod::calculateNewI(isendVout, I);
    Discharger::trySetIout(newI);

    return Strategy::RUNNING;
}
Example #3
0
Strategy::statusType TheveninCharge::doStrategy()
{
    bool stable;
    bool isendVout = isEndVout();
    uint16_t oldValue = smps.getValue();

    stable = isStable() || isendVout;
    //test for charge complete
    if(theveninMethod.isComlete(isendVout, oldValue)) {
        smps.powerOff(SMPS::CHARGING_COMPLETE);
        return COMPLETE;
    }

    if(stable) {
        uint16_t value = theveninMethod.calculateNewValue(isendVout, oldValue);
        if(value != oldValue)
            smps.setValue(value);
    }
    return RUNNING;
}
Strategy::statusType TheveninChargeStrategy::doStrategy()
{
    bool update;
    bool isendVout = isEndVout();
    uint16_t oldValue = AnalogInputs::getRealValue(AnalogInputs::Ismps);    //current
//    uint16_t oldValue = AnalogInputs::getAvrADCValue(AnalogInputs::Ismps);    //ign
	
    //test if charge complete
    if(TheveninMethod::isComlete(isendVout, oldValue)) {
        SMPS::powerOff(SMPS::CHARGING_COMPLETE);
        return Strategy::COMPLETE;
    }

//    update = AnalogInputs::isOutStable() || isendVout || TheveninMethod::isBelowMin(oldValue);

//    if(update && !Balancer::isWorking()) {
//    if(!Balancer::isWorking()) {

  uint16_t voltage = TheveninMethod::calculateNewValue(isendVout, oldValue);
  if(SMPS::getValue() != ProgramData::currentProgramData.battery.Ic)
  SMPS::setRealValue(ProgramData::currentProgramData.battery.Ic, voltage);
//}
    return Strategy::RUNNING;
}