Skip to content

Commit

Permalink
Float-Voltage korrigiert
Browse files Browse the repository at this point in the history
  • Loading branch information
shining-man committed Apr 10, 2024
1 parent f12b78f commit cddc4c2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
29 changes: 20 additions & 9 deletions src/inverter/ChargeCurrentCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace nsChargeCurrentCtrl
}*/


/********************************************************************************************
/********************************************************************************************
* calcChargeCurrentCutOff(int16_t u16_lChargeCurrent)
* Ladestrom auf 0 setzen, wenn längere Zeit mit einem geringen Ladestrom geladen wurde.
*
Expand All @@ -319,6 +319,7 @@ namespace nsChargeCurrentCtrl

int16_t lCutOffCurrent = (int16_t)WebSettings::getInt(ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_CURRENT,0,DT_ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_CURRENT);
uint8_t lCutOffSoc = (uint8_t)WebSettings::getInt(ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC,0,DT_ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC);
uint16_t lCutOffStartVoltage = (uint16_t)WebSettings::getInt(ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_START_VOLTAGE,0,DT_ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_START_VOLTAGE);

uint8_t lSoc = (uint8_t)inverterData.inverterSoc;

Expand All @@ -328,18 +329,28 @@ namespace nsChargeCurrentCtrl

if(inverterData.u16_mChargeCurrentCutOfTimer>=lCutOffTime)
{
if(lSoc < lCutOffSoc) //Wenn SoC zur Freigabe wieder unterschritten
{
inverterData.u16_mChargeCurrentCutOfTimer=0;
inverterData.floatState = Inverter::e_stateFloat::FLOAT_VOLTAGE;
}
else u16_lChargeCurrent=0;
//Wenn SoC zur Freigabe wieder unterschritten
if(lSoc < lCutOffSoc) inverterData.u16_mChargeCurrentCutOfTimer = 0;
else u16_lChargeCurrent = 0;

inverterData.floatState = Inverter::e_stateFloat::FLOAT_VOLTAGE;
}
else
{
//Timer hochzählen, wenn Strom kleiner
if(inverterData.batteryCurrent < lCutOffCurrent && lSoc>=lCutOffSoc) inverterData.u16_mChargeCurrentCutOfTimer++;
else inverterData.u16_mChargeCurrentCutOfTimer=0;
if(lCutOffStartVoltage > 0) // Wenn eine Startvoltage eingestellt ist
{
uint16_t lAktuelleMaxZellspg = BmsDataUtils::getMaxCellSpannungFromBms(inverterData.u8_bmsDatasource, inverterData.u16_bmsDatasourceAdd);

if(inverterData.batteryCurrent < lCutOffCurrent && (lAktuelleMaxZellspg >= lCutOffStartVoltage || inverterData.u16_mChargeCurrentCutOfTimer > 0) ) inverterData.u16_mChargeCurrentCutOfTimer++;
else inverterData.u16_mChargeCurrentCutOfTimer = 0;
}
else // Wenn keine Startvoltage eingestellt ist, dann muss der aktuelle SoC größer dem cutOffSoc sein.
{
if(inverterData.batteryCurrent < lCutOffCurrent && lSoc >= lCutOffSoc) inverterData.u16_mChargeCurrentCutOfTimer++;
else inverterData.u16_mChargeCurrentCutOfTimer = 0;
}

}

#ifdef CAN_DEBUG
Expand Down
7 changes: 3 additions & 4 deletions src/inverter/ChargeVoltageCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ namespace nsChargeVoltageCtrl
{
uint16_t lFloatVoltage = (uint16_t)WebSettings::getInt(ID_PARAM_BMS_FLOAT_CHARGE_SPG,0,DT_ID_PARAM_BMS_FLOAT_CHARGE_SPG);
if(lFloatVoltage < u16_lChargeVoltage) u16_lChargeVoltage = lFloatVoltage;
}
else
{
if(WebSettings::getInt(ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC,0,DT_ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC) < inverterData.inverterSoc)

if(inverterData.inverterSoc < WebSettings::getInt(ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC,0,DT_ID_PARAM_INVERTER_CHARGE_CURRENT_CUT_OFF_SOC))
{
inverterData.floatState = Inverter::e_stateFloat::ABSORPTION_VOLTAGE;
}
}


inverter.inverterDataSemaphoreTake();
inverterData.inverterChargeVoltage = u16_lChargeVoltage;
inverter.inverterDataSemaphoreGive();
Expand Down

0 comments on commit cddc4c2

Please sign in to comment.