Compare commits

..

No commits in common. "c31fddb450cdd65602a5a82dc9a9988ecc8a305a" and "0fcdfa75d38549970666d3c8492dd936cc2abf80" have entirely different histories.

13 changed files with 44 additions and 307 deletions

View File

@ -5,7 +5,6 @@
#include "task.h" #include "task.h"
#include "pDebug.h" #include "pDebug.h"
#include "parameter.h" #include "parameter.h"
#include "FM_TIM.h"
void startInfo(void) void startInfo(void)
{ {
@ -60,7 +59,7 @@ void start(void)
startInfo(); startInfo();
// HAL_Delay(5000); HAL_Delay(5000);
TimeSliceOffset_Start(); TimeSliceOffset_Start();
} }

View File

@ -20,8 +20,6 @@ uint8_t getExcessiveLoad(void);
void setExcessiveLoadFlag(BOOL state); void setExcessiveLoadFlag(BOOL state);
BOOL getExcessiveLoadFlag(void); BOOL getExcessiveLoadFlag(void);
void setSoftShortCircuit(uint16_t disChargCurrAdcNum);
void setPowerOutput(BOOL state); void setPowerOutput(BOOL state);
void checkAbnormal(void); void checkAbnormal(void);

View File

@ -111,15 +111,4 @@ void readtotalChargCapacity(float *totalChargCapacity);
void saveTime(timeInfo *time); void saveTime(timeInfo *time);
void readTime(timeInfo *time); void readTime(timeInfo *time);
#define eventsOrderRecordStartAddr 200
void eventsOrderRecordStartInit(void);
void setEventsOrderRecord(eventsOrderRecordMode mode);
void printfEventsOrderRecord(void);
#endif #endif

View File

@ -5,10 +5,8 @@
#include "checkTime.h" #include "checkTime.h"
#include "FM_GPIO.h" #include "FM_GPIO.h"
#include "task.h" #include "task.h"
#include "configParameter.h"
#include "capture.h"
//static int checkMode = 0;
/* 软件输出过载标志位 */ /* 软件输出过载标志位 */
static BOOL disChargOverLoad = FALSE; static BOOL disChargOverLoad = FALSE;
@ -20,7 +18,7 @@ static BOOL shortCircuitFlag = FALSE;
/* 硬件过载状态位 */ /* 硬件过载状态位 */
static uint8_t excessiveLoad = 0; static uint8_t excessiveLoad = 0;
static BOOL excessiveLoadFlag = FALSE; static BOOL excessiveLoadFlag = FALSE;
static BOOL excessiveLoadInterruptFlag = FALSE;
/** /**
* @brief * @brief
@ -30,9 +28,9 @@ static BOOL excessiveLoadInterruptFlag = FALSE;
*/ */
void setDisChargOverLoad(void) void setDisChargOverLoad(void)
{ {
/* 三段式保护中的第三段 */ /* 三段式保护中的段 */
static int num1 = 0; static int num1 = 0;
if (getDischargCurrent() > thirdStageProtectionCurr) { if (getDischargCurrent() > 30.0f) {
// disChargOverLoad = TRUE; // disChargOverLoad = TRUE;
num1++; num1++;
} else { } else {
@ -40,27 +38,25 @@ void setDisChargOverLoad(void)
num1 = 0; num1 = 0;
} }
/* 过载时间过长关闭输出 */ /* 过载时间过长关闭输出(120S) */
if (num1 >= thirdStageProtectionDelay) { if (num1 >= 1200000) {
num1 = 0; num1 = 0;
setPowerOutput(FALSE);
disChargOverLoad = TRUE; disChargOverLoad = TRUE;
setPowerOutput(FALSE);
} }
/* 三段式保护中的第二段 */
static int num2 = 0; static int num2 = 0;
if (getDischargCurrent() > secondStageProtectionCurr) { if (getDischargCurrent() > 35.0f) {
num2++; num2++;
} else { } else {
num2 = 0; num2 = 0;
} }
/* 过载时间过长关闭输出 */ /* 过载时间过长关闭输出(5S) */
if (num1 >= secondStageProtectionDelay) { if (num1 >= 50000) {
num1 = 0; num1 = 0;
setPowerOutput(FALSE);
disChargOverLoad = TRUE; disChargOverLoad = TRUE;
setPowerOutput(FALSE);
} }
} }
@ -70,58 +66,23 @@ void setDisChargOverLoad(void)
* @retval * @retval
* *
*/ */
void setSoftShortCircuit(uint16_t disChargCurrAdcNum) void setSoftShortCircuit(void)
{ {
// /* 三段式保护中的第一段 */
// static int num = 0;
// if (getDischargCurrent() > firstStageProtectionCurr) {
// num++;
// } else {
// num = 0;
// }
/* 三段式保护中的第一段 */
static int num = 0; static int num = 0;
if (disChargCurrAdcNum > firstStageProtectionValue) { if (getDischargCurrent() > 50.0f) {
num++; num++;
} else { } else {
num = 0; num = 0;
} }
/* 20uS内都短路则关闭输出 */ /* 200uS内都短路则关闭输出 */
if (num >= firstStageProtectionDelay) { if (num >= 2) {
setPowerOutput(FALSE);
shortCircuitFlag = TRUE; shortCircuitFlag = TRUE;
shortCircuit++; shortCircuit++;
setPowerOutput(FALSE);
startSoftShortCircuitProtection(); startSoftShortCircuitProtection();
} }
} }
void setSoftShortCircuit1(void)
{
// /* 三段式保护中的第一段 */
// static int num = 0;
// if (getDischargCurrent() > firstStageProtectionCurr) {
// num++;
// } else {
// num = 0;
// }
// /* 三段式保护中的第一段 */
// static int num = 0;
// if (getDischargCurrent() > firstStageProtectionCurr) {
// num++;
// } else {
// num = 0;
// }
// /* 200uS内都短路则关闭输出 */
// if (num >= firstStageProtectionDelay) {
// setPowerOutput(FALSE);
// shortCircuitFlag = TRUE;
// shortCircuit++;
// startSoftShortCircuitProtection();
// }
}
/** /**
* @brief * @brief
@ -308,63 +269,6 @@ void checkFFMOS_CON(void)
// } // }
/**
* @brief
* @param
* @retval
*
*/
void setOverLoad(void)
{
setPowerOutput(FALSE);
setExcessiveLoad();
/* 第一次进入输出过载,启动过载保护任务 */
if (getExcessiveLoad() == 1) {
setExcessiveLoadFlag(TRUE);
startExcessiveLoadProtection();
}
/* 多次进入输出过载,关闭输出 */
if (getExcessiveLoad() > 2) {
zeroExcessiveLoad();
}
}
/**
* @brief
* @param
* @retval
*
*/
void lowInputLoadDetection(void)
{
static int num = 0;
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < lowInputLoadDetectionVolt) {
num++;
} else {
num = 0;
excessiveLoadInterruptFlag = FALSE;
}
if (excessiveLoadInterruptFlag == TRUE && num == lowInputLoadDetectionDelay) {
setOverLoad();
}
}
/**
* @brief
* @param
* @retval
*
*/
void judgeChargCurr(void)
{
if (getChargCurrent() > maxChargCurr) {
stopChargWork();
}
}
void checkAbnormal(void) void checkAbnormal(void)
{ {
@ -381,9 +285,9 @@ void checkAbnormal(void)
/* 判断 */ /* 判断 */
checkFFMOS_CON(); checkFFMOS_CON();
setDisChargOverLoad(); setDisChargOverLoad();
setSoftShortCircuit1(); setSoftShortCircuit();
lowInputLoadDetection();
judgeChargCurr();
@ -398,19 +302,18 @@ void checkAbnormal(void)
*/ */
void WORK_VOLT_Interrupt(void) void WORK_VOLT_Interrupt(void)
{ {
// setPowerOutput(FALSE); setPowerOutput(FALSE);
// setExcessiveLoad(); setExcessiveLoad();
// /* 第一次进入输出过载,启动过载保护任务 */ /* 第一次进入输出过载,启动过载保护任务 */
// if (getExcessiveLoad() == 1) { if (getExcessiveLoad() == 1) {
// setExcessiveLoadFlag(TRUE); setExcessiveLoadFlag(TRUE);
// startExcessiveLoadProtection(); startExcessiveLoadProtection();
// } }
// /* 多次进入输出过载,关闭输出 */ /* 多次进入输出过载,关闭输出 */
// if (getExcessiveLoad() > 2) { if (getExcessiveLoad() > 2) {
// zeroExcessiveLoad(); zeroExcessiveLoad();
// } }
excessiveLoadInterruptFlag = TRUE;
} }
/** /**

View File

@ -557,10 +557,6 @@ void chargControlMode(void)
endChargWork(); endChargWork();
} }
else if (getBatteryState() == FALSE) {
setMPPT_Mode(noBattery);
}
else if (floatChargConditions()) { else if (floatChargConditions()) {
setMPPT_Mode(floatCharg); setMPPT_Mode(floatCharg);
} }

View File

@ -290,66 +290,3 @@ void readTime(timeInfo *time)
{ {
read_Flash((uint8_t *)time, time_SAVE_addr, sizeof(timeInfo)); read_Flash((uint8_t *)time, time_SAVE_addr, sizeof(timeInfo));
} }
/**
* @brief
* @param
*/
void eventsOrderRecordStartInit(void)
{
}
/**
* @brief flash中
* @param
*/
void setEventsOrderRecord(eventsOrderRecordMode mode)
{
static uint32_t len = sizeof(int);
float temp;
write_Flash((uint8_t *)&mode, eventsOrderRecordStartAddr + len, sizeof(mode));
len += sizeof(mode);
temp = getDischargCurrent();
write_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + len, sizeof(float));
len += sizeof(float);
temp = getOutputVoltage();
write_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + len, sizeof(float));
int count = 0;
read_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
count++;
write_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
}
/**
* @brief flash中依次读取出来
* @param
*/
void printfEventsOrderRecord(void)
{
int count = 0;
read_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
float temp;
eventsOrderRecordMode mode;
for (int i = 0; i < count; i++) {
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)), sizeof(mode));
log_info("eventsOrderRecordMode:%d\n", mode);
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)) + sizeof(mode), sizeof(float));
log_info("dischargCurrent:%f\n", temp);
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)) + sizeof(mode) + sizeof(float), sizeof(float));
log_info("OutputVoltage:%f\n", temp);
}
}

View File

@ -3,7 +3,6 @@
#include "FM_TIM.h" #include "FM_TIM.h"
#include "FM_GPIO.h" #include "FM_GPIO.h"
#include "capture.h" #include "capture.h"
#include "bl_chargControl.h"
config_parameter g_cfgParameter = {0}; config_parameter g_cfgParameter = {0};
static otherParameter g_otherParameter = {0}; static otherParameter g_otherParameter = {0};

View File

@ -10,7 +10,6 @@
#include "uart_dev.h" #include "uart_dev.h"
#include "abnormalManage.h" #include "abnormalManage.h"
#include "interruptSend.h" #include "interruptSend.h"
#include "configParameter.h"
#include <stdio.h> #include <stdio.h>
@ -274,7 +273,7 @@ void Task_refreshJudgeData(void)
/* 有电池太阳能输出功率大电池电压低于14V同时回路阻抗未测试或需要重新测试 */ /* 有电池太阳能输出功率大电池电压低于14V同时回路阻抗未测试或需要重新测试 */
if ((getCheckImpedanceState() == FALSE || g_cfgParameter.loopImpedance == 0.0f) if ((getCheckImpedanceState() == FALSE || g_cfgParameter.loopImpedance == 0.0f)
&& (getBatteryState() == TRUE) && (getChargCurrent() > checkLoopImpedanceChargCurr) && (getBatteryState() == TRUE) && (getChargCurrent() > 3.0f)
&& (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14) && (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14)
&& (getBatteryVoltage() < 14)) { && (getBatteryVoltage() < 14)) {
TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
@ -478,7 +477,7 @@ void Task_collectOpenCircuitVoltage(void)
if (getBatteryState()) { if (getBatteryState()) {
collectOpenCircuitVoltageYesFlag = TRUE; collectOpenCircuitVoltageYesFlag = TRUE;
stopChargWork(); stopChargWork();
/* 设置延时为1000-500ms */ /* 设置延时为1000-500ms */
m_collectOpenCircuitVoltage.count = 500; m_collectOpenCircuitVoltage.count = 500;
} }
collectOpenCircuitVoltageYesNUM = 0; collectOpenCircuitVoltageYesNUM = 0;
@ -486,13 +485,10 @@ void Task_collectOpenCircuitVoltage(void)
/* 检测开路电压 */ /* 检测开路电压 */
if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) { if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) {
/* 有电池才进行开路电压检测 */
if (getBatteryState()) {
setSolarOpenCircuitVoltage(); setSolarOpenCircuitVoltage();
beginChargWork(); beginChargWork();
collectOpenCircuitVoltageYesFlag = FALSE; collectOpenCircuitVoltageYesFlag = FALSE;
} }
}
} }
/** /**

View File

@ -34,6 +34,4 @@ float get_OUT_VOLT_IN(void);
void adcCaptureFir(); void adcCaptureFir();
extern void setSoftShortCircuit(uint16_t disChargCurrAdcNum);
#endif #endif

View File

@ -446,8 +446,6 @@ float get_OUT_VOLT_IN(void)
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hdma) void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hdma)
{ {
if (hdma->Instance == ADC1) { if (hdma->Instance == ADC1) {
setSoftShortCircuit(adcBuff[DSG_CURR_NUM]);
WORK_VOLT_capture.totalInData -= WORK_VOLT_capture.inData16[pointer]; WORK_VOLT_capture.totalInData -= WORK_VOLT_capture.inData16[pointer];
DSG_CURR_capture.totalInData -= DSG_CURR_capture.inData16[pointer]; DSG_CURR_capture.totalInData -= DSG_CURR_capture.inData16[pointer];
PV_VOLT_IN_capture.totalInData -= PV_VOLT_IN_capture.inData16[pointer]; PV_VOLT_IN_capture.totalInData -= PV_VOLT_IN_capture.inData16[pointer];

View File

@ -152,7 +152,7 @@ void SystemClock_Config(void)
*/ */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEState = RCC_HSE_ON;
// RCC_OscInitStruct.LSEState = RCC_LSE_ON; RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1; RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;

View File

@ -8,8 +8,7 @@ typedef enum _chargMode{
noWork = 0, /* 未进行充电 */ noWork = 0, /* 未进行充电 */
MPPT = 1, /* 最大功率充电 */ MPPT = 1, /* 最大功率充电 */
constantVoltage = 2, /* 恒压充电 */ constantVoltage = 2, /* 恒压充电 */
floatCharg = 3, /* 浮充充电 */ floatCharg = 3 /* 浮充充电 */
noBattery = 4, /* 无电池 */
}chargMode; }chargMode;
typedef enum { typedef enum {
@ -51,22 +50,8 @@ typedef struct _timeInfo {
/* 方式 */ /* 方式 */
typedef enum { typedef enum {
runLedChargMode = 1, //充电模式 runLedChargMode = 1,
runLedOtherMode = 2, //其他模式 runLedOtherMode = 2,
}runLedMode; }runLedMode;
/* 顺序事件记录 */
typedef enum {
firstStageProtection = 1, //第一段保护,短路保护
secondStageProtection , //第二段保护,介于过载和短路之间
thirdStageProtection, //第三段保护,过载保护
lowInputLoad, //输入功率不足保护
overTemperature, //过温保护
stopTemperature, //停止温度保护
overchargCurr, //充电功率过大保护
}eventsOrderRecordMode;
#endif #endif

View File

@ -1,61 +0,0 @@
#ifndef CONFIG_PARAMETER_
#define CONFIG_PARAMETER_
#include "comm_types.h"
// /* 第一段保护的延时时间单位100uS */
// const uint32_t firstStageProtectionDelay = 2; // 200uS
// /* 第一段保护的电流单位A */
// const float_t firstStageProtectionCurr = 50.0f;
// /* 第二段保护的延时时间单位100uS */
// const uint32_t secondStageProtectionDelay = 50000; // 5S
// /* 第二段保护的电流单位A */
// const float_t secondStageProtectionCurr = 30.0f;
// /* 第三段保护的延时时间单位100uS */
// const uint32_t thirdStageProtectionDelay = 1200000; // 120S
// /* 第三段保护的电流单位A */
// const uint32_t thirdStageProtectionCurr = 35.0f;
// /* 检测回路阻抗时的充电电流要大于该值单位A */
// const float_t checkLoopImpedanceChargCurr = 10.0f;
// /* 第三段保护的延时时间单位100uS */
// const uint32_t lowInputLoadDetectionDelay = 30; // 120S
// /* 第一段保护的延时时间单位100uS */
/* 第一段保护的延时时间单位10uS */
#define firstStageProtectionDelay 2
// /* 第一段保护的电流单位A */
#define firstStageProtectionCurr 50.0f
/* 第一段保护的电流采集的ADC的值 */
#define firstStageProtectionValue 3412
/* 第二段保护的延时时间单位100uS */
#define secondStageProtectionDelay 50000 // 5S
/* 第二段保护的电流单位A */
#define secondStageProtectionCurr 30.0f
/* 第三段保护的延时时间单位100uS */
#define thirdStageProtectionDelay 1200000 // 120S
/* 第三段保护的电流单位A */
#define thirdStageProtectionCurr 35.0f
/* 检测回路阻抗时的充电电流要大于该值单位A */
#define checkLoopImpedanceChargCurr 10.0f
/* 输入功率较低延时单位100uS */
#define lowInputLoadDetectionDelay 30 // 120S
/* 输入功率较低延时电流单位A */
#define lowInputLoadDetectionVolt 10.0f
/* 最大充电电流A */
#define maxChargCurr 35.0f
#endif