TMS.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "TMS.h"
  2. void TMS_Init(void)
  3. {
  4. tmsd_flg_firstRun = true;
  5. }
  6. void TMS(void)
  7. {
  8. static uint16_T TminLowNr;
  9. static uint16_T TminOverNr;
  10. static uint16_T TmaxOverNr;
  11. //初始值
  12. if (tmsd_flg_firstRun)
  13. {
  14. tmsd_st_heatAct = 0;
  15. TminLowNr = 0;
  16. TminOverNr = 0;
  17. TmaxOverNr = 0;
  18. }
  19. //================================温度判定 开关热管理状态===============================
  20. if (tmsd_st_heatAct == 0)
  21. {
  22. 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))
  23. {
  24. tmsd_st_heatAct = 1;
  25. }
  26. }
  27. else
  28. {
  29. 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)))
  30. {
  31. tmsd_st_heatAct = 0;
  32. }
  33. }
  34. //*/
  35. //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);
  36. /*/因故障关闭热管理
  37. if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
  38. {
  39. tmsd_st_heatAct = 0;
  40. }
  41. */
  42. //强制控制加热回路
  43. if (ihd_st_heatForceControl == 1)
  44. {
  45. tmsd_st_heatAct = 1;
  46. }
  47. if (ihd_st_heatForceControl == 2)
  48. {
  49. tmsd_st_heatAct = 0;
  50. }
  51. tmsd_flg_firstRun = false;
  52. }