MPPT算法异常
This commit is contained in:
parent
3ea22514fd
commit
a31b9af810
|
@ -468,6 +468,13 @@ void DSG_PROT_Interrupt(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 反向充电短路中断,反向充电电流大于一定值
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
|
||||
void EXCHG_PROT_Interrupt(void)
|
||||
{
|
||||
setPowerOutput(FALSE);
|
||||
|
|
|
@ -357,7 +357,7 @@ void mppt_readJust(void)
|
|||
// static float ki = 0.00001;
|
||||
|
||||
static float stepV1 = 0.2;
|
||||
static float stepV2 = 0.1;
|
||||
static float stepV2 = 0.08;
|
||||
|
||||
static uint8_t flag1 = 0; //表明上次运算是加还是减
|
||||
|
||||
|
@ -383,7 +383,8 @@ void mppt_readJust(void)
|
|||
|
||||
|
||||
flag = 0;
|
||||
Power = totalPower / 50.0f;
|
||||
// Power = totalPower / 30.0f;
|
||||
Power = totalPower;
|
||||
|
||||
static float powerT = 0;
|
||||
powerT = Power - lPower;
|
||||
|
@ -391,10 +392,13 @@ void mppt_readJust(void)
|
|||
powerT = -powerT;
|
||||
}
|
||||
|
||||
static uint8_t numFlag = 0;
|
||||
// if ((lPower + 0.8f < Power) && (lLPower + 0.8f < Power) && (lLLPower + 0.8f < Power)) {
|
||||
if ((lPower + 0.1f < Power) && (lLPower + 0.1f < Power)) {
|
||||
// if ((lPower + 0.1f < Power) && (lLPower + 0.1f < Power)) {
|
||||
if ((lPower + 8.0f < Power) && (lLPower + 8.0f < Power)) {
|
||||
numFlag = 0;
|
||||
// if ((lPower + 0.3f < Power)) {
|
||||
if (powerT > 5) {
|
||||
if (powerT > 250) {
|
||||
if (flag1) {
|
||||
SolarInCircuitV += stepV1;
|
||||
flag1 = 1;
|
||||
|
@ -412,9 +416,10 @@ void mppt_readJust(void)
|
|||
}
|
||||
}
|
||||
// } else if ((lPower - 0.8f > Power) && (lLPower - 0.8f > Power) && (lLLPower - 0.8f > Power)) {
|
||||
} else if ((lPower - 0.1f > Power) && (lLPower - 0.1f > Power)) {
|
||||
} else if ((lPower - 8.0f > Power) && (lLPower - 8.0f > Power)) {
|
||||
// } else if ((lPower - 0.3f > Power)) {
|
||||
if (powerT > 5) {
|
||||
if (powerT > 250) {
|
||||
numFlag = 0;
|
||||
if (flag1) {
|
||||
SolarInCircuitV -= stepV1;
|
||||
flag1 = 0;
|
||||
|
@ -431,8 +436,26 @@ void mppt_readJust(void)
|
|||
flag1 = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
numFlag++;
|
||||
}
|
||||
|
||||
/* 一段时间内都未调节 */
|
||||
if (numFlag == 100) {
|
||||
if (Power < 300) {
|
||||
SolarInCircuitV = 17.0f;
|
||||
}
|
||||
else if (flag1) {
|
||||
SolarInCircuitV -= stepV2;
|
||||
flag1 = 0;
|
||||
}
|
||||
else {
|
||||
SolarInCircuitV += stepV2;
|
||||
flag1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (SolarInCircuitV > 20.0f) {
|
||||
SolarInCircuitV = 20.0f;
|
||||
}
|
||||
|
@ -666,7 +689,7 @@ void BatteryChargControl(void)
|
|||
|
||||
case MPPT:
|
||||
mpptCharge();
|
||||
// mppt_constantVoltage(17.0f);
|
||||
// mppt_constantVoltage(17.5f);
|
||||
break;
|
||||
|
||||
case constantVoltage:
|
||||
|
|
|
@ -658,6 +658,7 @@ void stateMachine(device_handle device)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* 串口通信协议的初始化 */
|
||||
void uartCommonInit(void)
|
||||
{
|
||||
#ifdef HY_ChargeControlBox_PROTOCOL_ENABLE
|
||||
|
|
|
@ -123,17 +123,17 @@ void cfgTest(void)
|
|||
*/
|
||||
void readFlashContent(config_info *configInfo)
|
||||
{
|
||||
read_config_info(configInfo);
|
||||
/* 配置文件正确就返回 */
|
||||
read_config_info(configInfo);
|
||||
/* 配置文件正确就返回 */
|
||||
// static volatile uint16_t tempCrc1, tempCrc2;
|
||||
// tempCrc1 = configInfo->crc;
|
||||
// tempCrc2 = checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2);
|
||||
// if (tempCrc1 == tempCrc2) {
|
||||
// return;
|
||||
// }
|
||||
if (configInfo->crc == checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2)) {
|
||||
return;
|
||||
}
|
||||
if (configInfo->crc == checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// /* 更深处的配置文件正确就返回 */
|
||||
|
@ -277,26 +277,25 @@ void config_info_start(void)
|
|||
g_cfgParameter.reverseChargProtectionCurr = temp_configInfo.reverseChargProtectionCurr;
|
||||
|
||||
/* 读取的回路阻抗无效则回路阻抗设置为0 */
|
||||
float fTemp;
|
||||
// fTemp = 0.01f;
|
||||
// saveLoopImpedance(&fTemp);
|
||||
readLoopImpedance(&fTemp);
|
||||
// setLoopImpedance(fTemp);
|
||||
// if (getLoopImpedance() < 0 || getLoopImpedance() > 0.3f) {
|
||||
if (!setLoopImpedance(fTemp)) {
|
||||
setLoopImpedance(0.01f);
|
||||
fTemp = getLoopImpedance();
|
||||
saveLoopImpedance(&fTemp);
|
||||
}
|
||||
|
||||
readtotalElectricityConsumption(&fTemp);
|
||||
totalElectricityConsumptionInt(fTemp);
|
||||
readtotalChargCapacity(&fTemp);
|
||||
totalChargCapacityInt(fTemp);
|
||||
|
||||
timeInfo time;
|
||||
readTime(&time);
|
||||
setLastTime(time);
|
||||
float fTemp;
|
||||
// fTemp = 0.01f;
|
||||
// saveLoopImpedance(&fTemp);
|
||||
readLoopImpedance(&fTemp);
|
||||
// setLoopImpedance(fTemp);
|
||||
// if (getLoopImpedance() < 0 || getLoopImpedance() > 0.3f) {
|
||||
if (!setLoopImpedance(fTemp)) {
|
||||
setLoopImpedance(0);
|
||||
fTemp = getLoopImpedance();
|
||||
saveLoopImpedance(&fTemp);
|
||||
}
|
||||
|
||||
// readtotalElectricityConsumption(&fTemp);
|
||||
// totalElectricityConsumptionInt(fTemp);
|
||||
// readtotalChargCapacity(&fTemp);
|
||||
// totalChargCapacityInt(fTemp);
|
||||
// timeInfo time;
|
||||
// readTime(&time);
|
||||
// setLastTime(time);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -200,20 +200,20 @@ void Task_wdi(void)
|
|||
{
|
||||
feedDog();
|
||||
|
||||
// debug_printf("chargCurrent:%f \n", getChargCurrent());
|
||||
// debug_printf("outputVoltage:%f \n", getOutputVoltage());
|
||||
// debug_printf("BatteryVoltage:%f \n", getBatteryVoltage());
|
||||
// debug_printf("dischargCurrent:%f \n", getDischargCurrent());
|
||||
// debug_printf("solarInCircuitVoltage:%f \n", getSolarInCircuitVoltage());
|
||||
// debug_printf("HighSideMosTemperature:%f \n", getHighSideMosTemperature());
|
||||
// debug_printf("InputVoltage:%f \n", getInputVoltage());
|
||||
// debug_printf("DischargMosState:%d \n", getDischargMosState());
|
||||
// debug_printf("MPPT_Mode:%d \n", getMPPT_Mode());
|
||||
// debug_printf("loopImpedance:%f \n", getLoopImpedance());
|
||||
// debug_printf("DutyRatio:%f \n", getDutyRatio());
|
||||
// // debug_printf("OUT_VOLT_IN:%f \n", get_OUT_VOLT_IN());
|
||||
// debug_printf("HAL_GetTick:%d \n", HAL_GetTick());
|
||||
// debug_printf("getExChargeCurr:%f \n", getExChargeCurr());
|
||||
debug_printf("chargCurrent:%f \n", getChargCurrent());
|
||||
debug_printf("outputVoltage:%f \n", getOutputVoltage());
|
||||
debug_printf("BatteryVoltage:%f \n", getBatteryVoltage());
|
||||
debug_printf("dischargCurrent:%f \n", getDischargCurrent());
|
||||
debug_printf("solarInCircuitVoltage:%f \n", getSolarInCircuitVoltage());
|
||||
debug_printf("HighSideMosTemperature:%f \n", getHighSideMosTemperature());
|
||||
debug_printf("InputVoltage:%f \n", getInputVoltage());
|
||||
debug_printf("DischargMosState:%d \n", getDischargMosState());
|
||||
debug_printf("MPPT_Mode:%d \n", getMPPT_Mode());
|
||||
debug_printf("loopImpedance:%f \n", getLoopImpedance());
|
||||
debug_printf("DutyRatio:%f \n", getDutyRatio());
|
||||
// debug_printf("OUT_VOLT_IN:%f \n", get_OUT_VOLT_IN());
|
||||
debug_printf("HAL_GetTick:%d \n", HAL_GetTick());
|
||||
debug_printf("getExChargeCurr:%f \n", getExChargeCurr());
|
||||
|
||||
|
||||
// char buf[100];
|
||||
|
@ -268,14 +268,14 @@ void Task_wdi(void)
|
|||
// static uint32_t temp = 60 * 30;
|
||||
if (!(--temp)) {
|
||||
temp = 0;
|
||||
float tempF;
|
||||
tempF = getTotalElectricityConsumption();
|
||||
savetotalElectricityConsumption(&tempF);
|
||||
tempF = getTotalChargCapacity();
|
||||
savetotalChargCapacity(&tempF);
|
||||
timeInfo time;
|
||||
time = getLastTime();
|
||||
saveTime(&time);
|
||||
// float tempF;
|
||||
// tempF = getTotalElectricityConsumption();
|
||||
// savetotalElectricityConsumption(&tempF);
|
||||
// tempF = getTotalChargCapacity();
|
||||
// savetotalChargCapacity(&tempF);
|
||||
// timeInfo time;
|
||||
// time = getLastTime();
|
||||
// saveTime(&time);
|
||||
// NVIC_SystemReset();
|
||||
resetCheckImpedanceState();
|
||||
temp = 60 * 60 * 24;
|
||||
|
|
Loading…
Reference in New Issue