#include "TMS.h" void TMS_Init(void) { tmsd_flg_firstRun = true; } void TMS(void) { static uint16_T TminLowNr; static uint16_T TminOverNr; static uint16_T TmaxOverNr; //初始值 if (tmsd_flg_firstRun) { tmsd_st_heatAct = 0; TminLowNr = 0; TminOverNr = 0; TmaxOverNr = 0; } //================================温度判定 开关热管理状态=============================== if (tmsd_st_heatAct == 0) { 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; } } else { 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 || ihd_st_disChrgMosControl == 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) { tmsd_st_heatAct = 0; } */ //强制控制加热回路 if (ihd_st_heatForceControl == 1) { tmsd_st_heatAct = 1; } if (ihd_st_heatForceControl == 2) { tmsd_st_heatAct = 0; } tmsd_flg_firstRun = false; }