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