修改短路保护时间

This commit is contained in:
起床就犯困 2024-12-27 18:14:28 +08:00
parent 557fb2777e
commit c31fddb450
8 changed files with 79 additions and 19 deletions

View File

@ -5,6 +5,7 @@
#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)
{ {

View File

@ -112,7 +112,10 @@ void saveTime(timeInfo *time);
void readTime(timeInfo *time); void readTime(timeInfo *time);
#define eventsOrderRecordStartAddr 200 #define eventsOrderRecordStartAddr 200
void eventsOrderRecordStartInit(void);
void setEventsOrderRecord(eventsOrderRecordMode mode); void setEventsOrderRecord(eventsOrderRecordMode mode);
void printfEventsOrderRecord(void); void printfEventsOrderRecord(void);

View File

@ -8,7 +8,7 @@
#include "configParameter.h" #include "configParameter.h"
#include "capture.h" #include "capture.h"
static int checkMode = 0; //static int checkMode = 0;
/* 软件输出过载标志位 */ /* 软件输出过载标志位 */
static BOOL disChargOverLoad = FALSE; static BOOL disChargOverLoad = FALSE;
@ -43,8 +43,8 @@ void setDisChargOverLoad(void)
/* 过载时间过长关闭输出 */ /* 过载时间过长关闭输出 */
if (num1 >= thirdStageProtectionDelay) { if (num1 >= thirdStageProtectionDelay) {
num1 = 0; num1 = 0;
disChargOverLoad = TRUE;
setPowerOutput(FALSE); setPowerOutput(FALSE);
disChargOverLoad = TRUE;
} }
@ -59,8 +59,8 @@ void setDisChargOverLoad(void)
/* 过载时间过长关闭输出 */ /* 过载时间过长关闭输出 */
if (num1 >= secondStageProtectionDelay) { if (num1 >= secondStageProtectionDelay) {
num1 = 0; num1 = 0;
disChargOverLoad = TRUE;
setPowerOutput(FALSE); setPowerOutput(FALSE);
disChargOverLoad = TRUE;
} }
} }
@ -82,20 +82,46 @@ void setSoftShortCircuit(uint16_t disChargCurrAdcNum)
/* 三段式保护中的第一段 */ /* 三段式保护中的第一段 */
static int num = 0; static int num = 0;
if (disChargCurrAdcNum > firstStageProtectionCurr) { if (disChargCurrAdcNum > firstStageProtectionValue) {
num++; num++;
} else { } else {
num = 0; num = 0;
} }
/* 200uS内都短路则关闭输出 */ /* 20uS内都短路则关闭输出 */
if (num >= firstStageProtectionDelay) { if (num >= firstStageProtectionDelay) {
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
@ -327,6 +353,19 @@ void lowInputLoadDetection(void)
} }
/**
* @brief
* @param
* @retval
*
*/
void judgeChargCurr(void)
{
if (getChargCurrent() > maxChargCurr) {
stopChargWork();
}
}
void checkAbnormal(void) void checkAbnormal(void)
{ {
// checkTimeInit(); // checkTimeInit();
@ -342,9 +381,9 @@ void checkAbnormal(void)
/* 判断 */ /* 判断 */
checkFFMOS_CON(); checkFFMOS_CON();
setDisChargOverLoad(); setDisChargOverLoad();
// setSoftShortCircuit(); setSoftShortCircuit1();
lowInputLoadDetection(); lowInputLoadDetection();
judgeChargCurr();

View File

@ -292,6 +292,16 @@ void readTime(timeInfo *time)
} }
/**
* @brief
* @param
*/
void eventsOrderRecordStartInit(void)
{
}
/** /**
* @brief flash中 * @brief flash中
* @param * @param

View File

@ -446,6 +446,8 @@ 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];
@ -475,8 +477,6 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hdma)
DSG_CURR_capture.IODataF[3] = (float32_t)DSG_CURR_capture.totalInData / indata16_size; DSG_CURR_capture.IODataF[3] = (float32_t)DSG_CURR_capture.totalInData / indata16_size;
PV_VOLT_IN_capture.IODataF[3] = (float32_t)PV_VOLT_IN_capture.totalInData / indata16_size; PV_VOLT_IN_capture.IODataF[3] = (float32_t)PV_VOLT_IN_capture.totalInData / indata16_size;
CHG_CURR_capture.IODataF[3] = (float32_t)CHG_CURR_capture.totalInData / indata16_size; CHG_CURR_capture.IODataF[3] = (float32_t)CHG_CURR_capture.totalInData / indata16_size;
setSoftShortCircuit(DSG_CURR_capture.inData16[pointer - 1]);
} }
} }

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

@ -59,10 +59,12 @@ typedef enum {
/* 顺序事件记录 */ /* 顺序事件记录 */
typedef enum { typedef enum {
firstStageProtection = 1, //第一段保护,短路保护 firstStageProtection = 1, //第一段保护,短路保护
secondStageProtection = 2, //第二段保护,介于过载和短路之间 secondStageProtection , //第二段保护,介于过载和短路之间
thirdStageProtection = 3, //第三段保护,过载保护 thirdStageProtection, //第三段保护,过载保护
excessiveLoadIn = 4, //进入了电压降低中断 lowInputLoad, //输入功率不足保护
lowInputLoad = 5, //输入功率不足保护 overTemperature, //过温保护
stopTemperature, //停止温度保护
overchargCurr, //充电功率过大保护
}eventsOrderRecordMode; }eventsOrderRecordMode;

View File

@ -28,10 +28,13 @@
// const uint32_t lowInputLoadDetectionDelay = 30; // 120S // const uint32_t lowInputLoadDetectionDelay = 30; // 120S
/* 第一段保护的延时时间单位100uS */ // /* 第一段保护的延时时间单位100uS */
#define firstStageProtectionDelay 2 // 200uS /* 第一段保护的延时时间单位10uS */
/* 第一段保护的电流单位A */ #define firstStageProtectionDelay 2
// /* 第一段保护的电流单位A */
#define firstStageProtectionCurr 50.0f #define firstStageProtectionCurr 50.0f
/* 第一段保护的电流采集的ADC的值 */
#define firstStageProtectionValue 3412
/* 第二段保护的延时时间单位100uS */ /* 第二段保护的延时时间单位100uS */
#define secondStageProtectionDelay 50000 // 5S #define secondStageProtectionDelay 50000 // 5S
@ -51,6 +54,8 @@
/* 输入功率较低延时电流单位A */ /* 输入功率较低延时电流单位A */
#define lowInputLoadDetectionVolt 10.0f #define lowInputLoadDetectionVolt 10.0f
/* 最大充电电流A */
#define maxChargCurr 35.0f
#endif #endif