Exemplo n.º 1
0
void Balancer::startBalacing()
{
    //test if battery has recovered after last balancing
    if(!isStable(balancerStartStableCount))
        return;

    minCell_ = getCellMinV();
    AnalogInputs::ValueType vmin = getV(minCell_);

    //test if we can still discharge
    bool off = true;
    if(vmin >= ProgramData::currentProgramData.getVoltagePerCell(ProgramData::VDischarge)) {
        for(int i = 0; i < cells_; i++) {
            //save voltage values
            Von_[i] = Voff_[i] = getV(i);
            if(Von_[i] - vmin > settings.balancerError_)
                off = false;
        }
    }

    savedVon_ = false;
    startBalanceTime_ = timer.getMiliseconds();
    if(off) {
        endBalancing();
    } else {
        setBalance(calculateBalance());
    }
}
Exemplo n.º 2
0
void Balancer::startBalacing()
{
    //test if battery has recovered after last balancing
    if(!isStable(balancerStartStableCount) || !AnalogInputs::isOutStable())
        return;

    if(minCell < 0) {
        minCell = getCellMinV();
    }
    AnalogInputs::ValueType vmin = getV(minCell);

    //test if we can still discharge
    bool off = true;
    AnalogInputs::ValueType VdisMin =  ProgramData::currentProgramData.getVoltagePerCell(ProgramData::VDischarge);
    for(int i = 0; i < cells; i++) {
        //save voltage values
        AnalogInputs::ValueType v = getV(i);
        if(v < VdisMin) {
            off = true;
            break;
        }
        if(v > vmin) {
            off = false;
        }
        Von_[i] = Voff_[i] = v;
    }

    savedVon = false;
    startBalanceTimeSecondsU16_ = Time::getSecondsU16();
    if(off) {
        endBalancing();
    } else {
        setBalance(calculateBalance());
    }
}
Exemplo n.º 3
0
void Balancer::startBalacing()
{
    //test if battery has recovered after last balancing
    if(!isStable(balancerStartStableCount) || !AnalogInputs::isOutStable())
        return;

    if(minCell < 0) {
        minCell = getCellMinV();
    }
    AnalogInputs::ValueType vmin = getV(minCell);

    //test if we can still discharge
    bool off = true;
    AnalogInputs::ValueType VdisMin =  ProgramData::battery.Vd_per_cell;
    for(uint8_t i = 0; i < MAX_BALANCE_CELLS; i++) {
        if(AnalogInputs::connectedBalancePortCells & (1<<i)) {
            //save voltage values
            AnalogInputs::ValueType v = getV(i);
            if(v < VdisMin) {
                off = true;
                break;
            }
            if(v > vmin) {
                off = false;
            }
            Von_[i] = Voff_[i] = v;
        }
    }
    LogDebug("off:", off);

    savedVon = false;
    startBalanceTimeSecondsU16_ = Time::getSecondsU16();
    if(off) {
        endBalancing();
    } else {
        setBalance(calculateBalance());
    }
}