SPM.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "SPM.h"
  2. void SPM_Init(void)
  3. {
  4. SOH_Init();
  5. BLC_Init();
  6. CDM_Init();
  7. SOC_Init();
  8. PIM_Init();
  9. SOE_Init();
  10. SOR_Init();
  11. SOP_Init();
  12. spmd_flg_firstRun = true;
  13. }
  14. void SPM(void)
  15. {
  16. static uint16_T spmn_num_cellNr;
  17. uint8_T Feq = 30;
  18. if (spmd_flg_firstRun)
  19. {
  20. spmn_num_cellNr = 0;
  21. cand_idx_cellNr = 1;
  22. }
  23. spmn_num_cellNr = spmn_num_cellNr + 1;
  24. if (spmn_num_cellNr % Feq == 0)
  25. {
  26. cand_idx_cellNr ++;
  27. }
  28. else if (spmn_num_cellNr > 60000)
  29. {
  30. spmn_num_cellNr = 0;
  31. }
  32. if (cand_idx_cellNr > cmnc_num_cellUNum)
  33. {
  34. cand_idx_cellNr = 1;
  35. }
  36. //调用SOX算法
  37. SOH();
  38. BLC();
  39. if (ihd_flg_urtRecFlg && sfmd_V_cellUMin != 0)
  40. {
  41. CDM();
  42. SOC();
  43. PIM();
  44. SOE();
  45. SOR();
  46. SOP();
  47. }
  48. // 循环发送数组
  49. cand_Q_cellCap = sohv_Q_cellCapArrEo[cand_idx_cellNr-1];
  50. cand_V_chrgStartStat = sohv_V_chrgStartStatEo[cand_idx_cellNr-1];
  51. cand_Q_blcReqCp = blcv_Q_reqCpEo[cand_idx_cellNr-1];
  52. cand_Q_blcTotalCp = blcv_Q_totalCpEo[cand_idx_cellNr-1];
  53. spmd_flg_firstRun = false;
  54. }