更改开路电压采集错误
This commit is contained in:
parent
931a71a25c
commit
3a36df469e
|
@ -102,7 +102,7 @@ void mppt_constantVoltageO(float OutVoltage)
|
|||
// static float lastVolt = 0;
|
||||
// static float lastStepPwm = 0;
|
||||
static float lastDutyRatio = 0;
|
||||
static float kp = 0.005;
|
||||
static float kp = 0.002;
|
||||
static float ki = 0.00001;
|
||||
static float outVolt;
|
||||
static float error;
|
||||
|
|
|
@ -343,6 +343,8 @@ void Task_refreshJudgeData(void)
|
|||
if (getSolarInCircuitVoltage() >= g_cfgParameter.maxOpenSolarOutputCircuitV) {
|
||||
// log_info("getSolarInCircuitVoltage : %f", getSolarInCircuitVoltage());
|
||||
// log_info("g_cfgParameter.maxOpenSolarOutputCircuitV : %f", g_cfgParameter.maxOpenSolarOutputCircuitV);
|
||||
TimeSliceOffset_Unregister(&m_startControl);
|
||||
m_startControl.runFlag = 0;
|
||||
stopChargWork();
|
||||
insertEventsOrderRecord(overInputVolt);
|
||||
}
|
||||
|
@ -365,7 +367,6 @@ void Task_startControl(void)
|
|||
TimeSliceOffset_Unregister(&m_startControl);
|
||||
m_startControl.runFlag = 0;
|
||||
|
||||
|
||||
/* 判断有无电池 */
|
||||
if (getOutputVoltage() > 11.0f) {
|
||||
setBatteryState(TRUE);
|
||||
|
@ -499,52 +500,93 @@ void Task_impedanceCalculation(void)
|
|||
*/
|
||||
void Task_collectOpenCircuitVoltage(void)
|
||||
{
|
||||
/* 用于无充电控制时获取开路电压 */
|
||||
static uint32_t collectOpenCircuitVoltageNoNUM = 0;
|
||||
/* 用于有充电控制时获取开路电压 */
|
||||
static uint8_t collectOpenCircuitVoltageYesNUM = 0;
|
||||
// /* 用于无充电控制时获取开路电压 */
|
||||
// static uint32_t collectOpenCircuitVoltageNoNUM = 0;
|
||||
// /* 用于有充电控制时获取开路电压 */
|
||||
// static uint8_t collectOpenCircuitVoltageYesNUM = 0;
|
||||
/* 用于有充电控制时当标志位 */
|
||||
static BOOL collectOpenCircuitVoltageYesFlag = 0;
|
||||
|
||||
|
||||
/* 未进行充电时,3S采集一次开路电压 */
|
||||
if (FALSE == getChargControlFlag()) {
|
||||
if (2 <= collectOpenCircuitVoltageNoNUM++) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
collectOpenCircuitVoltageNoNUM = 0;
|
||||
}
|
||||
collectOpenCircuitVoltageYesNUM = 0;
|
||||
if (collectOpenCircuitVoltageYesFlag == TRUE) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
beginChargWork();
|
||||
collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
collectOpenCircuitVoltageYesNUM++;
|
||||
static uint32_t collectOpenCircuitVoltageNUM = 0;
|
||||
collectOpenCircuitVoltageNUM++;
|
||||
|
||||
/* 到达开路电压检测时间 */
|
||||
if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime) {
|
||||
if (collectOpenCircuitVoltageNUM == g_cfgParameter.collectOpenCircuitVoltageTime) {
|
||||
// if (collectOpenCircuitVoltageNUM == 180) {
|
||||
/* 有电池才进行开路电压检测 */
|
||||
if (getBatteryState()) {
|
||||
collectOpenCircuitVoltageYesFlag = TRUE;
|
||||
stopChargWork();
|
||||
/* 设置延时为(1000-500)ms */
|
||||
m_collectOpenCircuitVoltage.count = 500;
|
||||
if (!getBatteryState()) {
|
||||
collectOpenCircuitVoltageNUM = 0;
|
||||
return;
|
||||
}
|
||||
collectOpenCircuitVoltageYesNUM = 0;
|
||||
collectOpenCircuitVoltageYesFlag = TRUE;
|
||||
stopChargWork();
|
||||
/* 设置延时为(1000-500)ms */
|
||||
m_collectOpenCircuitVoltage.count = 500;
|
||||
}
|
||||
|
||||
/* 检测开路电压 */
|
||||
if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) {
|
||||
if (collectOpenCircuitVoltageNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) {
|
||||
// if (collectOpenCircuitVoltageNUM == 181) {
|
||||
/* 有电池才进行开路电压检测 */
|
||||
if (getBatteryState()) {
|
||||
if (!getBatteryState()) {
|
||||
collectOpenCircuitVoltageNUM = 0;
|
||||
return;
|
||||
}
|
||||
setSolarOpenCircuitVoltage();
|
||||
beginChargWork();
|
||||
collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
// beginSoftStartTask();
|
||||
collectOpenCircuitVoltageNUM = 0;
|
||||
// setChargControlFlag(TRUE);
|
||||
}
|
||||
|
||||
/* 未进行充电时,3S采集一次开路电压 */
|
||||
if (FALSE == getChargControlFlag() && !collectOpenCircuitVoltageYesFlag) {
|
||||
if (2 <= collectOpenCircuitVoltageNUM) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
beginChargWork();
|
||||
collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
collectOpenCircuitVoltageNUM = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// /* 未进行充电时,3S采集一次开路电压 */
|
||||
// if (FALSE == getChargControlFlag()) {
|
||||
// if (2 <= collectOpenCircuitVoltageNoNUM++) {
|
||||
// setSolarOpenCircuitVoltage();
|
||||
// collectOpenCircuitVoltageNoNUM = 0;
|
||||
// }
|
||||
// collectOpenCircuitVoltageYesNUM = 0;
|
||||
// if (collectOpenCircuitVoltageYesFlag == TRUE) {
|
||||
// setSolarOpenCircuitVoltage();
|
||||
// beginChargWork();
|
||||
// collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// collectOpenCircuitVoltageYesNUM++;
|
||||
|
||||
// /* 到达开路电压检测时间 */
|
||||
// if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime) {
|
||||
// /* 有电池才进行开路电压检测 */
|
||||
// if (getBatteryState()) {
|
||||
// collectOpenCircuitVoltageYesFlag = TRUE;
|
||||
// stopChargWork();
|
||||
// /* 设置延时为(1000-500)ms */
|
||||
// m_collectOpenCircuitVoltage.count = 500;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /* 检测开路电压 */
|
||||
// if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) {
|
||||
// /* 有电池才进行开路电压检测 */
|
||||
// if (getBatteryState()) {
|
||||
// setSolarOpenCircuitVoltage();
|
||||
// beginChargWork();
|
||||
// collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
// }
|
||||
// collectOpenCircuitVoltageYesNUM = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
Loading…
Reference in New Issue