BBox_Bcu.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #include <BBox_Bcu.h>
  2. static process_Rte gProcess_Rte_Task;
  3. #define PROC_RTE_STATE_SWITCH(a) (gProcess_Rte_Task = a)
  4. //=========================================================================
  5. //=========================================================================
  6. //=========================================================================
  7. void BBox_BCU_Task(void *pvParameters)
  8. {
  9. uint16_T i;
  10. uint16_T RecvCounter = 0;
  11. static boolean_T Flg;
  12. //鍚姩寤惰繜娌″仛
  13. PROC_RTE_STATE_SWITCH(PROCESS_STATE_INIT);
  14. while (TRUE)
  15. {
  16. switch (gProcess_Rte_Task)
  17. {
  18. //=========================鍒濆鍖�===============================
  19. case PROCESS_STATE_INIT:
  20. {
  21. BCU_initialize();
  22. BCUEEDataRead();
  23. PROC_RTE_STATE_SWITCH(PROCESS_STATE_WORK);
  24. break;
  25. }
  26. //============================宸ヤ綔妯″紡==========================
  27. case PROCESS_STATE_WORK:
  28. {
  29. if (TimerCounter % 100 == 0)
  30. {
  31. IH_Data_Update();
  32. /*
  33. bswv_V_cellU = 0;
  34. bswv_T_modT = 0;
  35. bswd_tm_month = 0;
  36. bswd_tm_day = 0;
  37. bswd_tm_hour = 0;
  38. bswd_tm_min = 0;
  39. bswd_tm_sec = 0;
  40. bswd_tm_year = 0;
  41. hvmd_st_operMod_T1 = 0;
  42. dcmd_st_chrgMod_T1 = 0;
  43. dcmd_st_chrgSts_T1 = 0;
  44. ihd_I_battCurr_T1 = 0;
  45. ihd_V_battU_T1 = 0;
  46. */
  47. // Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
  48. // BCU_step();
  49. //
  50. if (socd_flg_EEsave == 1)
  51. {
  52. BCUEEDataSave();
  53. }
  54. // Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_ON);
  55. OH_Data_Update();
  56. }
  57. vTaskDelay(pdMS_TO_TICKS(10));
  58. break;
  59. }
  60. default:
  61. {
  62. PROC_RTE_STATE_SWITCH(PROCESS_STATE_INIT);
  63. break;
  64. }
  65. }
  66. }
  67. }
  68. //=========================鏁版嵁瀛樺偍========================================
  69. void BCUEEDataRead(void)
  70. {
  71. memset(rtev_flg_EESt, 0, sizeof(rtev_flg_EESt));
  72. //时间
  73. ihd_tm_yearEi = BcuAppSaveDataInfo.ihd_tm_yearE;
  74. ihd_tm_monthEi = BcuAppSaveDataInfo.ihd_tm_monthE;
  75. ihd_tm_dayEi = BcuAppSaveDataInfo.ihd_tm_dayE;
  76. ihd_tm_hourEi = BcuAppSaveDataInfo.ihd_tm_hourE;
  77. ihd_tm_minEi = BcuAppSaveDataInfo.ihd_tm_minE;
  78. ihd_tm_secEi = BcuAppSaveDataInfo.ihd_tm_secE;
  79. //SOC
  80. socd_pct_bcuSocEi = BcuAppSaveDataInfo.socd_pct_bcuSocE;
  81. socd_pct_battSocEi = BcuAppSaveDataInfo.socd_pct_battSocE;
  82. /*/SOH
  83. sohd_flg_countEi = BcuAppSaveDataInfo.sohd_flg_countE;
  84. sohd_Q_chrgEi = BcuAppSaveDataInfo.sohd_Q_chrgE;
  85. memcpy(sohv_Q_cellCapEi, BcuAppSaveDataInfo.sohv_Q_cellCapE, sizeof(sohv_Q_cellCapEi));
  86. memcpy(sohv_V_cellUEi, BcuAppSaveDataInfo.sohv_V_cellUE, sizeof(sohv_V_cellUEi));
  87. memcpy(sohv_Q_packCapEi, BcuAppSaveDataInfo.sohv_Q_packCapE, sizeof(sohv_Q_packCapEi));
  88. //SOR
  89. memcpy(sorv_ohm_cellREi, BcuAppSaveDataInfo.sorv_ohm_cellRE, sizeof(sorv_ohm_cellREi));
  90. //BLC
  91. memcpy(blcv_Q_totalCpEi, BcuAppSaveDataInfo.blcv_Q_totalCpE, sizeof(blcv_Q_totalCpEi));
  92. memcpy(blcv_Q_reqCpEi, BcuAppSaveDataInfo.blcv_Q_reqCpE, sizeof(blcv_Q_reqCpEi));
  93. //ISC
  94. iscd_tm_chrgEi = BcuAppSaveDataInfo.iscd_tm_chrgE;
  95. iscd_tm_staticEi = BcuAppSaveDataInfo.iscd_tm_staticE;
  96. memcpy(iscv_ohm_chrgEi, BcuAppSaveDataInfo.iscv_ohm_chrgE, sizeof(iscv_ohm_chrgEi));
  97. memcpy(iscv_ohm_staticEi, BcuAppSaveDataInfo.iscv_ohm_staticE, sizeof(iscv_ohm_staticEi));
  98. memcpy(iscv_Q_chrgEi, BcuAppSaveDataInfo.iscv_Q_chrgE, sizeof(iscv_Q_chrgEi));
  99. memcpy(iscv_Q_staticEi, BcuAppSaveDataInfo.iscv_Q_staticE, sizeof(iscv_Q_staticEi));
  100. *///DAM
  101. damd_Q_totalChrgCpEi = BcuAppSaveDataInfo.damd_Q_totalChrgCpE;
  102. damd_E_totalChrgEngEi = BcuAppSaveDataInfo.damd_E_totalChrgEngE;
  103. damd_Q_totalRegenCpEi = BcuAppSaveDataInfo.damd_Q_totalRegenCpE;
  104. damd_E_totalRegenEngEi = BcuAppSaveDataInfo.damd_E_totalRegenEngE;
  105. damd_Q_totalDisChrgCpEi = BcuAppSaveDataInfo.damd_Q_totalDisChrgCpE;
  106. damd_E_totalDisChrgEngEi = BcuAppSaveDataInfo.damd_E_totalDisChrgEngE;
  107. }
  108. void BCUEEDataSave(void)
  109. {
  110. BcuAppSaveDataInfo.bcuSaveFlg = TRUE;
  111. //
  112. BcuAppSaveDataInfo.ihd_tm_yearE = ihd_tm_yearEo;
  113. BcuAppSaveDataInfo.ihd_tm_monthE = ihd_tm_monthEo;
  114. BcuAppSaveDataInfo.ihd_tm_dayE = ihd_tm_dayEo;
  115. BcuAppSaveDataInfo.ihd_tm_hourE = ihd_tm_hourEo;
  116. BcuAppSaveDataInfo.ihd_tm_minE = ihd_tm_minEo;
  117. BcuAppSaveDataInfo.ihd_tm_secE = ihd_tm_secEo;
  118. //SOC
  119. BcuAppSaveDataInfo.socd_pct_bcuSocE = socd_pct_bcuSocEo;
  120. BcuAppSaveDataInfo.socd_pct_battSocE = socd_pct_battSocEo;
  121. /*/SOH
  122. BcuAppSaveDataInfo.sohd_flg_countE = sohd_flg_countEo;
  123. BcuAppSaveDataInfo.sohd_Q_chrgE = sohd_Q_chrgEo;
  124. memcpy(BcuAppSaveDataInfo.sohv_Q_cellCapE, sohv_Q_cellCapEo,sizeof(sohv_Q_cellCapEo));
  125. memcpy(BcuAppSaveDataInfo.sohv_V_cellUE,sohv_V_cellUEo, sizeof(sohv_V_cellUEo));
  126. memcpy(BcuAppSaveDataInfo.sohv_Q_packCapE,sohv_Q_packCapEo, sizeof(sohv_Q_packCapEo));
  127. //SOR
  128. memcpy(BcuAppSaveDataInfo.sorv_ohm_cellRE,sorv_ohm_cellREo, sizeof(sorv_ohm_cellREo));
  129. //BLC
  130. memcpy(BcuAppSaveDataInfo.blcv_Q_totalCpE, blcv_Q_totalCpEo,sizeof(blcv_Q_totalCpEo));
  131. memcpy(BcuAppSaveDataInfo.blcv_Q_reqCpE, blcv_Q_reqCpEo,sizeof(blcv_Q_reqCpEo));
  132. //ISC
  133. BcuAppSaveDataInfo.iscd_tm_chrgE = iscd_tm_chrgEo;
  134. BcuAppSaveDataInfo.iscd_tm_staticE = iscd_tm_staticEo;
  135. memcpy(BcuAppSaveDataInfo.iscv_ohm_chrgE, iscv_ohm_chrgEo,sizeof(iscv_ohm_chrgEo));
  136. memcpy(BcuAppSaveDataInfo.iscv_ohm_staticE, iscv_ohm_staticEo,sizeof(iscv_ohm_staticEo));
  137. memcpy(BcuAppSaveDataInfo.iscv_Q_chrgE, iscv_Q_chrgEo,sizeof(iscv_Q_chrgEo));
  138. memcpy(BcuAppSaveDataInfo.iscv_Q_staticE, iscv_Q_staticEo,sizeof(iscv_Q_staticEo));
  139. *///DAM
  140. BcuAppSaveDataInfo.damd_Q_totalChrgCpE = damd_Q_totalChrgCpEo;
  141. BcuAppSaveDataInfo.damd_E_totalChrgEngE = damd_E_totalChrgEngEo;
  142. BcuAppSaveDataInfo.damd_Q_totalRegenCpE = damd_Q_totalRegenCpEo;
  143. BcuAppSaveDataInfo.damd_E_totalRegenEngE = damd_E_totalRegenEngEo;
  144. BcuAppSaveDataInfo.damd_Q_totalDisChrgCpE = damd_Q_totalDisChrgCpEo;
  145. BcuAppSaveDataInfo.damd_E_totalDisChrgEngE = damd_E_totalDisChrgEngEo;
  146. }