/*
 * File: BSPR_DChrgTempSnsrDiag.c
 *
 * Code generated for Simulink model 'BSPR_DChrgTempSnsrDiag'.
 *
 * Model version                  : 1.108F
 * Simulink Coder version         : 8.11F (R2016b) 25-Aug-2016
 * C/C++ source code generated on : Wed Dec 19 17:21:13 2018
 *
 * 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 "BSPR_DChrgTempSnsrDiag.h"
#include "BSPR_DChrgTempSnsrDiag_private.h"

/* Exported data definition */

/* Volatile memory section */
 
 

/* Definition for custom storage class: Volatile */
volatile uint8_T DFC_DChrgTNegElecMax_ASW;
volatile uint8_T DFC_DChrgTNegElecMin_ASW;
volatile uint8_T DFC_DChrgTNegElecSig_ASW;
volatile uint8_T DFC_DChrgTPosElecMax_ASW;
volatile uint8_T DFC_DChrgTPosElecMin_ASW;
volatile uint8_T DFC_DChrgTPosElecSig_ASW;

 
 

/* Definition for custom storage class: OutputSignal */
volatile boolean_T BSPR_bDChrgNegTempVld;
volatile boolean_T BSPR_bDChrgPosTempVld;
volatile boolean_T BSPR_bDChrgTNegJitErrDet;
volatile boolean_T BSPR_bDChrgTNegJitErrHeal;
volatile boolean_T BSPR_bDChrgTNegJitErrStt;
volatile boolean_T BSPR_bDChrgTNegMaxErrDet;
volatile boolean_T BSPR_bDChrgTNegMaxErrHeal;
volatile boolean_T BSPR_bDChrgTNegMaxErrStt;
volatile boolean_T BSPR_bDChrgTNegMinErrDet;
volatile boolean_T BSPR_bDChrgTNegMinErrHeal;
volatile boolean_T BSPR_bDChrgTNegMinErrStt;
volatile boolean_T BSPR_bDChrgTPosJitErrDet;
volatile boolean_T BSPR_bDChrgTPosJitErrHeal;
volatile boolean_T BSPR_bDChrgTPosJitErrStt;
volatile boolean_T BSPR_bDChrgTPosMaxErrDet;
volatile boolean_T BSPR_bDChrgTPosMaxErrHeal;
volatile boolean_T BSPR_bDChrgTPosMaxErrStt;
volatile boolean_T BSPR_bDChrgTPosMinErrDet;
volatile boolean_T BSPR_bDChrgTPosMinErrHeal;
volatile boolean_T BSPR_bDChrgTPosMinErrStt;

/* Block states (auto storage) */
DW_BSPR_DChrgTempSnsrDiag_T BSPR_DChrgTempSnsrDiag_DW;

/* Model step function */
void BSPR_DChrgTempSnsrDiag_step(void)
{
  boolean_T rtb_Compare;
  boolean_T rtb_LogicalOperator2;
  boolean_T rtb_LogicalOperator;
  boolean_T rtb_LogicalOperator1;
  boolean_T rtb_LogicalOperator2_g;
  boolean_T rtb_LogicalOperator_h;
  boolean_T rtb_LogicalOperator1_i2;
  boolean_T rtb_LogicalOperator4;
  real32_T rtb_Product_kf;
  uint8_T rtb_Switch4_h;
  real32_T rtb_LogicalOperator2_1;
  BSPR_bDChrgTPosJitErrStt = ((real32_T)fabs(BSPR_uDChrgPosTempFlt -
    BSPR_uDChrgPosTemp) > BSPR_uDChrgTPosJitDiff_C);
  if (BSPR_bDChrgTPosJitErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTPosJit_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTPosJit_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTPosJitErrStt;
  BSPR_bDChrgTPosJitErrDet = (rtb_Product_kf > BSPR_tiDChrgTPosJit_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l = rtb_Product_kf;
  rtb_Compare = ((BCCR_cntDChrgTempDiag_CW & 1) == 1);
  rtb_LogicalOperator2 = !BSPR_bDChrgTPosJitErrStt;
  if (rtb_LogicalOperator2) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTPosJit_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_f) {
    rtb_Product_kf = BSPR_tiDChrgTPosJit_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_f;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator2;
  BSPR_bDChrgTPosJitErrHeal = (rtb_Product_kf > BSPR_tiDChrgTPosJit_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_f = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_e) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecSig_ASW | 8U);
  } else if (rtb_Compare && BSPR_bDChrgTPosJitErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTPosElecSig_ASW | 152U);
  } else if ((!rtb_Compare) || BSPR_bDChrgTPosJitErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecSig_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_l;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_e = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_l = rtb_Switch4_h;
  DFC_DChrgTPosElecSig_ASW = rtb_Switch4_h;
  BSPR_bDChrgTPosMaxErrStt = (BSPR_uDChrgPosTemp > BSPR_uDChrgTPosElecMax_C);
  if (BSPR_bDChrgTPosMaxErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTPosElecMax_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_p) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTPosElecMax_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_p;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTPosMaxErrStt;
  BSPR_bDChrgTPosMaxErrDet = (rtb_Product_kf > BSPR_tiDChrgTPosElecMax_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_p = rtb_Product_kf;
  rtb_LogicalOperator2 = ((BCCR_cntDChrgTempDiag_CW & 2) == 2);
  rtb_LogicalOperator = !BSPR_bDChrgTPosMaxErrStt;
  if (rtb_LogicalOperator) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTPosElecMax_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_d) {
    rtb_Product_kf = BSPR_tiDChrgTPosElecMax_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_d;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator;
  BSPR_bDChrgTPosMaxErrHeal = (rtb_Product_kf > BSPR_tiDChrgTPosElecMax_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_d = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_n) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecMax_ASW | 8U);
  } else if (rtb_LogicalOperator2 && BSPR_bDChrgTPosMaxErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTPosElecMax_ASW | 152U);
  } else if ((!rtb_LogicalOperator2) || BSPR_bDChrgTPosMaxErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecMax_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_e;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_n = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_e = rtb_Switch4_h;
  DFC_DChrgTPosElecMax_ASW = rtb_Switch4_h;
  BSPR_bDChrgTPosMinErrStt = (BSPR_uDChrgPosTemp < BSPR_uDChrgTPosElecMin_C);
  if (BSPR_bDChrgTPosMinErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTPosElecMin_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_e) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTPosElecMin_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_e;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTPosMinErrStt;
  BSPR_bDChrgTPosMinErrDet = (rtb_Product_kf > BSPR_tiDChrgTPosElecMin_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_e = rtb_Product_kf;
  rtb_LogicalOperator = ((BCCR_cntDChrgTempDiag_CW & 4) == 4);
  rtb_LogicalOperator1 = !BSPR_bDChrgTPosMinErrStt;
  if (rtb_LogicalOperator1) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTPosElecMin_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_j) {
    rtb_Product_kf = BSPR_tiDChrgTPosElecMin_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_j;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator1;
  BSPR_bDChrgTPosMinErrHeal = (rtb_Product_kf > BSPR_tiDChrgTPosElecMin_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_j = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_h) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecMin_ASW | 8U);
  } else if (rtb_LogicalOperator && BSPR_bDChrgTPosMinErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTPosElecMin_ASW | 152U);
  } else if ((!rtb_LogicalOperator) || BSPR_bDChrgTPosMinErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTPosElecMin_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_k;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_h = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_k = rtb_Switch4_h;
  DFC_DChrgTPosElecMin_ASW = rtb_Switch4_h;
  BSPR_bDChrgTNegJitErrStt = ((real32_T)fabs(BSPR_uDChrgNegTempFlt -
    BSPR_uDChrgNegTemp) > BSPR_uDChrgTNegJitDiff_C);
  if (BSPR_bDChrgTNegJitErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTNegJit_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l5) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTNegJit_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l5;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTNegJitErrStt;
  BSPR_bDChrgTNegJitErrDet = (rtb_Product_kf > BSPR_tiDChrgTNegJit_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_l5 = rtb_Product_kf;
  rtb_LogicalOperator1 = ((BCCR_cntDChrgTempDiag_CW & 8) == 8);
  rtb_LogicalOperator2_g = !BSPR_bDChrgTNegJitErrStt;
  if (rtb_LogicalOperator2_g) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTNegJit_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_m) {
    rtb_Product_kf = BSPR_tiDChrgTNegJit_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_m;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator2_g;
  BSPR_bDChrgTNegJitErrHeal = (rtb_Product_kf > BSPR_tiDChrgTNegJit_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_m = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_i) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecSig_ASW | 8U);
  } else if (rtb_LogicalOperator1 && BSPR_bDChrgTNegJitErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTNegElecSig_ASW | 152U);
  } else if ((!rtb_LogicalOperator1) || BSPR_bDChrgTNegJitErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecSig_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_j;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_i = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_j = rtb_Switch4_h;
  DFC_DChrgTNegElecSig_ASW = rtb_Switch4_h;
  BSPR_bDChrgTNegMaxErrStt = (BSPR_uDChrgNegTemp > BSPR_uDChrgTNegElecMax_C);
  if (BSPR_bDChrgTNegMaxErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTNegElecMax_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_o) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTNegElecMax_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_o;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTNegMaxErrStt;
  BSPR_bDChrgTNegMaxErrDet = (rtb_Product_kf > BSPR_tiDChrgTNegElecMax_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_o = rtb_Product_kf;
  rtb_LogicalOperator2_g = ((BCCR_cntDChrgTempDiag_CW & 16) == 16);
  rtb_LogicalOperator_h = !BSPR_bDChrgTNegMaxErrStt;
  if (rtb_LogicalOperator_h) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTNegElecMax_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c4) {
    rtb_Product_kf = BSPR_tiDChrgTNegElecMax_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c4;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator_h;
  BSPR_bDChrgTNegMaxErrHeal = (rtb_Product_kf > BSPR_tiDChrgTNegElecMax_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c4 = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_c) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecMax_ASW | 8U);
  } else if (rtb_LogicalOperator2_g && BSPR_bDChrgTNegMaxErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTNegElecMax_ASW | 152U);
  } else if ((!rtb_LogicalOperator2_g) || BSPR_bDChrgTNegMaxErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecMax_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_n;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_c = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE_n = rtb_Switch4_h;
  DFC_DChrgTNegElecMax_ASW = rtb_Switch4_h;
  BSPR_bDChrgTNegMinErrStt = (BSPR_uDChrgNegTemp < BSPR_uDChrgTNegElecMin_C);
  if (BSPR_bDChrgTNegMinErrStt) {
    rtb_Product_kf = 0.1F;
  } else {
    rtb_Product_kf = 0.0F;
  }

  if (BSPR_tiDChrgTNegElecMin_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_i) {
    rtb_LogicalOperator2_1 = BSPR_tiDChrgTNegElecMin_C;
  } else {
    rtb_LogicalOperator2_1 = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_i;
  }

  rtb_Product_kf = (rtb_Product_kf + rtb_LogicalOperator2_1) * (real32_T)
    BSPR_bDChrgTNegMinErrStt;
  BSPR_bDChrgTNegMinErrDet = (rtb_Product_kf > BSPR_tiDChrgTNegElecMin_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_i = rtb_Product_kf;
  rtb_LogicalOperator_h = ((BCCR_cntDChrgTempDiag_CW & 32) == 32);
  rtb_LogicalOperator1_i2 = !BSPR_bDChrgTNegMinErrStt;
  if (rtb_LogicalOperator1_i2) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTNegElecMin_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_n) {
    rtb_Product_kf = BSPR_tiDChrgTNegElecMin_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_n;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator1_i2;
  BSPR_bDChrgTNegMinErrHeal = (rtb_Product_kf > BSPR_tiDChrgTNegElecMin_C);
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_n = rtb_Product_kf;
  if (BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE) {
    rtb_Switch4_h = (uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecMin_ASW | 8U);
  } else if (rtb_LogicalOperator_h && BSPR_bDChrgTNegMinErrDet) {
    rtb_Switch4_h = (uint8_T)(DFC_DChrgTNegElecMin_ASW | 152U);
  } else if ((!rtb_LogicalOperator_h) || BSPR_bDChrgTNegMinErrHeal) {
    rtb_Switch4_h = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_DChrgTNegElecMin_ASW
      | 16U) | 8U);
  } else {
    rtb_Switch4_h = BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE;
  }

  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay3_DSTATE = rtb_Switch4_h;
  DFC_DChrgTNegElecMin_ASW = rtb_Switch4_h;
  rtb_LogicalOperator1_i2 = !(BSPR_bDChrgTPosJitErrStt ||
    BSPR_bDChrgTPosMaxErrStt || BSPR_bDChrgTPosMinErrStt);
  rtb_LogicalOperator4 = !(BSPR_bDChrgTNegJitErrStt || BSPR_bDChrgTNegMaxErrStt ||
    BSPR_bDChrgTNegMinErrStt);
  if (rtb_LogicalOperator4) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTNegVld_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE) {
    rtb_Product_kf = BSPR_tiDChrgTNegVld_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator4;
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE = rtb_Product_kf;
  BSPR_bDChrgNegTempVld = ((!(rtb_LogicalOperator_h || rtb_LogicalOperator2_g ||
    rtb_LogicalOperator1)) || (rtb_Product_kf > BSPR_tiDChrgTNegVld_C));
  if (rtb_LogicalOperator1_i2) {
    rtb_LogicalOperator2_1 = 0.1F;
  } else {
    rtb_LogicalOperator2_1 = 0.0F;
  }

  if (BSPR_tiDChrgTPosVld_C <= BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c) {
    rtb_Product_kf = BSPR_tiDChrgTPosVld_C;
  } else {
    rtb_Product_kf = BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c;
  }

  rtb_Product_kf = (rtb_LogicalOperator2_1 + rtb_Product_kf) * (real32_T)
    rtb_LogicalOperator1_i2;
  BSPR_DChrgTempSnsrDiag_DW.Delay_DSTATE_c = rtb_Product_kf;
  BSPR_bDChrgPosTempVld = ((!(rtb_LogicalOperator || rtb_LogicalOperator2 ||
    rtb_Compare)) || (rtb_Product_kf > BSPR_tiDChrgTPosVld_C));
}

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

  /* block I/O */

  /* custom signals */
  BSPR_bDChrgNegTempVld = false;
  BSPR_bDChrgPosTempVld = false;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_e = true;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_n = true;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_h = true;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_i = true;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE_c = true;
  BSPR_DChrgTempSnsrDiag_DW.Delay2_DSTATE = true;
}

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