SFM.c 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. #include "SFM.h"
  2. #define FltArrLen 200
  3. #define FltDispArrLen 20
  4. DiagThrstruct DiagThr;
  5. DiagTimestruct DiagTime;
  6. void SFM_Init(void)
  7. {
  8. sfmd_flg_firstRun = true;
  9. }
  10. void SFM(void)
  11. {
  12. static uint8_T sfmn_num_Cnt;
  13. boolean_T sfmn_flg_interComFlt;
  14. boolean_T sfmn_flg_authFlt;
  15. boolean_T sfmn_flg_HVILFlt;
  16. boolean_T sfmn_flg_chrgMosClosFlt;
  17. boolean_T sfmn_flg_disChrgMosClosFlt;
  18. static uint16_T Time0Cnt;
  19. static uint16_T modTMaxArr[10];
  20. static uint16_T SumT0;
  21. static uint16_T Time1Cnt;
  22. static uint16_T heatT1Arr[10];
  23. static uint16_T SumT1;
  24. static uint16_T Time2Cnt;
  25. static uint16_T heatT2Arr[10];
  26. static uint16_T SumT2;
  27. static uint16_T CellUArry[4][cmnc_num_cellUNumMax];
  28. static uint8_T ErrNr[cmnc_num_cellUNumMax];
  29. static uint8_T RecNr[cmnc_num_cellUNumMax];
  30. static boolean_T sfmv_flg_cellUOpenFlt[cmnc_num_cellUNumMax];
  31. static boolean_T ErrUFlg[cmnc_num_cellUNumMax];
  32. uint32_T SumU;
  33. uint16_T UNum;
  34. boolean_T sfmd_flg_volFlt;
  35. boolean_T Enable1;
  36. boolean_T Enable2;
  37. static uint8_T modTOpenNr[cmnc_num_modTNumMax];
  38. boolean_T sfmd_flg_modTOpenFlt;
  39. boolean_T sfmv_flg_modTOpenFlt[cmnc_num_modTNumMax];
  40. boolean_T sfmd_flg_chrgMosTOpenFlt;
  41. boolean_T sfmd_flg_DCPlugTOpenFlt;
  42. boolean_T sfmd_flg_ACPlugTOpenFlt;
  43. boolean_T sfmd_flg_heatPanT1OpenFlt;
  44. boolean_T sfmd_flg_heatPanT2OpenFlt;
  45. static uint16_T modTArr[cmnc_num_modTNumMax];
  46. uint16_T Tnum;
  47. uint32_T SumT;
  48. static uint8_T modTRatNr[cmnc_num_modTNumMax];
  49. boolean_T sfmd_flg_modTRatFlt;
  50. boolean_T sfmv_flg_modTRatFlt[cmnc_num_modTNumMax];
  51. boolean_T sfmd_flg_chrgMosTRatFlt;
  52. boolean_T sfmd_flg_DCPlugTRatFlt;
  53. boolean_T sfmd_flg_ACPlugTRatFlt;
  54. boolean_T sfmd_flg_heatPanT1RatFlt;
  55. boolean_T sfmd_flg_heatPanT2RatFlt;
  56. boolean_T sfmn_flg_chrgMosTRatFltOnce;
  57. boolean_T sfmn_flg_DCPlugTRatFltOnce;
  58. boolean_T sfmn_flg_ACPlugTRatFltOnce;
  59. boolean_T sfmn_flg_heatPanT1RatFltOnce;
  60. boolean_T sfmn_flg_heatPanT2RatFltOnce;
  61. static uint16_T sfmn_T_mosT_Delay;
  62. static uint16_T sfmn_T_DCPlugT_Delay;
  63. static uint16_T sfmn_T_ACPlugT_Delay;
  64. static uint16_T sfmn_T_heatPanT1_Delay;
  65. static uint16_T sfmn_T_heatPanT2_Delay;
  66. static uint16_T sfmn_T_heatPanT1_Delay1;
  67. static uint16_T sfmn_T_heatPanT2_Delay1;
  68. boolean_T sfmd_flg_modTAllFlt;
  69. boolean_T sfmd_flg_heatPanTAllFlt;
  70. boolean_T sfmd_flg_currOpenFlt;
  71. uint16_T sfmn_I_currAbs;
  72. static boolean_T sfmd_flg_cellUOverFlt2;
  73. static boolean_T sfmd_flg_cellUOverFlt1;
  74. static boolean_T sfmd_flg_cellULowFlt2;
  75. static boolean_T sfmd_flg_cellULowFlt1;
  76. static boolean_T sfmd_flg_cellUDiffFlt2;
  77. static boolean_T sfmd_flg_cellUDiffFlt1;
  78. static boolean_T sfmd_flg_battUOverFlt2;
  79. static boolean_T sfmd_flg_battUOverFlt1;
  80. static boolean_T sfmd_flg_battULowFlt2;
  81. static boolean_T sfmd_flg_battULowFlt1;
  82. boolean_T chrgFlg;
  83. boolean_T disChrgFlg;
  84. static boolean_T sfmd_flg_chrgModTOverFlt2;
  85. static boolean_T sfmd_flg_chrgModTOverFlt1;
  86. static boolean_T sfmd_flg_chrgModTLowFlt2;
  87. static boolean_T sfmd_flg_chrgModTLowFlt1;
  88. static boolean_T sfmd_flg_disChrgModTOverFlt2;
  89. static boolean_T sfmd_flg_disChrgModTOverFlt1;
  90. static boolean_T sfmd_flg_disChrgModTLowFlt2;
  91. static boolean_T sfmd_flg_disChrgModTLowFlt1;
  92. static boolean_T sfmd_flg_modTDiffFlt2;
  93. static boolean_T sfmd_flg_modTDiffFlt1;
  94. static boolean_T sfmd_flg_chrgMosTOverFlt2;
  95. static boolean_T sfmd_flg_chrgMosTOverFlt1;
  96. static boolean_T sfmd_flg_disChrgMosTOverFlt2;
  97. static boolean_T sfmd_flg_disChrgMosTOverFlt1;
  98. static boolean_T sfmd_flg_DCPlugTOverFlt2;
  99. static boolean_T sfmd_flg_DCPlugTOverFlt1;
  100. static boolean_T sfmd_flg_ACPlugTOverFlt2;
  101. static boolean_T sfmd_flg_ACPlugTOverFlt1;
  102. static boolean_T sfmd_flg_heatPanTOverFlt2_1;
  103. static boolean_T sfmd_flg_heatPanTOverFlt2_2;
  104. boolean_T sfmd_flg_heatPanTOverFlt2;
  105. static boolean_T sfmd_flg_heatPanTOverFlt1_1;
  106. static boolean_T sfmd_flg_heatPanTOverFlt1_2;
  107. boolean_T sfmd_flg_heatPanTOverFlt1;
  108. static boolean_T sfmd_flg_chrgCurrOverFlt;
  109. static boolean_T sfmd_flg_disChrgCurrOverFlt;
  110. boolean_T sfmd_flg_chrgCurrOverMisFlt;
  111. boolean_T sfmd_flg_disChrgCurrOverMisFlt;
  112. boolean_T sfmd_flg_battULowMisFlt;
  113. boolean_T sfmd_flg_battUOverMisFlt;
  114. boolean_T sfmd_flg_cellULowMisFlt;
  115. boolean_T sfmd_flg_cellUOverMisFlt;
  116. boolean_T sfmd_flg_chrgModTOverMisFlt;
  117. boolean_T sfmd_flg_chrgModTLowMisFlt;
  118. boolean_T sfmd_flg_disChrgModTOverMisFlt;
  119. boolean_T sfmd_flg_disChrgModTLowMisFlt;
  120. boolean_T sfmd_flg_chrgMosTOverMisFlt;
  121. boolean_T sfmd_flg_disChrgMosTOverMisFlt;
  122. boolean_T sfmd_flg_socMisFlt;
  123. boolean_T sfmd_flg_sohMisFlt;
  124. boolean_T sfmd_flg_socJumpFlt;
  125. boolean_T sfmd_flg_EEsaveFlt;
  126. static uint16_T sfmn_pct_bcuSoc_Delay;
  127. static uint16_T noDisChrgCnt;
  128. static int16_T sfmd_I_curr_Delay;
  129. static boolean_T sfmn_flg_Udrop;
  130. static boolean_T sfmd_flg_heatclear;
  131. static boolean_T sfmn_flg_volFlt_keep;
  132. static uint16_T CntA;
  133. static uint16_T ModTStor[4][cmnc_num_modTNumMax];
  134. static boolean_T sfmn_flg_Tup;
  135. static boolean_T sfmn_flg_modTOpenFlt_keep;
  136. static uint16_T CntB;
  137. static boolean_T sfmn_flg_urtRecFlt_Delay = false;
  138. int32_T SumR;
  139. int32_T SumRR;
  140. boolean_T sfmd_flg_deltRFlt;
  141. static uint8_T deltRFltNr[cmnc_num_cellUNumMax];
  142. boolean_T FltFlg[FltArrLen];
  143. uint16_T FltLevel[FltArrLen];
  144. uint8_T FltAct[FltArrLen];
  145. uint16_T FltCodeArr[FltDispArrLen];
  146. uint16_T FltLevelArr[FltDispArrLen];
  147. uint8_T FltActArr[FltDispArrLen];
  148. uint16_T i;
  149. uint16_T j;
  150. uint16_T k;
  151. if (sfmn_flg_urtRecFlt_Delay)
  152. {
  153. sfmd_flg_firstRun = true;
  154. }
  155. sfmn_flg_urtRecFlt_Delay = ihd_flg_urtRecFlt;
  156. //初值
  157. if (sfmd_flg_firstRun)
  158. {
  159. sfmn_num_Cnt = 10;
  160. memset(&DiagThr, 0, sizeof(DiagThr));
  161. memset(&DiagTime, 0, sizeof(DiagTime));
  162. memset(heatT1Arr, 0, sizeof(heatT1Arr));
  163. memset(heatT2Arr, 0, sizeof(heatT2Arr));
  164. memset(ErrNr, 0, sizeof(ErrNr));
  165. memset(sfmv_flg_cellUOpenFlt, 0, sizeof(sfmv_flg_cellUOpenFlt));
  166. memset(ErrUFlg, 0, sizeof(ErrUFlg));
  167. memset(RecNr, 0, sizeof(RecNr));
  168. memset(modTOpenNr, 0, sizeof(modTOpenNr));
  169. memset(modTRatNr, 0, sizeof(modTRatNr));
  170. memset(deltRFltNr, 0, sizeof(deltRFltNr));
  171. sfmd_flg_cellUOverFlt2 = false;
  172. sfmd_flg_cellUOverFlt1 = false;
  173. sfmd_flg_cellULowFlt2 = false;
  174. sfmd_flg_cellULowFlt1 = false;
  175. sfmd_flg_cellUDiffFlt2 = false;
  176. sfmd_flg_cellUDiffFlt1 = false;
  177. sfmd_flg_battUOverFlt2 = false;
  178. sfmd_flg_battUOverFlt1 = false;
  179. sfmd_flg_battULowFlt2 = false;
  180. sfmd_flg_battULowFlt1 = false;
  181. sfmd_flg_chrgModTOverFlt2 = false;
  182. sfmd_flg_chrgModTOverFlt1 = false;
  183. sfmd_flg_chrgModTLowFlt2 = false;
  184. sfmd_flg_chrgModTLowFlt1 = false;
  185. sfmd_flg_disChrgModTOverFlt2 = false;
  186. sfmd_flg_disChrgModTOverFlt1 = false;
  187. sfmd_flg_disChrgModTLowFlt2 = false;
  188. sfmd_flg_disChrgModTLowFlt1 = false;
  189. sfmd_flg_modTDiffFlt2 = false;
  190. sfmd_flg_modTDiffFlt1 = false;
  191. sfmd_flg_chrgMosTOverFlt2 = false;
  192. sfmd_flg_chrgMosTOverFlt1 = false;
  193. sfmd_flg_disChrgMosTOverFlt2 = false;
  194. sfmd_flg_disChrgMosTOverFlt1 = false;
  195. sfmd_flg_DCPlugTOverFlt2 = false;
  196. sfmd_flg_DCPlugTOverFlt1 = false;
  197. sfmd_flg_ACPlugTOverFlt2 = false;
  198. sfmd_flg_ACPlugTOverFlt1 = false;
  199. sfmd_flg_heatPanTOverFlt2_1 = false;
  200. sfmd_flg_heatPanTOverFlt2_2 = false;
  201. sfmd_flg_heatPanTOverFlt1_1 = false;
  202. sfmd_flg_heatPanTOverFlt1_2 = false;
  203. sfmd_flg_chrgCurrOverFlt = false;
  204. sfmd_flg_disChrgCurrOverFlt = false;
  205. noDisChrgCnt = 0;
  206. sfmd_I_curr_Delay = ihd_I_curr;
  207. sfmn_flg_Udrop = false;
  208. sfmd_flg_heatclear = false;
  209. sfmn_flg_volFlt_keep = false;
  210. CntA = 10;
  211. sfmn_flg_Tup = false;
  212. sfmn_flg_modTOpenFlt_keep = false;
  213. CntB = 0;
  214. sfmn_T_mosT_Delay = ihd_T_mosT;
  215. sfmn_T_DCPlugT_Delay = ihd_T_DCPlugT;
  216. sfmn_T_ACPlugT_Delay = ihd_T_ACPlugT;
  217. sfmn_T_heatPanT1_Delay = ihd_T_heatPanT1;
  218. sfmn_T_heatPanT2_Delay = ihd_T_heatPanT2;
  219. sfmn_T_heatPanT1_Delay1 = ihd_T_heatPanT1;
  220. sfmn_T_heatPanT2_Delay1 = ihd_T_heatPanT2;
  221. sfmn_pct_bcuSoc_Delay = socd_pct_bcuSoc;
  222. }
  223. // 故障清楚指令
  224. if (ihd_flg_DTCClear)
  225. {
  226. sfmd_flg_mainCirClosFltEi = false;
  227. sfmd_flg_mainCirClosFltEo = false;
  228. sfmd_flg_heatCirOpenFltEi = false;
  229. sfmd_flg_heatCirOpenFltEo = false;
  230. sfmd_flg_heatCirClosFltEi = false;
  231. sfmd_flg_heatCirClosFltEo = false;
  232. sfmd_flg_heatRunFltEi = false;
  233. sfmd_flg_heatRunFltEo = false;
  234. sfmd_flg_iscFltEi = false;
  235. sfmd_flg_iscFltEo = false;
  236. }
  237. //=======================================================================================
  238. //====================================故障诊断 =======================================
  239. //=======================================================================================
  240. //=======================================================================================
  241. // 1 内网通信故障
  242. if (ihd_flg_urtRecFlt)
  243. {
  244. sfmn_flg_interComFlt = true;
  245. }
  246. else
  247. {
  248. sfmn_flg_interComFlt = false;
  249. }
  250. // 5 认证失败故障
  251. sfmn_flg_authFlt = (ihd_st_authFaild == 1) && (!sfmn_flg_interComFlt);
  252. // 11 高压互锁故障
  253. if (ihd_flg_HVILFlt)
  254. {
  255. sfmn_flg_HVILFlt = true;
  256. }
  257. else
  258. {
  259. sfmn_flg_HVILFlt = false;
  260. }
  261. // 16
  262. sfmd_flg_iscFltEo = iscd_flg_flt[0] || iscd_flg_flt[1] || iscd_flg_flt[2] || sfmd_flg_iscFltEi || sfmd_flg_iscFltEo;
  263. // 22 充电Mos失效故障
  264. sfmn_flg_chrgMosClosFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_flg_chrgMosClosFlt, &DiagTime.N22, 2);
  265. // 24 放电Mos失效故障
  266. sfmn_flg_disChrgMosClosFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_flg_disChrgMosClosFlt, &DiagTime.N24, 2);
  267. // 34 主回路常闭故障 //(充电MOS及放电MOS,主继电器断开 使能)
  268. sfmd_flg_mainCirClosFltEo = JudgeTimeSystem(!ihd_st_chrgMosControl && !ihd_st_disChrgMosControl && !ihd_st_relayControl, sfmd_I_curr > 5 || sfmd_I_curr < -5, &DiagTime.N34, 5) || sfmd_flg_mainCirClosFltEo || sfmd_flg_mainCirClosFltEi;
  269. // 52 电压开路故障
  270. sfmn_num_Cnt = sfmn_num_Cnt + 1;
  271. if (!sfmn_flg_interComFlt && sfmn_num_Cnt >= 0)
  272. {
  273. sfmn_num_Cnt = 0;
  274. // 矩阵更新
  275. for (j = 0; j < 4 && sfmd_flg_firstRun; j++)
  276. {
  277. for (i = 0; i < cmnc_num_cellUNum; i++)
  278. {
  279. CellUArry[j][i] = ihv_V_cellU[i];
  280. }
  281. }
  282. for (j = 0; j < 3; j++)
  283. {
  284. for (i = 0; i < cmnc_num_cellUNum; i++)
  285. {
  286. CellUArry[j][i] = CellUArry[j + 1][i];
  287. }
  288. }
  289. for (i = 0; i < cmnc_num_cellUNum; i++)
  290. {
  291. CellUArry[j][i] = ihv_V_cellU[i];
  292. }
  293. // 故障判断
  294. for (i = 0; i < cmnc_num_cellUNum - 1; i++)
  295. {
  296. if ((int16_T)(CellUArry[3][i] - CellUArry[1][i]) < -50 && (int16_T)(CellUArry[3][i + 1] - CellUArry[1][i + 1]) > 50)
  297. {
  298. ErrNr[i] = ErrNr[i] + 1;
  299. }
  300. else
  301. {
  302. ErrNr[i] = 0;
  303. }
  304. if (ErrNr[i] >= 2 || ((int16_T)(CellUArry[3][i] - CellUArry[2][i]) < -1000 && (int16_T)(CellUArry[3][i + 1] - CellUArry[2][i + 1]) > 1000))
  305. {
  306. sfmv_flg_cellUOpenFlt[i] = true;
  307. ErrUFlg[i] = true;
  308. ErrUFlg[i + 1] = true;
  309. }
  310. if (sfmv_flg_cellUOpenFlt[i])
  311. {
  312. for (k = 0; k < i; k++)
  313. {
  314. if ((int16_T)(CellUArry[3][i - k] - CellUArry[2][i - k]) < -200)
  315. {
  316. sfmv_flg_cellUOpenFlt[i - k] = true;
  317. ErrUFlg[i - k] = true;
  318. }
  319. }
  320. }
  321. }
  322. }
  323. //
  324. if (!sfmn_flg_interComFlt)
  325. {
  326. sfmd_V_cellUMax = 0;
  327. sfmd_V_cellUMin = 10000;
  328. SumU = 0;
  329. UNum = 0;
  330. for (i = 0; i < cmnc_num_cellUNum; i++)
  331. {
  332. if (!ErrUFlg[i])
  333. {
  334. SumU = SumU + ihv_V_cellU[i];
  335. UNum = UNum + 1;
  336. if (sfmd_V_cellUMax < ihv_V_cellU[i])
  337. {
  338. sfmd_V_cellUMax = ihv_V_cellU[i];
  339. sfmd_idx_cellUMax = i;
  340. }
  341. if (sfmd_V_cellUMin > ihv_V_cellU[i])
  342. {
  343. sfmd_V_cellUMin = ihv_V_cellU[i];
  344. sfmd_idx_cellUMin = i;
  345. }
  346. }
  347. }
  348. if (sfmd_V_cellUMax - sfmd_V_cellUMin > 5000) // 2021 10.24
  349. {
  350. sfmd_V_cellUAvrg = (SumU - sfmd_V_cellUMax - sfmd_V_cellUMin) / (UNum - 2);
  351. for (i = 0; i < cmnc_num_cellUNum; i++)
  352. {
  353. if (!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > 1500)
  354. {
  355. ErrUFlg[i] = true;
  356. }
  357. if (!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < -1500)
  358. {
  359. ErrUFlg[i] = true;
  360. sfmv_flg_cellUOpenFlt[i] = true;
  361. }
  362. }
  363. }
  364. else
  365. {
  366. sfmd_V_cellUAvrg = (SumU - sfmd_V_cellUMax - sfmd_V_cellUMin) / (UNum - 2);
  367. }
  368. // 恢复
  369. for (i = 0; i < cmnc_num_cellUNum; i++)
  370. {
  371. if (ErrUFlg[i])
  372. {
  373. if ((int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < 200 && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > -200)
  374. {
  375. RecNr[i] = (RecNr[i] + 1) > 200 ? 200 : (RecNr[i] + 1);
  376. }
  377. else
  378. {
  379. RecNr[i] = 0;
  380. }
  381. if (RecNr[i] >= 2)
  382. {
  383. sfmv_flg_cellUOpenFlt[i] = false;
  384. ErrUFlg[i] = false;
  385. }
  386. }
  387. }
  388. }
  389. //=======================电压处理======================================
  390. SumU = 0;
  391. sfmd_flg_volFlt = false;
  392. for (i = 0; i < cmnc_num_cellUNum; i++)
  393. {
  394. if (ErrUFlg[i] && !sfmn_flg_interComFlt)
  395. {
  396. sfmv_V_cellU[i] = sfmd_V_cellUAvrg;
  397. }
  398. else
  399. {
  400. sfmv_flg_cellUOpenFlt[i] = false;
  401. sfmv_V_cellU[i] = ihv_V_cellU[i];
  402. }
  403. SumU = SumU + sfmv_V_cellU[i];
  404. sfmd_flg_volFlt = sfmd_flg_volFlt || sfmv_flg_cellUOpenFlt[i];
  405. }
  406. sfmd_V_battU = (uint16_T)(SumU * 0.01);
  407. // 53 模组温度开路故障
  408. sfmd_flg_modTOpenFlt = false;
  409. for (i = 0; i < cmnc_num_modTNum; i++)
  410. {
  411. if (ihv_T_modT[i] == 10 && !sfmn_flg_interComFlt) //-30℃
  412. {
  413. modTOpenNr[i] = (modTOpenNr[i] + 1) > 200 ? 200 : (modTOpenNr[i] + 1);
  414. }
  415. else
  416. {
  417. modTOpenNr[i] = 0;
  418. }
  419. if (modTOpenNr[i] >= 2)
  420. {
  421. sfmv_flg_modTOpenFlt[i] = true;
  422. }
  423. else
  424. {
  425. sfmv_flg_modTOpenFlt[i] = false;
  426. }
  427. sfmd_flg_modTOpenFlt = sfmd_flg_modTOpenFlt || sfmv_flg_modTOpenFlt[i];
  428. }
  429. // 54 Mos温度开路故障
  430. sfmd_flg_chrgMosTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_mosT == 10, &DiagTime.N54, 2);
  431. // 56 快充插头温度开路故障
  432. sfmd_flg_DCPlugTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_DCPlugT == 0, &DiagTime.N56, 2);
  433. // 57 慢充插头温度开路故障
  434. sfmd_flg_ACPlugTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_ACPlugT == 0, &DiagTime.N57, 2);
  435. // 58 加热板#1温度开路故障
  436. sfmd_flg_heatPanT1OpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_heatPanT1 == 0, &DiagTime.N58, 2);
  437. // 59 加热板#2温度开路故障
  438. sfmd_flg_heatPanT2OpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_heatPanT2 == 0, &DiagTime.N59, 2);
  439. // 61 模组温度合理性故障
  440. sfmd_flg_modTRatFlt = false;
  441. for (i = 0; i < cmnc_num_modTNum && sfmd_flg_firstRun; i++)
  442. {
  443. modTArr[i] = ihv_T_modT[i];
  444. }
  445. for (i = 0; i < cmnc_num_modTNum; i++)
  446. {
  447. if (!sfmv_flg_modTOpenFlt[i] && ((int16_T)(modTArr[i] - ihv_T_modT[i]) > 10 || (int16_T)(modTArr[i] - ihv_T_modT[i]) < -20) && !sfmn_flg_interComFlt)
  448. {
  449. modTRatNr[i] = (modTRatNr[i] + 1) > 200 ? 200 : (modTRatNr[i] + 1);
  450. }
  451. else
  452. {
  453. modTRatNr[i] = 0;
  454. modTArr[i] = ihv_T_modT[i];
  455. }
  456. if (modTRatNr[i] >= 2)
  457. {
  458. sfmv_flg_modTRatFlt[i] = true;
  459. }
  460. else
  461. {
  462. sfmv_flg_modTRatFlt[i] = false;
  463. }
  464. sfmd_flg_modTRatFlt = sfmd_flg_modTRatFlt || sfmv_flg_modTRatFlt[i];
  465. }
  466. // printf("%d,%d,%d,%d\n",sfmn_T_mosT_Delay,ihd_T_mosT,FirstRun_SFM,ihd_flg_urtRecFlt);
  467. // 62 充电Mos 温度合理性故障
  468. sfmn_flg_chrgMosTRatFltOnce = !sfmn_flg_interComFlt && !sfmd_flg_chrgMosTOpenFlt && ((int16_T)(ihd_T_mosT - sfmn_T_mosT_Delay) < -10 || (int16_T)(ihd_T_mosT - sfmn_T_mosT_Delay) > 20);
  469. if (!sfmn_flg_chrgMosTRatFltOnce)
  470. {
  471. sfmn_T_mosT_Delay = ihd_T_mosT;
  472. }
  473. sfmd_flg_chrgMosTRatFlt = JudgeTimeSystem(1, sfmn_flg_chrgMosTRatFltOnce, &DiagTime.N62, 2);
  474. // 64 快充插头温度合理性故障
  475. sfmn_flg_DCPlugTRatFltOnce = !sfmn_flg_interComFlt && !sfmd_flg_DCPlugTOpenFlt && ((int16_T)(ihd_T_DCPlugT - sfmn_T_DCPlugT_Delay) < -10 || (int16_T)(ihd_T_DCPlugT - sfmn_T_DCPlugT_Delay) > 20);
  476. if (!sfmn_flg_chrgMosTRatFltOnce)
  477. {
  478. sfmn_T_DCPlugT_Delay = ihd_T_DCPlugT;
  479. }
  480. sfmd_flg_DCPlugTRatFlt = JudgeTimeSystem(1, sfmn_flg_DCPlugTRatFltOnce, &DiagTime.N64, 2);
  481. // 65 慢插头温度合理性故障
  482. sfmn_flg_ACPlugTRatFltOnce = !sfmn_flg_interComFlt && !sfmd_flg_ACPlugTOpenFlt && ((int16_T)(ihd_T_ACPlugT - sfmn_T_ACPlugT_Delay) < -10 || (int16_T)(ihd_T_ACPlugT - sfmn_T_ACPlugT_Delay) > 20);
  483. if (!sfmn_flg_ACPlugTRatFltOnce)
  484. {
  485. sfmn_T_ACPlugT_Delay = ihd_T_ACPlugT;
  486. }
  487. sfmd_flg_ACPlugTRatFlt = JudgeTimeSystem(1, sfmn_flg_ACPlugTRatFltOnce, &DiagTime.N65, 2);
  488. // 66 加热板#1 温度合理性故障
  489. sfmn_flg_heatPanT1RatFltOnce = !sfmn_flg_interComFlt && !sfmd_flg_heatPanT1OpenFlt && ((int16_T)(ihd_T_heatPanT1 - sfmn_T_heatPanT1_Delay) < -10 || (int16_T)(ihd_T_heatPanT1 - sfmn_T_heatPanT1_Delay) > 20);
  490. if (!sfmn_flg_heatPanT1RatFltOnce)
  491. {
  492. sfmn_T_heatPanT1_Delay = ihd_T_heatPanT1;
  493. }
  494. sfmd_flg_heatPanT1RatFlt = JudgeTimeSystem(1, sfmn_flg_heatPanT1RatFltOnce, &DiagTime.N66, 2);
  495. // 67 加热板#2 温度合理性故障
  496. sfmn_flg_heatPanT2RatFltOnce = !sfmn_flg_interComFlt && !sfmd_flg_heatPanT2OpenFlt && ((int16_T)(ihd_T_heatPanT2 - sfmn_T_heatPanT2_Delay) < -10 || (int16_T)(ihd_T_heatPanT2 - sfmn_T_heatPanT2_Delay) > 20);
  497. if (!sfmn_flg_heatPanT2RatFltOnce)
  498. {
  499. sfmn_T_heatPanT2_Delay = ihd_T_heatPanT2;
  500. }
  501. sfmd_flg_heatPanT2RatFlt = JudgeTimeSystem(1, sfmn_flg_heatPanT2RatFltOnce, &DiagTime.N67, 2);
  502. // 68 模组温度全部不可用
  503. sfmd_flg_modTAllFlt = true;
  504. for (i = 0; i < cmnc_num_modTNum; i++)
  505. {
  506. sfmd_flg_modTAllFlt = sfmd_flg_modTAllFlt && (sfmv_flg_modTOpenFlt[i] || sfmv_flg_modTRatFlt[i]);
  507. }
  508. // 温度处理
  509. sfmd_T_modTMax = 0;
  510. sfmd_T_modTMin = 200;
  511. Tnum = 0;
  512. SumT = 0;
  513. if (!sfmd_flg_modTAllFlt)
  514. {
  515. for (i = 0; i < cmnc_num_modTNum; i++)
  516. {
  517. if (!sfmv_flg_modTRatFlt[i] && !sfmv_flg_modTOpenFlt[i])
  518. {
  519. SumT = SumT + ihv_T_modT[i];
  520. Tnum = Tnum + 1;
  521. if (sfmd_T_modTMax < ihv_T_modT[i])
  522. {
  523. sfmd_T_modTMax = ihv_T_modT[i];
  524. sfmd_idx_modTMax = i;
  525. }
  526. if (sfmd_T_modTMin > ihv_T_modT[i])
  527. {
  528. sfmd_T_modTMin = ihv_T_modT[i];
  529. sfmd_idx_modTMin = i;
  530. }
  531. }
  532. }
  533. for (i = 0; i < cmnc_num_modTNum; i++)
  534. {
  535. if (!sfmv_flg_modTRatFlt[i] && !sfmv_flg_modTOpenFlt[i])
  536. {
  537. sfmv_T_modT[i] = ihv_T_modT[i];
  538. }
  539. else
  540. {
  541. sfmv_T_modT[i] = SumT / Tnum;
  542. }
  543. }
  544. }
  545. // 69 加热板温度全部开路故障
  546. sfmd_flg_heatPanTAllFlt = (sfmd_flg_heatPanT1OpenFlt || sfmd_flg_heatPanT1RatFlt) && (sfmd_flg_heatPanT2OpenFlt || sfmd_flg_heatPanT2RatFlt);
  547. // 71 电流传感器故障
  548. sfmd_flg_currOpenFlt = false;
  549. sfmd_I_curr = ihd_I_curr;
  550. // 81 单体过压故障2级
  551. sfmd_flg_cellUOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt, sfmd_V_cellUMax, sfmc_V_cellUOverThrFlt2, sfmc_V_cellUOverThrRec2, 2, 2, &DiagThr.fltNum81, &DiagThr.recNum81, &sfmd_flg_cellUOverFlt2);
  552. // 82 单体过压故障1级
  553. sfmd_flg_cellUOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt, sfmd_V_cellUMax, sfmc_V_cellUOverThrFlt1, sfmc_V_cellUOverThrRec1, 2, 2, &DiagThr.fltNum82, &DiagThr.recNum82, &sfmd_flg_cellUOverFlt1) && !sfmd_flg_cellUOverFlt2;
  554. // 83 单体欠压故障2级
  555. sfmd_flg_cellULowFlt2 = DiagThrSystem2(1, !sfmn_flg_interComFlt, sfmd_V_cellUMin, sfmc_V_cellULowThrFlt2, sfmc_V_cellULowThrRec2, 2, 2, &DiagThr.fltNum83, &DiagThr.recNum83, &sfmd_flg_cellULowFlt2);
  556. // 84 单体欠压故障1级
  557. sfmd_flg_cellULowFlt1 = DiagThrSystem2(0, !sfmn_flg_interComFlt, sfmd_V_cellUMin, sfmc_V_cellULowThrFlt1, sfmc_V_cellULowThrRec1, 2, 2, &DiagThr.fltNum84, &DiagThr.recNum84, &sfmd_flg_cellULowFlt1) && !sfmd_flg_cellULowFlt2;
  558. // 85 压差过大2级
  559. sfmd_flg_cellUDiffFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && socd_pct_battSoc > 200, sfmd_V_cellUMax - sfmd_V_cellUMin, sfmc_flg_cellUDiffThrFlt2, sfmc_flg_cellUDiffThrRec2, 2, 2, &DiagThr.fltNum85, &DiagThr.recNum85, &sfmd_flg_cellUDiffFlt2);
  560. // 86 压差过大1级
  561. sfmd_flg_cellUDiffFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && socd_pct_battSoc > 200, sfmd_V_cellUMax - sfmd_V_cellUMin, sfmc_flg_cellUDiffThrFlt1, sfmc_flg_cellUDiffThrRec1, 2, 2, &DiagThr.fltNum86, &DiagThr.recNum86, &sfmd_flg_cellUDiffFlt1) && !sfmd_flg_cellUDiffFlt2;
  562. // 87 总压过压2级
  563. sfmd_flg_battUOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt, sfmd_V_battU, sfmc_V_battUOverThrFlt2, sfmc_V_battUOverThrRec2, 2, 2, &DiagThr.fltNum87, &DiagThr.recNum87, &sfmd_flg_battUOverFlt2);
  564. // 88 总压过压1级
  565. sfmd_flg_battUOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt, sfmd_V_battU, sfmc_V_battUOverThrFlt1, sfmc_V_battUOverThrRec1, 2, 2, &DiagThr.fltNum88, &DiagThr.recNum88, &sfmd_flg_battUOverFlt1) && !sfmd_flg_battUOverFlt2;
  566. // 89 总压欠压2级
  567. sfmd_flg_battULowFlt2 = DiagThrSystem2(1, !sfmn_flg_interComFlt, sfmd_V_battU, sfmc_V_battULowThrFlt2, sfmc_V_battULowThrRec2, 2, 2, &DiagThr.fltNum89, &DiagThr.recNum89, &sfmd_flg_battULowFlt2);
  568. // 90 总压欠压1级
  569. sfmd_flg_battULowFlt1 = DiagThrSystem2(0, !sfmn_flg_interComFlt, sfmd_V_battU, sfmc_V_battULowThrFlt1, sfmc_V_battULowThrRec1, 2, 2, &DiagThr.fltNum90, &DiagThr.recNum90, &sfmd_flg_battULowFlt1) && !sfmd_flg_battULowFlt2;
  570. chrgFlg = ihd_st_workStat == 2;
  571. disChrgFlg = ihd_st_workStat != 2;
  572. // 97 模组充电温度过高2级故障
  573. sfmd_flg_chrgModTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && chrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMax, sfmc_T_chrgModTOverThrFlt2, sfmc_T_chrgModTOverThrRec2, 3, 3, &DiagThr.fltNum97, &DiagThr.recNum97, &sfmd_flg_chrgModTOverFlt2);
  574. // 98 模组充电温度过高1级故障
  575. sfmd_flg_chrgModTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && chrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMax, sfmc_T_chrgModTOverThrFlt1, sfmc_T_chrgModTOverThrRec1, 3, 3, &DiagThr.fltNum98, &DiagThr.recNum98, &sfmd_flg_chrgModTOverFlt1) && !sfmd_flg_chrgModTOverFlt2;
  576. // 99 模组充电温度过低2级故障
  577. sfmd_flg_chrgModTLowFlt2 = DiagThrSystem2(0, !sfmn_flg_interComFlt && chrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMin, sfmc_T_chrgModTLowThrFlt2, sfmc_T_chrgModTLowThrRec2, 3, 3, &DiagThr.fltNum99, &DiagThr.recNum99, &sfmd_flg_chrgModTLowFlt2);
  578. // 100 模组充电温度过低1级故障
  579. sfmd_flg_chrgModTLowFlt1 = DiagThrSystem2(0, !sfmn_flg_interComFlt && chrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMin, sfmc_T_chrgModTLowThrFlt1, sfmc_T_chrgModTLowThrRec1, 3, 3, &DiagThr.fltNum100, &DiagThr.recNum100, &sfmd_flg_chrgModTLowFlt1) && !sfmd_flg_chrgModTLowFlt2;
  580. // 101 模组放电温度过高2级故障
  581. sfmd_flg_disChrgModTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && disChrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMax, sfmc_T_disChrgModTOverThrFlt2, sfmc_T_disChrgModTOverThrRec2, 3, 3, &DiagThr.fltNum101, &DiagThr.recNum101, &sfmd_flg_disChrgModTOverFlt2);
  582. // 102 模组放电温度过高1级故障
  583. sfmd_flg_disChrgModTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && disChrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMax, sfmc_T_disChrgModTOverThrFlt1, sfmc_T_disChrgModTOverThrRec1, 3, 3, &DiagThr.fltNum102, &DiagThr.recNum102, &sfmd_flg_disChrgModTOverFlt1) && !sfmd_flg_disChrgModTOverFlt2;
  584. // 103 模组放电温度过低2级故障
  585. sfmd_flg_disChrgModTLowFlt2 = DiagThrSystem2(0, !sfmn_flg_interComFlt && disChrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMin, sfmc_T_disChrgModTLowThrFlt2, sfmc_T_disChrgModTLowThrRec2, 3, 3, &DiagThr.fltNum103, &DiagThr.recNum103, &sfmd_flg_disChrgModTLowFlt2);
  586. // 104 模组放电温度过低1级故障
  587. sfmd_flg_disChrgModTLowFlt1 = DiagThrSystem2(0, !sfmn_flg_interComFlt && disChrgFlg && !sfmd_flg_modTAllFlt, sfmd_T_modTMin, sfmc_T_disChrgModTLowThrFlt1, sfmc_T_disChrgModTLowThrRec1, 3, 3, &DiagThr.fltNum104, &DiagThr.recNum104, &sfmd_flg_disChrgModTLowFlt1) && !sfmd_flg_disChrgModTLowFlt2;
  588. //
  589. // 105 模组温差2级故障
  590. sfmd_flg_modTDiffFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && !sfmd_flg_modTAllFlt, sfmd_T_modTMax - sfmd_T_modTMin, sfmc_T_modTDiffThrFlt2, sfmc_T_modTDiffThrRec2, 3, 3, &DiagThr.fltNum105, &DiagThr.recNum105, &sfmd_flg_modTDiffFlt2);
  591. // 106 模组温差1级故障
  592. sfmd_flg_modTDiffFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && !sfmd_flg_modTAllFlt, sfmd_T_modTMax - sfmd_T_modTMin, sfmc_T_modTDiffThrFlt1, sfmc_T_modTDiffThrRec1, 3, 3, &DiagThr.fltNum106, &DiagThr.recNum106, &sfmd_flg_modTDiffFlt1) && !sfmd_flg_modTDiffFlt2;
  593. // 107 充电Mos温度过高2级故障
  594. sfmd_flg_chrgMosTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && chrgFlg && sfmd_flg_chrgMosTRatFlt && sfmd_flg_chrgMosTOpenFlt, ihd_T_mosT, sfmc_T_chrgMosTOverThrFlt2, sfmc_T_chrgMosTOverThrRec2, 3, 3, &DiagThr.fltNum107, &DiagThr.recNum107, &sfmd_flg_chrgMosTOverFlt2);
  595. // 108 充电Mos温度过高1级故障
  596. sfmd_flg_chrgMosTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && chrgFlg && sfmd_flg_chrgMosTRatFlt && sfmd_flg_chrgMosTOpenFlt, ihd_T_mosT, sfmc_T_chrgMosTOverThrFlt1, sfmc_T_chrgMosTOverThrRec1, 3, 3, &DiagThr.fltNum108, &DiagThr.recNum108, &sfmd_flg_chrgMosTOverFlt1) && !sfmd_flg_chrgMosTOverFlt2;
  597. // 109 放电Mos温度过高2级故障
  598. sfmd_flg_disChrgMosTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && disChrgFlg && sfmd_flg_chrgMosTRatFlt && sfmd_flg_chrgMosTOpenFlt, ihd_T_mosT, sfmc_T_disChrgMosTOverThrFlt2, sfmc_T_disChrgMosTOverThrRec2, 3, 3, &DiagThr.fltNum109, &DiagThr.recNum109, &sfmd_flg_disChrgMosTOverFlt2);
  599. // 110 放电Mos温度过高1级故障
  600. sfmd_flg_disChrgMosTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && disChrgFlg && sfmd_flg_chrgMosTRatFlt && sfmd_flg_chrgMosTOpenFlt, ihd_T_mosT, sfmc_T_disChrgMosTOverThrFlt1, sfmc_T_disChrgMosTOverThrRec1, 3, 3, &DiagThr.fltNum110, &DiagThr.recNum110, &sfmd_flg_disChrgMosTOverFlt1) && !sfmd_flg_disChrgMosTOverFlt2;
  601. // 111 快充插头温度过高2级故障
  602. sfmd_flg_DCPlugTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && sfmd_flg_DCPlugTRatFlt && sfmd_flg_DCPlugTOpenFlt, ihd_T_DCPlugT, sfmc_T_DCPlugTOverThrFlt2, sfmc_T_DCPlugTOverThrRec2, 3, 3, &DiagThr.fltNum111, &DiagThr.recNum111, &sfmd_flg_DCPlugTOverFlt2);
  603. // 112 快充插头温度过高1级故障
  604. sfmd_flg_DCPlugTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && sfmd_flg_DCPlugTRatFlt && sfmd_flg_DCPlugTOpenFlt, ihd_T_DCPlugT, sfmc_T_DCPlugTOverThrFlt1, sfmc_T_DCPlugTOverThrRec1, 3, 3, &DiagThr.fltNum112, &DiagThr.recNum112, &sfmd_flg_DCPlugTOverFlt1) && !sfmd_flg_DCPlugTOverFlt2;
  605. // 113 慢充插头温度过高2级故障
  606. sfmd_flg_ACPlugTOverFlt2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && sfmd_flg_ACPlugTRatFlt && sfmd_flg_ACPlugTOpenFlt, ihd_T_ACPlugT, sfmc_T_ACPlugTOverThrFlt2, sfmc_T_ACPlugTOverThrRec2, 3, 3, &DiagThr.fltNum113, &DiagThr.recNum113, &sfmd_flg_ACPlugTOverFlt2);
  607. // 114 慢充插头温度过高1级故障
  608. sfmd_flg_ACPlugTOverFlt1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && sfmd_flg_ACPlugTRatFlt && sfmd_flg_ACPlugTOpenFlt, ihd_T_ACPlugT, sfmc_T_ACPlugTOverThrFlt1, sfmc_T_ACPlugTOverThrRec1, 3, 3, &DiagThr.fltNum114, &DiagThr.recNum114, &sfmd_flg_ACPlugTOverFlt1) && !sfmd_flg_ACPlugTOverFlt2;
  609. // 115 加热板温度过高2级故障
  610. sfmd_flg_heatPanTOverFlt2_1 = DiagThrSystem1(1, !sfmn_flg_interComFlt && sfmd_flg_heatPanT1RatFlt && sfmd_flg_heatPanT1OpenFlt, ihd_T_heatPanT1, sfmc_T_heatPanTOverThrFlt2, sfmc_T_heatPanTOverThrRec2, 3, 3, &DiagThr.fltNum115_1, &DiagThr.recNum115_1, &sfmd_flg_heatPanTOverFlt2_1);
  611. sfmd_flg_heatPanTOverFlt2_2 = DiagThrSystem1(1, !sfmn_flg_interComFlt && sfmd_flg_heatPanT2RatFlt && sfmd_flg_heatPanT2OpenFlt, ihd_T_heatPanT2, sfmc_T_heatPanTOverThrFlt2, sfmc_T_heatPanTOverThrRec2, 3, 3, &DiagThr.fltNum115_2, &DiagThr.recNum115_2, &sfmd_flg_heatPanTOverFlt2_2);
  612. sfmd_flg_heatPanTOverFlt2 = sfmd_flg_heatPanTOverFlt2_1 || sfmd_flg_heatPanTOverFlt2_2;
  613. // 116 加热板温度过高1级故障
  614. sfmd_flg_heatPanTOverFlt1_1 = DiagThrSystem1(0, !sfmn_flg_interComFlt && sfmd_flg_heatPanT1RatFlt && sfmd_flg_heatPanT1OpenFlt, ihd_T_heatPanT1, sfmc_T_heatPanTOverThrFlt1, sfmc_T_heatPanTOverThrRec1, 3, 3, &DiagThr.fltNum116_1, &DiagThr.recNum116_1, &sfmd_flg_heatPanTOverFlt1_1) && !sfmd_flg_heatPanTOverFlt2;
  615. sfmd_flg_heatPanTOverFlt1_2 = DiagThrSystem1(0, !sfmn_flg_interComFlt && sfmd_flg_heatPanT2RatFlt && sfmd_flg_heatPanT2OpenFlt, ihd_T_heatPanT2, sfmc_T_heatPanTOverThrFlt1, sfmc_T_heatPanTOverThrRec1, 3, 3, &DiagThr.fltNum116_2, &DiagThr.recNum116_2, &sfmd_flg_heatPanTOverFlt1_2) && !sfmd_flg_heatPanTOverFlt2;
  616. sfmd_flg_heatPanTOverFlt1 = sfmd_flg_heatPanTOverFlt1_1 || sfmd_flg_heatPanTOverFlt1_2;
  617. sfmd_I_curr = ihd_I_curr;
  618. sfmn_I_currAbs = (uint16_T)(sfmd_I_curr > 0 ? sfmd_I_curr : -sfmd_I_curr);
  619. // 131 充电电流过高
  620. sfmd_flg_chrgCurrOverFlt = DiagThrSystem1(1, !sfmn_flg_interComFlt && chrgFlg && !sfmd_flg_currOpenFlt, sfmn_I_currAbs, sfmc_I_chrgCurrOverThr, sfmc_I_chrgCurrOverThr, 2, 2, &DiagThr.fltNum131, &DiagThr.recNum131, &sfmd_flg_chrgCurrOverFlt);
  621. // 132 放电电流过高
  622. sfmd_flg_disChrgCurrOverFlt = DiagThrSystem1(1, !sfmn_flg_interComFlt && disChrgFlg && !sfmd_flg_currOpenFlt, sfmn_I_currAbs, sfmc_I_disChrgCurrOverThr, sfmc_I_disChrgCurrOverThr, 2, 2, &DiagThr.fltNum132, &DiagThr.recNum132, &sfmd_flg_disChrgCurrOverFlt);
  623. // 151 充电过流故障不匹配
  624. sfmd_flg_chrgCurrOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgCurrOverFlt != ihd_flg_chrgCurrOverFlt, &DiagTime.N151, 2);
  625. // 152 放电过流故障不匹配
  626. sfmd_flg_disChrgCurrOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgCurrOverFlt != ihd_flg_disChrgCurrOverFlt, &DiagTime.N152, 2);
  627. // 153 总压欠压不匹配
  628. sfmd_flg_battULowMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_battULowFlt2 != ihd_flg_battULowFlt, &DiagTime.N153, 2);
  629. // 154 总压过压不匹配
  630. sfmd_flg_battUOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_battUOverFlt2 != ihd_flg_battUOverFlt, &DiagTime.N154, 2);
  631. // 155 单体欠压故障不匹配
  632. sfmd_flg_cellULowMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_cellULowFlt2 != ihd_flg_cellULowFlt, &DiagTime.N155, 2);
  633. // 156 单体过压故障不匹配
  634. sfmd_flg_cellUOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_cellUOverFlt2 != ihd_flg_cellUOverFlt, &DiagTime.N156, 2);
  635. // 157 充电模组过温故障不匹配
  636. sfmd_flg_chrgModTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgModTOverFlt2 != ihd_flg_chrgModTOverFlt, &DiagTime.N157, 2);
  637. // 158 充电模组低温故障不匹配
  638. sfmd_flg_chrgModTLowMisFlt = JudgeTimeSystem(0 && !sfmn_flg_interComFlt, sfmd_flg_chrgModTLowFlt2 != ihd_flg_chrgModTLowFlt, &DiagTime.N158, 2);
  639. // 159 放电模组过温故障不匹配
  640. sfmd_flg_disChrgModTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgModTOverFlt2 != ihd_flg_disChrgModTOverFlt, &DiagTime.N159, 2);
  641. // 160 放电模组低温故障不匹配
  642. sfmd_flg_disChrgModTLowMisFlt = JudgeTimeSystem(0 && !sfmn_flg_interComFlt, sfmd_flg_disChrgModTLowFlt2 != ihd_flg_disChrgModTLowFlt, &DiagTime.N160, 2);
  643. // 161 充电Mos过温故障不匹配
  644. sfmd_flg_chrgMosTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgMosTOverFlt2 != ihd_flg_chrgMosTOverFlt, &DiagTime.N161, 2);
  645. // 162 放电Mos过温故障不匹配
  646. sfmd_flg_disChrgMosTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgMosTOverFlt2 != ihd_flg_disChrgMosTOverFlt, &DiagTime.N162, 2);
  647. // 163 soc不匹配
  648. sfmd_flg_socMisFlt = 0 && !sfmd_flg_firstRun && (!sfmn_flg_interComFlt) && ((int16_T)(socd_pct_vcuSoc - ihd_pct_soc) > 100 || (int16_T)(socd_pct_vcuSoc - ihd_pct_soc) < -100);
  649. // 164 SOH 不匹配
  650. sfmd_flg_sohMisFlt = 0 && !sfmd_flg_firstRun && (!sfmn_flg_interComFlt) && ((int16_T)(sohd_pct_bcuSoh - ihd_pct_soh) > 50 || (int16_T)(sohd_pct_bcuSoh - ihd_pct_soh) < -50);
  651. // 178
  652. sfmd_flg_deltRFlt = false;
  653. if (!sfmn_flg_interComFlt)
  654. {
  655. SumR = 0;
  656. SumRR = 0;
  657. for (i = 0; i < cmnc_num_cellUNum; i++)
  658. {
  659. if (!cdmv_flg_inval[i])
  660. {
  661. SumR = SumR + cdmv_R_deltOhm[i];
  662. SumRR = SumRR + cdmv_R_deltOhm[i] * cdmv_R_deltOhm[i];
  663. }
  664. }
  665. for (i = 0; i < cmnc_num_cellUNum; i++)
  666. {
  667. if (!cdmv_flg_inval[i] && (cdmv_R_deltOhm[i] - SumR / cmnc_num_cellUNum) / (sqrt(SumRR / cmnc_num_cellUNum)) > 3 && (cdmv_R_deltOhm[i] - SumR / cmnc_num_cellUNum) > 500)
  668. {
  669. deltRFltNr[i] = (deltRFltNr[i] + 1) > 200 ? 200 : (deltRFltNr[i] + 1);
  670. }
  671. else
  672. {
  673. deltRFltNr[i] = 0;
  674. }
  675. }
  676. for (i = 0; i < cmnc_num_cellUNum; i++)
  677. {
  678. if (deltRFltNr[i] > 60)
  679. {
  680. sfmd_flg_deltRFlt = true;
  681. }
  682. }
  683. }
  684. // 179 soc跳变
  685. sfmd_flg_socJumpFlt = ((int16_T)(socd_pct_bcuSoc - sfmn_pct_bcuSoc_Delay) > 50 || (int16_T)(socd_pct_bcuSoc - sfmn_pct_bcuSoc_Delay) < -50) && JudgeTimeSystem(1, 1, &DiagTime.N179, 2);
  686. sfmn_pct_bcuSoc_Delay = socd_pct_bcuSoc;
  687. // 180 EE失效
  688. sfmd_flg_EEsaveFlt = ihd_flg_EESaveFlt;
  689. // 21 热失控故障
  690. if (sfmd_I_curr > -2 && (sfmd_I_curr_Delay - sfmd_I_curr) > -2 && (sfmd_I_curr_Delay - sfmd_I_curr) < 2)
  691. {
  692. noDisChrgCnt = (noDisChrgCnt + 1) > 200 ? 200 : (noDisChrgCnt + 1);
  693. }
  694. else
  695. {
  696. noDisChrgCnt = 0;
  697. }
  698. sfmd_I_curr_Delay = sfmd_I_curr;
  699. if (noDisChrgCnt > 60)
  700. {
  701. for (i = 0; i < cmnc_num_cellUNum; i++)
  702. {
  703. if ((int16_T)(CellUArry[3][i] - CellUArry[0][i]) < -100)
  704. {
  705. sfmn_flg_Udrop = true;
  706. }
  707. }
  708. if (sfmd_flg_heatclear)
  709. {
  710. sfmn_flg_Udrop = false;
  711. }
  712. }
  713. ////
  714. if (sfmd_flg_volFlt)
  715. {
  716. sfmn_flg_volFlt_keep = true;
  717. }
  718. if (sfmd_flg_heatclear)
  719. {
  720. sfmn_flg_volFlt_keep = false;
  721. }
  722. //
  723. CntA = CntA + 1;
  724. if (CntA >= 0)
  725. {
  726. CntA = 0;
  727. for (j = 0; j < 4 && sfmd_flg_firstRun; j++)
  728. {
  729. for (i = 0; i < cmnc_num_modTNum; i++)
  730. {
  731. ModTStor[j][i] = sfmv_T_modT[i];
  732. }
  733. }
  734. for (j = 0; j < 3; j++)
  735. {
  736. for (i = 0; i < cmnc_num_modTNum; i++)
  737. {
  738. ModTStor[j][i] = ModTStor[j + 1][i];
  739. }
  740. }
  741. for (i = 0; i < cmnc_num_modTNum; i++)
  742. {
  743. ModTStor[j][i] = sfmv_T_modT[i];
  744. }
  745. for (i = 0; i < cmnc_num_modTNum; i++)
  746. {
  747. if ((int16_T)(ModTStor[3][i] - ModTStor[2][i]) > 2 && (int16_T)(ModTStor[2][i] - ModTStor[1][i]) > 2 && (int16_T)(ModTStor[1][i] - ModTStor[0][i]) > 2)
  748. {
  749. sfmn_flg_Tup = true;
  750. }
  751. }
  752. if (sfmd_flg_heatclear)
  753. {
  754. sfmn_flg_Tup = false;
  755. }
  756. }
  757. //
  758. if (sfmd_flg_modTOpenFlt)
  759. {
  760. sfmn_flg_modTOpenFlt_keep = true;
  761. }
  762. if (sfmd_flg_heatclear)
  763. {
  764. sfmn_flg_modTOpenFlt_keep = false;
  765. }
  766. //////
  767. if (sfmn_flg_Udrop || sfmn_flg_volFlt_keep || sfmn_flg_Tup || sfmn_flg_modTOpenFlt_keep)
  768. {
  769. CntB = (CntB + 1) > 200 ? 200 : (CntB + 1);
  770. }
  771. if ((((sfmn_flg_Udrop && sfmn_flg_Tup) || (sfmn_flg_Udrop && sfmn_flg_modTOpenFlt_keep) || (sfmn_flg_volFlt_keep && sfmn_flg_Tup)) && CntB <= 180) || sfmd_flg_heatRunFltEi)
  772. {
  773. sfmd_flg_heatRunFltEo = true;
  774. }
  775. if (!sfmd_flg_heatRunFltEo && CntB > 180)
  776. {
  777. sfmd_flg_heatclear = true;
  778. CntB = 0;
  779. }
  780. else
  781. {
  782. sfmd_flg_heatclear = false;
  783. }
  784. ////32 加热回路常闭故障
  785. if (!sfmd_flg_modTAllFlt)
  786. {
  787. if (sfmd_flg_firstRun)
  788. {
  789. for (i = 0; i < 10; i++)
  790. {
  791. modTMaxArr[i] = sfmd_T_modTMax;
  792. }
  793. Time0Cnt = 0;
  794. SumT0 = 0;
  795. }
  796. Time0Cnt++;
  797. SumT0 = SumT0 + sfmd_T_modTMax;
  798. if (Time0Cnt >= 60)
  799. {
  800. for (i = 0; i < 9; i++)
  801. {
  802. modTMaxArr[i] = modTMaxArr[i + 1];
  803. }
  804. modTMaxArr[9] = SumT0 / Time0Cnt;
  805. Time0Cnt = 0;
  806. SumT0 = 0;
  807. }
  808. }
  809. if (!sfmd_flg_heatPanT1OpenFlt && !sfmd_flg_heatPanT1RatFlt && (int16_T)(ihd_T_heatPanT1 - sfmn_T_heatPanT1_Delay1) > -10 && (int16_T)(ihd_T_heatPanT1 - sfmn_T_heatPanT1_Delay1) < 20)
  810. {
  811. if (sfmd_flg_firstRun)
  812. {
  813. for (i = 0; i < 10; i++)
  814. {
  815. heatT1Arr[i] = ihd_T_heatPanT1;
  816. }
  817. Time1Cnt = 0;
  818. SumT1 = 0;
  819. }
  820. Time1Cnt++;
  821. SumT1 = SumT1 + ihd_T_heatPanT1;
  822. if (Time1Cnt >= 60)
  823. {
  824. for (i = 0; i < 9; i++)
  825. {
  826. heatT1Arr[i] = heatT1Arr[i + 1];
  827. }
  828. heatT1Arr[9] = SumT1 / Time1Cnt;
  829. Time1Cnt = 0;
  830. SumT1 = 0;
  831. }
  832. }
  833. sfmn_T_heatPanT1_Delay1 = ihd_T_heatPanT1;
  834. if (!sfmd_flg_heatPanT2OpenFlt && !sfmd_flg_heatPanT2RatFlt && (int16_T)(ihd_T_heatPanT2 - sfmn_T_heatPanT2_Delay1) > -10 && (int16_T)(ihd_T_heatPanT2 - sfmn_T_heatPanT2_Delay1) < 20)
  835. {
  836. if (sfmd_flg_firstRun)
  837. {
  838. for (i = 0; i < 10; i++)
  839. {
  840. heatT2Arr[i] = ihd_T_heatPanT2;
  841. }
  842. Time2Cnt = 0;
  843. SumT2 = 0;
  844. }
  845. Time2Cnt++;
  846. SumT2 = SumT2 + ihd_T_heatPanT2;
  847. if (Time2Cnt >= 60)
  848. {
  849. for (i = 0; i < 9; i++)
  850. {
  851. heatT2Arr[i] = heatT2Arr[i + 1];
  852. }
  853. heatT2Arr[9] = SumT2 / Time2Cnt;
  854. Time2Cnt = 0;
  855. SumT2 = 0;
  856. }
  857. }
  858. sfmn_T_heatPanT2_Delay1 = ihd_T_heatPanT2;
  859. // 32 加热回路常闭故障
  860. Enable1 = JudgeTimeSystem(1, tmsd_st_heatAct == 0, &DiagTime.N32, 600);
  861. sfmd_flg_heatCirClosFltEo = (((int16_T)(heatT2Arr[9] - heatT2Arr[0]) > 5 || (int16_T)(heatT1Arr[9] - heatT1Arr[0]) > 5) && (modTMaxArr[9] > modTMaxArr[0] + 4) && Enable1) || sfmd_flg_heatCirClosFltEo || sfmd_flg_heatCirClosFltEi;
  862. // 33 加热回路常开故障
  863. Enable2 = JudgeTimeSystem(1, tmsd_st_heatAct == 1, &DiagTime.N33, 600);
  864. Enable2 = (DiagTime.N33 == 600);
  865. sfmd_flg_heatCirOpenFltEo = (((int16_T)(heatT2Arr[9] - heatT2Arr[0]) < 5 && (int16_T)(heatT1Arr[9] - heatT1Arr[0]) < 5) && (modTMaxArr[9] < modTMaxArr[0] + 4) && Enable2) || sfmd_flg_heatCirOpenFltEo || sfmd_flg_heatCirOpenFltEi;
  866. //================================================================================================================================================================
  867. //================================================================================================================================================================
  868. //===========故障码 故障等级 禁止状态===================================================================
  869. //================================================================================================================================================================
  870. memset(FltFlg, 0, sizeof(FltFlg));
  871. memset(FltLevel, 0, sizeof(FltLevel));
  872. memset(FltAct, 0, sizeof(FltAct));
  873. FltFlg[0] = sfmn_flg_interComFlt;
  874. FltLevel[0] = 2;
  875. FltAct[0] = 2; // 1 内网通讯故障
  876. FltFlg[1] = 0;
  877. FltLevel[1] = 0;
  878. FltAct[1] = 0; // 2 外部通讯故障
  879. FltFlg[2] = 0;
  880. FltLevel[2] = 0;
  881. FltAct[2] = 0; // 3 通讯模块故障
  882. FltFlg[3] = 0;
  883. FltLevel[3] = 0;
  884. FltAct[3] = 0; // 4 通讯天线故障
  885. FltFlg[4] = sfmn_flg_authFlt;
  886. FltLevel[4] = 4;
  887. FltAct[4] = 34; // 5 认证失败
  888. FltFlg[5] = 0;
  889. FltLevel[5] = 0;
  890. FltAct[5] = 0; // 6 预留#5
  891. FltFlg[6] = 0;
  892. FltLevel[6] = 0;
  893. FltAct[6] = 0; // 7 预留#4
  894. FltFlg[7] = 0;
  895. FltLevel[7] = 0;
  896. FltAct[7] = 0; // 8 预留#3
  897. FltFlg[8] = 0;
  898. FltLevel[8] = 0;
  899. FltAct[8] = 0; // 9 预留#2
  900. FltFlg[9] = 0;
  901. FltLevel[9] = 0;
  902. FltAct[9] = 0; // 10 预留#1
  903. FltFlg[10] = sfmn_flg_HVILFlt;
  904. FltLevel[10] = 0;
  905. FltAct[10] = 0; // 11 高压互锁
  906. FltFlg[11] = 0;
  907. FltLevel[11] = 0;
  908. FltAct[11] = 0; // 12 硬件短路保护
  909. FltFlg[12] = 0;
  910. FltLevel[12] = 0;
  911. FltAct[12] = 0; // 13 绝缘模块故障
  912. FltFlg[13] = 0;
  913. FltLevel[13] = 0;
  914. FltAct[13] = 0; // 14 绝缘故障
  915. FltFlg[14] = 0;
  916. FltLevel[14] = 0;
  917. FltAct[14] = 0; // 15 绝缘告警
  918. FltFlg[15] = sfmd_flg_iscFltEo;
  919. FltLevel[15] = 4;
  920. FltAct[15] = 250; // 16
  921. FltFlg[16] = 0;
  922. FltLevel[16] = 0;
  923. FltAct[16] = 0; // 17 预留4
  924. FltFlg[17] = 0;
  925. FltLevel[17] = 0;
  926. FltAct[17] = 0; // 18 预留3
  927. FltFlg[18] = 0;
  928. FltLevel[18] = 0;
  929. FltAct[18] = 0; // 19 预留2
  930. FltFlg[19] = 0;
  931. FltLevel[19] = 0;
  932. FltAct[19] = 0; // 20 预留1
  933. FltFlg[20] = sfmd_flg_heatRunFltEo;
  934. FltLevel[20] = 5;
  935. FltAct[20] = 255; // 21 热失控;
  936. FltFlg[21] = sfmn_flg_chrgMosClosFlt;
  937. FltLevel[21] = 4;
  938. FltAct[21] = 106; // 22充电MOS常闭故障
  939. FltFlg[22] = 0;
  940. FltLevel[22] = 0;
  941. FltAct[22] = 0; // 23充电MOS常开故障
  942. FltFlg[23] = sfmn_flg_disChrgMosClosFlt;
  943. FltLevel[23] = 4;
  944. FltAct[23] = 106; // 24 放电Mos常闭故障
  945. FltFlg[24] = 0;
  946. FltLevel[24] = 0;
  947. FltAct[24] = 0; // 25 放电Mos常开故障
  948. FltFlg[25] = 0;
  949. FltLevel[25] = 0;
  950. FltAct[25] = 0;
  951. FltFlg[26] = 0;
  952. FltLevel[26] = 0;
  953. FltAct[26] = 0;
  954. FltFlg[27] = 0;
  955. FltLevel[27] = 0;
  956. FltAct[27] = 0;
  957. FltFlg[28] = 0;
  958. FltLevel[28] = 0;
  959. FltAct[28] = 0;
  960. FltFlg[29] = 0;
  961. FltLevel[29] = 0;
  962. FltAct[29] = 0;
  963. FltFlg[30] = 0;
  964. FltLevel[30] = 0;
  965. FltAct[30] = 0;
  966. FltFlg[31] = sfmd_flg_heatCirClosFltEo;
  967. FltLevel[31] = 4;
  968. FltAct[31] = 250; // 32 加热回路常闭故障
  969. FltFlg[32] = sfmd_flg_heatCirOpenFltEo;
  970. FltLevel[32] = 1;
  971. FltAct[32] = 0; // 33 加热回路常开故障
  972. FltFlg[33] = sfmd_flg_mainCirClosFltEo;
  973. FltLevel[33] = 4;
  974. FltAct[33] = 250; // 34 主回路常闭故障
  975. FltFlg[34] = 0;
  976. FltLevel[34] = 0;
  977. FltAct[34] = 0;
  978. FltFlg[35] = 0;
  979. FltLevel[35] = 0;
  980. FltAct[35] = 0;
  981. FltFlg[36] = 0;
  982. FltLevel[36] = 0;
  983. FltAct[36] = 0;
  984. FltFlg[37] = 0;
  985. FltLevel[37] = 0;
  986. FltAct[37] = 0;
  987. FltFlg[38] = 0;
  988. FltLevel[38] = 0;
  989. FltAct[38] = 0;
  990. FltFlg[39] = 0;
  991. FltLevel[39] = 0;
  992. FltAct[39] = 0;
  993. FltFlg[40] = 0;
  994. FltLevel[40] = 0;
  995. FltAct[40] = 0;
  996. FltFlg[41] = 0;
  997. FltLevel[41] = 0;
  998. FltAct[41] = 0;
  999. FltFlg[42] = 0;
  1000. FltLevel[42] = 0;
  1001. FltAct[42] = 0;
  1002. FltFlg[43] = 0;
  1003. FltLevel[43] = 0;
  1004. FltAct[43] = 0;
  1005. FltFlg[44] = 0;
  1006. FltLevel[44] = 0;
  1007. FltAct[44] = 0;
  1008. FltFlg[45] = 0;
  1009. FltLevel[45] = 0;
  1010. FltAct[45] = 0;
  1011. FltFlg[46] = 0;
  1012. FltLevel[46] = 0;
  1013. FltAct[46] = 0;
  1014. FltFlg[47] = 0;
  1015. FltLevel[47] = 0;
  1016. FltAct[47] = 0;
  1017. FltFlg[48] = 0;
  1018. FltLevel[48] = 0;
  1019. FltAct[48] = 0;
  1020. FltFlg[49] = 0;
  1021. FltLevel[49] = 0;
  1022. FltAct[49] = 0;
  1023. FltFlg[50] = 0;
  1024. FltLevel[50] = 0;
  1025. FltAct[50] = 0; // 51均衡失效(合一) 暂缺
  1026. FltFlg[51] = sfmd_flg_volFlt;
  1027. FltLevel[51] = 4;
  1028. FltAct[51] = 234; // 52电压开路故障(合一)
  1029. FltFlg[52] = sfmd_flg_modTOpenFlt;
  1030. FltLevel[52] = 2;
  1031. FltAct[52] = 2; // 53温度开路故障(合一)
  1032. FltFlg[53] = sfmd_flg_chrgMosTOpenFlt;
  1033. FltLevel[53] = 2;
  1034. FltAct[53] = 130; // 54 Mos温度开路故障
  1035. FltFlg[54] = 0;
  1036. FltLevel[54] = 0;
  1037. FltAct[54] = 0;
  1038. FltFlg[55] = sfmd_flg_DCPlugTOpenFlt;
  1039. FltLevel[55] = 2;
  1040. FltAct[55] = 2; // 56 快充插头温度开路故障
  1041. FltFlg[56] = sfmd_flg_ACPlugTOpenFlt;
  1042. FltLevel[56] = 2;
  1043. FltAct[56] = 2; // 57 慢充插头温度开路故障
  1044. FltFlg[57] = sfmd_flg_heatPanT1OpenFlt;
  1045. FltLevel[57] = 2;
  1046. FltAct[57] = 2; // 58加热板#1温度开路故障
  1047. FltFlg[58] = sfmd_flg_heatPanT2OpenFlt;
  1048. FltLevel[58] = 2;
  1049. FltAct[58] = 2; // 59加热板#2温度开路故障
  1050. FltFlg[59] = 0;
  1051. FltLevel[59] = 0;
  1052. FltAct[59] = 0;
  1053. FltFlg[60] = sfmd_flg_modTRatFlt;
  1054. FltLevel[60] = 2;
  1055. FltAct[60] = 2; // 61模组温度合理性故障
  1056. FltFlg[61] = sfmd_flg_chrgMosTRatFlt;
  1057. FltLevel[61] = 2;
  1058. FltAct[61] = 130; // 62mos温度合理性故障
  1059. FltFlg[62] = 0;
  1060. FltLevel[62] = 0;
  1061. FltAct[62] = 0;
  1062. FltFlg[63] = sfmd_flg_DCPlugTRatFlt;
  1063. FltLevel[63] = 2;
  1064. FltAct[63] = 2; // 64快充插头温度合理性故障
  1065. FltFlg[64] = sfmd_flg_ACPlugTRatFlt;
  1066. FltLevel[64] = 2;
  1067. FltAct[64] = 2; // 65慢充插头温度合理性故障
  1068. FltFlg[65] = sfmd_flg_heatPanT1RatFlt;
  1069. FltLevel[65] = 2;
  1070. FltAct[65] = 2; // 66加热板#1温度合理性故障
  1071. FltFlg[66] = sfmd_flg_heatPanT2RatFlt;
  1072. FltLevel[66] = 2;
  1073. FltAct[66] = 2; // 67加热板#2温度合理性故障
  1074. FltFlg[67] = sfmd_flg_modTAllFlt;
  1075. FltLevel[67] = 4;
  1076. FltAct[67] = 250; // 模组温度全不可信
  1077. FltFlg[68] = sfmd_flg_heatPanTAllFlt;
  1078. FltLevel[68] = 3;
  1079. FltAct[68] = 18; // 加热板温度全不可信
  1080. FltFlg[69] = 0;
  1081. FltLevel[69] = 0;
  1082. FltAct[69] = 0;
  1083. FltFlg[70] = 0;
  1084. FltLevel[70] = 0;
  1085. FltAct[70] = 0; // 71 电流传感器故障 暂缺
  1086. FltFlg[71] = 0;
  1087. FltLevel[71] = 0;
  1088. FltAct[71] = 0;
  1089. FltFlg[72] = 0;
  1090. FltLevel[72] = 0;
  1091. FltAct[72] = 0;
  1092. FltFlg[73] = 0;
  1093. FltLevel[73] = 0;
  1094. FltAct[73] = 0;
  1095. FltFlg[74] = 0;
  1096. FltLevel[74] = 0;
  1097. FltAct[74] = 0;
  1098. FltFlg[75] = 0;
  1099. FltLevel[75] = 0;
  1100. FltAct[75] = 0;
  1101. FltFlg[76] = 0;
  1102. FltLevel[76] = 0;
  1103. FltAct[76] = 0;
  1104. FltFlg[77] = 0;
  1105. FltLevel[77] = 0;
  1106. FltAct[77] = 0;
  1107. FltFlg[78] = 0;
  1108. FltLevel[78] = 0;
  1109. FltAct[78] = 0;
  1110. FltFlg[79] = 0;
  1111. FltLevel[79] = 0;
  1112. FltAct[79] = 0;
  1113. FltFlg[80] = sfmd_flg_cellUOverFlt2;
  1114. FltLevel[80] = 4;
  1115. FltAct[80] = 66; // 81单体过压2级故障
  1116. FltFlg[81] = sfmd_flg_cellUOverFlt1;
  1117. FltLevel[81] = 4;
  1118. FltAct[81] = 66; // 82单体过压1级故障
  1119. FltFlg[82] = sfmd_flg_cellULowFlt2;
  1120. FltLevel[82] = 4;
  1121. FltAct[82] = 162; // 83单体欠压2级故障
  1122. FltFlg[83] = sfmd_flg_cellULowFlt1;
  1123. FltLevel[83] = 3;
  1124. FltAct[83] = 131; // 84单体欠压1级故障
  1125. FltFlg[84] = sfmd_flg_cellUDiffFlt2;
  1126. FltLevel[84] = 3;
  1127. FltAct[84] = 3; // 85压差过大2级故障
  1128. FltFlg[85] = sfmd_flg_cellUDiffFlt1;
  1129. FltLevel[85] = 2;
  1130. FltAct[85] = 2; // 86压差过大1级故障
  1131. FltFlg[86] = sfmd_flg_battUOverFlt2;
  1132. FltLevel[86] = 4;
  1133. FltAct[86] = 66; // 87总压过压2级故障
  1134. FltFlg[87] = sfmd_flg_battUOverFlt1;
  1135. FltLevel[87] = 4;
  1136. FltAct[87] = 66; // 88总压过压1级故障
  1137. FltFlg[88] = sfmd_flg_battULowFlt2;
  1138. FltLevel[88] = 4;
  1139. FltAct[88] = 162; // 89总压欠压2级故障
  1140. FltFlg[89] = sfmd_flg_battULowFlt1;
  1141. FltLevel[89] = 3;
  1142. FltAct[89] = 131; // 90总压欠压1级故障
  1143. FltFlg[90] = 0;
  1144. FltLevel[90] = 0;
  1145. FltAct[90] = 0;
  1146. FltFlg[91] = 0;
  1147. FltLevel[91] = 0;
  1148. FltAct[91] = 0;
  1149. FltFlg[92] = 0;
  1150. FltLevel[92] = 0;
  1151. FltAct[92] = 0;
  1152. FltFlg[93] = 0;
  1153. FltLevel[93] = 0;
  1154. FltAct[93] = 0;
  1155. FltFlg[94] = 0;
  1156. FltLevel[94] = 0;
  1157. FltAct[94] = 0;
  1158. FltFlg[95] = 0;
  1159. FltLevel[95] = 0;
  1160. FltAct[95] = 0;
  1161. FltFlg[96] = sfmd_flg_chrgModTOverFlt2;
  1162. FltLevel[96] = 4;
  1163. FltAct[96] = 250; // 97模组充电温度过高2级故障
  1164. FltFlg[97] = sfmd_flg_chrgModTOverFlt1;
  1165. FltLevel[97] = 3;
  1166. FltAct[97] = 145; // 98模组充电温度过高1级故障
  1167. FltFlg[98] = sfmd_flg_chrgModTLowFlt2;
  1168. FltLevel[98] = 0;
  1169. FltAct[98] = 0; // 99模组充电温度过低2级故障 =======
  1170. FltFlg[99] = sfmd_flg_chrgModTLowFlt1;
  1171. FltLevel[99] = 0;
  1172. FltAct[99] = 0; // 100模组充电温度过低1级故障 =======
  1173. FltFlg[100] = sfmd_flg_disChrgModTOverFlt2;
  1174. FltLevel[100] = 4;
  1175. FltAct[100] = 250; // 101模组充电温度过高2级故障
  1176. FltFlg[101] = sfmd_flg_disChrgModTOverFlt1;
  1177. FltLevel[101] = 3;
  1178. FltAct[101] = 145; // 102模组充电温度过高1级故障
  1179. FltFlg[102] = sfmd_flg_disChrgModTLowFlt2;
  1180. FltLevel[102] = 0;
  1181. FltAct[102] = 0; // 103模组充电温度过低2级故障 ==========
  1182. FltFlg[103] = sfmd_flg_disChrgModTLowFlt1;
  1183. FltLevel[103] = 0;
  1184. FltAct[103] = 0; // 104模组充电温度过低1级故障 ==========
  1185. FltFlg[104] = sfmd_flg_modTDiffFlt2;
  1186. FltLevel[104] = 3;
  1187. FltAct[104] = 19; // 105模组温差过大2级故障
  1188. FltFlg[105] = sfmd_flg_modTDiffFlt1;
  1189. FltLevel[105] = 1;
  1190. FltAct[105] = 0; // 106模组温差过大1级故障
  1191. FltFlg[106] = sfmd_flg_chrgMosTOverFlt2;
  1192. FltLevel[106] = 4;
  1193. FltAct[106] = 250; // 107 充电Mos温度过高2级故障
  1194. FltFlg[107] = sfmd_flg_chrgMosTOverFlt1;
  1195. FltLevel[107] = 3;
  1196. FltAct[107] = 19; // 108 充电Mos温度过高1级故障
  1197. FltFlg[108] = sfmd_flg_disChrgMosTOverFlt2;
  1198. FltLevel[108] = 4;
  1199. FltAct[108] = 250; // 109 放电Mos温度过高2级故障
  1200. FltFlg[109] = sfmd_flg_disChrgMosTOverFlt1;
  1201. FltLevel[109] = 3;
  1202. FltAct[109] = 19; // 110 放电Mos温度过高1级故障
  1203. FltFlg[110] = sfmd_flg_DCPlugTOverFlt2;
  1204. FltLevel[110] = 1;
  1205. FltAct[110] = 0; // 111 快充插头温度过高2级故障
  1206. FltFlg[111] = sfmd_flg_DCPlugTOverFlt1;
  1207. FltLevel[111] = 1;
  1208. FltAct[111] = 0; // 112 快充插头温度过高1级故障
  1209. FltFlg[112] = sfmd_flg_ACPlugTOverFlt1;
  1210. FltLevel[112] = 1;
  1211. FltAct[112] = 0; // 113 慢充插头温度过高2级故障
  1212. FltFlg[113] = sfmd_flg_ACPlugTOverFlt1;
  1213. FltLevel[113] = 1;
  1214. FltAct[113] = 0; // 114 慢充插头温度过高1级故障
  1215. FltFlg[114] = sfmd_flg_heatPanTOverFlt2;
  1216. FltLevel[114] = 3;
  1217. FltAct[114] = 18; // 115 加热板温度过高2级故障
  1218. FltFlg[115] = sfmd_flg_heatPanTOverFlt1;
  1219. FltLevel[115] = 1;
  1220. FltAct[115] = 0; // 116 加热板温度过高1级故障
  1221. FltFlg[116] = 0;
  1222. FltLevel[116] = 0;
  1223. FltAct[116] = 0;
  1224. FltFlg[117] = 0;
  1225. FltLevel[117] = 0;
  1226. FltAct[117] = 0;
  1227. FltFlg[118] = 0;
  1228. FltLevel[118] = 0;
  1229. FltAct[118] = 0;
  1230. FltFlg[119] = 0;
  1231. FltLevel[119] = 0;
  1232. FltAct[119] = 0;
  1233. FltFlg[120] = 0;
  1234. FltLevel[120] = 0;
  1235. FltAct[120] = 0;
  1236. FltFlg[121] = 0;
  1237. FltLevel[121] = 0;
  1238. FltAct[121] = 0;
  1239. FltFlg[122] = 0;
  1240. FltLevel[122] = 0;
  1241. FltAct[122] = 0;
  1242. FltFlg[123] = 0;
  1243. FltLevel[123] = 0;
  1244. FltAct[123] = 0;
  1245. FltFlg[124] = 0;
  1246. FltLevel[124] = 0;
  1247. FltAct[124] = 0;
  1248. FltFlg[125] = 0;
  1249. FltLevel[125] = 0;
  1250. FltAct[125] = 0;
  1251. FltFlg[126] = 0;
  1252. FltLevel[126] = 0;
  1253. FltAct[126] = 0;
  1254. FltFlg[127] = 0;
  1255. FltLevel[127] = 0;
  1256. FltAct[127] = 0;
  1257. FltFlg[128] = 0;
  1258. FltLevel[128] = 0;
  1259. FltAct[128] = 0;
  1260. FltFlg[129] = 0;
  1261. FltLevel[129] = 0;
  1262. FltAct[129] = 0;
  1263. FltFlg[130] = sfmd_flg_chrgCurrOverFlt;
  1264. FltLevel[130] = 4;
  1265. FltAct[130] = 66; // 131 充电电流过高
  1266. FltFlg[131] = sfmd_flg_disChrgCurrOverFlt;
  1267. FltLevel[131] = 4;
  1268. FltAct[131] = 34; // 132 放电电流过高
  1269. FltFlg[132] = 0;
  1270. FltLevel[132] = 0;
  1271. FltAct[132] = 0;
  1272. FltFlg[133] = 0;
  1273. FltLevel[133] = 0;
  1274. FltAct[133] = 0;
  1275. FltFlg[134] = 0;
  1276. FltLevel[134] = 0;
  1277. FltAct[134] = 0;
  1278. FltFlg[135] = 0;
  1279. FltLevel[135] = 0;
  1280. FltAct[135] = 0;
  1281. FltFlg[136] = 0;
  1282. FltLevel[136] = 0;
  1283. FltAct[136] = 0;
  1284. FltFlg[137] = 0;
  1285. FltLevel[137] = 0;
  1286. FltAct[137] = 0;
  1287. FltFlg[138] = 0;
  1288. FltLevel[138] = 0;
  1289. FltAct[138] = 0;
  1290. FltFlg[139] = 0;
  1291. FltLevel[139] = 0;
  1292. FltAct[139] = 0;
  1293. FltFlg[140] = 0;
  1294. FltLevel[140] = 0;
  1295. FltAct[140] = 0;
  1296. FltFlg[141] = 0;
  1297. FltLevel[141] = 0;
  1298. FltAct[141] = 0;
  1299. FltFlg[142] = 0;
  1300. FltLevel[142] = 0;
  1301. FltAct[142] = 0;
  1302. FltFlg[143] = 0;
  1303. FltLevel[143] = 0;
  1304. FltAct[143] = 0;
  1305. FltFlg[144] = 0;
  1306. FltLevel[144] = 0;
  1307. FltAct[144] = 0;
  1308. FltFlg[145] = 0;
  1309. FltLevel[145] = 0;
  1310. FltAct[145] = 0;
  1311. FltFlg[146] = 0;
  1312. FltLevel[146] = 0;
  1313. FltAct[146] = 0;
  1314. FltFlg[147] = 0;
  1315. FltLevel[147] = 0;
  1316. FltAct[147] = 0;
  1317. FltFlg[148] = 0;
  1318. FltLevel[148] = 0;
  1319. FltAct[148] = 0;
  1320. FltFlg[149] = 0;
  1321. FltLevel[149] = 0;
  1322. FltAct[149] = 0;
  1323. FltFlg[150] = sfmd_flg_chrgCurrOverMisFlt;
  1324. FltLevel[150] = 1;
  1325. FltAct[150] = 0; // 151 充电过流故障不匹配
  1326. FltFlg[151] = sfmd_flg_disChrgCurrOverMisFlt;
  1327. FltLevel[151] = 1;
  1328. FltAct[151] = 0; // 152 放电过流故障不匹配
  1329. FltFlg[152] = sfmd_flg_battULowMisFlt;
  1330. FltLevel[152] = 1;
  1331. FltAct[152] = 0; // 153 总压欠压不匹配
  1332. FltFlg[153] = sfmd_flg_battUOverMisFlt;
  1333. FltLevel[153] = 1;
  1334. FltAct[153] = 0; // 154 总压过压不匹配
  1335. FltFlg[154] = sfmd_flg_cellULowMisFlt;
  1336. FltLevel[154] = 1;
  1337. FltAct[154] = 0; // 155 单体欠压故障不匹配
  1338. FltFlg[155] = sfmd_flg_cellUOverMisFlt;
  1339. FltLevel[155] = 1;
  1340. FltAct[155] = 0; // 156 单体过压故障不匹配
  1341. FltFlg[156] = sfmd_flg_chrgModTOverMisFlt;
  1342. FltLevel[156] = 1;
  1343. FltAct[156] = 0; // 157 充电模组过温故障不匹配
  1344. FltFlg[157] = sfmd_flg_chrgModTLowMisFlt;
  1345. FltLevel[157] = 1;
  1346. FltAct[157] = 0; // 158 充电模组低温故障不匹配
  1347. FltFlg[158] = sfmd_flg_disChrgModTOverMisFlt;
  1348. FltLevel[158] = 1;
  1349. FltAct[158] = 0; // 159 放电模组过温故障不匹配
  1350. FltFlg[159] = sfmd_flg_disChrgModTLowMisFlt;
  1351. FltLevel[159] = 1;
  1352. FltAct[159] = 0; // 160 放电模组低温故障不匹配
  1353. FltFlg[160] = sfmd_flg_chrgMosTOverMisFlt;
  1354. FltLevel[160] = 1;
  1355. FltAct[160] = 0; // 161 充电Mos过温故障不匹配
  1356. FltFlg[161] = sfmd_flg_disChrgMosTOverMisFlt;
  1357. FltLevel[161] = 1;
  1358. FltAct[161] = 0; // 162 放电Mos过温故障不匹配
  1359. FltFlg[162] = sfmd_flg_socMisFlt;
  1360. FltLevel[162] = 1;
  1361. FltAct[162] = 0; // 163 soc不匹配
  1362. FltFlg[163] = sfmd_flg_sohMisFlt;
  1363. FltLevel[163] = 1;
  1364. FltAct[163] = 0; // 164 SOH 不匹配
  1365. FltFlg[164] = 0;
  1366. FltLevel[164] = 0;
  1367. FltAct[164] = 0;
  1368. FltFlg[165] = 0;
  1369. FltLevel[165] = 0;
  1370. FltAct[165] = 0;
  1371. FltFlg[166] = 0;
  1372. FltLevel[166] = 0;
  1373. FltAct[166] = 0;
  1374. FltFlg[167] = 0;
  1375. FltLevel[167] = 0;
  1376. FltAct[167] = 0;
  1377. FltFlg[168] = 0;
  1378. FltLevel[168] = 0;
  1379. FltAct[168] = 0;
  1380. FltFlg[169] = 0;
  1381. FltLevel[169] = 0;
  1382. FltAct[169] = 0;
  1383. FltFlg[170] = 0;
  1384. FltLevel[170] = 0;
  1385. FltAct[170] = 0;
  1386. FltFlg[171] = 0;
  1387. FltLevel[171] = 0;
  1388. FltAct[171] = 0;
  1389. FltFlg[172] = 0;
  1390. FltLevel[172] = 0;
  1391. FltAct[172] = 0;
  1392. FltFlg[173] = 0;
  1393. FltLevel[173] = 0;
  1394. FltAct[173] = 0;
  1395. FltFlg[174] = 0;
  1396. FltLevel[174] = 0;
  1397. FltAct[174] = 0;
  1398. FltFlg[175] = 0;
  1399. FltLevel[175] = 0;
  1400. FltAct[175] = 0;
  1401. FltFlg[176] = 0;
  1402. FltLevel[176] = 0;
  1403. FltAct[176] = 0;
  1404. FltFlg[177] = sfmd_flg_deltRFlt;
  1405. FltLevel[177] = 1;
  1406. FltAct[177] = 0;
  1407. FltFlg[178] = sfmd_flg_socJumpFlt;
  1408. FltLevel[178] = 1;
  1409. FltAct[178] = 0; // 179 soc跳变
  1410. FltFlg[179] = sfmd_flg_EEsaveFlt;
  1411. FltLevel[179] = 1;
  1412. FltAct[179] = 0; // 180 EE失效
  1413. //==========================================================================================================================================================
  1414. memset(FltCodeArr, 0, sizeof(FltCodeArr));
  1415. memset(FltLevelArr, 0, sizeof(FltLevelArr));
  1416. memset(FltActArr, 0, sizeof(FltActArr));
  1417. sfmd_num_fltNum = 0;
  1418. for (i = 0; i < FltArrLen && sfmd_num_fltNum < FltDispArrLen; i++)
  1419. {
  1420. if (FltFlg[i])
  1421. {
  1422. FltCodeArr[sfmd_num_fltNum] = i + 1;
  1423. FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
  1424. FltActArr[sfmd_num_fltNum] = FltAct[i];
  1425. sfmd_num_fltNum = sfmd_num_fltNum + 1;
  1426. if (i == 50)
  1427. {
  1428. for (j = 0; j < cmnc_num_cellUNum; j++)
  1429. {
  1430. FltCodeArr[sfmd_num_fltNum] = 1001 + j;
  1431. FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
  1432. FltActArr[sfmd_num_fltNum] = FltAct[i];
  1433. sfmd_num_fltNum = sfmd_num_fltNum + 1;
  1434. }
  1435. }
  1436. if (i == 51)
  1437. {
  1438. for (j = 0; j < cmnc_num_cellUNum; j++)
  1439. {
  1440. if (sfmv_flg_cellUOpenFlt[j])
  1441. {
  1442. FltCodeArr[sfmd_num_fltNum] = 2001 + j;
  1443. FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
  1444. FltActArr[sfmd_num_fltNum] = FltAct[i];
  1445. sfmd_num_fltNum = sfmd_num_fltNum + 1;
  1446. }
  1447. }
  1448. }
  1449. if (i == 52)
  1450. {
  1451. for (j = 0; j < cmnc_num_modTNum; j++)
  1452. {
  1453. if (sfmv_flg_modTOpenFlt[j])
  1454. {
  1455. FltCodeArr[sfmd_num_fltNum] = 3001 + j;
  1456. FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
  1457. FltActArr[sfmd_num_fltNum] = FltAct[i];
  1458. sfmd_num_fltNum = sfmd_num_fltNum + 1;
  1459. }
  1460. }
  1461. }
  1462. if (i == 60)
  1463. {
  1464. for (j = 0; j < cmnc_num_modTNum; j++)
  1465. {
  1466. if (sfmv_flg_modTRatFlt[j])
  1467. {
  1468. FltCodeArr[sfmd_num_fltNum] = 3201 + j;
  1469. FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
  1470. FltActArr[sfmd_num_fltNum] = FltAct[i];
  1471. sfmd_num_fltNum = sfmd_num_fltNum + 1;
  1472. }
  1473. }
  1474. }
  1475. }
  1476. }
  1477. memset(sfmv_idx_fltCode, 0, sizeof(sfmv_idx_fltCode));
  1478. sfmd_st_fltAct = 0;
  1479. sfmd_st_fltLevel = 0;
  1480. for (i = 0; i < sfmd_num_fltNum; i++)
  1481. {
  1482. sfmv_idx_fltCode[i] = FltLevelArr[i] * 10000 + FltCodeArr[i];
  1483. if (sfmd_st_fltLevel < FltLevelArr[i])
  1484. {
  1485. sfmd_st_fltLevel = FltLevelArr[i];
  1486. }
  1487. sfmd_st_fltAct = sfmd_st_fltAct | FltActArr[i];
  1488. }
  1489. /*
  1490. for(i=0;i < 20;i++)
  1491. {
  1492. printf("%d ",sfmv_idx_fltCode[i]);
  1493. }
  1494. printf("\n");
  1495. */
  1496. ///=====================================================================
  1497. //======================================================================
  1498. sfmd_flg_cellUInval = sfmn_flg_interComFlt || sfmd_flg_volFlt;
  1499. sfmd_flg_currInval = sfmn_flg_interComFlt || sfmd_flg_currOpenFlt;
  1500. sfmd_flg_modTInval = sfmn_flg_interComFlt || sfmd_flg_modTOpenFlt || sfmd_flg_modTRatFlt;
  1501. sfmd_flg_firstRun = false;
  1502. }
  1503. //===============================================================================