1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- /*
- * @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"
- 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;
- }
- FirstRun_TMS = false;
- }
|