123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "SOE.h"
- void SOE_Init(void)
- {
- soed_flg_firstRun = true;
- }
- //-------------------------------------------------------------------------
- void SOE(void)
- {
- uint32_T soen_V_battOcv;
- uint16_T i;
-
- // 满电能量
- if(soed_flg_firstRun)
- {
- soen_V_battOcv = 0;
- for(i = socc_pct_battSocUp ;i >= socc_pct_battSocLow + 1;i--)
- {
- soen_V_battOcv = soen_V_battOcv + look1_u16tu16(i, cmnm_pct_soc, cmnm_V_ocv, 13) * cmnc_num_cellUNum;
- }
- soed_E_fullEng = (uint16_T) ( (real_T)(soen_V_battOcv * 0.001) * (real_T)(cmnc_Q_ratedCp * 0.1) * (real_T)(sohd_pct_bcuSoh * 0.1 * 0.01)/1000);
- }
- //当前SOC的剩余能量
- if(socd_pct_battSoc > socc_pct_battSocLow)
- {
- soen_V_battOcv = 0;
- for(i = socd_pct_battSoc;i >= socc_pct_battSocLow + 1;i--)
- {
- soen_V_battOcv = soen_V_battOcv + look1_u16tu16(i, cmnm_pct_soc, cmnm_V_ocv, 13) * cmnc_num_cellUNum;
- }
- soed_E_nowEng = (uint16_T) ( (real_T)(soen_V_battOcv * 0.001) * (real_T)(cmnc_Q_ratedCp * 0.1) * (real_T)(sohd_pct_bcuSoh * 0.1 * 0.01) /1000);
- }
- else
- {
- soed_E_nowEng = 0;
- }
- soed_pct_nowStat = (uint16_T)((uint32_T)(soed_E_nowEng * 1000)/soed_E_fullEng);
- soed_flg_firstRun = false;
- }
|