/*
 * File: BSPR_ThmTempSnsrDiag.c
 *
 * Code generated for Simulink model 'BSPR_ThmTempSnsrDiag'.
 *
 * Model version                  : 1.200
 * Simulink Coder version         : 8.13 (R2017b) 24-Jul-2017
 * C/C++ source code generated on : Fri Oct  9 10:59:38 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 "BSPR_ThmTempSnsrDiag.h"
#include "BSPR_ThmTempSnsrDiag_private.h"

/* Exported data definition */

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

/* Definition for custom storage class: Volatile */
volatile uint8_T DFC_ClntDsTElecMax_ASW;   /* Max fault of coolant inlet temperature sensor */
volatile uint8_T DFC_ClntDsTElecMin_ASW;   /* Min fault of coolant inlet temperature sensor */
volatile uint8_T DFC_ClntDsTElecSig_ASW;   /* Sig fault of coolant inlet temperature sensor */
volatile uint8_T DFC_ClntUsTElecMax_ASW;   /* Max fault of coolant outlet temperature sensor */
volatile uint8_T DFC_ClntUsTElecMin_ASW;   /* Min fault of coolant outlet temperature sensor */
volatile uint8_T DFC_ClntUsTElecSig_ASW;   /* Sig fault of coolant outlet temperature sensor */
volatile uint8_T DFC_InClntOverTmp_ASW;    /* Inlet coolant temperature high */
volatile uint8_T DFC_OutClntOverTmp_ASW;   /* Outlet coolant temperature high */

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"
#define ASW1_OEM_START_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Definition for custom storage class: OutputSignal */
volatile boolean_T BSPR_bClntDsTJitErrDet;
volatile boolean_T BSPR_bClntDsTJitErrHeal;
volatile boolean_T BSPR_bClntDsTJitErrStt;
volatile boolean_T BSPR_bClntDsTMaxErrDet;
volatile boolean_T BSPR_bClntDsTMaxErrHeal;
volatile boolean_T BSPR_bClntDsTMaxErrStt;
volatile boolean_T BSPR_bClntDsTMinErrDet;
volatile boolean_T BSPR_bClntDsTMinErrHeal;
volatile boolean_T BSPR_bClntDsTMinErrStt;
volatile boolean_T BSPR_bClntDsTOTErrDet;
volatile boolean_T BSPR_bClntDsTOTErrHeal;
volatile boolean_T BSPR_bClntDsTVld;
volatile boolean_T BSPR_bClntUsTJitErrDet;
volatile boolean_T BSPR_bClntUsTJitErrHeal;
volatile boolean_T BSPR_bClntUsTJitErrStt;
volatile boolean_T BSPR_bClntUsTMaxErrDet;
volatile boolean_T BSPR_bClntUsTMaxErrHeal;
volatile boolean_T BSPR_bClntUsTMaxErrStt;
volatile boolean_T BSPR_bClntUsTMinErrDet;
volatile boolean_T BSPR_bClntUsTMinErrHeal;
volatile boolean_T BSPR_bClntUsTMinErrStt;
volatile boolean_T BSPR_bClntUsTOTErrDet;
volatile boolean_T BSPR_bClntUsTOTErrHeal;
volatile boolean_T BSPR_bClntUsTVld;

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Block states (auto storage) */
DW_BSPR_ThmTempSnsrDiag_T BSPR_ThmTempSnsrDiag_DW;

/* Model step function */
void BSPR_ThmTempSnsrDiag_step(void)
{
  boolean_T rtb_RelationalOperator3;
  boolean_T rtb_LogicalOperator5_p;
  boolean_T rtb_LogicalOperator6;
  boolean_T rtb_LogicalOperator1;
  boolean_T rtb_LogicalOperator3_e;
  boolean_T rtb_LogicalOperator_a;
  boolean_T rtb_LogicalOperator1_f;
  boolean_T rtb_LogicalOperator4_b;
  real32_T rtb_Product_g;
  uint8_T rtb_Switch4_j;
  real32_T rtb_LogicalOperator6_0;
  BSPR_bClntUsTMinErrStt = (BSPR_uClntUsT < BSPR_uClntUsTElecMin_C);
  BSPR_bClntUsTMaxErrStt = (BSPR_uClntUsT > BSPR_uClntUsTElecMax_C);
  BSPR_bClntUsTJitErrStt = ((real32_T)fabs(BSPR_uClntUsTFlt - BSPR_uClntUsT) >
    BSPR_uClntUsTJitDiff_C);
  rtb_RelationalOperator3 = !(BSPR_bClntUsTMinErrStt || BSPR_bClntUsTMaxErrStt ||
    BSPR_bClntUsTJitErrStt);
  rtb_LogicalOperator5_p = (BSPR_tClntUsT > BSPR_tClntUsTOvrTemp_C);
  rtb_LogicalOperator6 = (rtb_RelationalOperator3 && rtb_LogicalOperator5_p);
  if (rtb_LogicalOperator6) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTOvrTemp_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l) {
    rtb_Product_g = BSPR_tiClntUsTOvrTemp_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator6;
  BSPR_bClntUsTOTErrDet = (rtb_Product_g > BSPR_tiClntUsTOvrTemp_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l = rtb_Product_g;
  rtb_RelationalOperator3 = (rtb_RelationalOperator3 && (!rtb_LogicalOperator5_p));
  if (rtb_RelationalOperator3) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTOvrTemp_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE) {
    rtb_Product_g = BSPR_tiClntUsTOvrTemp_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_RelationalOperator3;
  BSPR_bClntUsTOTErrHeal = (rtb_Product_g > BSPR_tiClntUsTOvrTemp_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_d) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_InClntOverTmp_ASW | 8U);
  } else {
    rtb_RelationalOperator3 = ((BCCR_cntClntTempDiag_CW & 64) == 64);
    if (rtb_RelationalOperator3 && BSPR_bClntUsTOTErrDet) {
      rtb_Switch4_j = (uint8_T)(DFC_InClntOverTmp_ASW | 152U);
    } else if ((!rtb_RelationalOperator3) || BSPR_bClntUsTOTErrHeal) {
      rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_InClntOverTmp_ASW |
        16U) | 8U);
    } else {
      rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_n;
    }
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_d = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_n = rtb_Switch4_j;
  DFC_InClntOverTmp_ASW = rtb_Switch4_j;
  BSPR_bClntDsTMinErrStt = (BSPR_uClntDsT < BSPR_uClntDsTElecMin_C);
  BSPR_bClntDsTMaxErrStt = (BSPR_uClntDsT > BSPR_uClntDsTElecMax_C);
  BSPR_bClntDsTJitErrStt = ((real32_T)fabs(BSPR_uClntDsTFlt - BSPR_uClntDsT) >
    BSPR_uClntDsTJitDiff_C);
  rtb_LogicalOperator5_p = !(BSPR_bClntDsTMinErrStt || BSPR_bClntDsTMaxErrStt ||
    BSPR_bClntDsTJitErrStt);
  rtb_RelationalOperator3 = (BSPR_tClntDsT > BSPR_tClntDsTOvrTemp_C);
  rtb_LogicalOperator6 = (rtb_LogicalOperator5_p && rtb_RelationalOperator3);
  if (rtb_LogicalOperator6) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTOvrTemp_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_dy) {
    rtb_Product_g = BSPR_tiClntDsTOvrTemp_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_dy;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator6;
  BSPR_bClntDsTOTErrDet = (rtb_Product_g > BSPR_tiClntDsTOvrTemp_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_dy = rtb_Product_g;
  rtb_RelationalOperator3 = (rtb_LogicalOperator5_p && (!rtb_RelationalOperator3));
  if (rtb_RelationalOperator3) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTOvrTemp_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_ds) {
    rtb_Product_g = BSPR_tiClntDsTOvrTemp_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_ds;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_RelationalOperator3;
  BSPR_bClntDsTOTErrHeal = (rtb_Product_g > BSPR_tiClntDsTOvrTemp_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_ds = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_OutClntOverTmp_ASW | 8U);
  } else {
    rtb_RelationalOperator3 = ((BCCR_cntClntTempDiag_CW & 128) == 128);
    if (rtb_RelationalOperator3 && BSPR_bClntDsTOTErrDet) {
      rtb_Switch4_j = (uint8_T)(DFC_OutClntOverTmp_ASW | 152U);
    } else if ((!rtb_RelationalOperator3) || BSPR_bClntDsTOTErrHeal) {
      rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_OutClntOverTmp_ASW
        | 16U) | 8U);
    } else {
      rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE;
    }
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE = rtb_Switch4_j;
  DFC_OutClntOverTmp_ASW = rtb_Switch4_j;
  if (BSPR_bClntDsTJitErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntDsTJit_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l5) {
    rtb_LogicalOperator6_0 = BSPR_tiClntDsTJit_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l5;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntDsTJitErrStt;
  BSPR_bClntDsTJitErrDet = (rtb_Product_g > BSPR_tiClntDsTJit_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l5 = rtb_Product_g;
  rtb_RelationalOperator3 = ((BCCR_cntClntTempDiag_CW & 8) == 8);
  rtb_LogicalOperator5_p = !BSPR_bClntDsTJitErrStt;
  if (rtb_LogicalOperator5_p) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTJit_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_m) {
    rtb_Product_g = BSPR_tiClntDsTJit_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_m;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator5_p;
  BSPR_bClntDsTJitErrHeal = (rtb_Product_g > BSPR_tiClntDsTJit_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_m = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_i) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecSig_ASW | 8U);
  } else if (rtb_RelationalOperator3 && BSPR_bClntDsTJitErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntDsTElecSig_ASW | 152U);
  } else if ((!rtb_RelationalOperator3) || BSPR_bClntDsTJitErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecSig_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_j;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_i = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_j = rtb_Switch4_j;
  DFC_ClntDsTElecSig_ASW = rtb_Switch4_j;
  if (BSPR_bClntDsTMaxErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntDsTElecMax_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_o) {
    rtb_LogicalOperator6_0 = BSPR_tiClntDsTElecMax_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_o;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntDsTMaxErrStt;
  BSPR_bClntDsTMaxErrDet = (rtb_Product_g > BSPR_tiClntDsTElecMax_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_o = rtb_Product_g;
  rtb_LogicalOperator5_p = ((BCCR_cntClntTempDiag_CW & 16) == 16);
  rtb_LogicalOperator6 = !BSPR_bClntDsTMaxErrStt;
  if (rtb_LogicalOperator6) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTElecMax_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c4) {
    rtb_Product_g = BSPR_tiClntDsTElecMax_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c4;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator6;
  BSPR_bClntDsTMaxErrHeal = (rtb_Product_g > BSPR_tiClntDsTElecMax_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c4 = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_c) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecMax_ASW | 8U);
  } else if (rtb_LogicalOperator5_p && BSPR_bClntDsTMaxErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntDsTElecMax_ASW | 152U);
  } else if ((!rtb_LogicalOperator5_p) || BSPR_bClntDsTMaxErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecMax_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_nv;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_c = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_nv = rtb_Switch4_j;
  DFC_ClntDsTElecMax_ASW = rtb_Switch4_j;
  if (BSPR_bClntDsTMinErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntDsTElecMin_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_i) {
    rtb_LogicalOperator6_0 = BSPR_tiClntDsTElecMin_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_i;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntDsTMinErrStt;
  BSPR_bClntDsTMinErrDet = (rtb_Product_g > BSPR_tiClntDsTElecMin_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_i = rtb_Product_g;
  rtb_LogicalOperator6 = ((BCCR_cntClntTempDiag_CW & 32) == 32);
  rtb_LogicalOperator1 = !BSPR_bClntDsTMinErrStt;
  if (rtb_LogicalOperator1) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTElecMin_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_n) {
    rtb_Product_g = BSPR_tiClntDsTElecMin_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_n;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator1;
  BSPR_bClntDsTMinErrHeal = (rtb_Product_g > BSPR_tiClntDsTElecMin_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_n = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_g) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecMin_ASW | 8U);
  } else if (rtb_LogicalOperator6 && BSPR_bClntDsTMinErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntDsTElecMin_ASW | 152U);
  } else if ((!rtb_LogicalOperator6) || BSPR_bClntDsTMinErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntDsTElecMin_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_b;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_g = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_b = rtb_Switch4_j;
  DFC_ClntDsTElecMin_ASW = rtb_Switch4_j;
  if (BSPR_bClntUsTJitErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntUsTJit_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2) {
    rtb_LogicalOperator6_0 = BSPR_tiClntUsTJit_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntUsTJitErrStt;
  BSPR_bClntUsTJitErrDet = (rtb_Product_g > BSPR_tiClntUsTJit_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2 = rtb_Product_g;
  rtb_LogicalOperator1 = ((BCCR_cntClntTempDiag_CW & 1) == 1);
  rtb_LogicalOperator3_e = !BSPR_bClntUsTJitErrStt;
  if (rtb_LogicalOperator3_e) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTJit_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_f) {
    rtb_Product_g = BSPR_tiClntUsTJit_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_f;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator3_e;
  BSPR_bClntUsTJitErrHeal = (rtb_Product_g > BSPR_tiClntUsTJit_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_f = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_e) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecSig_ASW | 8U);
  } else if (rtb_LogicalOperator1 && BSPR_bClntUsTJitErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntUsTElecSig_ASW | 152U);
  } else if ((!rtb_LogicalOperator1) || BSPR_bClntUsTJitErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecSig_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_l;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_e = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_l = rtb_Switch4_j;
  DFC_ClntUsTElecSig_ASW = rtb_Switch4_j;
  if (BSPR_bClntUsTMaxErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntUsTElecMax_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_p) {
    rtb_LogicalOperator6_0 = BSPR_tiClntUsTElecMax_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_p;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntUsTMaxErrStt;
  BSPR_bClntUsTMaxErrDet = (rtb_Product_g > BSPR_tiClntUsTElecMax_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_p = rtb_Product_g;
  rtb_LogicalOperator3_e = ((BCCR_cntClntTempDiag_CW & 2) == 2);
  rtb_LogicalOperator_a = !BSPR_bClntUsTMaxErrStt;
  if (rtb_LogicalOperator_a) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTElecMax_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_d) {
    rtb_Product_g = BSPR_tiClntUsTElecMax_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_d;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator_a;
  BSPR_bClntUsTMaxErrHeal = (rtb_Product_g > BSPR_tiClntUsTElecMax_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_d = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_n) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecMax_ASW | 8U);
  } else if (rtb_LogicalOperator3_e && BSPR_bClntUsTMaxErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntUsTElecMax_ASW | 152U);
  } else if ((!rtb_LogicalOperator3_e) || BSPR_bClntUsTMaxErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecMax_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_e;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_n = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_e = rtb_Switch4_j;
  DFC_ClntUsTElecMax_ASW = rtb_Switch4_j;
  if (BSPR_bClntUsTMinErrStt) {
    rtb_Product_g = 0.1F;
  } else {
    rtb_Product_g = 0.0F;
  }

  if (BSPR_tiClntUsTElecMin_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_e) {
    rtb_LogicalOperator6_0 = BSPR_tiClntUsTElecMin_C;
  } else {
    rtb_LogicalOperator6_0 = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_e;
  }

  rtb_Product_g = (rtb_Product_g + rtb_LogicalOperator6_0) * (real32_T)
    BSPR_bClntUsTMinErrStt;
  BSPR_bClntUsTMinErrDet = (rtb_Product_g > BSPR_tiClntUsTElecMin_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_e = rtb_Product_g;
  rtb_LogicalOperator_a = ((BCCR_cntClntTempDiag_CW & 4) == 4);
  rtb_LogicalOperator1_f = !BSPR_bClntUsTMinErrStt;
  if (rtb_LogicalOperator1_f) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTElecMin_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_j) {
    rtb_Product_g = BSPR_tiClntUsTElecMin_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_j;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator1_f;
  BSPR_bClntUsTMinErrHeal = (rtb_Product_g > BSPR_tiClntUsTElecMin_C);
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_j = rtb_Product_g;
  if (BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_h) {
    rtb_Switch4_j = (uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecMin_ASW | 8U);
  } else if (rtb_LogicalOperator_a && BSPR_bClntUsTMinErrDet) {
    rtb_Switch4_j = (uint8_T)(DFC_ClntUsTElecMin_ASW | 152U);
  } else if ((!rtb_LogicalOperator_a) || BSPR_bClntUsTMinErrHeal) {
    rtb_Switch4_j = (uint8_T)((uint8_T)~(uint8_T)((uint8_T)~DFC_ClntUsTElecMin_ASW |
      16U) | 8U);
  } else {
    rtb_Switch4_j = BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_k;
  }

  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_h = false;
  BSPR_ThmTempSnsrDiag_DW.Delay3_DSTATE_k = rtb_Switch4_j;
  DFC_ClntUsTElecMin_ASW = rtb_Switch4_j;
  rtb_LogicalOperator1_f = !(BSPR_bClntUsTJitErrStt || BSPR_bClntUsTMaxErrStt ||
    BSPR_bClntUsTMinErrStt);
  rtb_LogicalOperator4_b = !(BSPR_bClntDsTJitErrStt || BSPR_bClntDsTMaxErrStt ||
    BSPR_bClntDsTMinErrStt);
  if (rtb_LogicalOperator4_b) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntDsTVld_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2d) {
    rtb_Product_g = BSPR_tiClntDsTVld_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2d;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator4_b;
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_l2d = rtb_Product_g;
  BSPR_bClntDsTVld = ((!(rtb_LogicalOperator6 || rtb_LogicalOperator5_p ||
    rtb_RelationalOperator3)) || (rtb_Product_g > BSPR_tiClntDsTVld_C));
  if (rtb_LogicalOperator1_f) {
    rtb_LogicalOperator6_0 = 0.1F;
  } else {
    rtb_LogicalOperator6_0 = 0.0F;
  }

  if (BSPR_tiClntUsTVld_C < BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c) {
    rtb_Product_g = BSPR_tiClntUsTVld_C;
  } else {
    rtb_Product_g = BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c;
  }

  rtb_Product_g = (rtb_LogicalOperator6_0 + rtb_Product_g) * (real32_T)
    rtb_LogicalOperator1_f;
  BSPR_ThmTempSnsrDiag_DW.Delay_DSTATE_c = rtb_Product_g;
  BSPR_bClntUsTVld = ((!(rtb_LogicalOperator_a || rtb_LogicalOperator3_e ||
    rtb_LogicalOperator1)) || (rtb_Product_g > BSPR_tiClntUsTVld_C));
}

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

  /* block I/O */

  /* custom signals */
  BSPR_bClntDsTVld = false;
  BSPR_bClntUsTVld = false;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_d = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_i = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_c = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_g = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_e = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_n = true;
  BSPR_ThmTempSnsrDiag_DW.Delay2_DSTATE_h = true;
}

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