|
@@ -1,29 +1,19 @@
|
|
-/*
|
|
|
|
- * @Author : ChenJie
|
|
|
|
- * @Date : 2021-11-08 10:44:13
|
|
|
|
- * @Version : V3.0
|
|
|
|
- * @LastEditors : ChenJie
|
|
|
|
- * @LastEditTime : 2021-11-08 14:34:38
|
|
|
|
- * @Description : file content
|
|
|
|
- * @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\src\EmbeddedCoder_src\TMS.c
|
|
|
|
- */
|
|
|
|
|
|
|
|
#include "TMS.h"
|
|
#include "TMS.h"
|
|
|
|
|
|
-boolean_T FirstRun_TMS;
|
|
|
|
void TMS_Init(void)
|
|
void TMS_Init(void)
|
|
{
|
|
{
|
|
- FirstRun_TMS = true;
|
|
|
|
|
|
+ tmsd_flg_firstRun = true;
|
|
}
|
|
}
|
|
|
|
|
|
void TMS(void)
|
|
void TMS(void)
|
|
{
|
|
{
|
|
- static uint8_T TminLowNr;
|
|
|
|
- static uint8_T TminOverNr;
|
|
|
|
- static uint8_T TmaxOverNr;
|
|
|
|
|
|
+ static uint16_T TminLowNr;
|
|
|
|
+ static uint16_T TminOverNr;
|
|
|
|
+ static uint16_T TmaxOverNr;
|
|
|
|
|
|
//初始值
|
|
//初始值
|
|
- if (FirstRun_TMS)
|
|
|
|
|
|
+ if (tmsd_flg_firstRun)
|
|
{
|
|
{
|
|
tmsd_st_heatAct = 0;
|
|
tmsd_st_heatAct = 0;
|
|
TminLowNr = 0;
|
|
TminLowNr = 0;
|
|
@@ -31,49 +21,23 @@ void TMS(void)
|
|
TmaxOverNr = 0;
|
|
TmaxOverNr = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- //
|
|
|
|
- if (sfmd_T_modTMin < tmsc_T_openThr)
|
|
|
|
- {
|
|
|
|
- TminLowNr = (TminLowNr + 1) > 200 ? 200 : (TminLowNr + 1);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- TminLowNr = 0;
|
|
|
|
- }
|
|
|
|
- //
|
|
|
|
- if (sfmd_T_modTMin >= tmsc_T_closeMinThr)
|
|
|
|
- {
|
|
|
|
- TminOverNr = (TminOverNr + 1) > 200 ? 200 : (TminOverNr + 1);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- TminOverNr = 0;
|
|
|
|
- }
|
|
|
|
- //
|
|
|
|
- if (sfmd_T_modTMax >= tmsc_T_closeMaxThr)
|
|
|
|
- {
|
|
|
|
- TmaxOverNr = (TmaxOverNr + 1) > 200 ? 200 : (TmaxOverNr + 1);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- TmaxOverNr = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//================================温度判定 开关热管理状态===============================
|
|
//================================温度判定 开关热管理状态===============================
|
|
if (tmsd_st_heatAct == 0)
|
|
if (tmsd_st_heatAct == 0)
|
|
{
|
|
{
|
|
- if (TminLowNr >= 5 && ((socd_pct_battSoc > 100 && ihd_st_disChrgMosControl == 1) || ihd_st_chrgConnect == 1))
|
|
|
|
|
|
+ if (JudgeTimeSystem(1, sfmd_T_modTMin < tmsc_T_openThr, &TminLowNr,5) && ((socd_pct_battSoc > tmsc_pct_socOpen && ihd_st_disChrgMosControl == 1 && ihd_st_workStat !=0) || ihd_st_chrgConnect == 1))
|
|
{
|
|
{
|
|
tmsd_st_heatAct = 1;
|
|
tmsd_st_heatAct = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if (TmaxOverNr >= 5 || TminOverNr >= 5 || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < 50))
|
|
|
|
|
|
+ if (JudgeTimeSystem(1, sfmd_T_modTMin >= tmsc_T_closeMinThr, &TminOverNr,5) || JudgeTimeSystem(1, sfmd_T_modTMax >= tmsc_T_closeMaxThr, &TmaxOverNr,5) || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < tmsc_pct_socClos))
|
|
{
|
|
{
|
|
tmsd_st_heatAct = 0;
|
|
tmsd_st_heatAct = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //*/
|
|
|
|
+ //printf("tmsd_st_heatAct:%d,Tmin:%d,Tmax:%d,ihd_st_workStat:%d,SOC:%d\n\n",tmsd_st_heatAct,sfmd_T_modTMin,sfmd_T_modTMax,ihd_st_workStat,socd_pct_battSoc);
|
|
|
|
|
|
/*/因故障关闭热管理
|
|
/*/因故障关闭热管理
|
|
if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
|
|
if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
|
|
@@ -92,5 +56,5 @@ void TMS(void)
|
|
tmsd_st_heatAct = 0;
|
|
tmsd_st_heatAct = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- FirstRun_TMS = false;
|
|
|
|
|
|
+ tmsd_flg_firstRun = false;
|
|
}
|
|
}
|