123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #include "TMS.h"
- boolean_T FirstRun_TMS;
- void TMS_Init(void)
- {
- FirstRun_TMS = true;
- }
- void TMS(void)
- {
- static uint8_T TminLowNr;
- static uint8_T TminOverNr;
- static uint8_T TmaxOverNr;
-
- //初始值
- if (FirstRun_TMS)
- {
- tmsd_st_heatAct = 0;
- TminLowNr = 0;
- TminOverNr = 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 (TminLowNr >= 5 && ((socd_pct_battSoc > 100 && ihd_st_disChrgMosControl == 1) || ihd_st_chrgConnect == 1))
- {
- tmsd_st_heatAct = 1;
- }
- }
- else
- {
- if (TmaxOverNr >= 5 || TminOverNr >= 5 || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < 50))
- {
- tmsd_st_heatAct = 0;
- }
- }
-
- //因故障关闭热管理
- 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;
- }
- printf("tmsd_st_heatAct:%d\n",tmsd_st_heatAct);
-
- FirstRun_TMS = false;
- }
|