/*
 * File: COMR_Swadp.c
 *
 * Code generated for Simulink model 'COMR_Swadp'.
 *
 * Model version                  : A2.1_0
 * Simulink Coder version         : 8.11 (R2016b) 25-Aug-2016
 * C/C++ source code generated on : Thu Sep 24 10:20:59 2020
 *
 * 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 "COMR_Swadp.h"
#include "COMR_Swadp_private.h"

/* Named constants for Chart: '<S1>/HvCnttCalc' */
#define COMR_Swad_IN_DisCnntConfirm_Stt ((uint8_T)3U)
#define COMR_Swadp_IN_Cnnt_Stt         ((uint8_T)1U)
#define COMR_Swadp_IN_Cnnting_Stt      ((uint8_T)2U)
#define COMR_Swadp_IN_Discnnt_Stt      ((uint8_T)4U)

/* Named constants for Chart: '<S5>/3E0' */
#define COMR_Swadp_IN_CellVolt         ((uint8_T)1U)
#define COMR_Swadp_IN_CellVolt3        ((uint8_T)2U)
#define COMR_Swadp_IN_CellVolt4        ((uint8_T)3U)
#define COMR_Swadp_IN_CellVolt5        ((uint8_T)4U)

/* Named constants for Chart: '<S6>/3E1' */
#define COMR_Swadp_IN_CellVolt1        ((uint8_T)2U)
#define COMR_Swadp_IN_CellVolt2        ((uint8_T)3U)
#define COMR_Swadp_IN_CellVolt3_g      ((uint8_T)4U)
#define COMR_Swadp_IN_CellVolt4_f      ((uint8_T)5U)
#define COMR_Swadp_IN_CellVolt5_j      ((uint8_T)6U)
#define COMR_Swadp_IN_CellVolt6        ((uint8_T)7U)

/* Exported data definition */

/* Volatile memory section */
/* Definition for custom storage class: Volatile */
volatile uint8_T DFC_638LinCommErr_ASW;
volatile uint8_T DFC_EepReadErr_ASW;

/* Definition for custom storage class: OutputSignal */
volatile uint8_T BCCR_stDcChNegCtrStatus;
volatile uint8_T BCCR_stDcChPosCtrStatus;
volatile uint8_T BCCR_stHVConnSt;
volatile uint8_T BCCR_stMNegChCtrStatus;
volatile uint8_T BCCR_stMPosCtrStatus;
volatile uint8_T BCCR_stPreChCtrStatus;
volatile boolean_T BCMR_bCC2Fault;
volatile boolean_T BCMR_bChrgFul;
volatile real32_T BCMR_tiChrgRemTime;
volatile boolean_T BEPR_bKl30VoltFault;
volatile boolean_T BEPR_bKl30VoltHiFault;
volatile boolean_T BEPR_bKl30VoltLoFault;
volatile boolean_T BMS_TempValueWarning;
volatile boolean_T BSER_bCellCnstFault;
volatile boolean_T BSER_bCellOvrVoltFault;
volatile boolean_T BSER_bCellUndrVoltFault;
volatile boolean_T BSER_bSocHiFault;
volatile boolean_T BSER_bSocLoFault;
volatile boolean_T BSPR_bBattOvrTempFault;
volatile boolean_T BSPR_bBattUndrTempFault;
volatile uint8_T BSPR_cntCellSer;
volatile uint8_T BSPR_cntCellTemp;
volatile boolean_T BSPR_flgGwAbmVld;
volatile real32_T BSPR_iBattCurr_CAN;
volatile real32_T COMR_ahCapacity;
volatile boolean_T COMR_b638LinComErrDet;
volatile boolean_T COMR_b638LinComErrHeal;
volatile boolean_T COMR_bCmuComBoff;
volatile boolean_T COMR_bCmuComTOut;
volatile boolean_T COMR_bDChrgComBoff;
volatile boolean_T COMR_bEvComBoff;
volatile boolean_T COMR_bObcComTOut;
volatile boolean_T COMR_bVcuComTOut;
volatile uint8_T COMR_cntCellBattSnsrNum;
volatile boolean_T COMR_flgBmsSlp;
volatile real32_T COMR_tCellBattTempRaw_A[96];
volatile real32_T COMR_tCellBattTemp_A[96];
volatile real32_T COMR_tCellTempA;
volatile real32_T COMR_tCellTempB;
volatile real32_T COMR_tCellTempC;
volatile real32_T COMR_tCellTempD;
volatile real32_T COMR_tCellTempE;
volatile real32_T COMR_tCellTempF;
volatile real32_T COMR_tCellTempG;
volatile real32_T COMR_uCellVoltA;
volatile real32_T COMR_uCellVoltB;
volatile real32_T COMR_uCellVoltC;
volatile real32_T COMR_uCellVoltD;
volatile real32_T COMR_uIsoVoltNeg;
volatile real32_T COMR_uIsoVoltPos;
volatile real32_T COMR_uLoPwrSply;
volatile real32_T COMR_uMaxCellVolt;
volatile real32_T COMR_uMinCellVolt;
volatile boolean_T HVSR_bCrashFault;
volatile boolean_T HVSR_bHvilInpScb;
volatile boolean_T HVSR_bHvilOl;
volatile boolean_T HVSR_bHvilScg;
volatile uint8_T HVSR_bIsoFault;
volatile boolean_T HVSR_bSrvLmp;
volatile boolean_T HVSR_bWarnLmp;

/* Block states (auto storage) */
DW_COMR_Swadp_T COMR_Swadp_DW;

/* Forward declaration for local functions */
static void COMR_S_enter_atomic_Cnnting_Stt(void);
static void COMR_Swadp_Discnnt_Stt(void);
static void enter_atomic_DisCnntConfirm_Stt(void);
static void COMR_Swadp_Cnnt_Stt(void);
static void COMR_S_enter_atomic_Discnnt_Stt(void);
static void COMR_Swad_enter_atomic_Cnnt_Stt(void);
static void COMR_Swadp_Cnnting_Stt(void);
static void COMR_Swadp_DisCnntConfirm_Stt(void);
static void COMR_Swadp_Cell_Volt(void);

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_S_enter_atomic_Cnnting_Stt(void)
{
  BCCR_stHVConnSt = 1U;
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_Swadp_Discnnt_Stt(void)
{
  if (BCCR_stBmsCtrMode == 3) {
    COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swadp_IN_Cnnting_Stt;
    COMR_S_enter_atomic_Cnnting_Stt();
  }
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void enter_atomic_DisCnntConfirm_Stt(void)
{
  BCCR_stHVConnSt = 2U;
  COMR_Swadp_DW.COMR_tiHvCnntStCalc = 0.0F;
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_Swadp_Cnnt_Stt(void)
{
  if ((BCCR_stBmsCtrMode == 5) || (BCCR_stBmsCtrMode == 7)) {
    COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swad_IN_DisCnntConfirm_Stt;
    enter_atomic_DisCnntConfirm_Stt();
  }
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_S_enter_atomic_Discnnt_Stt(void)
{
  BCCR_stHVConnSt = 0U;
  COMR_Swadp_DW.COMR_tiHvCnntStCalc = 0.0F;
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_Swad_enter_atomic_Cnnt_Stt(void)
{
  BCCR_stHVConnSt = 2U;
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_Swadp_Cnnting_Stt(void)
{
  if (BCCR_stBmsCtrMode == 4) {
    COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swadp_IN_Cnnt_Stt;
    COMR_Swad_enter_atomic_Cnnt_Stt();
  } else {
    if ((BCCR_stBmsCtrMode == 14) || (BCCR_stBmsCtrMode == 17)) {
      COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swadp_IN_Discnnt_Stt;
      COMR_S_enter_atomic_Discnnt_Stt();
    }
  }
}

/* Function for Chart: '<S1>/HvCnttCalc' */
static void COMR_Swadp_DisCnntConfirm_Stt(void)
{
  if ((BCCR_stMainCtrDisConn == 1) || (BCCR_stMainCtrDisConn == 2) ||
      (COMR_Swadp_DW.COMR_tiHvCnntStCalc >= 1.0F) || (COMR_stPwrUpDwnVcuReq == 1))
  {
    COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swadp_IN_Discnnt_Stt;
    COMR_S_enter_atomic_Discnnt_Stt();
  } else {
    COMR_Swadp_DW.COMR_tiHvCnntStCalc += 0.01F;
  }
}

/* Function for Chart: '<S6>/3E1' */
static void COMR_Swadp_Cell_Volt(void)
{
  int32_T tmp;
  switch (COMR_Swadp_DW.is_Cell_Volt) {
   case COMR_Swadp_IN_CellVolt:
    if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 8) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt1;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = 0.0F;
      COMR_tCellTempC = 0.0F;
      COMR_tCellTempD = 0.0F;
      COMR_tCellTempE = 0.0F;
      COMR_tCellTempF = 0.0F;
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 9) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt2;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = 0.0F;
      COMR_tCellTempD = 0.0F;
      COMR_tCellTempE = 0.0F;
      COMR_tCellTempF = 0.0F;
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 13) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt6;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
      COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 12) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt5_j;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
      COMR_tCellTempF = 0.0F;
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 11) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt4_f;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = 0.0F;
      COMR_tCellTempF = 0.0F;
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 10) {
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt3_g;
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = 0.0F;
      COMR_tCellTempE = 0.0F;
      COMR_tCellTempF = 0.0F;
      COMR_tCellTempG = 0.0F;
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else if (COMR_cntCellBattSnsrNum - COMR_Swadp_DW.j == 7) {
      COMR_Swadp_DW.j = 0U;
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
      COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
      COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else {
      tmp = COMR_Swadp_DW.j + 7;
      if (tmp > 255) {
        tmp = 255;
      }

      COMR_Swadp_DW.j = (uint8_T)tmp;
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
      COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
      COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    }
    break;

   case COMR_Swadp_IN_CellVolt1:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;

   case COMR_Swadp_IN_CellVolt2:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;

   case COMR_Swadp_IN_CellVolt3_g:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;

   case COMR_Swadp_IN_CellVolt4_f:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;

   case COMR_Swadp_IN_CellVolt5_j:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;

   default:
    COMR_Swadp_DW.j = 0U;
    COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
    COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
    COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
    COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
    COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
    COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
    COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
    COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
    BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    break;
  }
}

/* Model step function */
void COMR_Swadp_step(void)
{
  boolean_T rtb_LogicalOperator1;
  boolean_T rtb_Counter;
  real32_T rtb_Product_m;
  real32_T rtb_Product;
  uint8_T rtb_Switch4_c;
  int32_T i;
  real32_T rtb_LogicalOperator1_0;
  if (BSWLinCommunicationFault != 0) {
    rtb_Product = 0.01F;
  } else {
    rtb_Product = 0.0F;
  }

  if (COMR_ti638LinComErr_C <= COMR_Swadp_DW.Delay_DSTATE_k) {
    rtb_Product_m = COMR_ti638LinComErr_C;
  } else {
    rtb_Product_m = COMR_Swadp_DW.Delay_DSTATE_k;
  }

  rtb_Product_m = (real32_T)(BSWLinCommunicationFault != 0) * (rtb_Product +
    rtb_Product_m);
  COMR_b638LinComErrDet = (rtb_Product_m > COMR_ti638LinComErr_C);
  COMR_Swadp_DW.Delay_DSTATE_k = rtb_Product_m;
  rtb_LogicalOperator1 = !(BSWLinCommunicationFault != 0);
  if (rtb_LogicalOperator1) {
    rtb_LogicalOperator1_0 = 0.01F;
  } else {
    rtb_LogicalOperator1_0 = 0.0F;
  }

  if (COMR_ti638LinComErr_C <= COMR_Swadp_DW.Delay_DSTATE_b) {
    rtb_Product = COMR_ti638LinComErr_C;
  } else {
    rtb_Product = COMR_Swadp_DW.Delay_DSTATE_b;
  }

  rtb_Product_m = (rtb_LogicalOperator1_0 + rtb_Product) * (real32_T)
    rtb_LogicalOperator1;
  COMR_b638LinComErrHeal = (rtb_Product_m > COMR_ti638LinComErr_C);
  COMR_Swadp_DW.Delay_DSTATE_b = rtb_Product_m;
  if (COMR_Swadp_DW.Delay2_DSTATE_o) {
    rtb_Switch4_c = (uint8_T)~(uint8_T)((uint8_T)~DFC_638LinCommErr_ASW | 8U);
  } else if (COMR_b638LinComErrDet) {
    rtb_Switch4_c = (uint8_T)(DFC_638LinCommErr_ASW | 152U);
  } else if (COMR_b638LinComErrHeal) {
    rtb_Switch4_c = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_638LinCommErr_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_c = COMR_Swadp_DW.Delay3_DSTATE_i;
  }

  COMR_Swadp_DW.Delay2_DSTATE_o = false;
  COMR_Swadp_DW.Delay3_DSTATE_i = rtb_Switch4_c;
  DFC_638LinCommErr_ASW = rtb_Switch4_c;
  rtb_LogicalOperator1 = (BSWNVMReadStatus == 1);
  if (rtb_LogicalOperator1) {
    rtb_LogicalOperator1_0 = 0.01F;
  } else {
    rtb_LogicalOperator1_0 = 0.0F;
  }

  if (COMR_tiNvmReadErr_C <= COMR_Swadp_DW.Delay_DSTATE_h) {
    rtb_Product = COMR_tiNvmReadErr_C;
  } else {
    rtb_Product = COMR_Swadp_DW.Delay_DSTATE_h;
  }

  rtb_Product_m = (rtb_LogicalOperator1_0 + rtb_Product) * (real32_T)
    rtb_LogicalOperator1;
  COMR_Swadp_DW.Delay_DSTATE_h = rtb_Product_m;
  rtb_LogicalOperator1 = !rtb_LogicalOperator1;
  if (rtb_LogicalOperator1) {
    rtb_LogicalOperator1_0 = 0.01F;
  } else {
    rtb_LogicalOperator1_0 = 0.0F;
  }

  if (COMR_tiNvmReadErr_C <= COMR_Swadp_DW.Delay_DSTATE) {
    rtb_Product = COMR_tiNvmReadErr_C;
  } else {
    rtb_Product = COMR_Swadp_DW.Delay_DSTATE;
  }

  rtb_Product = (rtb_LogicalOperator1_0 + rtb_Product) * (real32_T)
    rtb_LogicalOperator1;
  COMR_Swadp_DW.Delay_DSTATE = rtb_Product;
  if (COMR_Swadp_DW.Delay2_DSTATE_k) {
    rtb_Switch4_c = (uint8_T)~(uint8_T)((uint8_T)~DFC_EepReadErr_ASW | 8U);
  } else if ((COMR_cntNvmReadErr_CW > 0) && (rtb_Product_m > COMR_tiNvmReadErr_C))
  {
    rtb_Switch4_c = (uint8_T)(DFC_EepReadErr_ASW | 152U);
  } else if ((!(COMR_cntNvmReadErr_CW > 0)) || (rtb_Product >
              COMR_tiNvmReadErr_C)) {
    rtb_Switch4_c = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_EepReadErr_ASW | 16U)
      | 8U);
  } else {
    rtb_Switch4_c = COMR_Swadp_DW.Delay3_DSTATE;
  }

  COMR_Swadp_DW.Delay2_DSTATE_k = false;
  COMR_Swadp_DW.Delay3_DSTATE = rtb_Switch4_c;
  DFC_EepReadErr_ASW = rtb_Switch4_c;
  if (COMR_Swadp_DW.is_active_c4_COMR_Swadp == 0U) {
    COMR_Swadp_DW.is_active_c4_COMR_Swadp = 1U;
    COMR_Swadp_DW.is_c4_COMR_Swadp = COMR_Swadp_IN_Discnnt_Stt;
    COMR_S_enter_atomic_Discnnt_Stt();
  } else {
    switch (COMR_Swadp_DW.is_c4_COMR_Swadp) {
     case COMR_Swadp_IN_Cnnt_Stt:
      COMR_Swadp_Cnnt_Stt();
      break;

     case COMR_Swadp_IN_Cnnting_Stt:
      COMR_Swadp_Cnnting_Stt();
      break;

     case COMR_Swad_IN_DisCnntConfirm_Stt:
      COMR_Swadp_DisCnntConfirm_Stt();
      break;

     default:
      COMR_Swadp_Discnnt_Stt();
      break;
    }
  }

  HVSR_bSrvLmp = ((DFC_Kl30cVoltLoErr_ASW & 24) == 24);
  HVSR_bWarnLmp = (DSMR_stFaultRank >= 3);
  switch (BMCR_stBmsModeCtrl) {
   case 5:
    BCMR_tiChrgRemTime = BCMR_tiRemDChrgTime;
    break;

   case 6:
    BCMR_tiChrgRemTime = BCMR_tiRemAChgTime;
    break;

   default:
    BCMR_tiChrgRemTime = 2047.0F;
    break;
  }

  COMR_flgBmsSlp = BMCR_flgBmsSlp;
  BSER_bSocHiFault = (((DFC_SocRngHiMax_ASW & 24) == 24) || ((DFC_SocRngHiMin_ASW & 24) ==
    24));
  BSER_bSocLoFault = (((DFC_SocRngLoMax_ASW & 24) == 24) || ((DFC_SocRngLoMin_ASW & 24) ==
    24));
  COMR_uMaxCellVolt = BSPR_uCellVoltMax;
  COMR_uMinCellVolt = BSPR_uCellVoltMin;
  BCMR_bChrgFul = (BCMR_bAChrgFul || BCMR_bDChrgFul);
  BSER_bCellCnstFault = ((DFC_CellVoltNpl_ASW & 24) == 24);
  BMS_TempValueWarning = ((DFC_BattTCnstMax_ASW & 24) == 24);
  BSPR_bBattOvrTempFault = ((DFC_BattTFaultMax_ASW & 24) == 24);
  BSER_bCellOvrVoltFault = ((DFC_CellVoltFusfMax_ASW & 24) == 24);
  BSER_bCellUndrVoltFault = ((DFC_CellVoltFusfMin_ASW & 24) == 24);
  if (BMCR_stBmsModeCtrl == 11) {
    BSPR_iBattCurr_CAN = 938.3F;
  } else {
    BSPR_iBattCurr_CAN = BSPR_iBattCurr;
  }

  COMR_uIsoVoltNeg = BSPR_uIsoNegVolt;
  COMR_uIsoVoltPos = BSPR_uIsoPosVolt;
  COMR_uLoPwrSply = BSPR_uKl30;
  BEPR_bKl30VoltHiFault = ((DFC_Kl30VoltHiErr_ASW & 24) == 24);
  BEPR_bKl30VoltFault = ((DFC_Kl30OutRngErr_ASW & 24) == 24);
  BEPR_bKl30VoltLoFault = ((DFC_Kl30VoltLoErr_ASW & 24) == 24);
  rtb_LogicalOperator1 = false;
  if (COMR_Swadp_DW.Delay2_DSTATE) {
    COMR_Swadp_DW.Counter1_Count = 0U;
  }

  if (COMR_Swadp_DW.Counter1_Count < 255) {
    COMR_Swadp_DW.Counter1_Count++;
  } else {
    COMR_Swadp_DW.Counter1_Count = 0U;
  }

  if (COMR_Swadp_DW.Counter1_Count == 2) {
    rtb_LogicalOperator1 = true;
  }

  if (rtb_LogicalOperator1) {
    if (COMR_Swadp_DW.is_active_c1_COMR_Swadp == 0U) {
      COMR_Swadp_DW.is_active_c1_COMR_Swadp = 1U;
      COMR_Swadp_DW.i = 0U;
      COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
      COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
      COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
      COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
      COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
      BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
    } else {
      switch (COMR_Swadp_DW.is_Cell_Volt_l) {
       case COMR_Swadp_IN_CellVolt:
        if (BSPR_cntCellSerNum - COMR_Swadp_DW.i == 7) {
          COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt3;
          i = COMR_Swadp_DW.i + 4;
          if (i > 255) {
            i = 255;
          }

          COMR_Swadp_DW.i = (uint8_T)i;
          COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
          COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
          COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
          COMR_uCellVoltD = 0.0F;
          BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        } else if (BSPR_cntCellSerNum - COMR_Swadp_DW.i == 5) {
          COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt5;
          i = COMR_Swadp_DW.i + 4;
          if (i > 255) {
            i = 255;
          }

          COMR_Swadp_DW.i = (uint8_T)i;
          COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
          COMR_uCellVoltB = 0.0F;
          COMR_uCellVoltC = 0.0F;
          COMR_uCellVoltD = 0.0F;
          BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        } else if (BSPR_cntCellSerNum - COMR_Swadp_DW.i == 6) {
          COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt4;
          i = COMR_Swadp_DW.i + 4;
          if (i > 255) {
            i = 255;
          }

          COMR_Swadp_DW.i = (uint8_T)i;
          COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
          COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
          COMR_uCellVoltC = 0.0F;
          COMR_uCellVoltD = 0.0F;
          BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        } else if (BSPR_cntCellSerNum - COMR_Swadp_DW.i == 4) {
          COMR_Swadp_DW.i = 0U;
          COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
          COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
          COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
          COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
          COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
          BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        } else {
          i = COMR_Swadp_DW.i + 4;
          if (i > 255) {
            i = 255;
          }

          COMR_Swadp_DW.i = (uint8_T)i;
          COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
          COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
          COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
          COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
          COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
          BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        }
        break;

       case COMR_Swadp_IN_CellVolt3:
        COMR_Swadp_DW.i = 0U;
        COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
        COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
        COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
        COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
        COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
        BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        break;

       case COMR_Swadp_IN_CellVolt4:
        COMR_Swadp_DW.i = 0U;
        COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
        COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
        COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
        COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
        COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
        BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        break;

       default:
        COMR_Swadp_DW.i = 0U;
        COMR_Swadp_DW.is_Cell_Volt_l = COMR_Swadp_IN_CellVolt;
        COMR_uCellVoltA = BSPR_uCellVolt_A[COMR_Swadp_DW.i];
        COMR_uCellVoltB = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 1];
        COMR_uCellVoltC = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 2];
        COMR_uCellVoltD = BSPR_uCellVolt_A[COMR_Swadp_DW.i + 3];
        BSPR_cntCellSer = (uint8_T)((uint32_T)COMR_Swadp_DW.i >> 2);
        break;
      }
    }
  }

  for (i = 0; i < 48; i++) {
    COMR_tCellBattTempRaw_A[i] = BSPR_tCellTemp_A[i];
    COMR_tCellBattTempRaw_A[i + 48] = BSPR_tBattTemp_A[i];
  }

  for (i = 0; i < 96; i++) {
    COMR_tCellBattTemp_A[i] = COMR_tCellBattTempRaw_A[i];
  }

  for (i = 0; i < 48; i++) {
    COMR_tCellBattTemp_A[i + GcRTE_CellTempNumb_numb] = BSPR_tBattTemp_A[i];
  }

  COMR_cntCellBattSnsrNum = (uint8_T)((uint32_T)GcRTE_CellTempNumb_numb +
    GcRTE_BusbarTempNumb_numb);
  rtb_Counter = false;
  if (COMR_Swadp_DW.Delay1_DSTATE) {
    COMR_Swadp_DW.Counter_Count = 0U;
  }

  if (COMR_Swadp_DW.Counter_Count < 255) {
    COMR_Swadp_DW.Counter_Count++;
  } else {
    COMR_Swadp_DW.Counter_Count = 0U;
  }

  if (COMR_Swadp_DW.Counter_Count == 10) {
    rtb_Counter = true;
  }

  if (rtb_Counter) {
    if (COMR_Swadp_DW.is_active_c2_COMR_Swadp == 0U) {
      COMR_Swadp_DW.is_active_c2_COMR_Swadp = 1U;
      COMR_Swadp_DW.j = 0U;
      COMR_Swadp_DW.is_Cell_Volt = COMR_Swadp_IN_CellVolt;
      COMR_tCellTempA = COMR_tCellBattTemp_A[COMR_Swadp_DW.j];
      COMR_tCellTempB = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 1];
      COMR_tCellTempC = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 2];
      COMR_tCellTempD = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 3];
      COMR_tCellTempE = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 4];
      COMR_tCellTempF = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 5];
      COMR_tCellTempG = COMR_tCellBattTemp_A[COMR_Swadp_DW.j + 6];
      BSPR_cntCellTemp = (uint8_T)(COMR_Swadp_DW.j / 7);
    } else {
      COMR_Swadp_Cell_Volt();
    }
  }

  COMR_bVcuComTOut = ((DFC_Msg2A3Tmt_ASW & 24) == 24);
  COMR_bObcComTOut = ((DFC_Msg2E6Tmt_ASW & 24) == 24);
  BCMR_bCC2Fault = ((DFC_CC2Chk_ASW & 24) == 24);
  BSPR_bBattUndrTempFault = ((DFC_BattTFaultMin_ASW & 24) == 24);
  COMR_bCmuComTOut = (((DFC_CellTempTmt_ASW & 24) == 24) || ((DFC_CellVoltTmt_ASW & 24) ==
    24) || ((DFC_BoardTempTmt_ASW & 24) == 24));
  COMR_bCmuComBoff = ((DFC_InCanBusOff_ASW & 24) == 24);
  COMR_bDChrgComBoff = ((DFC_DcCanBusOff_ASW & 24) == 24);
  COMR_bEvComBoff = ((DFC_VeCanBusOff_ASW & 24) == 24);
  HVSR_bHvilInpScb = ((DFC_HvilMax_ASW & 24) == 24);
  HVSR_bHvilScg = ((DFC_HvilMin_ASW & 24) == 24);
  HVSR_bHvilOl = ((DFC_HvilSig_ASW & 24) == 24);
  HVSR_bCrashFault = ((DFC_CrashNpl_ASW & 24) == 24);
  if ((DFC_PosStuckMax_ASW & 24) == 24) {
    rtb_Switch4_c = 3U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    rtb_Switch4_c = 3U;
  } else if ((DFC_MPosStuckMin_ASW & 24) == 24) {
    rtb_Switch4_c = 2U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    BCCR_stMPosCtrStatus = rtb_Switch4_c;
  } else {
    BCCR_stMPosCtrStatus = (uint8_T)BCCR_bMPosCtrSwtOn;
  }

  if ((DFC_MNegStuckMax_ASW & 24) == 24) {
    rtb_Switch4_c = 3U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    rtb_Switch4_c = 3U;
  } else if ((DFC_MNegStuckMin_ASW & 24) == 24) {
    rtb_Switch4_c = 2U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    BCCR_stMNegChCtrStatus = rtb_Switch4_c;
  } else {
    BCCR_stMNegChCtrStatus = (uint8_T)BCCR_bMNegCtrSwtOn;
  }

  if ((DFC_PrStuckMin_ASW & 24) == 24) {
    rtb_Switch4_c = 2U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    BCCR_stPreChCtrStatus = rtb_Switch4_c;
  } else {
    BCCR_stPreChCtrStatus = (uint8_T)BCCR_bPreChCtrSwtOn;
  }

  if ((DFC_DChrgPosStuckMax_ASW & 24) == 24) {
    rtb_Switch4_c = 3U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    rtb_Switch4_c = 3U;
  } else if ((DFC_DChrgPosStuckMin_ASW & 24) == 24) {
    rtb_Switch4_c = 2U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    BCCR_stDcChPosCtrStatus = rtb_Switch4_c;
  } else {
    BCCR_stDcChPosCtrStatus = (uint8_T)BCCR_bDChrgPosCtrSwtOn;
  }

  if ((DFC_DChrgNegStuckMax_ASW & 24) == 24) {
    rtb_Switch4_c = 3U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    rtb_Switch4_c = 3U;
  } else if ((DFC_DChrgNegStuckMin_ASW & 24) == 24) {
    rtb_Switch4_c = 2U;
  } else {
    rtb_Switch4_c = 0U;
  }

  if (rtb_Switch4_c != 0) {
    BCCR_stDcChNegCtrStatus = rtb_Switch4_c;
  } else {
    BCCR_stDcChNegCtrStatus = (uint8_T)BCCR_bDChrgNegCtrSwtOn;
  }

  BSPR_flgGwAbmVld = !(((DFC_ChkSumMsg050Err_ASW & 24) == 24) || ((DFC_RcMsg050Mis_ASW &
    24) == 24));
  if (HVSR_InsResValdFault != 0) {
    HVSR_bIsoFault = 1U;
  } else if (HVSR_flgIsoFaultLvl1 != 0) {
    HVSR_bIsoFault = 2U;
  } else if (HVSR_flgIsoFaultLvl2 != 0) {
    HVSR_bIsoFault = 3U;
  } else {
    HVSR_bIsoFault = 0U;
  }

  COMR_ahCapacity = COMR_ahBattNrmCap_C;
  COMR_Swadp_DW.Delay2_DSTATE = rtb_LogicalOperator1;
  COMR_Swadp_DW.Delay1_DSTATE = rtb_Counter;
}

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

  /* block I/O */

  /* custom signals */
  BCMR_tiChrgRemTime = 0.0F;
  COMR_uMaxCellVolt = 0.0F;
  COMR_uMinCellVolt = 0.0F;
  BSPR_iBattCurr_CAN = 0.0F;
  COMR_uIsoVoltNeg = 0.0F;
  COMR_uIsoVoltPos = 0.0F;
  COMR_uLoPwrSply = 0.0F;
  COMR_ahCapacity = 0.0F;
  COMR_tCellTempA = 0.0F;
  COMR_tCellTempB = 0.0F;
  COMR_tCellTempC = 0.0F;
  COMR_tCellTempD = 0.0F;
  COMR_tCellTempE = 0.0F;
  COMR_tCellTempF = 0.0F;
  COMR_tCellTempG = 0.0F;
  COMR_uCellVoltA = 0.0F;
  COMR_uCellVoltB = 0.0F;
  COMR_uCellVoltC = 0.0F;
  COMR_uCellVoltD = 0.0F;
  BCCR_stMPosCtrStatus = ((uint8_T)0U);
  BCCR_stMNegChCtrStatus = ((uint8_T)0U);
  BCCR_stPreChCtrStatus = ((uint8_T)0U);
  BCCR_stDcChPosCtrStatus = ((uint8_T)0U);
  BCCR_stDcChNegCtrStatus = ((uint8_T)0U);
  HVSR_bIsoFault = ((uint8_T)0U);
  BSPR_cntCellTemp = ((uint8_T)0U);
  BSPR_cntCellSer = ((uint8_T)0U);
  BCCR_stHVConnSt = ((uint8_T)0U);
  HVSR_bSrvLmp = false;
  HVSR_bWarnLmp = false;
  COMR_flgBmsSlp = false;
  BSER_bSocHiFault = false;
  BSER_bSocLoFault = false;
  BCMR_bChrgFul = false;
  BSER_bCellCnstFault = false;
  BMS_TempValueWarning = false;
  BSPR_bBattOvrTempFault = false;
  BSER_bCellOvrVoltFault = false;
  BSER_bCellUndrVoltFault = false;
  BEPR_bKl30VoltHiFault = false;
  BEPR_bKl30VoltFault = false;
  BEPR_bKl30VoltLoFault = false;
  COMR_bVcuComTOut = false;
  COMR_bObcComTOut = false;
  BCMR_bCC2Fault = false;
  BSPR_bBattUndrTempFault = false;
  COMR_bCmuComTOut = false;
  COMR_bCmuComBoff = false;
  COMR_bDChrgComBoff = false;
  COMR_bEvComBoff = false;
  HVSR_bHvilInpScb = false;
  HVSR_bHvilScg = false;
  HVSR_bHvilOl = false;
  HVSR_bCrashFault = false;
  BSPR_flgGwAbmVld = false;
  COMR_b638LinComErrDet = false;
  COMR_b638LinComErrHeal = false;
  COMR_Swadp_DW.Delay2_DSTATE_o = true;
  COMR_Swadp_DW.Delay2_DSTATE_k = true;
}

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