123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764 |
- #include "SFM.h"
- #define FltArrLen 200
- #define FltDispArrLen 20
- DiagThrstruct DiagThr;
- DiagTimestruct DiagTime;
- void SFM_Init(void)
- {
- sfmd_flg_firstRun = true;
- }
- void SFM(void)
- {
- static uint8_T sfmn_num_Cnt;
- boolean_T sfmn_flg_interComFlt;
- boolean_T sfmn_flg_authFlt;
- boolean_T sfmn_flg_HVILFlt;
- boolean_T sfmn_flg_chrgMosClosFlt;
- boolean_T sfmn_flg_disChrgMosClosFlt;
- static uint16_T Time0Cnt;
- static uint16_T modTMaxArr[10];
- static uint16_T SumT0;
- static uint16_T Time1Cnt;
- static uint16_T heatT1Arr[10];
- static uint16_T SumT1;
- static uint16_T Time2Cnt;
- static uint16_T heatT2Arr[10];
- static uint16_T SumT2;
- static uint16_T CellUArry[4][cmnc_num_cellUNumMax];
- static uint8_T ErrNr[cmnc_num_cellUNumMax];
- static uint8_T RecNr[cmnc_num_cellUNumMax];
- static boolean_T sfmv_flg_cellUOpenFlt[cmnc_num_cellUNumMax];
- static boolean_T ErrUFlg[cmnc_num_cellUNumMax];
- uint32_T SumU;
- uint16_T UNum;
- boolean_T sfmd_flg_volFlt;
- boolean_T Enable1;
- boolean_T Enable2;
- static uint8_T modTOpenNr[cmnc_num_modTNumMax];
- boolean_T sfmd_flg_modTOpenFlt;
- boolean_T sfmv_flg_modTOpenFlt[cmnc_num_modTNumMax];
- boolean_T sfmd_flg_chrgMosTOpenFlt;
- boolean_T sfmd_flg_DCPlugTOpenFlt;
- boolean_T sfmd_flg_ACPlugTOpenFlt;
- boolean_T sfmd_flg_heatPanT1OpenFlt;
- boolean_T sfmd_flg_heatPanT2OpenFlt;
- static uint16_T modTArr[cmnc_num_modTNumMax];
- uint16_T Tnum;
- uint32_T SumT;
- static uint8_T modTRatNr[cmnc_num_modTNumMax];
- boolean_T sfmd_flg_modTRatFlt;
- boolean_T sfmv_flg_modTRatFlt[cmnc_num_modTNumMax];
- boolean_T sfmd_flg_chrgMosTRatFlt;
- boolean_T sfmd_flg_DCPlugTRatFlt;
- boolean_T sfmd_flg_ACPlugTRatFlt;
- boolean_T sfmd_flg_heatPanT1RatFlt;
- boolean_T sfmd_flg_heatPanT2RatFlt;
- boolean_T sfmn_flg_chrgMosTRatFltOnce;
- boolean_T sfmn_flg_DCPlugTRatFltOnce;
- boolean_T sfmn_flg_ACPlugTRatFltOnce;
- boolean_T sfmn_flg_heatPanT1RatFltOnce;
- boolean_T sfmn_flg_heatPanT2RatFltOnce;
- static uint16_T sfmn_T_mosT_Delay;
- static uint16_T sfmn_T_DCPlugT_Delay;
- static uint16_T sfmn_T_ACPlugT_Delay;
- static uint16_T sfmn_T_heatPanT1_Delay;
- static uint16_T sfmn_T_heatPanT2_Delay;
- static uint16_T sfmn_T_heatPanT1_Delay1;
- static uint16_T sfmn_T_heatPanT2_Delay1;
- boolean_T sfmd_flg_modTAllFlt;
- boolean_T sfmd_flg_heatPanTAllFlt;
- boolean_T sfmd_flg_currOpenFlt;
- uint16_T sfmn_I_currAbs;
- static boolean_T sfmd_flg_cellUOverFlt2;
- static boolean_T sfmd_flg_cellUOverFlt1;
- static boolean_T sfmd_flg_cellULowFlt2;
- static boolean_T sfmd_flg_cellULowFlt1;
- static boolean_T sfmd_flg_cellUDiffFlt2;
- static boolean_T sfmd_flg_cellUDiffFlt1;
- static boolean_T sfmd_flg_battUOverFlt2;
- static boolean_T sfmd_flg_battUOverFlt1;
- static boolean_T sfmd_flg_battULowFlt2;
- static boolean_T sfmd_flg_battULowFlt1;
- boolean_T chrgFlg;
- boolean_T disChrgFlg;
- static boolean_T sfmd_flg_chrgModTOverFlt2;
- static boolean_T sfmd_flg_chrgModTOverFlt1;
- static boolean_T sfmd_flg_chrgModTLowFlt2;
- static boolean_T sfmd_flg_chrgModTLowFlt1;
- static boolean_T sfmd_flg_disChrgModTOverFlt2;
- static boolean_T sfmd_flg_disChrgModTOverFlt1;
- static boolean_T sfmd_flg_disChrgModTLowFlt2;
- static boolean_T sfmd_flg_disChrgModTLowFlt1;
- static boolean_T sfmd_flg_modTDiffFlt2;
- static boolean_T sfmd_flg_modTDiffFlt1;
- static boolean_T sfmd_flg_chrgMosTOverFlt2;
- static boolean_T sfmd_flg_chrgMosTOverFlt1;
- static boolean_T sfmd_flg_disChrgMosTOverFlt2;
- static boolean_T sfmd_flg_disChrgMosTOverFlt1;
- static boolean_T sfmd_flg_DCPlugTOverFlt2;
- static boolean_T sfmd_flg_DCPlugTOverFlt1;
- static boolean_T sfmd_flg_ACPlugTOverFlt2;
- static boolean_T sfmd_flg_ACPlugTOverFlt1;
- static boolean_T sfmd_flg_heatPanTOverFlt2_1;
- static boolean_T sfmd_flg_heatPanTOverFlt2_2;
- boolean_T sfmd_flg_heatPanTOverFlt2;
- static boolean_T sfmd_flg_heatPanTOverFlt1_1;
- static boolean_T sfmd_flg_heatPanTOverFlt1_2;
- boolean_T sfmd_flg_heatPanTOverFlt1;
- static boolean_T sfmd_flg_chrgCurrOverFlt;
- static boolean_T sfmd_flg_disChrgCurrOverFlt;
- boolean_T sfmd_flg_chrgCurrOverMisFlt;
- boolean_T sfmd_flg_disChrgCurrOverMisFlt;
- boolean_T sfmd_flg_battULowMisFlt;
- boolean_T sfmd_flg_battUOverMisFlt;
- boolean_T sfmd_flg_cellULowMisFlt;
- boolean_T sfmd_flg_cellUOverMisFlt;
- boolean_T sfmd_flg_chrgModTOverMisFlt;
- boolean_T sfmd_flg_chrgModTLowMisFlt;
- boolean_T sfmd_flg_disChrgModTOverMisFlt;
- boolean_T sfmd_flg_disChrgModTLowMisFlt;
- boolean_T sfmd_flg_chrgMosTOverMisFlt;
- boolean_T sfmd_flg_disChrgMosTOverMisFlt;
- boolean_T sfmd_flg_socMisFlt;
- boolean_T sfmd_flg_sohMisFlt;
- boolean_T sfmd_flg_socJumpFlt;
- boolean_T sfmd_flg_EEsaveFlt;
- static uint16_T sfmn_pct_bcuSoc_Delay;
- static uint16_T noDisChrgCnt;
- static int16_T sfmd_I_curr_Delay;
- static boolean_T sfmn_flg_Udrop;
- static boolean_T sfmd_flg_heatclear;
- static boolean_T sfmn_flg_volFlt_keep;
- static uint16_T CntA;
- static uint16_T ModTStor[4][cmnc_num_modTNumMax];
- static boolean_T sfmn_flg_Tup;
- static boolean_T sfmn_flg_modTOpenFlt_keep;
- static uint16_T CntB;
- static boolean_T sfmn_flg_urtRecFlt_Delay = false;
- int32_T SumR;
- int32_T SumRR;
- boolean_T sfmd_flg_deltRFlt;
- static uint8_T deltRFltNr[cmnc_num_cellUNumMax];
- boolean_T FltFlg[FltArrLen];
- uint16_T FltLevel[FltArrLen];
- uint8_T FltAct[FltArrLen];
- uint16_T FltCodeArr[FltDispArrLen];
- uint16_T FltLevelArr[FltDispArrLen];
- uint8_T FltActArr[FltDispArrLen];
- uint16_T i;
- uint16_T j;
- uint16_T k;
- if (sfmn_flg_urtRecFlt_Delay)
- {
- sfmd_flg_firstRun = true;
- }
- sfmn_flg_urtRecFlt_Delay = ihd_flg_urtRecFlt;
- //初值
- if (sfmd_flg_firstRun)
- {
- sfmn_num_Cnt = 10;
- memset(&DiagThr, 0, sizeof(DiagThr));
- memset(&DiagTime, 0, sizeof(DiagTime));
- memset(heatT1Arr, 0, sizeof(heatT1Arr));
- memset(heatT2Arr, 0, sizeof(heatT2Arr));
- memset(ErrNr, 0, sizeof(ErrNr));
- memset(sfmv_flg_cellUOpenFlt, 0, sizeof(sfmv_flg_cellUOpenFlt));
- memset(ErrUFlg, 0, sizeof(ErrUFlg));
- memset(RecNr, 0, sizeof(RecNr));
- memset(modTOpenNr, 0, sizeof(modTOpenNr));
- memset(modTRatNr, 0, sizeof(modTRatNr));
- memset(deltRFltNr, 0, sizeof(deltRFltNr));
- sfmd_flg_cellUOverFlt2 = false;
- sfmd_flg_cellUOverFlt1 = false;
- sfmd_flg_cellULowFlt2 = false;
- sfmd_flg_cellULowFlt1 = false;
- sfmd_flg_cellUDiffFlt2 = false;
- sfmd_flg_cellUDiffFlt1 = false;
- sfmd_flg_battUOverFlt2 = false;
- sfmd_flg_battUOverFlt1 = false;
- sfmd_flg_battULowFlt2 = false;
- sfmd_flg_battULowFlt1 = false;
- sfmd_flg_chrgModTOverFlt2 = false;
- sfmd_flg_chrgModTOverFlt1 = false;
- sfmd_flg_chrgModTLowFlt2 = false;
- sfmd_flg_chrgModTLowFlt1 = false;
- sfmd_flg_disChrgModTOverFlt2 = false;
- sfmd_flg_disChrgModTOverFlt1 = false;
- sfmd_flg_disChrgModTLowFlt2 = false;
- sfmd_flg_disChrgModTLowFlt1 = false;
- sfmd_flg_modTDiffFlt2 = false;
- sfmd_flg_modTDiffFlt1 = false;
- sfmd_flg_chrgMosTOverFlt2 = false;
- sfmd_flg_chrgMosTOverFlt1 = false;
- sfmd_flg_disChrgMosTOverFlt2 = false;
- sfmd_flg_disChrgMosTOverFlt1 = false;
- sfmd_flg_DCPlugTOverFlt2 = false;
- sfmd_flg_DCPlugTOverFlt1 = false;
- sfmd_flg_ACPlugTOverFlt2 = false;
- sfmd_flg_ACPlugTOverFlt1 = false;
- sfmd_flg_heatPanTOverFlt2_1 = false;
- sfmd_flg_heatPanTOverFlt2_2 = false;
- sfmd_flg_heatPanTOverFlt1_1 = false;
- sfmd_flg_heatPanTOverFlt1_2 = false;
- sfmd_flg_chrgCurrOverFlt = false;
- sfmd_flg_disChrgCurrOverFlt = false;
- noDisChrgCnt = 0;
- sfmd_I_curr_Delay = ihd_I_curr;
- sfmn_flg_Udrop = false;
- sfmd_flg_heatclear = false;
- sfmn_flg_volFlt_keep = false;
- CntA = 10;
- sfmn_flg_Tup = false;
- sfmn_flg_modTOpenFlt_keep = false;
- CntB = 0;
- sfmn_T_mosT_Delay = ihd_T_mosT;
- sfmn_T_DCPlugT_Delay = ihd_T_DCPlugT;
- sfmn_T_ACPlugT_Delay = ihd_T_ACPlugT;
- sfmn_T_heatPanT1_Delay = ihd_T_heatPanT1;
- sfmn_T_heatPanT2_Delay = ihd_T_heatPanT2;
- sfmn_T_heatPanT1_Delay1 = ihd_T_heatPanT1;
- sfmn_T_heatPanT2_Delay1 = ihd_T_heatPanT2;
- sfmn_pct_bcuSoc_Delay = socd_pct_bcuSoc;
- }
- // 故障清楚指令
- if (ihd_flg_DTCClear)
- {
- sfmd_flg_mainCirClosFltEi = false;
- sfmd_flg_mainCirClosFltEo = false;
- sfmd_flg_heatCirOpenFltEi = false;
- sfmd_flg_heatCirOpenFltEo = false;
- sfmd_flg_heatCirClosFltEi = false;
- sfmd_flg_heatCirClosFltEo = false;
- sfmd_flg_heatRunFltEi = false;
- sfmd_flg_heatRunFltEo = false;
- sfmd_flg_iscFltEi = false;
- sfmd_flg_iscFltEo = false;
- }
- //=======================================================================================
- //====================================故障诊断 =======================================
- //=======================================================================================
- //=======================================================================================
- // 1 内网通信故障
- if (ihd_flg_urtRecFlt)
- {
- sfmn_flg_interComFlt = true;
- }
- else
- {
- sfmn_flg_interComFlt = false;
- }
- // 5 认证失败故障
- sfmn_flg_authFlt = (ihd_st_authFaild == 1) && (!sfmn_flg_interComFlt);
- // 11 高压互锁故障
- if (ihd_flg_HVILFlt)
- {
- sfmn_flg_HVILFlt = true;
- }
- else
- {
- sfmn_flg_HVILFlt = false;
- }
- // 16
- sfmd_flg_iscFltEo = iscd_flg_flt[0] || iscd_flg_flt[1] || iscd_flg_flt[2] || sfmd_flg_iscFltEi || sfmd_flg_iscFltEo;
- // 22 充电Mos失效故障
- sfmn_flg_chrgMosClosFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_flg_chrgMosClosFlt, &DiagTime.N22, 2);
- // 24 放电Mos失效故障
- sfmn_flg_disChrgMosClosFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_flg_disChrgMosClosFlt, &DiagTime.N24, 2);
- // 34 主回路常闭故障 //(充电MOS及放电MOS,主继电器断开 使能)
- 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;
- // 52 电压开路故障
- sfmn_num_Cnt = sfmn_num_Cnt + 1;
- if (!sfmn_flg_interComFlt && sfmn_num_Cnt >= 0)
- {
- sfmn_num_Cnt = 0;
- // 矩阵更新
- for (j = 0; j < 4 && sfmd_flg_firstRun; j++)
- {
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- CellUArry[j][i] = ihv_V_cellU[i];
- }
- }
- for (j = 0; j < 3; j++)
- {
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- CellUArry[j][i] = CellUArry[j + 1][i];
- }
- }
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- CellUArry[j][i] = ihv_V_cellU[i];
- }
- // 故障判断
- for (i = 0; i < cmnc_num_cellUNum - 1; i++)
- {
- if ((int16_T)(CellUArry[3][i] - CellUArry[1][i]) < -50 && (int16_T)(CellUArry[3][i + 1] - CellUArry[1][i + 1]) > 50)
- {
- ErrNr[i] = ErrNr[i] + 1;
- }
- else
- {
- ErrNr[i] = 0;
- }
- if (ErrNr[i] >= 2 || ((int16_T)(CellUArry[3][i] - CellUArry[2][i]) < -1000 && (int16_T)(CellUArry[3][i + 1] - CellUArry[2][i + 1]) > 1000))
- {
- sfmv_flg_cellUOpenFlt[i] = true;
- ErrUFlg[i] = true;
- ErrUFlg[i + 1] = true;
- }
- if (sfmv_flg_cellUOpenFlt[i])
- {
- for (k = 0; k < i; k++)
- {
- if ((int16_T)(CellUArry[3][i - k] - CellUArry[2][i - k]) < -200)
- {
- sfmv_flg_cellUOpenFlt[i - k] = true;
- ErrUFlg[i - k] = true;
- }
- }
- }
- }
- }
- //
- if (!sfmn_flg_interComFlt)
- {
- sfmd_V_cellUMax = 0;
- sfmd_V_cellUMin = 10000;
- SumU = 0;
- UNum = 0;
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (!ErrUFlg[i])
- {
- SumU = SumU + ihv_V_cellU[i];
- UNum = UNum + 1;
- if (sfmd_V_cellUMax < ihv_V_cellU[i])
- {
- sfmd_V_cellUMax = ihv_V_cellU[i];
- sfmd_idx_cellUMax = i;
- }
- if (sfmd_V_cellUMin > ihv_V_cellU[i])
- {
- sfmd_V_cellUMin = ihv_V_cellU[i];
- sfmd_idx_cellUMin = i;
- }
- }
- }
- if (sfmd_V_cellUMax - sfmd_V_cellUMin > 5000) // 2021 10.24
- {
- sfmd_V_cellUAvrg = (SumU - sfmd_V_cellUMax - sfmd_V_cellUMin) / (UNum - 2);
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > 1500)
- {
- ErrUFlg[i] = true;
- }
- if (!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < -1500)
- {
- ErrUFlg[i] = true;
- sfmv_flg_cellUOpenFlt[i] = true;
- }
- }
- }
- else
- {
- sfmd_V_cellUAvrg = (SumU - sfmd_V_cellUMax - sfmd_V_cellUMin) / (UNum - 2);
- }
- // 恢复
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (ErrUFlg[i])
- {
- if ((int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < 200 && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > -200)
- {
- RecNr[i] = (RecNr[i] + 1) > 200 ? 200 : (RecNr[i] + 1);
- }
- else
- {
- RecNr[i] = 0;
- }
- if (RecNr[i] >= 2)
- {
- sfmv_flg_cellUOpenFlt[i] = false;
- ErrUFlg[i] = false;
- }
- }
- }
- }
- //=======================电压处理======================================
- SumU = 0;
- sfmd_flg_volFlt = false;
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (ErrUFlg[i] && !sfmn_flg_interComFlt)
- {
- sfmv_V_cellU[i] = sfmd_V_cellUAvrg;
- }
- else
- {
- sfmv_flg_cellUOpenFlt[i] = false;
- sfmv_V_cellU[i] = ihv_V_cellU[i];
- }
- SumU = SumU + sfmv_V_cellU[i];
- sfmd_flg_volFlt = sfmd_flg_volFlt || sfmv_flg_cellUOpenFlt[i];
- }
- sfmd_V_battU = (uint16_T)(SumU * 0.01);
- // 53 模组温度开路故障
- sfmd_flg_modTOpenFlt = false;
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- if (ihv_T_modT[i] == 10 && !sfmn_flg_interComFlt) //-30℃
- {
- modTOpenNr[i] = (modTOpenNr[i] + 1) > 200 ? 200 : (modTOpenNr[i] + 1);
- }
- else
- {
- modTOpenNr[i] = 0;
- }
- if (modTOpenNr[i] >= 2)
- {
- sfmv_flg_modTOpenFlt[i] = true;
- }
- else
- {
- sfmv_flg_modTOpenFlt[i] = false;
- }
- sfmd_flg_modTOpenFlt = sfmd_flg_modTOpenFlt || sfmv_flg_modTOpenFlt[i];
- }
- // 54 Mos温度开路故障
- sfmd_flg_chrgMosTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_mosT == 10, &DiagTime.N54, 2);
- // 56 快充插头温度开路故障
- sfmd_flg_DCPlugTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_DCPlugT == 0, &DiagTime.N56, 2);
- // 57 慢充插头温度开路故障
- sfmd_flg_ACPlugTOpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_ACPlugT == 0, &DiagTime.N57, 2);
- // 58 加热板#1温度开路故障
- sfmd_flg_heatPanT1OpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_heatPanT1 == 0, &DiagTime.N58, 2);
- // 59 加热板#2温度开路故障
- sfmd_flg_heatPanT2OpenFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, ihd_T_heatPanT2 == 0, &DiagTime.N59, 2);
- // 61 模组温度合理性故障
- sfmd_flg_modTRatFlt = false;
- for (i = 0; i < cmnc_num_modTNum && sfmd_flg_firstRun; i++)
- {
- modTArr[i] = ihv_T_modT[i];
- }
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- 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)
- {
- modTRatNr[i] = (modTRatNr[i] + 1) > 200 ? 200 : (modTRatNr[i] + 1);
- }
- else
- {
- modTRatNr[i] = 0;
- modTArr[i] = ihv_T_modT[i];
- }
- if (modTRatNr[i] >= 2)
- {
- sfmv_flg_modTRatFlt[i] = true;
- }
- else
- {
- sfmv_flg_modTRatFlt[i] = false;
- }
- sfmd_flg_modTRatFlt = sfmd_flg_modTRatFlt || sfmv_flg_modTRatFlt[i];
- }
- // printf("%d,%d,%d,%d\n",sfmn_T_mosT_Delay,ihd_T_mosT,FirstRun_SFM,ihd_flg_urtRecFlt);
- // 62 充电Mos 温度合理性故障
- 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);
- if (!sfmn_flg_chrgMosTRatFltOnce)
- {
- sfmn_T_mosT_Delay = ihd_T_mosT;
- }
- sfmd_flg_chrgMosTRatFlt = JudgeTimeSystem(1, sfmn_flg_chrgMosTRatFltOnce, &DiagTime.N62, 2);
- // 64 快充插头温度合理性故障
- 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);
- if (!sfmn_flg_chrgMosTRatFltOnce)
- {
- sfmn_T_DCPlugT_Delay = ihd_T_DCPlugT;
- }
- sfmd_flg_DCPlugTRatFlt = JudgeTimeSystem(1, sfmn_flg_DCPlugTRatFltOnce, &DiagTime.N64, 2);
- // 65 慢插头温度合理性故障
- 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);
- if (!sfmn_flg_ACPlugTRatFltOnce)
- {
- sfmn_T_ACPlugT_Delay = ihd_T_ACPlugT;
- }
- sfmd_flg_ACPlugTRatFlt = JudgeTimeSystem(1, sfmn_flg_ACPlugTRatFltOnce, &DiagTime.N65, 2);
- // 66 加热板#1 温度合理性故障
- 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);
- if (!sfmn_flg_heatPanT1RatFltOnce)
- {
- sfmn_T_heatPanT1_Delay = ihd_T_heatPanT1;
- }
- sfmd_flg_heatPanT1RatFlt = JudgeTimeSystem(1, sfmn_flg_heatPanT1RatFltOnce, &DiagTime.N66, 2);
- // 67 加热板#2 温度合理性故障
- 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);
- if (!sfmn_flg_heatPanT2RatFltOnce)
- {
- sfmn_T_heatPanT2_Delay = ihd_T_heatPanT2;
- }
- sfmd_flg_heatPanT2RatFlt = JudgeTimeSystem(1, sfmn_flg_heatPanT2RatFltOnce, &DiagTime.N67, 2);
- // 68 模组温度全部不可用
- sfmd_flg_modTAllFlt = true;
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- sfmd_flg_modTAllFlt = sfmd_flg_modTAllFlt && (sfmv_flg_modTOpenFlt[i] || sfmv_flg_modTRatFlt[i]);
- }
- // 温度处理
- sfmd_T_modTMax = 0;
- sfmd_T_modTMin = 200;
- Tnum = 0;
- SumT = 0;
- if (!sfmd_flg_modTAllFlt)
- {
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- if (!sfmv_flg_modTRatFlt[i] && !sfmv_flg_modTOpenFlt[i])
- {
- SumT = SumT + ihv_T_modT[i];
- Tnum = Tnum + 1;
- if (sfmd_T_modTMax < ihv_T_modT[i])
- {
- sfmd_T_modTMax = ihv_T_modT[i];
- sfmd_idx_modTMax = i;
- }
- if (sfmd_T_modTMin > ihv_T_modT[i])
- {
- sfmd_T_modTMin = ihv_T_modT[i];
- sfmd_idx_modTMin = i;
- }
- }
- }
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- if (!sfmv_flg_modTRatFlt[i] && !sfmv_flg_modTOpenFlt[i])
- {
- sfmv_T_modT[i] = ihv_T_modT[i];
- }
- else
- {
- sfmv_T_modT[i] = SumT / Tnum;
- }
- }
- }
- // 69 加热板温度全部开路故障
- sfmd_flg_heatPanTAllFlt = (sfmd_flg_heatPanT1OpenFlt || sfmd_flg_heatPanT1RatFlt) && (sfmd_flg_heatPanT2OpenFlt || sfmd_flg_heatPanT2RatFlt);
- // 71 电流传感器故障
- sfmd_flg_currOpenFlt = false;
- sfmd_I_curr = ihd_I_curr;
- // 81 单体过压故障2级
- 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);
- // 82 单体过压故障1级
- 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;
- // 83 单体欠压故障2级
- 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);
- // 84 单体欠压故障1级
- 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;
- // 85 压差过大2级
- 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);
- // 86 压差过大1级
- 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;
- // 87 总压过压2级
- 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);
- // 88 总压过压1级
- 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;
- // 89 总压欠压2级
- 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);
- // 90 总压欠压1级
- 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;
- chrgFlg = ihd_st_workStat == 2;
- disChrgFlg = ihd_st_workStat != 2;
- // 97 模组充电温度过高2级故障
- 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);
- // 98 模组充电温度过高1级故障
- 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;
- // 99 模组充电温度过低2级故障
- 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);
- // 100 模组充电温度过低1级故障
- 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;
- // 101 模组放电温度过高2级故障
- 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);
- // 102 模组放电温度过高1级故障
- 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;
- // 103 模组放电温度过低2级故障
- 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);
- // 104 模组放电温度过低1级故障
- 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;
- //
- // 105 模组温差2级故障
- 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);
- // 106 模组温差1级故障
- 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;
- // 107 充电Mos温度过高2级故障
- 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);
- // 108 充电Mos温度过高1级故障
- 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;
- // 109 放电Mos温度过高2级故障
- 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);
- // 110 放电Mos温度过高1级故障
- 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;
- // 111 快充插头温度过高2级故障
- 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);
- // 112 快充插头温度过高1级故障
- 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;
- // 113 慢充插头温度过高2级故障
- 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);
- // 114 慢充插头温度过高1级故障
- 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;
- // 115 加热板温度过高2级故障
- 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);
- 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);
- sfmd_flg_heatPanTOverFlt2 = sfmd_flg_heatPanTOverFlt2_1 || sfmd_flg_heatPanTOverFlt2_2;
- // 116 加热板温度过高1级故障
- 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;
- 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;
- sfmd_flg_heatPanTOverFlt1 = sfmd_flg_heatPanTOverFlt1_1 || sfmd_flg_heatPanTOverFlt1_2;
- sfmd_I_curr = ihd_I_curr;
- sfmn_I_currAbs = (uint16_T)(sfmd_I_curr > 0 ? sfmd_I_curr : -sfmd_I_curr);
- // 131 充电电流过高
- 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);
- // 132 放电电流过高
- 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);
- // 151 充电过流故障不匹配
- sfmd_flg_chrgCurrOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgCurrOverFlt != ihd_flg_chrgCurrOverFlt, &DiagTime.N151, 2);
- // 152 放电过流故障不匹配
- sfmd_flg_disChrgCurrOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgCurrOverFlt != ihd_flg_disChrgCurrOverFlt, &DiagTime.N152, 2);
- // 153 总压欠压不匹配
- sfmd_flg_battULowMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_battULowFlt2 != ihd_flg_battULowFlt, &DiagTime.N153, 2);
- // 154 总压过压不匹配
- sfmd_flg_battUOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_battUOverFlt2 != ihd_flg_battUOverFlt, &DiagTime.N154, 2);
- // 155 单体欠压故障不匹配
- sfmd_flg_cellULowMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_cellULowFlt2 != ihd_flg_cellULowFlt, &DiagTime.N155, 2);
- // 156 单体过压故障不匹配
- sfmd_flg_cellUOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_cellUOverFlt2 != ihd_flg_cellUOverFlt, &DiagTime.N156, 2);
- // 157 充电模组过温故障不匹配
- sfmd_flg_chrgModTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgModTOverFlt2 != ihd_flg_chrgModTOverFlt, &DiagTime.N157, 2);
- // 158 充电模组低温故障不匹配
- sfmd_flg_chrgModTLowMisFlt = JudgeTimeSystem(0 && !sfmn_flg_interComFlt, sfmd_flg_chrgModTLowFlt2 != ihd_flg_chrgModTLowFlt, &DiagTime.N158, 2);
- // 159 放电模组过温故障不匹配
- sfmd_flg_disChrgModTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgModTOverFlt2 != ihd_flg_disChrgModTOverFlt, &DiagTime.N159, 2);
- // 160 放电模组低温故障不匹配
- sfmd_flg_disChrgModTLowMisFlt = JudgeTimeSystem(0 && !sfmn_flg_interComFlt, sfmd_flg_disChrgModTLowFlt2 != ihd_flg_disChrgModTLowFlt, &DiagTime.N160, 2);
- // 161 充电Mos过温故障不匹配
- sfmd_flg_chrgMosTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_chrgMosTOverFlt2 != ihd_flg_chrgMosTOverFlt, &DiagTime.N161, 2);
- // 162 放电Mos过温故障不匹配
- sfmd_flg_disChrgMosTOverMisFlt = JudgeTimeSystem(!sfmn_flg_interComFlt, sfmd_flg_disChrgMosTOverFlt2 != ihd_flg_disChrgMosTOverFlt, &DiagTime.N162, 2);
- // 163 soc不匹配
- 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);
- // 164 SOH 不匹配
- 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);
- // 178
- sfmd_flg_deltRFlt = false;
- if (!sfmn_flg_interComFlt)
- {
- SumR = 0;
- SumRR = 0;
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (!cdmv_flg_inval[i])
- {
- SumR = SumR + cdmv_R_deltOhm[i];
- SumRR = SumRR + cdmv_R_deltOhm[i] * cdmv_R_deltOhm[i];
- }
- }
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- 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)
- {
- deltRFltNr[i] = (deltRFltNr[i] + 1) > 200 ? 200 : (deltRFltNr[i] + 1);
- }
- else
- {
- deltRFltNr[i] = 0;
- }
- }
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if (deltRFltNr[i] > 60)
- {
- sfmd_flg_deltRFlt = true;
- }
- }
- }
- // 179 soc跳变
- 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);
- sfmn_pct_bcuSoc_Delay = socd_pct_bcuSoc;
- // 180 EE失效
- sfmd_flg_EEsaveFlt = ihd_flg_EESaveFlt;
- // 21 热失控故障
- if (sfmd_I_curr > -2 && (sfmd_I_curr_Delay - sfmd_I_curr) > -2 && (sfmd_I_curr_Delay - sfmd_I_curr) < 2)
- {
- noDisChrgCnt = (noDisChrgCnt + 1) > 200 ? 200 : (noDisChrgCnt + 1);
- }
- else
- {
- noDisChrgCnt = 0;
- }
- sfmd_I_curr_Delay = sfmd_I_curr;
- if (noDisChrgCnt > 60)
- {
- for (i = 0; i < cmnc_num_cellUNum; i++)
- {
- if ((int16_T)(CellUArry[3][i] - CellUArry[0][i]) < -100)
- {
- sfmn_flg_Udrop = true;
- }
- }
- if (sfmd_flg_heatclear)
- {
- sfmn_flg_Udrop = false;
- }
- }
- ////
- if (sfmd_flg_volFlt)
- {
- sfmn_flg_volFlt_keep = true;
- }
- if (sfmd_flg_heatclear)
- {
- sfmn_flg_volFlt_keep = false;
- }
- //
- CntA = CntA + 1;
- if (CntA >= 0)
- {
- CntA = 0;
- for (j = 0; j < 4 && sfmd_flg_firstRun; j++)
- {
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- ModTStor[j][i] = sfmv_T_modT[i];
- }
- }
- for (j = 0; j < 3; j++)
- {
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- ModTStor[j][i] = ModTStor[j + 1][i];
- }
- }
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- ModTStor[j][i] = sfmv_T_modT[i];
- }
- for (i = 0; i < cmnc_num_modTNum; i++)
- {
- 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)
- {
- sfmn_flg_Tup = true;
- }
- }
- if (sfmd_flg_heatclear)
- {
- sfmn_flg_Tup = false;
- }
- }
- //
- if (sfmd_flg_modTOpenFlt)
- {
- sfmn_flg_modTOpenFlt_keep = true;
- }
- if (sfmd_flg_heatclear)
- {
- sfmn_flg_modTOpenFlt_keep = false;
- }
- //////
- if (sfmn_flg_Udrop || sfmn_flg_volFlt_keep || sfmn_flg_Tup || sfmn_flg_modTOpenFlt_keep)
- {
- CntB = (CntB + 1) > 200 ? 200 : (CntB + 1);
- }
- 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)
- {
- sfmd_flg_heatRunFltEo = true;
- }
- if (!sfmd_flg_heatRunFltEo && CntB > 180)
- {
- sfmd_flg_heatclear = true;
- CntB = 0;
- }
- else
- {
- sfmd_flg_heatclear = false;
- }
- ////32 加热回路常闭故障
- if (!sfmd_flg_modTAllFlt)
- {
- if (sfmd_flg_firstRun)
- {
- for (i = 0; i < 10; i++)
- {
- modTMaxArr[i] = sfmd_T_modTMax;
- }
- Time0Cnt = 0;
- SumT0 = 0;
- }
- Time0Cnt++;
- SumT0 = SumT0 + sfmd_T_modTMax;
- if (Time0Cnt >= 60)
- {
- for (i = 0; i < 9; i++)
- {
- modTMaxArr[i] = modTMaxArr[i + 1];
- }
- modTMaxArr[9] = SumT0 / Time0Cnt;
- Time0Cnt = 0;
- SumT0 = 0;
- }
- }
- 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)
- {
- if (sfmd_flg_firstRun)
- {
- for (i = 0; i < 10; i++)
- {
- heatT1Arr[i] = ihd_T_heatPanT1;
- }
- Time1Cnt = 0;
- SumT1 = 0;
- }
- Time1Cnt++;
- SumT1 = SumT1 + ihd_T_heatPanT1;
- if (Time1Cnt >= 60)
- {
- for (i = 0; i < 9; i++)
- {
- heatT1Arr[i] = heatT1Arr[i + 1];
- }
- heatT1Arr[9] = SumT1 / Time1Cnt;
- Time1Cnt = 0;
- SumT1 = 0;
- }
- }
- sfmn_T_heatPanT1_Delay1 = ihd_T_heatPanT1;
- 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)
- {
- if (sfmd_flg_firstRun)
- {
- for (i = 0; i < 10; i++)
- {
- heatT2Arr[i] = ihd_T_heatPanT2;
- }
- Time2Cnt = 0;
- SumT2 = 0;
- }
- Time2Cnt++;
- SumT2 = SumT2 + ihd_T_heatPanT2;
- if (Time2Cnt >= 60)
- {
- for (i = 0; i < 9; i++)
- {
- heatT2Arr[i] = heatT2Arr[i + 1];
- }
- heatT2Arr[9] = SumT2 / Time2Cnt;
- Time2Cnt = 0;
- SumT2 = 0;
- }
- }
- sfmn_T_heatPanT2_Delay1 = ihd_T_heatPanT2;
- // 32 加热回路常闭故障
- Enable1 = JudgeTimeSystem(1, tmsd_st_heatAct == 0, &DiagTime.N32, 600);
- 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;
- // 33 加热回路常开故障
- Enable2 = JudgeTimeSystem(1, tmsd_st_heatAct == 1, &DiagTime.N33, 600);
- Enable2 = (DiagTime.N33 == 600);
- 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;
- //================================================================================================================================================================
- //================================================================================================================================================================
- //===========故障码 故障等级 禁止状态===================================================================
- //================================================================================================================================================================
- memset(FltFlg, 0, sizeof(FltFlg));
- memset(FltLevel, 0, sizeof(FltLevel));
- memset(FltAct, 0, sizeof(FltAct));
- FltFlg[0] = sfmn_flg_interComFlt;
- FltLevel[0] = 2;
- FltAct[0] = 2; // 1 内网通讯故障
- FltFlg[1] = 0;
- FltLevel[1] = 0;
- FltAct[1] = 0; // 2 外部通讯故障
- FltFlg[2] = 0;
- FltLevel[2] = 0;
- FltAct[2] = 0; // 3 通讯模块故障
- FltFlg[3] = 0;
- FltLevel[3] = 0;
- FltAct[3] = 0; // 4 通讯天线故障
- FltFlg[4] = sfmn_flg_authFlt;
- FltLevel[4] = 4;
- FltAct[4] = 34; // 5 认证失败
- FltFlg[5] = 0;
- FltLevel[5] = 0;
- FltAct[5] = 0; // 6 预留#5
- FltFlg[6] = 0;
- FltLevel[6] = 0;
- FltAct[6] = 0; // 7 预留#4
- FltFlg[7] = 0;
- FltLevel[7] = 0;
- FltAct[7] = 0; // 8 预留#3
- FltFlg[8] = 0;
- FltLevel[8] = 0;
- FltAct[8] = 0; // 9 预留#2
- FltFlg[9] = 0;
- FltLevel[9] = 0;
- FltAct[9] = 0; // 10 预留#1
- FltFlg[10] = sfmn_flg_HVILFlt;
- FltLevel[10] = 0;
- FltAct[10] = 0; // 11 高压互锁
- FltFlg[11] = 0;
- FltLevel[11] = 0;
- FltAct[11] = 0; // 12 硬件短路保护
- FltFlg[12] = 0;
- FltLevel[12] = 0;
- FltAct[12] = 0; // 13 绝缘模块故障
- FltFlg[13] = 0;
- FltLevel[13] = 0;
- FltAct[13] = 0; // 14 绝缘故障
- FltFlg[14] = 0;
- FltLevel[14] = 0;
- FltAct[14] = 0; // 15 绝缘告警
- FltFlg[15] = sfmd_flg_iscFltEo;
- FltLevel[15] = 4;
- FltAct[15] = 250; // 16
- FltFlg[16] = 0;
- FltLevel[16] = 0;
- FltAct[16] = 0; // 17 预留4
- FltFlg[17] = 0;
- FltLevel[17] = 0;
- FltAct[17] = 0; // 18 预留3
- FltFlg[18] = 0;
- FltLevel[18] = 0;
- FltAct[18] = 0; // 19 预留2
- FltFlg[19] = 0;
- FltLevel[19] = 0;
- FltAct[19] = 0; // 20 预留1
- FltFlg[20] = sfmd_flg_heatRunFltEo;
- FltLevel[20] = 5;
- FltAct[20] = 255; // 21 热失控;
- FltFlg[21] = sfmn_flg_chrgMosClosFlt;
- FltLevel[21] = 4;
- FltAct[21] = 106; // 22充电MOS常闭故障
- FltFlg[22] = 0;
- FltLevel[22] = 0;
- FltAct[22] = 0; // 23充电MOS常开故障
- FltFlg[23] = sfmn_flg_disChrgMosClosFlt;
- FltLevel[23] = 4;
- FltAct[23] = 106; // 24 放电Mos常闭故障
- FltFlg[24] = 0;
- FltLevel[24] = 0;
- FltAct[24] = 0; // 25 放电Mos常开故障
- FltFlg[25] = 0;
- FltLevel[25] = 0;
- FltAct[25] = 0;
- FltFlg[26] = 0;
- FltLevel[26] = 0;
- FltAct[26] = 0;
- FltFlg[27] = 0;
- FltLevel[27] = 0;
- FltAct[27] = 0;
- FltFlg[28] = 0;
- FltLevel[28] = 0;
- FltAct[28] = 0;
- FltFlg[29] = 0;
- FltLevel[29] = 0;
- FltAct[29] = 0;
- FltFlg[30] = 0;
- FltLevel[30] = 0;
- FltAct[30] = 0;
- FltFlg[31] = sfmd_flg_heatCirClosFltEo;
- FltLevel[31] = 4;
- FltAct[31] = 250; // 32 加热回路常闭故障
- FltFlg[32] = sfmd_flg_heatCirOpenFltEo;
- FltLevel[32] = 1;
- FltAct[32] = 0; // 33 加热回路常开故障
- FltFlg[33] = sfmd_flg_mainCirClosFltEo;
- FltLevel[33] = 4;
- FltAct[33] = 250; // 34 主回路常闭故障
- FltFlg[34] = 0;
- FltLevel[34] = 0;
- FltAct[34] = 0;
- FltFlg[35] = 0;
- FltLevel[35] = 0;
- FltAct[35] = 0;
- FltFlg[36] = 0;
- FltLevel[36] = 0;
- FltAct[36] = 0;
- FltFlg[37] = 0;
- FltLevel[37] = 0;
- FltAct[37] = 0;
- FltFlg[38] = 0;
- FltLevel[38] = 0;
- FltAct[38] = 0;
- FltFlg[39] = 0;
- FltLevel[39] = 0;
- FltAct[39] = 0;
- FltFlg[40] = 0;
- FltLevel[40] = 0;
- FltAct[40] = 0;
- FltFlg[41] = 0;
- FltLevel[41] = 0;
- FltAct[41] = 0;
- FltFlg[42] = 0;
- FltLevel[42] = 0;
- FltAct[42] = 0;
- FltFlg[43] = 0;
- FltLevel[43] = 0;
- FltAct[43] = 0;
- FltFlg[44] = 0;
- FltLevel[44] = 0;
- FltAct[44] = 0;
- FltFlg[45] = 0;
- FltLevel[45] = 0;
- FltAct[45] = 0;
- FltFlg[46] = 0;
- FltLevel[46] = 0;
- FltAct[46] = 0;
- FltFlg[47] = 0;
- FltLevel[47] = 0;
- FltAct[47] = 0;
- FltFlg[48] = 0;
- FltLevel[48] = 0;
- FltAct[48] = 0;
- FltFlg[49] = 0;
- FltLevel[49] = 0;
- FltAct[49] = 0;
- FltFlg[50] = 0;
- FltLevel[50] = 0;
- FltAct[50] = 0; // 51均衡失效(合一) 暂缺
- FltFlg[51] = sfmd_flg_volFlt;
- FltLevel[51] = 4;
- FltAct[51] = 234; // 52电压开路故障(合一)
- FltFlg[52] = sfmd_flg_modTOpenFlt;
- FltLevel[52] = 2;
- FltAct[52] = 2; // 53温度开路故障(合一)
- FltFlg[53] = sfmd_flg_chrgMosTOpenFlt;
- FltLevel[53] = 2;
- FltAct[53] = 130; // 54 Mos温度开路故障
- FltFlg[54] = 0;
- FltLevel[54] = 0;
- FltAct[54] = 0;
- FltFlg[55] = sfmd_flg_DCPlugTOpenFlt;
- FltLevel[55] = 2;
- FltAct[55] = 2; // 56 快充插头温度开路故障
- FltFlg[56] = sfmd_flg_ACPlugTOpenFlt;
- FltLevel[56] = 2;
- FltAct[56] = 2; // 57 慢充插头温度开路故障
- FltFlg[57] = sfmd_flg_heatPanT1OpenFlt;
- FltLevel[57] = 2;
- FltAct[57] = 2; // 58加热板#1温度开路故障
- FltFlg[58] = sfmd_flg_heatPanT2OpenFlt;
- FltLevel[58] = 2;
- FltAct[58] = 2; // 59加热板#2温度开路故障
- FltFlg[59] = 0;
- FltLevel[59] = 0;
- FltAct[59] = 0;
- FltFlg[60] = sfmd_flg_modTRatFlt;
- FltLevel[60] = 2;
- FltAct[60] = 2; // 61模组温度合理性故障
- FltFlg[61] = sfmd_flg_chrgMosTRatFlt;
- FltLevel[61] = 2;
- FltAct[61] = 130; // 62mos温度合理性故障
- FltFlg[62] = 0;
- FltLevel[62] = 0;
- FltAct[62] = 0;
- FltFlg[63] = sfmd_flg_DCPlugTRatFlt;
- FltLevel[63] = 2;
- FltAct[63] = 2; // 64快充插头温度合理性故障
- FltFlg[64] = sfmd_flg_ACPlugTRatFlt;
- FltLevel[64] = 2;
- FltAct[64] = 2; // 65慢充插头温度合理性故障
- FltFlg[65] = sfmd_flg_heatPanT1RatFlt;
- FltLevel[65] = 2;
- FltAct[65] = 2; // 66加热板#1温度合理性故障
- FltFlg[66] = sfmd_flg_heatPanT2RatFlt;
- FltLevel[66] = 2;
- FltAct[66] = 2; // 67加热板#2温度合理性故障
- FltFlg[67] = sfmd_flg_modTAllFlt;
- FltLevel[67] = 4;
- FltAct[67] = 250; // 模组温度全不可信
- FltFlg[68] = sfmd_flg_heatPanTAllFlt;
- FltLevel[68] = 3;
- FltAct[68] = 18; // 加热板温度全不可信
- FltFlg[69] = 0;
- FltLevel[69] = 0;
- FltAct[69] = 0;
- FltFlg[70] = 0;
- FltLevel[70] = 0;
- FltAct[70] = 0; // 71 电流传感器故障 暂缺
- FltFlg[71] = 0;
- FltLevel[71] = 0;
- FltAct[71] = 0;
- FltFlg[72] = 0;
- FltLevel[72] = 0;
- FltAct[72] = 0;
- FltFlg[73] = 0;
- FltLevel[73] = 0;
- FltAct[73] = 0;
- FltFlg[74] = 0;
- FltLevel[74] = 0;
- FltAct[74] = 0;
- FltFlg[75] = 0;
- FltLevel[75] = 0;
- FltAct[75] = 0;
- FltFlg[76] = 0;
- FltLevel[76] = 0;
- FltAct[76] = 0;
- FltFlg[77] = 0;
- FltLevel[77] = 0;
- FltAct[77] = 0;
- FltFlg[78] = 0;
- FltLevel[78] = 0;
- FltAct[78] = 0;
- FltFlg[79] = 0;
- FltLevel[79] = 0;
- FltAct[79] = 0;
- FltFlg[80] = sfmd_flg_cellUOverFlt2;
- FltLevel[80] = 4;
- FltAct[80] = 66; // 81单体过压2级故障
- FltFlg[81] = sfmd_flg_cellUOverFlt1;
- FltLevel[81] = 4;
- FltAct[81] = 66; // 82单体过压1级故障
- FltFlg[82] = sfmd_flg_cellULowFlt2;
- FltLevel[82] = 4;
- FltAct[82] = 162; // 83单体欠压2级故障
- FltFlg[83] = sfmd_flg_cellULowFlt1;
- FltLevel[83] = 3;
- FltAct[83] = 131; // 84单体欠压1级故障
- FltFlg[84] = sfmd_flg_cellUDiffFlt2;
- FltLevel[84] = 3;
- FltAct[84] = 3; // 85压差过大2级故障
- FltFlg[85] = sfmd_flg_cellUDiffFlt1;
- FltLevel[85] = 2;
- FltAct[85] = 2; // 86压差过大1级故障
- FltFlg[86] = sfmd_flg_battUOverFlt2;
- FltLevel[86] = 4;
- FltAct[86] = 66; // 87总压过压2级故障
- FltFlg[87] = sfmd_flg_battUOverFlt1;
- FltLevel[87] = 4;
- FltAct[87] = 66; // 88总压过压1级故障
- FltFlg[88] = sfmd_flg_battULowFlt2;
- FltLevel[88] = 4;
- FltAct[88] = 162; // 89总压欠压2级故障
- FltFlg[89] = sfmd_flg_battULowFlt1;
- FltLevel[89] = 3;
- FltAct[89] = 131; // 90总压欠压1级故障
- FltFlg[90] = 0;
- FltLevel[90] = 0;
- FltAct[90] = 0;
- FltFlg[91] = 0;
- FltLevel[91] = 0;
- FltAct[91] = 0;
- FltFlg[92] = 0;
- FltLevel[92] = 0;
- FltAct[92] = 0;
- FltFlg[93] = 0;
- FltLevel[93] = 0;
- FltAct[93] = 0;
- FltFlg[94] = 0;
- FltLevel[94] = 0;
- FltAct[94] = 0;
- FltFlg[95] = 0;
- FltLevel[95] = 0;
- FltAct[95] = 0;
- FltFlg[96] = sfmd_flg_chrgModTOverFlt2;
- FltLevel[96] = 4;
- FltAct[96] = 250; // 97模组充电温度过高2级故障
- FltFlg[97] = sfmd_flg_chrgModTOverFlt1;
- FltLevel[97] = 3;
- FltAct[97] = 145; // 98模组充电温度过高1级故障
- FltFlg[98] = sfmd_flg_chrgModTLowFlt2;
- FltLevel[98] = 0;
- FltAct[98] = 0; // 99模组充电温度过低2级故障 =======
- FltFlg[99] = sfmd_flg_chrgModTLowFlt1;
- FltLevel[99] = 0;
- FltAct[99] = 0; // 100模组充电温度过低1级故障 =======
- FltFlg[100] = sfmd_flg_disChrgModTOverFlt2;
- FltLevel[100] = 4;
- FltAct[100] = 250; // 101模组充电温度过高2级故障
- FltFlg[101] = sfmd_flg_disChrgModTOverFlt1;
- FltLevel[101] = 3;
- FltAct[101] = 145; // 102模组充电温度过高1级故障
- FltFlg[102] = sfmd_flg_disChrgModTLowFlt2;
- FltLevel[102] = 0;
- FltAct[102] = 0; // 103模组充电温度过低2级故障 ==========
- FltFlg[103] = sfmd_flg_disChrgModTLowFlt1;
- FltLevel[103] = 0;
- FltAct[103] = 0; // 104模组充电温度过低1级故障 ==========
- FltFlg[104] = sfmd_flg_modTDiffFlt2;
- FltLevel[104] = 3;
- FltAct[104] = 19; // 105模组温差过大2级故障
- FltFlg[105] = sfmd_flg_modTDiffFlt1;
- FltLevel[105] = 1;
- FltAct[105] = 0; // 106模组温差过大1级故障
- FltFlg[106] = sfmd_flg_chrgMosTOverFlt2;
- FltLevel[106] = 4;
- FltAct[106] = 250; // 107 充电Mos温度过高2级故障
- FltFlg[107] = sfmd_flg_chrgMosTOverFlt1;
- FltLevel[107] = 3;
- FltAct[107] = 19; // 108 充电Mos温度过高1级故障
- FltFlg[108] = sfmd_flg_disChrgMosTOverFlt2;
- FltLevel[108] = 4;
- FltAct[108] = 250; // 109 放电Mos温度过高2级故障
- FltFlg[109] = sfmd_flg_disChrgMosTOverFlt1;
- FltLevel[109] = 3;
- FltAct[109] = 19; // 110 放电Mos温度过高1级故障
- FltFlg[110] = sfmd_flg_DCPlugTOverFlt2;
- FltLevel[110] = 1;
- FltAct[110] = 0; // 111 快充插头温度过高2级故障
- FltFlg[111] = sfmd_flg_DCPlugTOverFlt1;
- FltLevel[111] = 1;
- FltAct[111] = 0; // 112 快充插头温度过高1级故障
- FltFlg[112] = sfmd_flg_ACPlugTOverFlt1;
- FltLevel[112] = 1;
- FltAct[112] = 0; // 113 慢充插头温度过高2级故障
- FltFlg[113] = sfmd_flg_ACPlugTOverFlt1;
- FltLevel[113] = 1;
- FltAct[113] = 0; // 114 慢充插头温度过高1级故障
- FltFlg[114] = sfmd_flg_heatPanTOverFlt2;
- FltLevel[114] = 3;
- FltAct[114] = 18; // 115 加热板温度过高2级故障
- FltFlg[115] = sfmd_flg_heatPanTOverFlt1;
- FltLevel[115] = 1;
- FltAct[115] = 0; // 116 加热板温度过高1级故障
- FltFlg[116] = 0;
- FltLevel[116] = 0;
- FltAct[116] = 0;
- FltFlg[117] = 0;
- FltLevel[117] = 0;
- FltAct[117] = 0;
- FltFlg[118] = 0;
- FltLevel[118] = 0;
- FltAct[118] = 0;
- FltFlg[119] = 0;
- FltLevel[119] = 0;
- FltAct[119] = 0;
- FltFlg[120] = 0;
- FltLevel[120] = 0;
- FltAct[120] = 0;
- FltFlg[121] = 0;
- FltLevel[121] = 0;
- FltAct[121] = 0;
- FltFlg[122] = 0;
- FltLevel[122] = 0;
- FltAct[122] = 0;
- FltFlg[123] = 0;
- FltLevel[123] = 0;
- FltAct[123] = 0;
- FltFlg[124] = 0;
- FltLevel[124] = 0;
- FltAct[124] = 0;
- FltFlg[125] = 0;
- FltLevel[125] = 0;
- FltAct[125] = 0;
- FltFlg[126] = 0;
- FltLevel[126] = 0;
- FltAct[126] = 0;
- FltFlg[127] = 0;
- FltLevel[127] = 0;
- FltAct[127] = 0;
- FltFlg[128] = 0;
- FltLevel[128] = 0;
- FltAct[128] = 0;
- FltFlg[129] = 0;
- FltLevel[129] = 0;
- FltAct[129] = 0;
- FltFlg[130] = sfmd_flg_chrgCurrOverFlt;
- FltLevel[130] = 4;
- FltAct[130] = 66; // 131 充电电流过高
- FltFlg[131] = sfmd_flg_disChrgCurrOverFlt;
- FltLevel[131] = 4;
- FltAct[131] = 34; // 132 放电电流过高
- FltFlg[132] = 0;
- FltLevel[132] = 0;
- FltAct[132] = 0;
- FltFlg[133] = 0;
- FltLevel[133] = 0;
- FltAct[133] = 0;
- FltFlg[134] = 0;
- FltLevel[134] = 0;
- FltAct[134] = 0;
- FltFlg[135] = 0;
- FltLevel[135] = 0;
- FltAct[135] = 0;
- FltFlg[136] = 0;
- FltLevel[136] = 0;
- FltAct[136] = 0;
- FltFlg[137] = 0;
- FltLevel[137] = 0;
- FltAct[137] = 0;
- FltFlg[138] = 0;
- FltLevel[138] = 0;
- FltAct[138] = 0;
- FltFlg[139] = 0;
- FltLevel[139] = 0;
- FltAct[139] = 0;
- FltFlg[140] = 0;
- FltLevel[140] = 0;
- FltAct[140] = 0;
- FltFlg[141] = 0;
- FltLevel[141] = 0;
- FltAct[141] = 0;
- FltFlg[142] = 0;
- FltLevel[142] = 0;
- FltAct[142] = 0;
- FltFlg[143] = 0;
- FltLevel[143] = 0;
- FltAct[143] = 0;
- FltFlg[144] = 0;
- FltLevel[144] = 0;
- FltAct[144] = 0;
- FltFlg[145] = 0;
- FltLevel[145] = 0;
- FltAct[145] = 0;
- FltFlg[146] = 0;
- FltLevel[146] = 0;
- FltAct[146] = 0;
- FltFlg[147] = 0;
- FltLevel[147] = 0;
- FltAct[147] = 0;
- FltFlg[148] = 0;
- FltLevel[148] = 0;
- FltAct[148] = 0;
- FltFlg[149] = 0;
- FltLevel[149] = 0;
- FltAct[149] = 0;
- FltFlg[150] = sfmd_flg_chrgCurrOverMisFlt;
- FltLevel[150] = 1;
- FltAct[150] = 0; // 151 充电过流故障不匹配
- FltFlg[151] = sfmd_flg_disChrgCurrOverMisFlt;
- FltLevel[151] = 1;
- FltAct[151] = 0; // 152 放电过流故障不匹配
- FltFlg[152] = sfmd_flg_battULowMisFlt;
- FltLevel[152] = 1;
- FltAct[152] = 0; // 153 总压欠压不匹配
- FltFlg[153] = sfmd_flg_battUOverMisFlt;
- FltLevel[153] = 1;
- FltAct[153] = 0; // 154 总压过压不匹配
- FltFlg[154] = sfmd_flg_cellULowMisFlt;
- FltLevel[154] = 1;
- FltAct[154] = 0; // 155 单体欠压故障不匹配
- FltFlg[155] = sfmd_flg_cellUOverMisFlt;
- FltLevel[155] = 1;
- FltAct[155] = 0; // 156 单体过压故障不匹配
- FltFlg[156] = sfmd_flg_chrgModTOverMisFlt;
- FltLevel[156] = 1;
- FltAct[156] = 0; // 157 充电模组过温故障不匹配
- FltFlg[157] = sfmd_flg_chrgModTLowMisFlt;
- FltLevel[157] = 1;
- FltAct[157] = 0; // 158 充电模组低温故障不匹配
- FltFlg[158] = sfmd_flg_disChrgModTOverMisFlt;
- FltLevel[158] = 1;
- FltAct[158] = 0; // 159 放电模组过温故障不匹配
- FltFlg[159] = sfmd_flg_disChrgModTLowMisFlt;
- FltLevel[159] = 1;
- FltAct[159] = 0; // 160 放电模组低温故障不匹配
- FltFlg[160] = sfmd_flg_chrgMosTOverMisFlt;
- FltLevel[160] = 1;
- FltAct[160] = 0; // 161 充电Mos过温故障不匹配
- FltFlg[161] = sfmd_flg_disChrgMosTOverMisFlt;
- FltLevel[161] = 1;
- FltAct[161] = 0; // 162 放电Mos过温故障不匹配
- FltFlg[162] = sfmd_flg_socMisFlt;
- FltLevel[162] = 1;
- FltAct[162] = 0; // 163 soc不匹配
- FltFlg[163] = sfmd_flg_sohMisFlt;
- FltLevel[163] = 1;
- FltAct[163] = 0; // 164 SOH 不匹配
- FltFlg[164] = 0;
- FltLevel[164] = 0;
- FltAct[164] = 0;
- FltFlg[165] = 0;
- FltLevel[165] = 0;
- FltAct[165] = 0;
- FltFlg[166] = 0;
- FltLevel[166] = 0;
- FltAct[166] = 0;
- FltFlg[167] = 0;
- FltLevel[167] = 0;
- FltAct[167] = 0;
- FltFlg[168] = 0;
- FltLevel[168] = 0;
- FltAct[168] = 0;
- FltFlg[169] = 0;
- FltLevel[169] = 0;
- FltAct[169] = 0;
- FltFlg[170] = 0;
- FltLevel[170] = 0;
- FltAct[170] = 0;
- FltFlg[171] = 0;
- FltLevel[171] = 0;
- FltAct[171] = 0;
- FltFlg[172] = 0;
- FltLevel[172] = 0;
- FltAct[172] = 0;
- FltFlg[173] = 0;
- FltLevel[173] = 0;
- FltAct[173] = 0;
- FltFlg[174] = 0;
- FltLevel[174] = 0;
- FltAct[174] = 0;
- FltFlg[175] = 0;
- FltLevel[175] = 0;
- FltAct[175] = 0;
- FltFlg[176] = 0;
- FltLevel[176] = 0;
- FltAct[176] = 0;
- FltFlg[177] = sfmd_flg_deltRFlt;
- FltLevel[177] = 1;
- FltAct[177] = 0;
- FltFlg[178] = sfmd_flg_socJumpFlt;
- FltLevel[178] = 1;
- FltAct[178] = 0; // 179 soc跳变
- FltFlg[179] = sfmd_flg_EEsaveFlt;
- FltLevel[179] = 1;
- FltAct[179] = 0; // 180 EE失效
- //==========================================================================================================================================================
- memset(FltCodeArr, 0, sizeof(FltCodeArr));
- memset(FltLevelArr, 0, sizeof(FltLevelArr));
- memset(FltActArr, 0, sizeof(FltActArr));
- sfmd_num_fltNum = 0;
- for (i = 0; i < FltArrLen && sfmd_num_fltNum < FltDispArrLen; i++)
- {
- if (FltFlg[i])
- {
- FltCodeArr[sfmd_num_fltNum] = i + 1;
- FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
- FltActArr[sfmd_num_fltNum] = FltAct[i];
- sfmd_num_fltNum = sfmd_num_fltNum + 1;
- if (i == 50)
- {
- for (j = 0; j < cmnc_num_cellUNum; j++)
- {
- FltCodeArr[sfmd_num_fltNum] = 1001 + j;
- FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
- FltActArr[sfmd_num_fltNum] = FltAct[i];
- sfmd_num_fltNum = sfmd_num_fltNum + 1;
- }
- }
- if (i == 51)
- {
- for (j = 0; j < cmnc_num_cellUNum; j++)
- {
- if (sfmv_flg_cellUOpenFlt[j])
- {
- FltCodeArr[sfmd_num_fltNum] = 2001 + j;
- FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
- FltActArr[sfmd_num_fltNum] = FltAct[i];
- sfmd_num_fltNum = sfmd_num_fltNum + 1;
- }
- }
- }
- if (i == 52)
- {
- for (j = 0; j < cmnc_num_modTNum; j++)
- {
- if (sfmv_flg_modTOpenFlt[j])
- {
- FltCodeArr[sfmd_num_fltNum] = 3001 + j;
- FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
- FltActArr[sfmd_num_fltNum] = FltAct[i];
- sfmd_num_fltNum = sfmd_num_fltNum + 1;
- }
- }
- }
- if (i == 60)
- {
- for (j = 0; j < cmnc_num_modTNum; j++)
- {
- if (sfmv_flg_modTRatFlt[j])
- {
- FltCodeArr[sfmd_num_fltNum] = 3201 + j;
- FltLevelArr[sfmd_num_fltNum] = FltLevel[i];
- FltActArr[sfmd_num_fltNum] = FltAct[i];
- sfmd_num_fltNum = sfmd_num_fltNum + 1;
- }
- }
- }
- }
- }
- memset(sfmv_idx_fltCode, 0, sizeof(sfmv_idx_fltCode));
- sfmd_st_fltAct = 0;
- sfmd_st_fltLevel = 0;
- for (i = 0; i < sfmd_num_fltNum; i++)
- {
- sfmv_idx_fltCode[i] = FltLevelArr[i] * 10000 + FltCodeArr[i];
- if (sfmd_st_fltLevel < FltLevelArr[i])
- {
- sfmd_st_fltLevel = FltLevelArr[i];
- }
- sfmd_st_fltAct = sfmd_st_fltAct | FltActArr[i];
- }
- /*
- for(i=0;i < 20;i++)
- {
- printf("%d ",sfmv_idx_fltCode[i]);
- }
- printf("\n");
- */
- ///=====================================================================
- //======================================================================
- sfmd_flg_cellUInval = sfmn_flg_interComFlt || sfmd_flg_volFlt;
- sfmd_flg_currInval = sfmn_flg_interComFlt || sfmd_flg_currOpenFlt;
- sfmd_flg_modTInval = sfmn_flg_interComFlt || sfmd_flg_modTOpenFlt || sfmd_flg_modTRatFlt;
- sfmd_flg_firstRun = false;
- }
- //===============================================================================
|