/*
 * File: BCMR_DChrgDiag.c
 *
 * Code generated for Simulink model 'BCMR_DChrgDiag'.
 *
 * Model version                  : 1.789
 * Simulink Coder version         : 8.11 (R2016b) 25-Aug-2016
 * C/C++ source code generated on : Wed Nov 17 15:52:44 2021
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Infineon->TriCore
 * Code generation objectives:
 *    1. MISRA C:2012 guidelines
 *    2. Execution efficiency
 * Validation result: Not run
 */

#include "BCMR_DChrgDiag.h"
#include "BCMR_DChrgDiag_private.h"

/* Exported data definition */

/* Volatile memory section */
#define ASW1_OEM_START_SEC_DEFAULT_RAM1_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Definition for custom storage class: Volatile */
volatile uint8_T DFC_APlusChk_ASW;
volatile uint8_T DFC_CC2Chk_ASW;
volatile uint8_T DFC_DChrgBattTMax_ASW;
volatile uint8_T DFC_DChrgBattTMin_ASW;
volatile uint8_T DFC_DChrgCCSTmt_ASW;
volatile uint8_T DFC_DChrgCHMTmt_ASW;
volatile uint8_T DFC_DChrgCMLTmt_ASW;
volatile uint8_T DFC_DChrgCRMTmt_ASW;
volatile uint8_T DFC_DChrgCROTmt_ASW;
volatile uint8_T DFC_DChrgCSDTmt_ASW;
volatile uint8_T DFC_DChrgCSTTmt_ASW;
volatile uint8_T DFC_DChrgCurrMish_ASW;
volatile uint8_T DFC_DChrgFobd_ASW;
volatile uint8_T DFC_DChrgHvOnFail_ASW;
volatile uint8_T DFC_DChrgLowTempCurrMish_ASW;
volatile uint8_T DFC_DChrgMsgTmt_ASW;
volatile uint8_T DFC_DChrgParaChk_ASW;
volatile uint8_T DFC_DChrgStakeErr_ASW;
volatile uint8_T DFC_DChrgStkCurrErr_ASW;
volatile uint8_T DFC_DChrgStkVoltErr_ASW;
volatile uint8_T DFC_DChrgTCnntMax_ASW;
volatile uint8_T DFC_DChrgVoltMish_ASW;
volatile uint8_T DFC_EVCCDevFlt_ASW;
volatile uint8_T DFC_EVCCPileComFlt_ASW;
volatile uint8_T DFC_EVCCPileHwFlt_ASW;
volatile uint8_T DFC_EVCCSplyPwrFlt_ASW;
volatile uint8_T DFC_EVCCVehComFlt_ASW;
volatile uint8_T DFC_EVCCVehHwFlt_ASW;

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM1_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"
#define ASW1_OEM_START_SEC_DEFAULT_RAM1_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Definition for custom storage class: OutputSignal */
volatile boolean_T BCMR_bCC2VoltHighErrDet;
volatile boolean_T BCMR_bCC2VoltHighErrHeal;
volatile boolean_T BCMR_bCC2VoltLowErrDet;
volatile boolean_T BCMR_bCC2VoltLowErrHeal;
volatile boolean_T BCMR_bChrgCnnttErrDet;
volatile boolean_T BCMR_bChrgCnnttErrHeal;
volatile boolean_T BCMR_bDChrgCnnt;
volatile boolean_T BCMR_bDChrgCurrModifyEna;
volatile boolean_T BCMR_bDChrgCutOffVoltOvrCurrDet;
volatile boolean_T BCMR_bDChrgCutOffVoltOvrCurrHeal;
volatile boolean_T BCMR_bDChrgFobd;
volatile boolean_T BCMR_bDChrgLowTempCurrOvrCnt;
volatile boolean_T BCMR_bDChrgLowTempOvrCurrErrDet;
volatile boolean_T BCMR_bDChrgLowTempOvrCurrErrHeal;
volatile boolean_T BCMR_bDChrgOvrSafeCellVoltDet;
volatile boolean_T BCMR_bDChrgOvrSafeCellVoltHeal;
volatile boolean_T BCMR_bDChrgStopEna;
volatile boolean_T BCMR_bDChrgTempHighErrDet;
volatile boolean_T BCMR_bDChrgTempHighErrHeal;
volatile boolean_T BCMR_bDChrgTempLowErrDet;
volatile boolean_T BCMR_bDChrgTempLowErrHeal;
volatile boolean_T BCMR_bDChrgWkup;
volatile boolean_T BCMR_bDcChrgCurrOutRngErrDet;
volatile boolean_T BCMR_bDcChrgCurrOutRngErrHeal;
volatile boolean_T BCMR_bDcChrgOvrCurrErrDet;
volatile boolean_T BCMR_bDcChrgOvrCurrErrHeal;
volatile boolean_T BCMR_bDcChrgVoltOutRngErrDet;
volatile boolean_T BCMR_bDcChrgVoltOutRngErrHeal;
volatile boolean_T BCMR_bDcComErrDet;
volatile boolean_T BCMR_bDcComErrHeal;
volatile boolean_T BCMR_bDcOutputContErrDet;
volatile boolean_T BCMR_bDcOutputContErrHeal;
volatile uint8_T BCMR_stBattDChrgCurrOvrErr;
volatile uint8_T BCMR_stBattDChrgLowTempCurrOvrErr;
volatile uint8_T BCMR_stBattDChrgVoltOvrErr;
volatile uint8_T BCMR_stBattNormalTempDChrgCurrOvrErr;
volatile uint8_T BCMR_stCC2ChkVoltErr;
volatile uint8_T BCMR_stDChrgCnntErr;
volatile uint8_T BCMR_stDChrgModeBcl;
volatile uint8_T BCMR_stDcBattCellVoltErr;
volatile uint8_T BCMR_stDcBattInsulationErr;
volatile uint8_T BCMR_stDcBattSocErr;
volatile uint8_T BCMR_stDcBattTempOvrErr;
volatile uint8_T BCMR_stDcOutpCnntOvrTempErr;
volatile uint8_T BCMR_stDcRchCellVoltLmt;
volatile uint8_T BCMR_stMainRelayErr;
volatile uint8_T BCMR_stOtherErr;

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM1_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Block signals (auto storage) */
B_BCMR_DChrgDiag_T BCMR_DChrgDiag_B;

/* Block states (auto storage) */
DW_BCMR_DChrgDiag_T BCMR_DChrgDiag_DW;

/* Previous zero-crossings (trigger) states */
PrevZCX_BCMR_DChrgDiag_T BCMR_DChrgDiag_PrevZCX;

/* Model step function */
void BCMR_DChrgDiag_step(void)
{
  real32_T rtb_Switch2;
  boolean_T rtb_LogicalOperator4;
  boolean_T rtb_LogicalOperator1;
  real32_T rtb_Subtract1;
  real32_T rtb_DataTypeConversion;
  real32_T rtb_Product_ho;
  real32_T rtb_Product_oy;
  boolean_T rtb_Compare_dc;
  boolean_T rtb_Compare_cpj;
  boolean_T rtb_Compare_az;
  boolean_T rtb_Compare_nd;
  boolean_T rtb_LogicalOperator8_h;
  uint8_T rtb_Switch_m;
  uint8_T rtb_Switch4_jg;
  int32_T tmp;
  real32_T tmp_0;
  real32_T rtb_LogicalOperator4_0;
  if (BCMR_EVCCDiagSw_C) {
    rtb_Switch2 = GcRTE_EvccDtc_numb;
  } else {
    rtb_Switch2 = 0.0F;
  }

  rtb_LogicalOperator4 = ((rtb_Switch2 == 57347.0F) || (rtb_Switch2 == 57344.0F));
  rtb_LogicalOperator1 = ((rtb_Switch2 != 57347.0F) && (rtb_Switch2 != 57344.0F));
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_h2) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCDevFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCDevFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCDevFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_nw;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_h2 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_nw = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCDevFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCDevFlt_ASW = 0U;
  }

  rtb_LogicalOperator4 = ((rtb_Switch2 == 49272.0F) || (rtb_Switch2 == 53521.0F));
  rtb_LogicalOperator1 = ((rtb_Switch2 != 49272.0F) && (rtb_Switch2 != 53521.0F));
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_b0) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCVehComFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCVehComFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCVehComFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_h;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_b0 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_h = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCVehComFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCVehComFlt_ASW = 0U;
  }

  rtb_LogicalOperator4 = (rtb_Switch2 == 54627.0F);
  rtb_LogicalOperator1 = (rtb_Switch2 != 54627.0F);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_h) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCSplyPwrFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCSplyPwrFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCSplyPwrFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_p;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_h = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_p = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCSplyPwrFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCSplyPwrFlt_ASW = 0U;
  }

  rtb_LogicalOperator4 = (rtb_Switch2 == 8183.0F);
  rtb_LogicalOperator1 = (rtb_Switch2 != 8183.0F);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_ji) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCPileComFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCPileComFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCPileComFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_n;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_ji = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_n = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCPileComFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCPileComFlt_ASW = 0U;
  }

  if (BCMR_EVCCDiagccSw_C) {
    tmp = (rtb_Switch2 == 8180.0F);
  } else {
    tmp = 0;
  }

  rtb_LogicalOperator4 = ((rtb_Switch2 == 8176.0F) || (rtb_Switch2 == 8177.0F) ||
    (rtb_Switch2 == 8178.0F) || (tmp != 0));
  rtb_LogicalOperator1 = ((rtb_Switch2 != 8176.0F) && (rtb_Switch2 != 8177.0F) &&
    (rtb_Switch2 != 8178.0F) && (rtb_Switch2 != 8180.0F));
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_k) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCPileHwFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCPileHwFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCPileHwFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_dp;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_k = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_dp = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCPileHwFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCPileHwFlt_ASW = 0U;
  }

  if (BCMR_EVCCDiagccSw_C) {
    tmp = (rtb_Switch2 == 8180.0F);
  } else {
    tmp = 0;
  }

  rtb_LogicalOperator4 = ((tmp != 0) || (rtb_Switch2 == 8181.0F) || (rtb_Switch2 ==
    8182.0F) || (rtb_Switch2 == 8184.0F));
  rtb_LogicalOperator1 = ((rtb_Switch2 != 8180.0F) && (rtb_Switch2 != 8181.0F) &&
    (rtb_Switch2 != 8182.0F) && (rtb_Switch2 != 8184.0F));
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_f) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCVehHwFlt_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_EVCCVehHwFlt_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EVCCVehHwFlt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_c;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_f = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_c = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_EVCCVehHwFlt_ASW = rtb_Switch4_jg;
  } else {
    DFC_EVCCVehHwFlt_ASW = 0U;
  }

  rtb_LogicalOperator4 = !COMR_bDcCanBusOff;
  if (COMR_bDcCanBusOff) {
    tmp_0 = BCMR_tiDChrgDiagBase_C;
  } else {
    tmp_0 = 0.0F;
  }

  if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_bd) {
    rtb_DataTypeConversion = BCMR_tiDChrgDetDiagDebs_C;
  } else {
    rtb_DataTypeConversion = BCMR_DChrgDiag_DW.Delay_DSTATE_bd;
  }

  rtb_Product_ho = (tmp_0 + rtb_DataTypeConversion) * (real32_T)
    COMR_bDcCanBusOff;
  BCMR_bDcComErrDet = (rtb_Product_ho > BCMR_tiDChrgDetDiagDebs_C);
  BCMR_DChrgDiag_DW.Delay_DSTATE_bd = rtb_Product_ho;
  if (rtb_LogicalOperator4) {
    rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
  } else {
    rtb_LogicalOperator4_0 = 0.0F;
  }

  if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_opi) {
    tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
  } else {
    tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_opi;
  }

  rtb_Product_ho = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
    rtb_LogicalOperator4;
  BCMR_bDcComErrHeal = (rtb_Product_ho > BCMR_tiDChrgHealDiagDebs_C);
  BCMR_DChrgDiag_DW.Delay_DSTATE_opi = rtb_Product_ho;
  rtb_Switch4_jg = (uint8_T)(COMR_stVcuFalutLvl >= 3);
  if (rtb_Switch4_jg != 0) {
    rtb_Product_ho = BCMR_tiDChrgDiagBase_C;
  } else {
    rtb_Product_ho = 0.0F;
  }

  if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_kx) {
    tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
  } else {
    tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_kx;
  }

  rtb_Product_ho = (real32_T)(rtb_Switch4_jg != 0) * (rtb_Product_ho + tmp_0);
  BCMR_DChrgDiag_DW.Delay_DSTATE_kx = rtb_Product_ho;
  BCMR_stOtherErr = (uint8_T)((rtb_Product_ho > BCMR_tiDChrgDetDiagDebs_C) ||
    HVSR_flgHvilFault || (DSMR_stFaultRank >= 3) || BCMR_bDcComErrDet ||
    ((COMR_stPwrUpDwnVcuReq == 2) && ((BCMR_stDChrgMode == 3) ||
    (BCMR_stDChrgMode == 4))));
  if (BCMR_stOtherErr == 1) {
    rtb_Product_ho = 0.0F;
  } else {
    rtb_Product_ho = BCMR_stDChrgGbFlowTimeout;
  }

  BCMR_bDChrgWkup = BSPR_bDCWkUp;
  if (BCMR_H1U0PlatformSwDiag_C) {
    tmp_0 = BSPR_uKl30;
  } else {
    tmp_0 = 5.0F;
  }

  rtb_DataTypeConversion = (real32_T)((real32_T)fabs(BSPR_uCC2Volt - 0.5F *
    tmp_0) <= BCMR_uCC2ChkDiffDet_C);
  rtb_Subtract1 = rtb_DataTypeConversion - BCMR_DChrgDiag_DW.Delay1_DSTATE;
  rtb_LogicalOperator4 = (rtb_Subtract1 == 1.0F);
  if (rtb_LogicalOperator4) {
    rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
  } else {
    rtb_LogicalOperator4_0 = 0.0F;
  }

  if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_lg) {
    tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
  } else {
    tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_lg;
  }

  rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
    rtb_LogicalOperator4;
  BCMR_DChrgDiag_DW.Delay_DSTATE_lg = rtb_Product_oy;
  rtb_LogicalOperator4 = (rtb_Subtract1 == -1.0F);
  if (rtb_LogicalOperator4) {
    rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
  } else {
    rtb_LogicalOperator4_0 = 0.0F;
  }

  if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_hz) {
    tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
  } else {
    tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_hz;
  }

  rtb_Subtract1 = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
    rtb_LogicalOperator4;
  BCMR_DChrgDiag_DW.Delay_DSTATE_hz = rtb_Subtract1;
  if ((!BCMR_DChrgDiag_DW.UnitDelay1_DSTATE) && (!((rtb_Product_oy >
         BCMR_tiDChrgDetDiagDebs_C) || (rtb_Subtract1 >
         BCMR_tiDChrgDetDiagDebs_C)))) {
    rtb_DataTypeConversion = BCMR_DChrgDiag_DW.Delay1_DSTATE;
  }

  BCMR_bDChrgCnnt = (rtb_DataTypeConversion != 0.0F);
  BCMR_DChrgDiag_DW.UnitDelay1_DSTATE = false;
  BCMR_DChrgDiag_DW.Delay1_DSTATE = rtb_DataTypeConversion;
  if (BCMR_bDChrgWkup) {
    if (!BCMR_DChrgDiag_DW.Subsystem_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_n = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_o = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_e = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_b = 0.0F;
      BCMR_DChrgDiag_DW.Subsystem_MODE = true;
    }

    rtb_LogicalOperator4 = (BSPR_tCellTempMin < BCMR_uDChrgLowTempDet_C);
    rtb_LogicalOperator1 = (BSPR_tCellTempMin >= BCMR_uDChrgLowTempHeal_C);
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_n) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_n;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bDChrgTempLowErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_n = rtb_DataTypeConversion;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_o) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_o;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDChrgTempLowErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_o = rtb_DataTypeConversion;
    rtb_LogicalOperator4 = (BSPR_tCellTempMax > BCMR_uDChrgHighTempDet_C);
    rtb_LogicalOperator1 = (BSPR_tCellTempMax <= BCMR_uDChrgHighTempHeal_C);
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_e) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_e;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bDChrgTempHighErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_e = rtb_DataTypeConversion;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_b) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_b;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDChrgTempHighErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_b = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.Subsystem_MODE) {
      BCMR_bDChrgTempLowErrDet = false;
      BCMR_bDChrgTempLowErrHeal = false;
      BCMR_bDChrgTempHighErrDet = false;
      BCMR_bDChrgTempHighErrHeal = false;
      BCMR_DChrgDiag_DW.Subsystem_MODE = false;
    }
  }

  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_i) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgBattTMin_ASW | 8U);
  } else if (BCMR_bDChrgTempLowErrDet) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgBattTMin_ASW | 152U);
  } else if (BCMR_bDChrgTempLowErrHeal) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgBattTMin_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_l;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_i = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_l = rtb_Switch4_jg;
  if (BCMR_bDChrgTempLowErrHeal || BCMR_bDChrgTempLowErrDet) {
    DFC_DChrgBattTMin_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgBattTMin_ASW = 0U;
  }

  if (BCMR_DChrgDiag_DW.Delay2_DSTATE) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgBattTMax_ASW | 8U);
  } else if (BCMR_bDChrgTempHighErrDet) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgBattTMax_ASW | 152U);
  } else if (BCMR_bDChrgTempHighErrHeal) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgBattTMax_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE = rtb_Switch4_jg;
  if (BCMR_bDChrgTempHighErrHeal || BCMR_bDChrgTempHighErrDet) {
    DFC_DChrgBattTMax_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgBattTMax_ASW = 0U;
  }

  BCMR_stDcBattTempOvrErr = (uint8_T)(((DFC_BattTFaultMax_ASW & 24) == 24) ||
    ((DFC_BattTWarnMax_ASW & 24) == 24) || ((DFC_DChrgBattTMin_ASW & 24) == 24) ||
    ((DFC_DChrgBattTMax_ASW & 24) == 24));
  if ((BCMR_stDChrgMode == 2) || (BCMR_stDChrgMode == 3)) {
    if (!BCMR_DChrgDiag_DW.APlusDet_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_e4 = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_c2 = 0.0F;
      BCMR_DChrgDiag_DW.APlusDet_MODE = true;
    }

    rtb_LogicalOperator4 = !BSPR_bDCWkUp;
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_e4) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_e4;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bChrgCnnttErrDet = (rtb_DataTypeConversion > BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_e4 = rtb_DataTypeConversion;
    if (BSPR_bDCWkUp) {
      tmp_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      tmp_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_c2) {
      rtb_DataTypeConversion = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      rtb_DataTypeConversion = BCMR_DChrgDiag_DW.Delay_DSTATE_c2;
    }

    rtb_DataTypeConversion = (tmp_0 + rtb_DataTypeConversion) * (real32_T)
      BSPR_bDCWkUp;
    BCMR_bChrgCnnttErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_c2 = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.APlusDet_MODE) {
      BCMR_bChrgCnnttErrDet = false;
      BCMR_bChrgCnnttErrHeal = false;
      BCMR_DChrgDiag_DW.APlusDet_MODE = false;
    }
  }

  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_nk) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_APlusChk_ASW | 8U);
  } else if (BCMR_bChrgCnnttErrDet) {
    rtb_Switch4_jg = (uint8_T)(DFC_APlusChk_ASW | 152U);
  } else if (BCMR_bChrgCnnttErrHeal) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_APlusChk_ASW | 16U)
      | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_hz;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_nk = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_hz = rtb_Switch4_jg;
  if (BCMR_bChrgCnnttErrHeal || BCMR_bChrgCnnttErrDet) {
    DFC_APlusChk_ASW = rtb_Switch4_jg;
  } else {
    DFC_APlusChk_ASW = 0U;
  }

  BCMR_stDChrgCnntErr = (uint8_T)((DFC_APlusChk_ASW & 24) == 24);
  if (BSPR_bDCWkUp) {
    if (!BCMR_DChrgDiag_DW.CC2Det_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_bu = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_f2 = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_ao = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_cg = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_a = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_kp = 0.0F;
      BCMR_DChrgDiag_DW.CC2Det_MODE = true;
    }

    if (BCMR_H1U0PlatformSwDiag_C) {
      tmp_0 = BSPR_uKl30;
    } else {
      tmp_0 = 5.0F;
    }

    rtb_DataTypeConversion = (real32_T)fabs(BSPR_uCC2Volt - 0.5F * tmp_0);
    rtb_LogicalOperator4 = (rtb_DataTypeConversion > BCMR_uCC2ChkDiffDet_C);
    rtb_LogicalOperator1 = (rtb_DataTypeConversion < BCMR_uCC2ChkDiffHeal_C);
    rtb_Compare_dc = (BSPR_uCC2Volt < BCMR_uCC2VoltLowDet_C);
    rtb_Compare_cpj = (BSPR_uCC2Volt > BCMR_uCC2VoltLowHeal_C);
    rtb_Compare_az = (BSPR_uCC2Volt > BCMR_uCC2VoltHighDet_C);
    rtb_Compare_nd = (BSPR_uCC2Volt < BCMR_uCC2VoltHighHeal_C);
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_bu) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_bu;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bDcOutputContErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_bu = rtb_DataTypeConversion;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_f2) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_f2;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDcOutputContErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_f2 = rtb_DataTypeConversion;
    if (rtb_Compare_dc) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_ao) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_ao;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_dc;
    BCMR_bCC2VoltLowErrDet = (rtb_DataTypeConversion > BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_ao = rtb_DataTypeConversion;
    if (rtb_Compare_cpj) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_cg) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_cg;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_cpj;
    BCMR_bCC2VoltLowErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_cg = rtb_DataTypeConversion;
    if (rtb_Compare_az) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_a) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_a;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_az;
    BCMR_bCC2VoltHighErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_a = rtb_DataTypeConversion;
    if (rtb_Compare_nd) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_kp) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_kp;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_nd;
    BCMR_bCC2VoltHighErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_kp = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.CC2Det_MODE) {
      BCMR_bDcOutputContErrDet = false;
      BCMR_bDcOutputContErrHeal = false;
      BCMR_bCC2VoltLowErrDet = false;
      BCMR_bCC2VoltLowErrHeal = false;
      BCMR_bCC2VoltHighErrDet = false;
      BCMR_bCC2VoltHighErrHeal = false;
      BCMR_DChrgDiag_DW.CC2Det_MODE = false;
    }
  }

  rtb_LogicalOperator4 = (BCMR_bDcOutputContErrDet || BCMR_bCC2VoltLowErrDet ||
    BCMR_bCC2VoltHighErrDet);
  rtb_LogicalOperator1 = (BCMR_bDcOutputContErrHeal && BCMR_bCC2VoltLowErrHeal &&
    BCMR_bCC2VoltHighErrHeal);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_nb) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_CC2Chk_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_CC2Chk_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_CC2Chk_ASW | 16U) |
      8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_ap;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_nb = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_ap = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_CC2Chk_ASW = rtb_Switch4_jg;
  } else {
    DFC_CC2Chk_ASW = 0U;
  }

  BCMR_stCC2ChkVoltErr = (uint8_T)((DFC_CC2Chk_ASW & 24) == 24);
  rtb_LogicalOperator4 = (BSPR_iBattCurr <= BCMR_iDChrgCurrDiagLmt_C);
  if (rtb_LogicalOperator4) {
    rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
  } else {
    rtb_LogicalOperator4_0 = 0.0F;
  }

  if (BCMR_tiDChrgDetSec_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_c) {
    tmp_0 = BCMR_tiDChrgDetSec_C;
  } else {
    tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_c;
  }

  rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
    rtb_LogicalOperator4;
  BCMR_DChrgDiag_DW.Delay_DSTATE_c = rtb_DataTypeConversion;
  rtb_LogicalOperator4 = (BCMR_bDChrgWkup && (rtb_DataTypeConversion >=
    BCMR_tiDChrgDetSec_C));
  if (rtb_LogicalOperator4) {
    if (!BCMR_DChrgDiag_DW.NormalCurrDiag_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE = 1.0F;
      BCMR_DChrgDiag_DW.UnitDelay_DSTATE_n = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_eo = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_l = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_h = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_o3 = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_oy = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_d = 0.0F;
      BCMR_DChrgDiag_DW.NormalCurrDiag_MODE = true;
    }

    rtb_Product_oy = (real32_T)fabs(COMR_iDcChrgOutputCurrCcs);
    rtb_Subtract1 = (real32_T)fabs(BSPR_iBattCurr);
    rtb_DataTypeConversion = (real32_T)fabs(BCMR_iDChrgBattCurrReqCalc);
    if (!(BCMR_DChrgDiag_DW.Delay_DSTATE > 0.0F)) {
      rtb_DataTypeConversion = (rtb_DataTypeConversion -
        BCMR_DChrgDiag_DW.UnitDelay_DSTATE_n) * BCMR_kWaveFltFactor_C +
        BCMR_DChrgDiag_DW.UnitDelay_DSTATE_n;
    }

    if (BCMR_G1E0PlatformSwDiag_C) {
      rtb_Compare_cpj = (rtb_Product_oy >= BCMR_iDcChrgOvrCurr_C);
    } else {
      rtb_Compare_cpj = false;
    }

    rtb_LogicalOperator1 = (rtb_Compare_cpj || (BCMR_iDcChrgOvrCurr_C <=
      rtb_Subtract1));
    rtb_Compare_dc = !rtb_LogicalOperator1;
    if (BCMR_G1E0PlatformSwDiag_C) {
      rtb_Compare_cpj = (rtb_Product_oy - BCMR_iDChrgCurrReqCalc >=
                         BCMR_iDcChrgDiffOvrCurr_C);
    } else {
      rtb_Compare_cpj = false;
    }

    rtb_Compare_cpj = ((rtb_Subtract1 - rtb_DataTypeConversion >=
                        BCMR_iDcChrgDiffOvrCurr_C) || rtb_Compare_cpj);
    rtb_Compare_az = !rtb_Compare_cpj;
    rtb_Compare_nd = ((BSPR_uCellVoltMax >= BCMR_uDChrgOvrCellVoltDet_C) &&
                      (rtb_Subtract1 >= BCMR_iDChrgCutOffVoltOvrCurrDet_C));
    rtb_LogicalOperator8_h = ((BSPR_uCellVoltMax < BCMR_uDChrgOvrCellVoltHeal_C)
      || (rtb_Subtract1 < BCMR_iDChrgCutOffVoltOvrCurrHeal_C));
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_eo) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_eo;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDcChrgCurrOutRngErrDet = (rtb_Product_oy > BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_eo = rtb_Product_oy;
    if (rtb_Compare_dc) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_l) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_l;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)rtb_Compare_dc;
    BCMR_bDcChrgCurrOutRngErrHeal = (rtb_Product_oy > BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_l = rtb_Product_oy;
    if (rtb_Compare_cpj) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgMishCurrDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_h) {
      tmp_0 = BCMR_tiDChrgMishCurrDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_h;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_cpj;
    BCMR_bDcChrgOvrCurrErrDet = (rtb_Product_oy >
      BCMR_tiDChrgMishCurrDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_h = rtb_Product_oy;
    if (rtb_Compare_az) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgHealDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_o3) {
      tmp_0 = BCMR_tiDChrgHealDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_o3;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)rtb_Compare_az;
    BCMR_bDcChrgOvrCurrErrHeal = (rtb_Product_oy > BCMR_tiDChrgHealDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_o3 = rtb_Product_oy;
    if (rtb_Compare_nd) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgOvrCellVolt_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_oy) {
      tmp_0 = BCMR_tiDChrgOvrCellVolt_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_oy;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)rtb_Compare_nd;
    BCMR_bDChrgCutOffVoltOvrCurrDet = (rtb_Product_oy >
      BCMR_tiDChrgOvrCellVolt_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_oy = rtb_Product_oy;
    if (rtb_LogicalOperator8_h) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgOvrCellVolt_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_d) {
      tmp_0 = BCMR_tiDChrgOvrCellVolt_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_d;
    }

    rtb_Product_oy = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator8_h;
    BCMR_bDChrgCutOffVoltOvrCurrHeal = (rtb_Product_oy >
      BCMR_tiDChrgOvrCellVolt_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_d = rtb_Product_oy;
    BCMR_DChrgDiag_DW.Delay_DSTATE = 0.0F;
    BCMR_DChrgDiag_DW.UnitDelay_DSTATE_n = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.NormalCurrDiag_MODE) {
      BCMR_bDcChrgCurrOutRngErrDet = false;
      BCMR_bDcChrgCurrOutRngErrHeal = false;
      BCMR_bDcChrgOvrCurrErrDet = false;
      BCMR_bDcChrgOvrCurrErrHeal = false;
      BCMR_bDChrgCutOffVoltOvrCurrDet = false;
      BCMR_bDChrgCutOffVoltOvrCurrHeal = false;
      BCMR_DChrgDiag_DW.NormalCurrDiag_MODE = false;
    }
  }

  rtb_LogicalOperator1 = (BCMR_bDcChrgCurrOutRngErrDet ||
    BCMR_bDcChrgOvrCurrErrDet || BCMR_bDChrgCutOffVoltOvrCurrDet);
  rtb_Compare_dc = (BCMR_bDcChrgCurrOutRngErrHeal && BCMR_bDcChrgOvrCurrErrHeal &&
                    BCMR_bDChrgCutOffVoltOvrCurrHeal);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_e) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCurrMish_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCurrMish_ASW | 152U);
  } else if (rtb_Compare_dc) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCurrMish_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_b;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_e = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_b = rtb_Switch4_jg;
  if (rtb_Compare_dc || rtb_LogicalOperator1) {
    DFC_DChrgCurrMish_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCurrMish_ASW = 0U;
  }

  BCMR_stBattNormalTempDChrgCurrOvrErr = (uint8_T)((DFC_DChrgCurrMish_ASW & 24) ==
    24);
  if (rtb_LogicalOperator4 && (BSPR_tCellTempMin <
       BCMR_tBattLowTempDiagTempThrd_C)) {
    if (!BCMR_DChrgDiag_DW.LowTempCurrDiag_MODE) {
      BCMR_DChrgDiag_DW.Delay1_DSTATE_o = true;
      BCMR_DChrgDiag_DW.Delay_DSTATE_kq = 0.0F;
      BCMR_DChrgDiag_DW.UnitDelay_DSTATE = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_dr = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_k = 0.0F;
      BCMR_DChrgDiag_DW.LowTempCurrDiag_MODE = true;
    }

    rtb_DataTypeConversion = (real32_T)fabs(BSPR_iBattCurr) -
      BCMR_iDChrgBattCurrReqCalc;
    rtb_LogicalOperator1 = (rtb_DataTypeConversion >=
      BCMR_iDcChrgLowTempOvrCurrCutOff_C);
    rtb_Compare_dc = (rtb_DataTypeConversion < BCMR_iDcChrgLowTempOvrCurrHeal_C);
    rtb_Compare_cpj = (rtb_DataTypeConversion >=
                       BCMR_iDcChrgLowTempDiffOvrCurrMody_C);
    rtb_Compare_az = !BCMR_DChrgDiag_DW.Delay1_DSTATE_o;
    BCMR_DChrgDiag_DW.Delay1_DSTATE_o = BCMR_bDChrgWkup;
    if (rtb_Compare_cpj) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_kq) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_kq;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_cpj;
    BCMR_bDChrgCurrModifyEna = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_kq = rtb_DataTypeConversion;
    if (BCMR_bDChrgCurrModifyEna &&
        (BCMR_DChrgDiag_PrevZCX.LowTempOvrCurrCnt_Trig_ZCE != POS_ZCSIG)) {
      if (rtb_Compare_az && BCMR_bDChrgWkup) {
        rtb_Switch2 = 0.0F;
      } else {
        rtb_Switch2 = 1.0F + BCMR_DChrgDiag_DW.UnitDelay_DSTATE;
      }

      BCMR_DChrgDiag_B.Compare = (rtb_Switch2 >= 3.0F);
      BCMR_DChrgDiag_DW.UnitDelay_DSTATE = rtb_Switch2;
    }

    BCMR_DChrgDiag_PrevZCX.LowTempOvrCurrCnt_Trig_ZCE = BCMR_bDChrgCurrModifyEna;
    BCMR_bDChrgLowTempCurrOvrCnt = BCMR_DChrgDiag_B.Compare;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgLowTOvrCurrDet_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_dr) {
      tmp_0 = BCMR_tiDChrgLowTOvrCurrDet_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_dr;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDChrgLowTempOvrCurrErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgLowTOvrCurrDet_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_dr = rtb_DataTypeConversion;
    if (rtb_Compare_dc) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgLowTOvrCurrHeal_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_k) {
      tmp_0 = BCMR_tiDChrgLowTOvrCurrHeal_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_k;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_Compare_dc;
    BCMR_bDChrgLowTempOvrCurrErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgLowTOvrCurrHeal_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_k = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.LowTempCurrDiag_MODE) {
      BCMR_bDChrgLowTempOvrCurrErrDet = false;
      BCMR_bDChrgLowTempOvrCurrErrHeal = false;
      BCMR_DChrgDiag_DW.LowTempCurrDiag_MODE = false;
    }
  }

  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_bw) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgLowTempCurrMish_ASW | 8U);
  } else if (BCMR_bDChrgLowTempOvrCurrErrDet) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgLowTempCurrMish_ASW | 152U);
  } else if (BCMR_bDChrgLowTempOvrCurrErrHeal) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)
      ~DFC_DChrgLowTempCurrMish_ASW | 16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_k;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_bw = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_k = rtb_Switch4_jg;
  if (BCMR_bDChrgLowTempOvrCurrErrHeal || BCMR_bDChrgLowTempOvrCurrErrDet) {
    DFC_DChrgLowTempCurrMish_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgLowTempCurrMish_ASW = 0U;
  }

  BCMR_stBattDChrgLowTempCurrOvrErr = (uint8_T)((DFC_DChrgLowTempCurrMish_ASW & 24) ==
    24);
  BCMR_stBattDChrgCurrOvrErr = (uint8_T)((BCMR_stBattNormalTempDChrgCurrOvrErr >
    0) || (BCMR_stBattDChrgLowTempCurrOvrErr > 0));
  if (BCMR_cntIsoFltTrigger_CW > 77) {
    BCMR_stDcBattInsulationErr = (uint8_T)HVSR_flgIsoFaultLvl2;
  } else {
    BCMR_stDcBattInsulationErr = 1U;
  }

  BCMR_stMainRelayErr = (uint8_T)(((DFC_PosStuckMax_ASW & 24) == 24) ||
    ((DFC_DChrgNegStuckMax_ASW & 24) == 24) || ((DFC_MPosStuckMin_ASW & 24) == 24) ||
    ((DFC_DChrgNegStuckMin_ASW & 24) == 24) || ((DFC_PrStuckMin_ASW & 24) == 24) ||
    ((DFC_DChrgPosStuckMax_ASW & 24) == 24) || ((DFC_MNegStuckMin_ASW & 24) == 24) ||
    ((DFC_DChrgPosStuckMin_ASW & 24) == 24) || ((DFC_MNegStuckMax_ASW & 24) == 24));
  if (rtb_LogicalOperator4) {
    if (!BCMR_DChrgDiag_DW.DChrgVoltDiag_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_j = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_i = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_oz = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_op = 0.0F;
      BCMR_DChrgDiag_DW.DChrgVoltDiag_MODE = true;
    }

    rtb_LogicalOperator4 = (BSPR_uCellVoltMax < BCMR_uDChrgOvrSafeCellVoltHeal_C);
    rtb_LogicalOperator1 = (BSPR_uCellVoltMax >= BCMR_uDChrgOvrSafeCellVoltDet_C);
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgOvrSafeCellVoltDet_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_j) {
      tmp_0 = BCMR_tiDChrgOvrSafeCellVoltDet_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_j;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDChrgOvrSafeCellVoltDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgOvrSafeCellVoltDet_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_j = rtb_DataTypeConversion;
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgOvrSafeCellVoltDet_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_i) {
      tmp_0 = BCMR_tiDChrgOvrSafeCellVoltDet_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_i;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bDChrgOvrSafeCellVoltHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgOvrSafeCellVoltDet_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_i = rtb_DataTypeConversion;
    rtb_LogicalOperator4 = ((BSPR_uDChrgVolt >= BCMR_iDcChrgOvrVolt_C) ||
      (BSPR_uPackVolt >= BCMR_iDcChrgOvrVolt_C) || (BSPR_uBattVolt >=
      BCMR_iDcChrgOvrVolt_C));
    rtb_LogicalOperator1 = !rtb_LogicalOperator4;
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgVoltFltDetDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_oz) {
      tmp_0 = BCMR_tiDChrgVoltFltDetDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_oz;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_bDcChrgVoltOutRngErrDet = (rtb_DataTypeConversion >
      BCMR_tiDChrgVoltFltDetDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_oz = rtb_DataTypeConversion;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgVoltFltHealDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_op) {
      tmp_0 = BCMR_tiDChrgVoltFltHealDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_op;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_bDcChrgVoltOutRngErrHeal = (rtb_DataTypeConversion >
      BCMR_tiDChrgVoltFltHealDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_op = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.DChrgVoltDiag_MODE) {
      BCMR_bDChrgOvrSafeCellVoltDet = false;
      BCMR_bDChrgOvrSafeCellVoltHeal = false;
      BCMR_bDcChrgVoltOutRngErrDet = false;
      BCMR_bDcChrgVoltOutRngErrHeal = false;
      BCMR_DChrgDiag_DW.DChrgVoltDiag_MODE = false;
    }
  }

  rtb_LogicalOperator4 = (BCMR_bDcChrgVoltOutRngErrDet ||
    BCMR_bDChrgOvrSafeCellVoltDet);
  rtb_LogicalOperator1 = (BCMR_bDcChrgVoltOutRngErrHeal &&
    BCMR_bDChrgOvrSafeCellVoltHeal);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_b) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgVoltMish_ASW | 8U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgVoltMish_ASW | 152U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgVoltMish_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_d;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_b = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_d = rtb_Switch4_jg;
  if (rtb_LogicalOperator1 || rtb_LogicalOperator4) {
    DFC_DChrgVoltMish_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgVoltMish_ASW = 0U;
  }

  BCMR_stBattDChrgVoltOvrErr = (uint8_T)((DFC_DChrgVoltMish_ASW & 24) == 24);
  if (BCMR_bDChrgWkup) {
    if (!BCMR_DChrgDiag_DW.DChrgInletDiag_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_ew = 0.0F;
      BCMR_DChrgDiag_DW.Delay_DSTATE_f = 0.0F;
      BCMR_DChrgDiag_DW.DChrgInletDiag_MODE = true;
    }

    if (BCMR_cntDChrgTCnntMax_C != 24) {
      if (BSPR_tDcChPos >= BSPR_tDcChNeg) {
        tmp_0 = BSPR_tDcChPos;
      } else {
        tmp_0 = BSPR_tDcChNeg;
      }

      rtb_LogicalOperator4 = (tmp_0 >= BCMR_tDcChrgIntfTempLmt_C);
    } else {
      rtb_LogicalOperator4 = false;
    }

    rtb_LogicalOperator1 = !rtb_LogicalOperator4;
    if (rtb_LogicalOperator4) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_ew) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_ew;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator4;
    BCMR_DChrgDiag_B.RelationalOperator_n = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_ew = rtb_DataTypeConversion;
    if (rtb_LogicalOperator1) {
      rtb_LogicalOperator4_0 = BCMR_tiDChrgDiagBase_C;
    } else {
      rtb_LogicalOperator4_0 = 0.0F;
    }

    if (BCMR_tiDChrgDetDiagDebs_C <= BCMR_DChrgDiag_DW.Delay_DSTATE_f) {
      tmp_0 = BCMR_tiDChrgDetDiagDebs_C;
    } else {
      tmp_0 = BCMR_DChrgDiag_DW.Delay_DSTATE_f;
    }

    rtb_DataTypeConversion = (rtb_LogicalOperator4_0 + tmp_0) * (real32_T)
      rtb_LogicalOperator1;
    BCMR_DChrgDiag_B.RelationalOperator = (rtb_DataTypeConversion >
      BCMR_tiDChrgDetDiagDebs_C);
    BCMR_DChrgDiag_DW.Delay_DSTATE_f = rtb_DataTypeConversion;
  } else {
    if (BCMR_DChrgDiag_DW.DChrgInletDiag_MODE) {
      BCMR_DChrgDiag_B.RelationalOperator_n = false;
      BCMR_DChrgDiag_B.RelationalOperator = true;
      BCMR_DChrgDiag_DW.DChrgInletDiag_MODE = false;
    }
  }

  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_j) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTCnntMax_ASW | 8U);
  } else if (BCMR_DChrgDiag_B.RelationalOperator_n) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgTCnntMax_ASW | 152U);
  } else if (BCMR_DChrgDiag_B.RelationalOperator) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTCnntMax_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_f;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_j = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_f = rtb_Switch4_jg;
  if (BCMR_DChrgDiag_B.RelationalOperator ||
      BCMR_DChrgDiag_B.RelationalOperator_n) {
    DFC_DChrgTCnntMax_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgTCnntMax_ASW = 0U;
  }

  BCMR_stDcOutpCnntOvrTempErr = (uint8_T)((DFC_DChrgTCnntMax_ASW & 24) == 24);
  BCMR_bDChrgFobd = ((BCMR_stDcBattTempOvrErr == 1) ||
                     (BCMR_stBattDChrgVoltOvrErr == 1) || (BCMR_stCC2ChkVoltErr ==
    1) || (BCMR_stBattDChrgCurrOvrErr == 1) || (BCMR_stDcBattInsulationErr == 1)
                     || (BCMR_stOtherErr == 1) || (BCMR_stMainRelayErr == 1) ||
                     BCMR_DChrgDiag_ConstB.Compare ||
                     (BCMR_stDcOutpCnntOvrTempErr == 1) || (BCMR_stDChrgCnntErr ==
    1));
  BCMR_bDChrgStopEna = (BCMR_bDChrgFobd || (COMR_stPwrUpDwnVcuReq == 2) ||
                        ((BSER_rSocDspl >= 100.0F) || COMR_bChrgStopActive));
  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCHMTimeout_C) &&
    BCMR_bDChrgWkup);
  rtb_LogicalOperator4 = (((int32_T)rtb_Product_ho == BCMR_stNoTimeout_C) ||
    (!BCMR_bDChrgWkup));
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_c) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCHMTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCHMTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCHMTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_e;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_c = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_e = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCHMTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCHMTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCRMAATimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_jw) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCRMTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCRMTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCRMTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_f1;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_jw = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_f1 = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCRMTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCRMTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (BCMR_flgDChrgStopCActive && BCMR_bDChrgWkup &&
    BCMR_bDChrgStopCActiveSw_C);
  rtb_Compare_dc = !rtb_LogicalOperator1;
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_hi) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStakeErr_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgStakeErr_ASW | 152U);
  } else if (rtb_Compare_dc) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStakeErr_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_lt;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_hi = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_lt = rtb_Switch4_jg;
  if (rtb_Compare_dc || rtb_LogicalOperator1) {
    DFC_DChrgStakeErr_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgStakeErr_ASW = 0U;
  }

  rtb_LogicalOperator1 = (BCMR_flgTxBEM && BCMR_bDChrgWkup);
  rtb_Compare_dc = !rtb_LogicalOperator1;
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_o) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgMsgTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgMsgTmt_ASW | 152U);
  } else if (rtb_Compare_dc) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgMsgTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_j;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_o = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_j = rtb_Switch4_jg;
  if (rtb_Compare_dc || rtb_LogicalOperator1) {
    DFC_DChrgMsgTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgMsgTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stParaMish_C) &&
    (!BCMR_bDChrgFobd) && BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_f3) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgParaChk_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgParaChk_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgParaChk_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_a;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_f3 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_a = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgParaChk_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgParaChk_ASW = 0U;
  }

  rtb_LogicalOperator1 = (BCMR_bDChrgFobd && BCMR_bDChrgWkup);
  rtb_Compare_dc = !rtb_LogicalOperator1;
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_d) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgFobd_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgFobd_ASW | 152U);
  } else if (rtb_Compare_dc) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgFobd_ASW | 16U)
      | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_a4;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_d = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_a4 = rtb_Switch4_jg;
  if (rtb_Compare_dc || rtb_LogicalOperator1) {
    DFC_DChrgFobd_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgFobd_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCMLTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_b1) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCMLTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCMLTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCMLTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_lw;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_b1 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_lw = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCMLTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCMLTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stHvOnTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_n) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgHvOnFail_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgHvOnFail_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgHvOnFail_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_b0;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_n = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_b0 = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgHvOnFail_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgHvOnFail_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCROTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_i3) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCROTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCROTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCROTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_kx;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_i3 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_kx = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCROTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCROTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCROAATimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_m) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStkVoltErr_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgStkVoltErr_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStkVoltErr_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_o;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_m = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_o = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgStkVoltErr_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgStkVoltErr_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCCSTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_bl) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCCSTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCCSTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCCSTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_np;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_bl = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_np = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCCSTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCCSTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCSTTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_k4) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCSTTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCSTTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCSTTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_cr;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_k4 = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_cr = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCSTTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCSTTmt_ASW = 0U;
  }

  rtb_LogicalOperator1 = (((int32_T)rtb_Product_ho == BCMR_stCurrDwnTimeout_C) &&
    BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_ov) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStkCurrErr_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgStkCurrErr_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgStkCurrErr_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_h1;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_ov = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_h1 = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgStkCurrErr_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgStkCurrErr_ASW = 0U;
  }

  rtb_LogicalOperator1 = ((((int32_T)rtb_Product_ho == BCMR_stCSDTimeout1_C) ||
    ((int32_T)rtb_Product_ho == BCMR_stCSDTimeout2_C)) && BCMR_bDChrgWkup);
  if (BCMR_DChrgDiag_DW.Delay2_DSTATE_mi) {
    rtb_Switch4_jg = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCSDTmt_ASW | 8U);
  } else if (rtb_LogicalOperator1) {
    rtb_Switch4_jg = (uint8_T)(DFC_DChrgCSDTmt_ASW | 152U);
  } else if (rtb_LogicalOperator4) {
    rtb_Switch4_jg = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgCSDTmt_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay3_DSTATE_m;
  }

  BCMR_DChrgDiag_DW.Delay2_DSTATE_mi = false;
  BCMR_DChrgDiag_DW.Delay3_DSTATE_m = rtb_Switch4_jg;
  if (rtb_LogicalOperator4 || rtb_LogicalOperator1) {
    DFC_DChrgCSDTmt_ASW = rtb_Switch4_jg;
  } else {
    DFC_DChrgCSDTmt_ASW = 0U;
  }

  if (BCMR_bDChrgWkup) {
    if (!BCMR_DChrgDiag_DW.RchCellVoltLmt_MODE) {
      BCMR_DChrgDiag_DW.Delay_DSTATE_eb = false;
      BCMR_DChrgDiag_DW.RchCellVoltLmt_MODE = true;
    }

    rtb_LogicalOperator4 = ((BCMR_DChrgDiag_DW.Delay_DSTATE_eb ||
      BCMR_flgDChrgFulChk) && (!((BCMR_stDChrgMode == 6) || (BCMR_stDChrgMode ==
      0))));
    BCMR_stDcRchCellVoltLmt = (uint8_T)rtb_LogicalOperator4;
    BCMR_DChrgDiag_DW.Delay_DSTATE_eb = rtb_LogicalOperator4;
  } else {
    if (BCMR_DChrgDiag_DW.RchCellVoltLmt_MODE) {
      BCMR_stDcRchCellVoltLmt = 0U;
      BCMR_DChrgDiag_DW.RchCellVoltLmt_MODE = false;
    }
  }

  if (((DFC_SocRngLoMax_ASW & 24) == 24) || ((DFC_SocRngLoMin_ASW & 24) == 24)) {
    rtb_Switch4_jg = 2U;
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay_DSTATE_is;
  }

  if (((DFC_SocRngHiMax_ASW & 24) == 24) || ((DFC_SocRngHiMin_ASW & 24) == 24)) {
    BCMR_stDcBattSocErr = 1U;
  } else {
    BCMR_stDcBattSocErr = rtb_Switch4_jg;
  }

  BCMR_DChrgDiag_DW.Delay_DSTATE_is = rtb_Switch4_jg;
  if (((DFC_CellVoltAlrmMin_ASW & 24) == 24) || ((DFC_CellVoltFaultMin_ASW & 24) == 24) ||
      ((DFC_CellVoltWarnMin_ASW & 24) == 24)) {
    rtb_Switch4_jg = 2U;
  } else {
    rtb_Switch4_jg = BCMR_DChrgDiag_DW.Delay_DSTATE_ir;
  }

  if (((DFC_CellVoltAlrmMax_ASW & 24) == 24) || ((DFC_CellVoltFaultMax_ASW & 24) == 24) ||
      ((DFC_CellVoltWarnMax_ASW & 24) == 24)) {
    rtb_Switch_m = 1U;
  } else {
    rtb_Switch_m = rtb_Switch4_jg;
  }

  if (rtb_Switch_m > 0) {
    BCMR_stDcBattCellVoltErr = rtb_Switch_m;
  } else {
    BCMR_stDcBattCellVoltErr = 0U;
  }

  BCMR_DChrgDiag_DW.Delay_DSTATE_ir = rtb_Switch4_jg;
  BCMR_stDChrgModeBcl = 2U;
}

/* Model initialize function */
void BCMR_DChrgDiag_initialize(void)
{
  /* Registration code */

  /* block I/O */

  /* custom signals */
  BCMR_stDChrgModeBcl = ((uint8_T)0U);
  BCMR_stDcBattTempOvrErr = ((uint8_T)0U);
  BCMR_stDcBattSocErr = ((uint8_T)0U);
  BCMR_stMainRelayErr = ((uint8_T)0U);
  BCMR_stDcRchCellVoltLmt = ((uint8_T)0U);
  BCMR_stBattDChrgVoltOvrErr = ((uint8_T)0U);
  BCMR_stBattNormalTempDChrgCurrOvrErr = ((uint8_T)0U);
  BCMR_stBattDChrgLowTempCurrOvrErr = ((uint8_T)0U);
  BCMR_stBattDChrgCurrOvrErr = ((uint8_T)0U);
  BCMR_stOtherErr = ((uint8_T)0U);
  BCMR_stDcBattInsulationErr = ((uint8_T)0U);
  BCMR_stDcOutpCnntOvrTempErr = ((uint8_T)0U);
  BCMR_stDChrgCnntErr = ((uint8_T)0U);
  BCMR_stCC2ChkVoltErr = ((uint8_T)0U);
  BCMR_stDcBattCellVoltErr = ((uint8_T)0U);
  BCMR_bDChrgTempLowErrDet = false;
  BCMR_bDChrgOvrSafeCellVoltHeal = false;
  BCMR_bDChrgOvrSafeCellVoltDet = false;
  BCMR_bDcChrgVoltOutRngErrHeal = false;
  BCMR_bDcChrgVoltOutRngErrDet = false;
  BCMR_bDChrgCutOffVoltOvrCurrHeal = false;
  BCMR_bDChrgCutOffVoltOvrCurrDet = false;
  BCMR_bDcChrgOvrCurrErrHeal = false;
  BCMR_bDcChrgOvrCurrErrDet = false;
  BCMR_bDcChrgCurrOutRngErrHeal = false;
  BCMR_bDcChrgCurrOutRngErrDet = false;
  BCMR_bDChrgLowTempCurrOvrCnt = false;
  BCMR_bDChrgLowTempOvrCurrErrHeal = false;
  BCMR_bDChrgLowTempOvrCurrErrDet = false;
  BCMR_bDChrgCurrModifyEna = false;
  BCMR_bDChrgWkup = false;
  BCMR_bDChrgCnnt = false;
  BCMR_bCC2VoltHighErrHeal = false;
  BCMR_bCC2VoltHighErrDet = false;
  BCMR_bCC2VoltLowErrHeal = false;
  BCMR_bCC2VoltLowErrDet = false;
  BCMR_bDcOutputContErrHeal = false;
  BCMR_bDcOutputContErrDet = false;
  BCMR_bChrgCnnttErrHeal = false;
  BCMR_bChrgCnnttErrDet = false;
  BCMR_bDcComErrHeal = false;
  BCMR_bDcComErrDet = false;
  BCMR_bDChrgFobd = false;
  BCMR_bDChrgStopEna = false;
  BCMR_DChrgDiag_PrevZCX.LowTempOvrCurrCnt_Trig_ZCE = POS_ZCSIG;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_h2 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_b0 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_h = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_ji = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_k = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_f = true;
  BCMR_DChrgDiag_DW.UnitDelay1_DSTATE = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_i = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_nk = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_nb = true;
  BCMR_DChrgDiag_DW.Delay_DSTATE = 1.0F;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_e = true;
  BCMR_DChrgDiag_DW.Delay1_DSTATE_o = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_bw = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_b = true;
  BCMR_DChrgDiag_B.RelationalOperator = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_j = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_c = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_jw = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_hi = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_o = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_f3 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_d = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_b1 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_n = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_i3 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_m = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_bl = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_k4 = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_ov = true;
  BCMR_DChrgDiag_DW.Delay2_DSTATE_mi = true;
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
