/* * File: HVAC_model.c * * Code generated for Simulink model 'HVAC_model'. * * Model version : 1.760 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 * C/C++ source code generated on : Fri Apr 3 18:15:49 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M * Emulation hardware selection: * Differs from embedded hardware (MATLAB Host) * Code generation objectives: Unspecified * Validation result: Not run */ #include "HVAC_model.h" #include #include #include "HVAC_model_private.h" #include #include "HVAC_model_types.h" #include "Rs_Cal_Base.h" /* Named constants for Test Sequence: '/Test Sequence' */ #define IN_step_1 ((uint8_t)1U) #define IN_step_2 ((uint8_t)2U) #define IN_step_3 ((uint8_t)3U) /* Exported block states */ ActuatorCmdBus Actuator_Ch0_Command_Model;/* '/Data Store Memory15' */ ActuatorCmdBus Actuator_Ch1_Command_Model;/* '/Data Store Memory15' */ ActuatorCmdBus Actuator_Ch2_Command_Model;/* '/Data Store Memory15' */ CmdBusStatus Status_Sensor_Model; /* '/Data Store Memory' */ CmdBusError CCU_Errors_Model; /* '/Data Store Memory3' */ CmdBusPWMGet PWM_Get; /* '/Data Store Memory1' */ /* Block signals (default storage) */ B rtB; /* Block states (default storage) */ DW rtDW; /* External outputs (root outports fed by signals with default storage) */ ExtY rtY; /* Real-time model */ static RT_MODEL rtM_; RT_MODEL *const rtM = &rtM_; uint16_t look1_iu16bs16lu64n32_binlcse(uint16_t u0, const int16_t bp0[], const uint16_t table[], uint32_t maxIndex) { uint64_t frac; uint32_t iLeft; uint16_t y; uint16_t yL_0d0; uint16_t yR_0d0; /* Column-major Lookup 1-D Search method: 'binary' Use previous index: 'off' Interpolation method: 'Linear point-slope' Extrapolation method: 'Clip' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' Rounding mode: 'simplest' */ /* Prelookup - Index and Fraction Index Search method: 'binary' Extrapolation method: 'Clip' Use previous index: 'off' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' Rounding mode: 'simplest' */ yR_0d0 = u0; if (u0 > 32767) { yR_0d0 = 32767U; } if (u0 < bp0[0U]) { iLeft = 0U; frac = 0ULL; } else if ((int16_t)yR_0d0 < bp0[maxIndex]) { uint32_t bpIdx; uint32_t iRght; /* Binary Search */ bpIdx = maxIndex >> 1U; iLeft = 0U; iRght = maxIndex; while (iRght - iLeft > 1U) { if ((int16_t)yR_0d0 < bp0[bpIdx]) { iRght = bpIdx; } else { iLeft = bpIdx; } bpIdx = (iRght + iLeft) >> 1U; } frac = ((uint64_t)(u0 - (uint32_t)bp0[iLeft]) << 32) / (uint32_t)(bp0[iLeft + 1U] - bp0[iLeft]); } else { iLeft = maxIndex - 1U; frac = 4294967296ULL; } /* Column-major Interpolation 1-D Interpolation method: 'Linear point-slope' Use last breakpoint for index at or above upper limit: 'off' Rounding mode: 'simplest' Overflow mode: 'wrapping' */ yR_0d0 = table[iLeft + 1U]; yL_0d0 = table[iLeft]; if (yR_0d0 >= yL_0d0) { y = (uint16_t)((uint32_t)(uint16_t)(((uint16_t)((uint32_t)yR_0d0 - yL_0d0) * frac) >> 32) + yL_0d0); } else { y = (uint16_t)((uint32_t)yL_0d0 - (uint16_t)(((uint16_t)((uint32_t)yL_0d0 - yR_0d0) * frac) >> 32)); } return y; } uint32_t binsearch_u32s16(int16_t u, const int16_t bp[], uint32_t startIndex, uint32_t maxIndex) { uint32_t bpIdx; uint32_t bpIndex; uint32_t iRght; /* Binary Search */ bpIdx = startIndex; bpIndex = 0U; iRght = maxIndex; while (iRght - bpIndex > 1U) { if (u < bp[bpIdx]) { iRght = bpIdx; } else { bpIndex = bpIdx; } bpIdx = (iRght + bpIndex) >> 1U; } return bpIndex; } uint8_t look2_iu8bu8s16lu64n32_binlcse(uint8_t u0, uint8_t u1, const uint8_t bp0[], const int16_t bp1[], const uint8_t table[], const uint32_t maxIndex[], uint32_t stride) { uint64_t fractions[2]; uint64_t frac; uint32_t bpIndices[2]; uint32_t bpIdx; uint32_t iLeft; uint32_t iRght; uint8_t bpLeftVar; uint8_t y; uint8_t yL_0d0; uint8_t yL_1d; /* Column-major Lookup 2-D Search method: 'binary' Use previous index: 'off' Interpolation method: 'Linear point-slope' Extrapolation method: 'Clip' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' Rounding mode: 'simplest' */ /* Prelookup - Index and Fraction Index Search method: 'binary' Extrapolation method: 'Clip' Use previous index: 'off' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' Rounding mode: 'simplest' */ if (u0 <= bp0[0U]) { iLeft = 0U; frac = 0ULL; } else if (u0 < bp0[maxIndex[0U]]) { /* Binary Search */ bpIdx = maxIndex[0U] >> 1U; iLeft = 0U; iRght = maxIndex[0U]; while (iRght - iLeft > 1U) { if (u0 < bp0[bpIdx]) { iRght = bpIdx; } else { iLeft = bpIdx; } bpIdx = (iRght + iLeft) >> 1U; } bpLeftVar = bp0[iLeft]; frac = ((uint64_t)((uint32_t)u0 - bpLeftVar) << 32) / ((uint32_t)bp0[iLeft + 1U] - bpLeftVar); } else { iLeft = maxIndex[0U] - 1U; frac = 4294967296ULL; } fractions[0U] = frac; bpIndices[0U] = iLeft; /* Prelookup - Index and Fraction Index Search method: 'binary' Extrapolation method: 'Clip' Use previous index: 'off' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' Rounding mode: 'simplest' */ if (u1 < bp1[0U]) { iLeft = 0U; frac = 0ULL; } else if (u1 < bp1[maxIndex[1U]]) { /* Binary Search */ bpIdx = maxIndex[1U] >> 1U; iLeft = 0U; iRght = maxIndex[1U]; while (iRght - iLeft > 1U) { if (u1 < bp1[bpIdx]) { iRght = bpIdx; } else { iLeft = bpIdx; } bpIdx = (iRght + iLeft) >> 1U; } frac = ((uint64_t)(u1 - (uint32_t)bp1[iLeft]) << 32) / (uint32_t)(bp1[iLeft + 1U] - bp1[iLeft]); } else { iLeft = maxIndex[1U] - 1U; frac = 4294967296ULL; } /* Column-major Interpolation 2-D Interpolation method: 'Linear point-slope' Use last breakpoint for index at or above upper limit: 'off' Rounding mode: 'simplest' Overflow mode: 'wrapping' */ bpIdx = iLeft * stride + bpIndices[0U]; bpLeftVar = table[bpIdx + 1U]; yL_0d0 = table[bpIdx]; if (bpLeftVar >= yL_0d0) { yL_1d = (uint8_t)((uint32_t)(uint8_t)(((uint8_t)((uint32_t)bpLeftVar - yL_0d0) * fractions[0U]) >> 32) + yL_0d0); } else { yL_1d = (uint8_t)((uint32_t)yL_0d0 - (uint8_t)(((uint8_t)((uint32_t)yL_0d0 - bpLeftVar) * fractions[0U]) >> 32)); } bpIdx += stride; bpLeftVar = table[bpIdx + 1U]; yL_0d0 = table[bpIdx]; if (bpLeftVar >= yL_0d0) { bpLeftVar = (uint8_t)((uint32_t)(uint8_t)(((uint8_t)((uint32_t)bpLeftVar - yL_0d0) * fractions[0U]) >> 32) + yL_0d0); } else { bpLeftVar = (uint8_t)((uint32_t)yL_0d0 - (uint8_t)(((uint8_t)((uint32_t) yL_0d0 - bpLeftVar) * fractions[0U]) >> 32)); } if (bpLeftVar >= yL_1d) { y = (uint8_t)((uint32_t)(uint8_t)(((uint8_t)((uint32_t)bpLeftVar - yL_1d) * frac) >> 32) + yL_1d); } else { y = (uint8_t)((uint32_t)yL_1d - (uint8_t)(((uint8_t)((uint32_t)yL_1d - bpLeftVar) * frac) >> 32)); } return y; } int16_t look1_iu16tdIs16_binlcs(uint16_t u0, const uint16_t bp0[], const double table[], uint32_t maxIndex) { double frac; double yL_0d0; int32_t tmp_1; uint32_t iLeft; int16_t tmp; int16_t tmp_0; /* Column-major Lookup 1-D Search method: 'binary' Use previous index: 'off' Interpolation method: 'Linear point-slope' Extrapolation method: 'Clip' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' */ /* Prelookup - Index and Fraction Index Search method: 'binary' Extrapolation method: 'Clip' Use previous index: 'off' Use last breakpoint for index at or above upper limit: 'off' Remove protection against out-of-range input in generated code: 'off' */ if (u0 <= bp0[0U]) { iLeft = 0U; frac = 0.0; } else if (u0 < bp0[maxIndex]) { uint32_t bpIdx; uint32_t iRght; /* Binary Search */ bpIdx = maxIndex >> 1U; iLeft = 0U; iRght = maxIndex; while (iRght - iLeft > 1U) { if (u0 < bp0[bpIdx]) { iRght = bpIdx; } else { iLeft = bpIdx; } bpIdx = (iRght + iLeft) >> 1U; } uint16_t bpLeftVar; bpLeftVar = bp0[iLeft]; frac = (double)((uint32_t)u0 - bpLeftVar) / (double)((uint32_t)bp0[iLeft + 1U] - bpLeftVar); } else { iLeft = maxIndex - 1U; frac = 1.0; } /* Column-major Interpolation 1-D Interpolation method: 'Linear point-slope' Use last breakpoint for index at or above upper limit: 'off' Overflow mode: 'saturate' */ yL_0d0 = table[iLeft]; if (yL_0d0 < 32768.0) { if (yL_0d0 >= -32768.0) { tmp = (int16_t)yL_0d0; } else { tmp = INT16_MIN; } } else { tmp = INT16_MAX; } frac *= table[iLeft + 1U] - yL_0d0; if (frac < 32768.0) { if (frac >= -32768.0) { tmp_0 = (int16_t)frac; } else { tmp_0 = INT16_MIN; } } else { tmp_0 = INT16_MAX; } tmp_1 = tmp + tmp_0; if (tmp_1 > 32767) { tmp_1 = 32767; } else if (tmp_1 < -32768) { tmp_1 = -32768; } return (int16_t)tmp_1; } uint32_t plook_u32s16_bincka(int16_t u, const int16_t bp[], uint32_t maxIndex) { uint32_t bpIndex; /* Prelookup - Index only Index Search method: 'binary' Extrapolation method: 'Clip' Use previous index: 'off' Use last breakpoint for index at or above upper limit: 'on' Remove protection against out-of-range input in generated code: 'off' */ if (u <= bp[0U]) { bpIndex = 0U; } else if (u < bp[maxIndex]) { bpIndex = binsearch_u32s16(u, bp, maxIndex >> 1U, maxIndex); } else { bpIndex = maxIndex; } return bpIndex; } /* * Output and update for atomic system: * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_for_LVL' */ void get_tg_FLL_for_LVL(uint8_t rtu_ambient_Lvl, uint8_t rtu_set_tmp, int16_t *rty_vals) { int32_t i; uint32_t qY; int16_t tmp[78]; /* : table = [ */ /* : g_assTG_FLL_LV0; */ /* : g_assTG_FLL_LV1; */ /* : g_assTG_FLL_LV2; */ /* : g_assTG_FLL_LV3; */ /* : g_assTG_FLL_LV4; */ /* : g_assTG_FLL_LV5 */ /* : ]; */ /* : vals = table(ambient_Lvl + 1, set_tmp - 16); */ for (i = 0; i < 13; i++) { tmp[6 * i] = g_assTG_FLL_LV0[i]; tmp[6 * i + 1] = g_assTG_FLL_LV1[i]; tmp[6 * i + 2] = g_assTG_FLL_LV2[i]; tmp[6 * i + 3] = g_assTG_FLL_LV3[i]; tmp[6 * i + 4] = g_assTG_FLL_LV4[i]; tmp[6 * i + 5] = g_assTG_FLL_LV5[i]; } i = (int32_t)(rtu_ambient_Lvl + 1U); if (rtu_ambient_Lvl + 1U > 255U) { i = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = rtu_set_tmp - 16U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if (rtu_set_tmp - 16U > rtu_set_tmp) { qY = 0U; } *rty_vals = tmp[(((int32_t)qY - 1) * 6 + i) - 1]; } /* * Output and update for atomic system: * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' * '/get_tg_FLL_for_LVL' */ void get_tg_FLL_for_LVL_j(uint8_t rtu_ambient_Lvl, uint8_t rtu_set_tmp, int16_t * rty_vals) { int32_t i; uint32_t qY; int16_t tmp[78]; /* : table = [ */ /* : g_assTG_FRL_LV0; */ /* : g_assTG_FRL_LV1; */ /* : g_assTG_FRL_LV2; */ /* : g_assTG_FRL_LV3; */ /* : g_assTG_FRL_LV4; */ /* : g_assTG_FRL_LV5 */ /* : ]; */ /* : vals = table(ambient_Lvl + 1, set_tmp - 16); */ for (i = 0; i < 13; i++) { tmp[6 * i] = g_assTG_FRL_LV0[i]; tmp[6 * i + 1] = g_assTG_FRL_LV1[i]; tmp[6 * i + 2] = g_assTG_FRL_LV2[i]; tmp[6 * i + 3] = g_assTG_FRL_LV3[i]; tmp[6 * i + 4] = g_assTG_FRL_LV4[i]; tmp[6 * i + 5] = g_assTG_FRL_LV5[i]; } i = (int32_t)(rtu_ambient_Lvl + 1U); if (rtu_ambient_Lvl + 1U > 255U) { i = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = rtu_set_tmp - 16U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if (rtu_set_tmp - 16U > rtu_set_tmp) { qY = 0U; } *rty_vals = tmp[(((int32_t)qY - 1) * 6 + i) - 1]; } /* * Output and update for atomic system: * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' */ void g_assFLOW_BI_AMB_TGT_n(uint8_t rtu_LVL, int16_t *rty_c_g_assFLOW_BI_AMB_TGT) { int32_t tmp; /* : c_g_assFLOW_BI_AMB_TGT = g_assFLOW_BI_AMB_TGT(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_c_g_assFLOW_BI_AMB_TGT = g_assFLOW_BI_AMB_TGT[tmp - 1]; } /* * Output and update for action system: * '/Bilevel' * '/Bilevel' */ void Bilevel(int16_t rtu_Amb_Fb, uint8_t rtu_LVL, uint16_t rty_Out1[9], uint8_t rtu_setTempFL, uint8_t rtu_setTempFR) { int32_t tmp; int32_t tmp_0; int16_t rtb_u_eg; uint16_t rtb_FLF_NEW; uint16_t rtb_FRF_NEW; uint16_t rtb_Switch2_a_idx_0; uint16_t rtb_Switch2_a_idx_1; uint16_t rtb_Switch2_c_0; int8_t rtb_X; uint8_t rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN; uint8_t rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX_n; uint8_t rtb_c_g_aucFLOW_BI_FOOT_VALVE_MIN; uint8_t rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h; uint8_t rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN; uint8_t rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a; /* MATLAB Function: '/get_tg_FLL_for_LVL' */ /* : c_g_assFLOW_BI_TEMP_TGT = g_assFLOW_BI_TEMP_TGT(LVL + 1); */ get_tg_FLL_for_LVL(rtu_LVL, rtu_setTempFL, &rtb_u_eg); /* MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ rtb_u_eg = (int16_t)(g_assFLOW_BI_TEMP_TGT[tmp_0 - 1] - rtb_u_eg); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_eg; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch1' incorporates: * Gain: '/Gain6' * Sum: '/Add' */ /* : c_g_aucFLOW_BI_FOOT_PLUS = g_aucFLOW_BI_FOOT_PLUS(LVL + 1); */ if (rtb_X >= 0) { rtb_FLF_NEW = rty_Out1[4]; } else { /* MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_LEFT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_LEFT' * Product: '/Product3' */ tmp_0 = g_aucFLOW_BI_FOOT_PLUS[tmp_0 - 1] * rtb_X * 13107; rtb_FLF_NEW = (uint16_t)((int16_t)rty_Out1[4] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_FOOT_VALVE_MAX = g_aucFLOW_BI_FOOT_VALVE_MAX(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX_n = g_aucFLOW_BI_FOOT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX1' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_FOOT_VALVE_MIN = g_aucFLOW_BI_FOOT_VALVE_MIN(LVL +1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN = g_aucFLOW_BI_FOOT_VALVE_MIN[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN1' */ /* MATLAB Function: '/get_tg_FLL_for_LVL' */ /* : c_g_assFLOW_BI_TEMP_TGT = g_assFLOW_BI_TEMP_TGT(LVL + 1 + 6); */ get_tg_FLL_for_LVL_j(rtu_LVL, rtu_setTempFR, &rtb_u_eg); /* MATLAB Function: '/g_assFLOW_BI_TEMP_TGT_RIGHT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_assFLOW_BI_TEMP_TGT_RIGHT' */ rtb_u_eg = (int16_t)(g_assFLOW_BI_TEMP_TGT[tmp - 1] - rtb_u_eg); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_eg; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch3' incorporates: * Gain: '/Gain7' * Sum: '/Add1' */ /* : c_g_aucFLOW_BI_FOOT_PLUS = g_aucFLOW_BI_FOOT_PLUS(LVL + 1 + 6); */ if (rtb_X >= 0) { rtb_FRF_NEW = rty_Out1[6]; } else { /* MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_RIGHT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain7' incorporates: * MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_RIGHT' * Product: '/Product4' */ tmp_0 = g_aucFLOW_BI_FOOT_PLUS[tmp - 1] * rtb_X * 13107; rtb_FRF_NEW = (uint16_t)((int16_t)rty_Out1[6] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch3' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX2' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_FOOT_VALVE_MAX = g_aucFLOW_BI_FOOT_VALVE_MAX(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX = g_aucFLOW_BI_FOOT_VALVE_MAX[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX2' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN2' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_FOOT_VALVE_MIN = g_aucFLOW_BI_FOOT_VALVE_MIN(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI_FOOT_VALVE_MIN = g_aucFLOW_BI_FOOT_VALVE_MIN[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN2' */ /* MATLAB Function: '/g_assFLOW_BI_AMB_TGT' */ /* : c_g_aucFLOW_BI_VENT_PLUS = g_aucFLOW_BI_VENT_PLUS(LVL + 1); */ g_assFLOW_BI_AMB_TGT_n(rtu_LVL, &rtb_u_eg); /* MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ tmp = (int16_t)(rtb_u_eg - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_eg = (int16_t)((int8_t)(((((uint32_t)tmp & 65536U) != 0U) && ((((uint32_t)tmp & 65535U) != 0U) || (tmp > 0))) + (tmp >> 17)) * (int32_t) ((g_aucFLOW_BI_VENT_PLUS[tmp_0 - 1] * 205U + 1024U) >> 11)); /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_a_idx_0 = (uint16_t)((uint16_t)((rty_Out1[0] - rtb_u_eg) >> 1) << 1); rtb_Switch2_a_idx_1 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_eg) >> 1) << 1); /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_VENT_VALVE_MAX = g_aucFLOW_BI_VENT_VALVE_MAX(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h = g_aucFLOW_BI_VENT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' */ /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_VENT_VALVE_MIN = g_aucFLOW_BI_VENT_VALVE_MIN(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a = g_aucFLOW_BI_VENT_VALVE_MIN[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' */ /* MATLAB Function: '/g_assFLOW_BI_AMB_TGT' */ /* : c_g_aucFLOW_BI_VENT_PLUS = g_aucFLOW_BI_VENT_PLUS(LVL + 1 + 6); */ g_assFLOW_BI_AMB_TGT_n(rtu_LVL, &rtb_u_eg); /* MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ tmp_0 = (int16_t)(rtb_u_eg - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_eg = (int16_t)((int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)) * (int32_t)((g_aucFLOW_BI_VENT_PLUS[tmp - 1] * 205U + 1024U) >> 11)); /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_VENT_VALVE_MAX = g_aucFLOW_BI_VENT_VALVE_MAX(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX = g_aucFLOW_BI_VENT_VALVE_MAX[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' */ /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI_VENT_VALVE_MIN = g_aucFLOW_BI_VENT_VALVE_MIN(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN = g_aucFLOW_BI_VENT_VALVE_MIN[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' */ /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_c_0 = (uint16_t)((uint16_t)((rty_Out1[0] - rtb_u_eg) >> 1) << 1); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_a_idx_0 > rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h) { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[0] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h; } else if (rtb_Switch2_a_idx_0 < rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [1-2]' * SignalConversion generated from: '/Out1' */ rty_Out1[0] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a; } else { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[0] = rtb_Switch2_a_idx_0; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_c_0 > rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX; } else if (rtb_Switch2_c_0 < rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [3-4]' * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[2] = rtb_Switch2_c_0; } /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_c_0 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_eg) >> 1) << 1); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_a_idx_1 > rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h) { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[1] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX_h; } else if (rtb_Switch2_a_idx_1 < rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [1-2]' * SignalConversion generated from: '/Out1' */ rty_Out1[1] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN_a; } else { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[1] = rtb_Switch2_a_idx_1; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_c_0 > rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MAX; } else if (rtb_Switch2_c_0 < rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [3-4]' * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_BI_VENT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[3] = rtb_Switch2_c_0; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_FLF_NEW > rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX_n) { /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX_n; } else if (rtb_FLF_NEW < rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [5]' * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[4] = rtb_FLF_NEW; } /* End of Switch: '/Switch2' */ /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_FRF_NEW > rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX) { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_BI_FOOT_VALVE_MAX; } else if (rtb_FRF_NEW < rtb_c_g_aucFLOW_BI_FOOT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [7]' * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_BI_FOOT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[6] = rtb_FRF_NEW; } /* End of Switch: '/Switch2' */ } /* * Output and update for atomic system: * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' * '/g_assFLOW_BI_AMB_TGT' */ void g_assFLOW_BI_AMB_TGT_e(uint8_t rtu_LVL, int16_t *rty_c_g_assFLOW_BI2_AMB_TGT) { int32_t tmp; /* : c_g_assFLOW_BI2_AMB_TGT = g_assFLOW_B2I_AMB_TGT(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_c_g_assFLOW_BI2_AMB_TGT = g_assFLOW_B2I_AMB_TGT[tmp - 1]; } /* * Output and update for action system: * '/Bilevel2' * '/Bilevel2' */ void Bilevel2(int16_t rtu_Amb_Fb, uint8_t rtu_LVL, uint16_t rty_Out1[9], uint8_t rtu_setTempFL, uint8_t rtu_setTempFR) { int32_t tmp; int32_t tmp_0; int16_t rtb_u_abl; uint16_t rtb_FLF_NEW; uint16_t rtb_FRF_NEW; uint16_t rtb_Switch2_i_idx_0; uint16_t rtb_Switch2_i_idx_1; uint16_t rtb_Switch2_p_0; int8_t rtb_X; uint8_t rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX_l; uint8_t rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN; uint8_t rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN_l; uint8_t rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k; uint8_t rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN; uint8_t rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f; /* MATLAB Function: '/get_tg_FLL_for_LVL' */ /* : c_g_assFLOW_BI2_TEMP_TGT = g_assFLOW_BI2_TEMP_TGT(LVL + 1); */ get_tg_FLL_for_LVL(rtu_LVL, rtu_setTempFL, &rtb_u_abl); /* MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ rtb_u_abl = (int16_t)(g_assFLOW_BI2_TEMP_TGT[tmp_0 - 1] - rtb_u_abl); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_abl; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch1' incorporates: * Gain: '/Gain6' * Sum: '/Add' */ /* : c_g_aucFLOW_BI2_FOOT_PLUS = g_aucFLOW_BI2_FOOT_PLUS(LVL + 1); */ if (rtb_X >= 0) { rtb_FLF_NEW = rty_Out1[4]; } else { /* MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_LEFT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_LEFT' * Product: '/Product3' */ tmp_0 = g_aucFLOW_BI2_FOOT_PLUS[tmp_0 - 1] * rtb_X * 13107; rtb_FLF_NEW = (uint16_t)((int16_t)rty_Out1[4] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_FOOT_VALVE_MAX = g_aucFLOW_BI2_FOOT_VALVE_MAX(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX_l = g_aucFLOW_BI2_FOOT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX1' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_FOOT_VALVE_MIN = g_aucFLOW_BI2_FOOT_VALVE_MIN(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN = g_aucFLOW_BI2_FOOT_VALVE_MIN[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN1' */ /* MATLAB Function: '/get_tg_FLL_for_LVL' */ /* : c_g_assFLOW_BI2_TEMP_TGT = g_assFLOW_BI2_TEMP_TGT(LVL + 1 + 6); */ get_tg_FLL_for_LVL_j(rtu_LVL, rtu_setTempFR, &rtb_u_abl); /* MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_RIGHT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_RIGHT' */ rtb_u_abl = (int16_t)(g_assFLOW_BI2_TEMP_TGT[tmp - 1] - rtb_u_abl); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_abl; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch3' incorporates: * Gain: '/Gain7' * Sum: '/Add1' */ /* : c_g_aucFLOW_BI2_FOOT_PLUS = g_aucFLOW_BI2_FOOT_PLUS(LVL + 1 + 6); */ if (rtb_X >= 0) { rtb_FRF_NEW = rty_Out1[6]; } else { /* MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_RIGHT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain7' incorporates: * MATLAB Function: '/g_aucFLOW_BI_FOOT_PLUS_RIGHT' * Product: '/Product4' */ tmp_0 = g_aucFLOW_BI2_FOOT_PLUS[tmp - 1] * rtb_X * 13107; rtb_FRF_NEW = (uint16_t)((int16_t)rty_Out1[6] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch3' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX2' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_FOOT_VALVE_MAX = g_aucFLOW_BI2_FOOT_VALVE_MAX(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX = g_aucFLOW_BI2_FOOT_VALVE_MAX[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MAX2' */ /* MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN2' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_FOOT_VALVE_MIN = g_aucFLOW_BI2_FOOT_VALVE_MIN(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN_l = g_aucFLOW_BI2_FOOT_VALVE_MIN[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_FOOT_VALVE_MIN2' */ /* MATLAB Function: '/g_assFLOW_BI_AMB_TGT' */ /* : c_g_aucFLOW_BI2_VENT_PLUS = g_aucFLOW_BI2_VENT_PLUS(LVL + 1); */ g_assFLOW_BI_AMB_TGT_e(rtu_LVL, &rtb_u_abl); /* MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ tmp = (int16_t)(rtb_u_abl - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_abl = (int16_t)((int8_t)(((((uint32_t)tmp & 65536U) != 0U) && ((((uint32_t)tmp & 65535U) != 0U) || (tmp > 0))) + (tmp >> 17)) * (int32_t) ((g_aucFLOW_BI2_VENT_PLUS[tmp_0 - 1] * 205U + 1024U) >> 11)); /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_i_idx_0 = (uint16_t)((uint16_t)((rty_Out1[0] - rtb_u_abl) >> 1) << 1); rtb_Switch2_i_idx_1 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_abl) >> 1) << 1); /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_VENT_VALVE_MAX = g_aucFLOW_BI2_VENT_VALVE_MAX(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k = g_aucFLOW_BI2_VENT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' */ /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_VENT_VALVE_MIN = g_aucFLOW_BI2_VENT_VALVE_MIN(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f = g_aucFLOW_BI2_VENT_VALVE_MIN[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' */ /* MATLAB Function: '/g_assFLOW_BI_AMB_TGT' */ /* : c_g_aucFLOW_BI2_VENT_PLUS = g_aucFLOW_BI2_VENT_PLUS(LVL + 1 + 6); */ g_assFLOW_BI_AMB_TGT_e(rtu_LVL, &rtb_u_abl); /* MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ tmp_0 = (int16_t)(rtb_u_abl - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_abl = (int16_t)((int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)) * (int32_t)((g_aucFLOW_BI2_VENT_PLUS[tmp - 1] * 205U + 1024U) >> 11)); /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_VENT_VALVE_MAX = g_aucFLOW_BI2_VENT_VALVE_MAX(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX = g_aucFLOW_BI2_VENT_VALVE_MAX[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MAX' */ /* MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_BI2_VENT_VALVE_MIN = g_aucFLOW_BI2_VENT_VALVE_MIN(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN = g_aucFLOW_BI2_VENT_VALVE_MIN[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_BI_VENT_VALVE_MIN' */ /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_p_0 = (uint16_t)((uint16_t)((rty_Out1[0] - rtb_u_abl) >> 1) << 1); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_i_idx_0 > rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k) { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[0] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k; } else if (rtb_Switch2_i_idx_0 < rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [1-2]' * SignalConversion generated from: '/Out1' */ rty_Out1[0] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f; } else { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[0] = rtb_Switch2_i_idx_0; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_p_0 > rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX; } else if (rtb_Switch2_p_0 < rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [3-4]' * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[2] = rtb_Switch2_p_0; } /* DataTypeConversion: '/Data Type Conversion' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ rtb_Switch2_p_0 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_abl) >> 1) << 1); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_i_idx_1 > rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k) { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[1] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX_k; } else if (rtb_Switch2_i_idx_1 < rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [1-2]' * SignalConversion generated from: '/Out1' */ rty_Out1[1] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN_f; } else { /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[1] = rtb_Switch2_i_idx_1; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_Switch2_p_0 > rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MAX; } else if (rtb_Switch2_p_0 < rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [3-4]' * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_BI2_VENT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[3] = rtb_Switch2_p_0; } /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_FLF_NEW > rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX_l) { /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX_l; } else if (rtb_FLF_NEW < rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [5]' * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN; } else { /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[4] = rtb_FLF_NEW; } /* End of Switch: '/Switch2' */ /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' * RelationalOperator: '/UpperRelop' * Switch: '/Switch' */ if (rtb_FRF_NEW > rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX) { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MAX; } else if (rtb_FRF_NEW < rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN_l) { /* Switch: '/Switch' incorporates: * Assignment: '/Присваивание в [7]' * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_BI2_FOOT_VALVE_MIN_l; } else { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[6] = rtb_FRF_NEW; } /* End of Switch: '/Switch2' */ } /* * Output and update for atomic system: * '/g_aucFLOW_AF_FOOT_VALVE_MAX' * '/g_aucFLOW_AF_FOOT_VALVE_MAX' * '/g_aucFLOW_AF_FOOT_VALVE_MAX' * '/g_aucFLOW_AF_FOOT_VALVE_MAX' */ void g_aucFLOW_AF_FOOT_VALVE_MAX_e(uint8_t rtu_LVL, uint8_t *rty_c_g_aucFLOW_AF_FOOT_VALVE_MAX) { int32_t tmp; /* : c_g_aucFLOW_AF_FOOT_VALVE_MAX = g_aucFLOW_AF_FOOT_VALVE_MAX(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_c_g_aucFLOW_AF_FOOT_VALVE_MAX = g_aucFLOW_AF_FOOT_VALVE_MAX[tmp - 1]; } /* * Output and update for atomic system: * '/g_assFLOW_AF_AMB_TGT' * '/g_assFLOW_AF_AMB_TGT' * '/g_assFLOW_AF_AMB_TGT' * '/g_assFLOW_AF_AMB_TGT' * '/g_assFLOW_AF_AMB_TGT' * '/g_assFLOW_AF_AMB_TGT' */ void g_assFLOW_AF_AMB_TGT_g(uint8_t rtu_LVL, int16_t *rty_c_g_assFLOW_AF_AMB_TGT) { int32_t tmp; /* : c_g_assFLOW_AF_AMB_TGT = g_assFLOW_AF_AMB_TGT(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_c_g_assFLOW_AF_AMB_TGT = g_assFLOW_AF_AMB_TGT[tmp - 1]; } /* * Output and update for action system: * '/Afoot' * '/Afoot' */ void Afoot(int16_t rtu_Amb_Fb, uint8_t rtu_LVL, uint16_t rty_Out1[9], uint8_t rtu_setTempFL, uint8_t rtu_setTempFR) { int32_t i; int32_t tmp_0; uint32_t qY; int16_t tmp[78]; int16_t rtb_deg_en; uint16_t rtb_FLF_NEW; uint16_t rtb_FRF_NEW; uint16_t rtb_Switch2_ar_idx_0; uint16_t rtb_Switch2_ar_idx_1; uint16_t rtb_Switch2_j_idx_0; uint16_t rtb_Switch2_j_idx_1; int8_t rtb_X; uint8_t rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k; /* MATLAB Function: '/get_tg_for_LVL' */ /* : c_g_aucFLOW_AF_BLR_AF_TGT = g_aucFLOW_AF_BLR_AF_TGT(LVL + 1); */ /* : table = [ */ /* : g_assVTG_FL_LV0; */ /* : g_assVTG_FL_LV1; */ /* : g_assVTG_FL_LV2; */ /* : g_assVTG_FL_LV3; */ /* : g_assVTG_FL_LV4; */ /* : g_assVTG_FL_LV5 */ /* : ]; */ /* : vals = table(ambient_Lvl + 1, set_tmp - 16); */ for (i = 0; i < 13; i++) { tmp[6 * i] = g_assVTG_FL_LV0[i]; tmp[6 * i + 1] = g_assVTG_FL_LV1[i]; tmp[6 * i + 2] = g_assVTG_FL_LV2[i]; tmp[6 * i + 3] = g_assVTG_FL_LV3[i]; tmp[6 * i + 4] = g_assVTG_FL_LV4[i]; tmp[6 * i + 5] = g_assVTG_FL_LV5[i]; } /* MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } /* MATLAB Function: '/get_tg_for_LVL' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = rtu_setTempFL - 16U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if (rtu_setTempFL - 16U > rtu_setTempFL) { qY = 0U; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' * MATLAB Function: '/get_tg_for_LVL' * Sum: '/ 1' */ i = (int16_t)(g_aucFLOW_AF_BLR_AF_TGT[i - 1] - tmp[(((int32_t)qY - 1) * 6 + tmp_0) - 1]) * 13107; rtb_X = (int8_t)(((((uint32_t)i & 65536U) != 0U) && ((((uint32_t)i & 65535U) != 0U) || (i > 0))) + (i >> 17)); /* Switch: '/Switch1' incorporates: * Gain: '/Gain6' * Sum: '/Add' */ /* : c_g_aucFLOW_AF_FOOT_PLUS = g_aucFLOW_AF_FOOT_PLUS(LVL + 1); */ if (rtb_X >= 0) { rtb_FLF_NEW = rty_Out1[4]; } else { /* MATLAB Function: '/g_aucFLOW_AF_FOOT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_aucFLOW_AF_FOOT_PLUS' * Product: '/Product3' */ i = g_aucFLOW_AF_FOOT_PLUS[i - 1] * rtb_X * 13107; rtb_FLF_NEW = (uint16_t)((int16_t)rty_Out1[4] - (int8_t)(((((uint32_t)i & 65536U) != 0U) && (((uint32_t)i & 65535U) != 0U)) + (i >> 17))); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/g_aucFLOW_AF_FOOT_VALVE_MAX' */ g_aucFLOW_AF_FOOT_VALVE_MAX_e(rtu_LVL, &rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_FLF_NEW > rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX) { rtb_FLF_NEW = rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX; } /* End of Switch: '/Switch2' */ /* MATLAB Function: '/get_vtg_for_LVL' */ /* : c_g_aucFLOW_AF_BLR_AF_TGT = g_aucFLOW_AF_BLR_AF_TGT(LVL + 1); */ /* : table = [ */ /* : g_assVTG_FR_LV0; */ /* : g_assVTG_FR_LV1; */ /* : g_assVTG_FR_LV2; */ /* : g_assVTG_FR_LV3; */ /* : g_assVTG_FR_LV4; */ /* : g_assVTG_FR_LV5 */ /* : ]; */ /* : vals = table(ambient_Lvl + 1, set_tmp - 16); */ for (i = 0; i < 13; i++) { tmp[6 * i] = g_assVTG_FR_LV0[i]; tmp[6 * i + 1] = g_assVTG_FR_LV1[i]; tmp[6 * i + 2] = g_assVTG_FR_LV2[i]; tmp[6 * i + 3] = g_assVTG_FR_LV3[i]; tmp[6 * i + 4] = g_assVTG_FR_LV4[i]; tmp[6 * i + 5] = g_assVTG_FR_LV5[i]; } /* MATLAB Function: '/g_aucFLOW_AF_BLR_AF_TGT' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } /* MATLAB Function: '/get_vtg_for_LVL' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } qY = rtu_setTempFR - 16U; if (rtu_setTempFR - 16U > rtu_setTempFR) { qY = 0U; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_aucFLOW_AF_BLR_AF_TGT' * MATLAB Function: '/get_vtg_for_LVL' */ rtb_deg_en = (int16_t)(g_aucFLOW_AF_BLR_AF_TGT[i - 1] - tmp[(((int32_t)qY - 1) * 6 + tmp_0) - 1]); /* Gain: '/Gain6' */ i = 13107 * rtb_deg_en; rtb_X = (int8_t)(((((uint32_t)i & 65536U) != 0U) && ((((uint32_t)i & 65535U) != 0U) || (i > 0))) + (i >> 17)); /* Switch: '/Switch3' incorporates: * Gain: '/Gain7' * Sum: '/Add1' */ /* : c_g_aucFLOW_AF_FOOT_PLUS = g_aucFLOW_AF_FOOT_PLUS(LVL + 1 + 6); */ if (rtb_X >= 0) { rtb_FRF_NEW = rty_Out1[6]; } else { /* MATLAB Function: '/g_aucFLOW_AF_FOOT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } tmp_0 = (int32_t)((uint32_t)i + 6U); if ((uint32_t)i + 6U > 255U) { tmp_0 = 255; } /* Gain: '/Gain7' incorporates: * MATLAB Function: '/g_aucFLOW_AF_FOOT_PLUS' * Product: '/Product4' */ i = g_aucFLOW_AF_FOOT_PLUS[tmp_0 - 1] * rtb_X * 13107; rtb_FRF_NEW = (uint16_t)((int16_t)rty_Out1[6] - (int8_t)(((((uint32_t)i & 65536U) != 0U) && (((uint32_t)i & 65535U) != 0U)) + (i >> 17))); } /* End of Switch: '/Switch3' */ /* MATLAB Function: '/g_aucFLOW_AF_FOOT_VALVE_MAX' */ g_aucFLOW_AF_FOOT_VALVE_MAX_e(rtu_LVL, &rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX); /* MATLAB Function: '/g_assFLOW_AF_AMB_TGT' */ /* : c_g_aucFLOW_AF_VENT_PLUS = g_aucFLOW_AF_VENT_PLUS(LVL + 1); */ g_assFLOW_AF_AMB_TGT_g(rtu_LVL, &rtb_deg_en); /* Sum: '/deg' */ rtb_deg_en -= rtu_Amb_Fb; /* Gain: '/Gain2' */ i = 13107 * rtb_deg_en; rtb_X = (int8_t)(((((uint32_t)i & 65536U) != 0U) && ((((uint32_t)i & 65535U) != 0U) || (i > 0))) + (i >> 17)); /* Switch: '/if (deg < 0)' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ if (rtb_X >= 0) { rtb_Switch2_ar_idx_0 = rty_Out1[0]; rtb_Switch2_ar_idx_1 = rty_Out1[1]; } else { /* MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } /* Product: '/Умножили' incorporates: * Gain: '/Gain' * MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' */ rtb_deg_en = (int16_t)((int32_t)((g_aucFLOW_AF_VENT_PLUS[i - 1] * 205U + 1024U) >> 11) * rtb_X); rtb_Switch2_ar_idx_0 = (uint16_t)(rty_Out1[0] - rtb_deg_en); rtb_Switch2_ar_idx_1 = (uint16_t)(rty_Out1[1] - rtb_deg_en); } /* End of Switch: '/if (deg < 0)' */ /* MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_AF_VENT_VALVE_MAX = g_aucFLOW_AF_VENT_VALVE_MAX(LVL + 1); */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k = g_aucFLOW_AF_VENT_VALVE_MAX[i - 1]; /* End of MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' */ /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_ar_idx_0 > rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k) { rtb_Switch2_ar_idx_0 = rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k; } if (rtb_Switch2_ar_idx_1 > rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k) { rtb_Switch2_ar_idx_1 = rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k; } /* End of Switch: '/Switch2' */ /* MATLAB Function: '/g_assFLOW_AF_AMB_TGT' */ /* : c_g_aucFLOW_AF_VENT_PLUS = g_aucFLOW_AF_VENT_PLUS(LVL + 1 + 6); */ g_assFLOW_AF_AMB_TGT_g(rtu_LVL, &rtb_deg_en); /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ i = (int16_t)(rtb_deg_en - rtu_Amb_Fb) * 13107; rtb_X = (int8_t)(((((uint32_t)i & 65536U) != 0U) && ((((uint32_t)i & 65535U) != 0U) || (i > 0))) + (i >> 17)); /* Switch: '/if (deg < 0)' incorporates: * DataTypeConversion: '/Data Type Conversion' * Sum: '/ ' * Switch: '/Switch2' */ if (rtb_X >= 0) { rtb_Switch2_j_idx_0 = rty_Out1[0]; rtb_Switch2_j_idx_1 = rty_Out1[1]; } else { /* MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } tmp_0 = (int32_t)((uint32_t)i + 6U); if ((uint32_t)i + 6U > 255U) { tmp_0 = 255; } /* Product: '/Умножили' incorporates: * Gain: '/Gain' * MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' */ rtb_deg_en = (int16_t)((int32_t)((g_aucFLOW_AF_VENT_PLUS[tmp_0 - 1] * 205U + 1024U) >> 11) * rtb_X); rtb_Switch2_j_idx_0 = (uint16_t)((int16_t)rty_Out1[0] - rtb_deg_en); rtb_Switch2_j_idx_1 = (uint16_t)((int16_t)rty_Out1[1] - rtb_deg_en); } /* End of Switch: '/if (deg < 0)' */ /* MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_BI2_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_AF_VENT_VALVE_MAX = g_aucFLOW_AF_VENT_VALVE_MAX(LVL + 1 + 6); */ i = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { i = 255; } tmp_0 = (int32_t)((uint32_t)i + 6U); if ((uint32_t)i + 6U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k = g_aucFLOW_AF_VENT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' */ /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch2' */ rty_Out1[0] = rtb_Switch2_ar_idx_0; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_j_idx_0 > rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_Switch2_j_idx_0; } /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch2' */ rty_Out1[1] = rtb_Switch2_ar_idx_1; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_j_idx_1 > rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_AF_VENT_VALVE_MAX_k; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_Switch2_j_idx_1; } /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_FLF_NEW; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_FRF_NEW > rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX) { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_AF_FOOT_VALVE_MAX; } else { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[6] = rtb_FRF_NEW; } /* End of Switch: '/Switch2' */ } /* * Output and update for atomic system: * '/g_aucFLOW_AFSM_FOOT_VALVE_MAX' * '/g_aucFLOW_AF_FOOT_VALVE_MAX' * '/g_aucFLOW_AFSM_FOOT_VALVE_MAX' * '/g_aucFLOW_AF_FOOT_VALVE_MAX' */ void g_aucFLOW_AFSM_FOOT_VALVE_MAX_f(uint8_t rtu_LVL, uint8_t *rty_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX) { int32_t tmp; /* : c_g_aucFLOW_AFSM_FOOT_VALVE_MAX = g_aucFLOW_AFSM_FOOT_VALVE_MAX(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX = g_aucFLOW_AFSM_FOOT_VALVE_MAX[tmp - 1]; } /* * Output and update for action system: * '/Afoot_Summer' * '/Afoot_Summer' */ void Afoot_Summer(int16_t rtu_Amb_Fb, uint8_t rtu_LVL, uint16_t rty_Out1[9], uint8_t rtu_setTempFL, uint8_t rtu_setTempFR) { int32_t tmp; int32_t tmp_0; int16_t rtb_deg_c; uint16_t rtb_FLF_NEW; uint16_t rtb_FRF_NEW; uint16_t rtb_Switch2_j1_idx_0; uint16_t rtb_Switch2_j1_idx_1; uint16_t rtb_Switch2_l_idx_0; uint16_t rtb_Switch2_l_idx_1; int8_t rtb_X; uint8_t rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX; uint8_t rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g; /* MATLAB Function: '/get_tg_for_LVL' */ /* : c_g_assFLOW_AFSM_TEMP_TGT = g_assFLOW_AFSM_TEMP_TGT(LVL + 1); */ get_tg_FLL_for_LVL(rtu_LVL, rtu_setTempFL, &rtb_deg_c); /* MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Sum: '/ 1' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ rtb_deg_c = (int16_t)(g_assFLOW_AFSM_TEMP_TGT[tmp_0 - 1] - rtb_deg_c); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_deg_c; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch1' incorporates: * Gain: '/Gain6' * Sum: '/Add' */ /* : c_g_aucFLOW_AFSM_FOOT_PLUS = g_aucFLOW_AFSM_FOOT_PLUS(LVL + 1); */ if (rtb_X >= 0) { rtb_FLF_NEW = rty_Out1[4]; } else { /* MATLAB Function: '/g_aucFLOW_AFSM_FOOT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_aucFLOW_AFSM_FOOT_PLUS' * Product: '/Product3' */ tmp_0 = g_aucFLOW_AFSM_FOOT_PLUS[tmp_0 - 1] * rtb_X * 13107; rtb_FLF_NEW = (uint16_t)((int16_t)rty_Out1[4] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/g_aucFLOW_AFSM_FOOT_VALVE_MAX' */ g_aucFLOW_AFSM_FOOT_VALVE_MAX_f(rtu_LVL, &rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX); /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_FLF_NEW > rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX) { rtb_FLF_NEW = rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX; } /* End of Switch: '/Switch2' */ /* MATLAB Function: '/get_tg_FLL_for_LVL' */ /* : c_g_assFLOW_AFSM_TEMP_TGT = g_assFLOW_AFSM_TEMP_TGT(LVL + 1 + 6); */ get_tg_FLL_for_LVL_j(rtu_LVL, rtu_setTempFR, &rtb_deg_c); /* MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain6' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT' * Sum: '/ 1' */ tmp_0 = (int16_t)(g_assFLOW_AFSM_TEMP_TGT[tmp - 1] - rtb_deg_c) * 13107; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/Switch3' incorporates: * Gain: '/Gain7' * Sum: '/Add1' */ /* : c_g_aucFLOW_AFSM_FOOT_PLUS = g_aucFLOW_AFSM_FOOT_PLUS(LVL + 1 + 6); */ if (rtb_X >= 0) { rtb_FRF_NEW = rty_Out1[6]; } else { /* MATLAB Function: '/g_aucFLOW_AFSM_FOOT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Gain: '/Gain7' incorporates: * MATLAB Function: '/g_aucFLOW_AFSM_FOOT_PLUS' * Product: '/Product4' */ tmp_0 = g_aucFLOW_AFSM_FOOT_PLUS[tmp - 1] * rtb_X * 13107; rtb_FRF_NEW = (uint16_t)((int16_t)rty_Out1[6] - (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && (((uint32_t)tmp_0 & 65535U) != 0U)) + (tmp_0 >> 17))); } /* End of Switch: '/Switch3' */ /* MATLAB Function: '/g_aucFLOW_AF_FOOT_VALVE_MAX' */ g_aucFLOW_AFSM_FOOT_VALVE_MAX_f(rtu_LVL, &rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX); /* MATLAB Function: '/g_assFLOW_AFSM_AMB_TGT' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_AFSM_VENT_PLUS = g_aucFLOW_AFSM_VENT_PLUS(LVL + 1); */ /* : c_g_assFLOW_AFSM_AMB_TGT = g_assFLOW_AFSM_AMB_TGT(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Sum: '/deg' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_AMB_TGT' */ rtb_deg_c = (int16_t)(g_assFLOW_AFSM_AMB_TGT[tmp_0 - 1] - rtu_Amb_Fb); /* Gain: '/Gain2' */ tmp_0 = 13107 * rtb_deg_c; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/if (deg < 0)' incorporates: * Sum: '/ ' * Switch: '/Switch2' */ if (rtb_X >= 0) { rtb_Switch2_l_idx_0 = rty_Out1[0]; rtb_Switch2_l_idx_1 = rty_Out1[1]; } else { /* MATLAB Function: '/g_aucFLOW_AFSM_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } /* Product: '/Умножили' incorporates: * Gain: '/Gain' * MATLAB Function: '/g_aucFLOW_AFSM_VENT_PLUS' */ rtb_deg_c = (int16_t)((int32_t)((g_aucFLOW_AFSM_VENT_PLUS[tmp_0 - 1] * 205U + 1024U) >> 11) * rtb_X); rtb_Switch2_l_idx_0 = (uint16_t)(rty_Out1[0] - rtb_deg_c); rtb_Switch2_l_idx_1 = (uint16_t)(rty_Out1[1] - rtb_deg_c); } /* End of Switch: '/if (deg < 0)' */ /* MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_AFSM_VENT_VALVE_MAX = g_aucFLOW_AFSM_VENT_VALVE_MAX(LVL + 1); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g = g_aucFLOW_AFSM_VENT_VALVE_MAX[tmp_0 - 1]; /* End of MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' */ /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_l_idx_0 > rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g) { rtb_Switch2_l_idx_0 = rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g; } if (rtb_Switch2_l_idx_1 > rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g) { rtb_Switch2_l_idx_1 = rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g; } /* End of Switch: '/Switch2' */ /* MATLAB Function: '/g_assFLOW_AF_AMB_TGT' */ /* : c_g_aucFLOW_AFSM_VENT_PLUS = g_aucFLOW_AFSM_VENT_PLUS(LVL + 1 + 6); */ g_assFLOW_AF_AMB_TGT_g(rtu_LVL, &rtb_deg_c); /* Gain: '/Gain2' incorporates: * Sum: '/deg' */ tmp_0 = (int16_t)(rtb_deg_c - rtu_Amb_Fb) * 13107; rtb_X = (int8_t)(((((uint32_t)tmp_0 & 65536U) != 0U) && ((((uint32_t)tmp_0 & 65535U) != 0U) || (tmp_0 > 0))) + (tmp_0 >> 17)); /* Switch: '/if (deg < 0)' incorporates: * DataTypeConversion: '/Data Type Conversion' * Sum: '/ ' * Switch: '/Switch2' */ if (rtb_X >= 0) { rtb_Switch2_j1_idx_0 = rty_Out1[0]; rtb_Switch2_j1_idx_1 = rty_Out1[1]; } else { /* MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } /* Product: '/Умножили' incorporates: * Gain: '/Gain' * MATLAB Function: '/g_aucFLOW_AF_VENT_PLUS' */ rtb_deg_c = (int16_t)((int32_t)((g_aucFLOW_AFSM_VENT_PLUS[tmp - 1] * 205U + 1024U) >> 11) * rtb_X); rtb_Switch2_j1_idx_0 = (uint16_t)((int16_t)rty_Out1[0] - rtb_deg_c); rtb_Switch2_j1_idx_1 = (uint16_t)((int16_t)rty_Out1[1] - rtb_deg_c); } /* End of Switch: '/if (deg < 0)' */ /* MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' incorporates: * MATLAB Function: '/g_assFLOW_AFSM_TEMP_TGT_LEFT' */ /* : c_g_aucFLOW_AFSM_VENT_VALVE_MAX = g_aucFLOW_AFSM_VENT_VALVE_MAX(LVL + 1 + 6); */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g = g_aucFLOW_AFSM_VENT_VALVE_MAX[tmp - 1]; /* End of MATLAB Function: '/g_aucFLOW_AF_VENT_VALVE_MAX' */ /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch2' */ rty_Out1[0] = rtb_Switch2_l_idx_0; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_j1_idx_0 > rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[2] = rtb_Switch2_j1_idx_0; } /* Assignment: '/Присваивание в [1-2]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch2' */ rty_Out1[1] = rtb_Switch2_l_idx_1; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_Switch2_j1_idx_1 > rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g) { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_c_g_aucFLOW_AFSM_VENT_VALVE_MAX_g; } else { /* Assignment: '/Присваивание в [3-4]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[3] = rtb_Switch2_j1_idx_1; } /* Assignment: '/Присваивание в [5]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[4] = rtb_FLF_NEW; /* Switch: '/Switch2' incorporates: * RelationalOperator: '/LowerRelop1' */ if (rtb_FRF_NEW > rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX) { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' */ rty_Out1[6] = rtb_c_g_aucFLOW_AFSM_FOOT_VALVE_MAX; } else { /* Assignment: '/Присваивание в [7]' incorporates: * SignalConversion generated from: '/Out1' * Switch: '/Switch' */ rty_Out1[6] = rtb_FRF_NEW; } /* End of Switch: '/Switch2' */ } double rt_roundd(double u) { double y; if (fabs(u) < 4.503599627370496E+15) { if (u >= 0.5) { y = floor(u + 0.5); } else if (u > -0.5) { y = 0.0; } else { y = ceil(u - 0.5); } } else { y = u; } return y; } /* * Output and update for atomic system: * '/Начальные положения заслонок left' * '/Начальные положения заслонок right' */ void left(uint8_t rtu_idx, uint16_t rty_vals[9]) { int32_t i; int32_t rtu_idx_0; uint16_t tmp[45]; /* : table = [ */ /* : g_ausFLOW_FR_VE2VALVE; */ /* : g_ausFLOW_FR_BIVALVE; */ /* : g_ausFLOW_FR_BI2VALVE; */ /* : g_ausFLOW_FR_AF2VALVE; */ /* : g_ausFLOW_FR_AF2VALVE_SUMMER */ /* : ]; */ /* : idx = idx / 10; */ /* : vals = table(idx, :); */ rtu_idx_0 = (int32_t)rt_roundd((double)rtu_idx / 10.0); for (i = 0; i < 9; i++) { tmp[5 * i] = g_ausFLOW_FR_VE2VALVE[i]; tmp[5 * i + 1] = g_ausFLOW_FR_BIVALVE[i]; tmp[5 * i + 2] = g_ausFLOW_FR_BI2VALVE[i]; tmp[5 * i + 3] = g_ausFLOW_FR_AF2VALVE[i]; tmp[5 * i + 4] = g_ausFLOW_FR_AF2VALVE_SUMMER[i]; rty_vals[i] = tmp[(5 * i + rtu_idx_0) - 1]; } } /* * Output and update for action system: * '/Stop Mode' * '/Stop Mode' */ void StopMode(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t *rtd_Busy_private_a, uint8_t rtd_COM_private_h[9], const uint8_t *rtd_Error_Connect_private_f, uint8_t rtd_MODE_private_a[9]) { int32_t i; /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' */ if ((*rtd_Busy_private_a == 0) && (*rtd_Error_Connect_private_f == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtd_MODE_private_a[i] = 2U; /* DataStoreWrite: '/Data Store Write1' */ rtd_COM_private_h[i] = 1U; } /* Sum: '/step inc' incorporates: * Constant: '/Constant' */ *rty_step = (int8_t)(rtu_stepIn + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* SignalConversion generated from: '/stepIn' */ *rty_step = rtu_stepIn; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ } /* * Output and update for atomic system: * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' */ void g_assSTART_ENTER_INCAR_a(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; /* : out = int16(g_assSTART_ENTER_INCAR(LVL+1)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_assSTART_ENTER_INCAR[tmp - 1]; } /* * Output and update for action system: * '/Level 3' * '/Level 4' * '/Level 5' */ void Level3(int8_t *rty_step1, const uint16_t *rtd_ECT, const uint8_t *rtd_LEVEL, const double *rtd_MODE_DRIVER) { int32_t q0; uint32_t qY; /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : out = int16(g_assSTART_ENTER_COOLANT(LVL + 1 - 3)); */ q0 = (int32_t)(*rtd_LEVEL + 1U); if (*rtd_LEVEL + 1U > 255U) { q0 = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = (uint32_t)q0 - 3U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)q0 - 3U > (uint32_t)q0) { qY = 0U; } /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Logic: '/AND' * MATLAB Function: '/g_assSTART_ENTER_COOLANT ' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator2' */ if ((*rtd_ECT < g_assSTART_ENTER_COOLANT[(int32_t)qY - 1]) && (*rtd_MODE_DRIVER == 1.0)) { *rty_step1 = 0; } else { *rty_step1 = -1; } /* End of Switch: '/Switch' */ } /* * Output and update for action system: * '/Level 0' * '/Level 1' * '/Level 2' * '/Level 0' * '/Level 1' */ void Level0(int8_t *rty_step) { /* SignalConversion generated from: '/step' incorporates: * Constant: '/Constant' */ *rty_step = 1; } /* * Output and update for atomic system: * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' * ... */ void incarfilterdown(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_INCAR_FLT_DN(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_INCAR_FLT_DN[tmp - 1]; } /* * Output and update for atomic system: * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' * ... */ void incarfilterup(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_INCAR_FLT_UP(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_INCAR_FLT_UP[tmp - 1]; } /* * Output and update for atomic system: * '/g_assSTART_COOLANT_STEP0_TO_1 ' * '/g_assSTART_COOLANT_STEP0_TO_1 ' */ void g_assSTART_COOLANT_STEP0_TO_1_k(uint8_t rtu_LVL, int16_t *rty_out) { int32_t q0; uint32_t qY; /* : out = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 1 - 2)); */ q0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { q0 = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = (uint32_t)q0 - 2U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)q0 - 2U > (uint32_t)q0) { qY = 0U; } *rty_out = g_assSTART_COOLANT_STEP0_TO_1[(int32_t)qY - 1]; } /* * Output and update for atomic system: * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' */ void uwayvalvestatus(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_3WAY_OPEN(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_3WAY_OPEN[tmp - 1]; } /* * Output and update for atomic system: * '/Dtg_FrontLower_X' * '/Dtg_FrontLower_X' * '/Dtg_FrontLower_X' */ void Dtg_FrontLower_X(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_L(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_FX_L[tmp - 1]; } /* * Output and update for atomic system: * '/Dtg_FrontUpper_X' * '/Dtg_FrontUpper_X' * '/Dtg_FrontUpper_X' */ void Dtg_FrontUpper_X(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_U(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_FX_U[tmp - 1]; } /* * Output and update for atomic system: * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' */ void Incartempgotofromstep1tostep2(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; /* : out = int16(g_assSTART_INCAR_STEP1_TO_2(LVL + 1)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_assSTART_INCAR_STEP1_TO_2[tmp - 1]; } /* * Output and update for atomic system: * '/blower FR' * '/blower FR' */ void blowerFR(uint8_t rtu_LVL, uint16_t *rty_out) { int32_t tmp; /* : out = g_ausSTART_BLR_AF_STEP12_F(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_ausSTART_BLR_AF_STEP12_F[tmp - 1]; } /* * Output and update for atomic system: * '/mode FR step 1' * '/mode FR step 1' * '/mode FR step 1' * '/mode FR step 1' * '/mode FR step 1' */ void modeFRstep1(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_VALVE_IDX_STEP1(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_VALVE_IDX_STEP1[tmp - 1]; } /* * Output and update for atomic system: * '/window heating' * '/window heating' * '/window heating' * '/window heating' * '/window heating' */ void windowheating(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_ELEC_WINDOW(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_ELEC_WINDOW[tmp - 1]; } /* * Output and update for atomic system: * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' */ void Timegotofromstep1tostep2(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; uint16_t tmp_0; /* : out = int16(g_ausSTART_TIME_STEP1_TO_2(LVL + 1)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = g_ausSTART_TIME_STEP1_TO_2[tmp - 1]; if (tmp_0 > 32767) { tmp_0 = 32767U; } *rty_out = (int16_t)tmp_0; } /* * Output and update for atomic system: * '/ECT min max' * '/ECT min max' * '/ECT min max' */ void ECTminmax(uint8_t rtu_LVL, int16_t rty_out[2]) { int32_t q0; uint32_t qY; /* : min = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 1 - 2)); */ /* : max = int16(g_assSTART_COOLANT_TO_STEP2(1)); */ /* : out = [min, max]; */ q0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { q0 = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ qY = (uint32_t)q0 - 2U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)q0 - 2U > (uint32_t)q0) { qY = 0U; } rty_out[0] = g_assSTART_COOLANT_STEP0_TO_1[(int32_t)qY - 1]; rty_out[1] = g_assSTART_COOLANT_TO_STEP2[0]; } /* * Output and update for atomic system: * '/blower min max' * '/blower min max' * '/blower min max' */ void blowerminmax(uint8_t rtu_LVL, uint16_t rty_out[2]) { int32_t tmp; /* : min = 20; */ /* : max = g_ausSTART_BLR_AF_STEP12_F(LVL + 1); */ /* : out = [min, max]; */ rty_out[0] = 20U; tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } rty_out[1] = g_ausSTART_BLR_AF_STEP12_F[tmp - 1]; } /* * Output and update for action system: * '/Level 4' * '/Level 5' */ void Level4(int8_t *rty_step, uint16_t *rtd_Blower_FL, uint16_t *rtd_Blower_FR, uint8_t *rtd_Dtg_FLL, uint8_t *rtd_Dtg_FLR, uint8_t *rtd_Dtg_FUL, uint8_t *rtd_Dtg_FUR, const uint16_t *rtd_ECT, uint8_t *rtd_El_window_heating, const int16_t *rtd_Incar_FL, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_FL, uint8_t *rtd_Mode_FR, double *rtd_Recirculation, uint8_t *rtd_Valve_3_way, const int8_t *rtd_step_start_controle_front, const uint32_t *rtd_t_now, DW_Level4 *localDW) { int32_t tmp; int16_t rtb_out_ns[2]; int16_t rtb_out_g3; int16_t rtb_out_hk; uint16_t rtb_out_gp[2]; uint8_t rtb_out_oc; bool rtb_Equal_c; bool rtb_RelationalOperator1_f; /* DataStoreWrite: '/Data Store Write8' incorporates: * DataStoreRead: '/Data Store Read10' * MATLAB Function: '/3 way valve status' */ uwayvalvestatus(*rtd_LEVEL, rtd_Valve_3_way); /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown(*rtd_LEVEL, rtd_Incar_filter_down_value); /* MATLAB Function: '/mode FR step 1' incorporates: * DataStoreRead: '/Data Store Read5' */ modeFRstep1(*rtd_LEVEL, &rtb_out_oc); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_FR = rtb_out_oc; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_FL = rtb_out_oc; /* MATLAB Function: '/window heating' incorporates: * DataStoreRead: '/Data Store Read6' */ windowheating(*rtd_LEVEL, &rtb_out_oc); /* DataStoreWrite: '/Data Store Write4' */ *rtd_El_window_heating = rtb_out_oc; /* MATLAB Function: '/blower min max' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerminmax(*rtd_LEVEL, rtb_out_gp); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax(*rtd_LEVEL, rtb_out_ns); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_FR = look1_iu16bs16lu64n32_binlcse(*rtd_ECT, rtb_out_ns, rtb_out_gp, 1U); /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_FL = *rtd_Blower_FR; /* MATLAB Function: '/Dtg_FrontUpper_X' incorporates: * DataStoreRead: '/Data Store Read8' */ /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_U(LVL + 1); */ tmp = (int32_t)(*rtd_LEVEL + 1U); if (*rtd_LEVEL + 1U > 255U) { tmp = 255; } rtb_out_oc = g_aucSTART_DUCT_TGT_STEP2_FX_U[tmp - 1]; /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_FUR = rtb_out_oc; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_FUL = rtb_out_oc; /* MATLAB Function: '/Dtg_FrontLower_X' incorporates: * DataStoreRead: '/Data Store Read8' * DataStoreRead: '/Data Store Read9' * MATLAB Function: '/Dtg_FrontUpper_X' */ /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_L(LVL + 1); */ tmp = (int32_t)(*rtd_LEVEL + 1U); if (*rtd_LEVEL + 1U > 255U) { tmp = 255; } rtb_out_oc = g_aucSTART_DUCT_TGT_STEP2_FX_L[tmp - 1]; /* End of MATLAB Function: '/Dtg_FrontLower_X' */ /* DataStoreWrite: '/Data Store Write12' */ *rtd_Dtg_FLR = rtb_out_oc; /* DataStoreWrite: '/Data Store Write13' */ *rtd_Dtg_FLL = rtb_out_oc; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_c = (*rtd_step_start_controle_front == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2(*rtd_LEVEL, &rtb_out_g3); /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2(*rtd_LEVEL, &rtb_out_hk); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_RelationalOperator1_f = (*rtd_t_now - localDW->t_start_delay_private_DSTATE > (uint32_t)(1000 * rtb_out_hk)); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_Equal_c && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * DataStoreRead: '/incar temp' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator' */ if ((*rtd_Incar_FL > rtb_out_g3) || rtb_RelationalOperator1_f) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_c; } /* * Output and update for atomic system: * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' * '/3 way valve status' */ void uwayvalvestatus_m(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_3WAY_OPEN(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_3WAY_OPEN[tmp_0 - 1]; } /* * Output and update for atomic system: * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' */ void timeforstep(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_L(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_FX_L[tmp_0 - 1]; } /* * Output and update for atomic system: * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' */ void timeforstep_a(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_DUCT_TGT_STEP2_FX_U(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_FX_U[tmp_0 - 1]; } /* * Output and update for atomic system: * '/Time goto from step 2 to step 3 ' * '/Time goto from step 2 to step 3 ' * '/Time goto from step 2 to step 3 ' * '/Time goto from step 2 to step 3 ' * '/Time goto from step 2 to step 3 ' */ void Timegotofromstep2tostep3(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; uint16_t tmp_0; /* : out = int16(g_ausSTART_TIME_STEP2_TO_3(LVL + 1)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = g_ausSTART_TIME_STEP2_TO_3[tmp - 1]; if (tmp_0 > 32767) { tmp_0 = 32767U; } *rty_out = (int16_t)tmp_0; } /* * Output and update for atomic system: * '/blower step' * '/blower step' * '/blower step' * '/blower step' * '/blower step' */ void blowerstep(uint8_t rtu_LVL, uint16_t *rty_out) { int32_t tmp; /* : out = g_ausSTART_BLR_SPD_STEP2_F(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_ausSTART_BLR_SPD_STEP2_F[tmp - 1]; } /* * Output and update for atomic system: * '/blower time for step' * '/blower time for step' * '/blower time for step' * '/blower time for step' * '/blower time for step' */ void blowertimeforstep(uint8_t rtu_LVL, uint16_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_ausSTART_BLR_SPD_STEP2_F(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_ausSTART_BLR_SPD_STEP2_F[tmp_0 - 1]; } /* * Output and update for atomic system: * '/step' * '/step' * '/step' * '/step' * '/step' */ void step_l(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_VALVE_CHANGE_SPD_F(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_VALVE_CHANGE_SPD_F[tmp - 1]; } /* * Output and update for atomic system: * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' */ void timeforstep_f(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_VALVE_CHANGE_SPD_F(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_VALVE_CHANGE_SPD_F[tmp_0 - 1]; } /* * Output and update for atomic system: * '/window heating' * '/window heating' * '/window heating' * '/window heating' */ void windowheating_k(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_ELEC_WINDOW(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_ELEC_WINDOW[tmp_0 - 1]; } /* * Output and update for atomic system: * '/autodemist (autodefog)' * '/autodemist (autodefog)' * '/autodemist (autodefog)' */ void autodemistautodefog(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_AUTODEMIST2_STEP2(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_AUTODEMIST2_STEP2[tmp - 1]; } /* * Output and update for action system: * '/Level 3' * '/Level 4' */ void Level3_d(int8_t *rty_step, uint8_t *rtd_Autodefog, uint16_t *rtd_Blower_FL, uint16_t *rtd_Blower_FR, const uint16_t *rtd_Blower_logic_FL, uint8_t *rtd_Dtg_FLL, uint8_t *rtd_Dtg_FLR, uint8_t *rtd_Dtg_FUL, uint8_t *rtd_Dtg_FUR, const uint8_t *rtd_Dtg_logic_FLL, const uint8_t *rtd_Dtg_logic_FUL, uint8_t *rtd_El_window_heating, const bool *rtd_HI_logic_on, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_FL, uint8_t *rtd_Mode_FR, const uint8_t *rtd_Mode_logic_FL, double *rtd_Recirculation, uint8_t *rtd_Valve_3_way, const int8_t *rtd_step_start_controle_front, const uint32_t *rtd_t_now, DW_Level3_h *localDW) { int32_t tmp; int16_t rtb_out_jl; uint16_t rtb_out_apg; uint16_t rtb_out_g1; uint8_t rtb_out_f4; uint8_t rtb_out_fo; uint8_t rtb_out_j5; bool rtb_Cond_prev_private_l2; bool rtb_RelationalOperator1_f; /* DataStoreWrite: '/Data Store Write8' incorporates: * DataStoreRead: '/Data Store Read10' * MATLAB Function: '/3 way valve status' */ uwayvalvestatus_m(*rtd_LEVEL, rtd_Valve_3_way); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read9' */ Dtg_FrontLower_X(*rtd_LEVEL, &rtb_out_j5); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read9' */ timeforstep(*rtd_LEVEL, &rtb_out_fo); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write12' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint8_t)(*rtd_Dtg_FLL - *rtd_Dtg_logic_FLL) <= 0.01) { *rtd_Dtg_FLR = *rtd_Dtg_logic_FLL; } else { if (*rtd_Dtg_FLL <= *rtd_Dtg_logic_FLL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Dtg_FLR = (uint8_t)((double)rtb_out_j5 / (double)rtb_out_fo / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE) * (double)tmp + (double)* rtd_Dtg_FLL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write13' incorporates: * DataStoreWrite: '/Data Store Write12' */ *rtd_Dtg_FLL = *rtd_Dtg_FLR; /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_FrontUpper_X(*rtd_LEVEL, &rtb_out_j5); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_a(*rtd_LEVEL, &rtb_out_fo); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write10' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint8_t)(*rtd_Dtg_FUL - *rtd_Dtg_logic_FUL) <= 0.01) { *rtd_Dtg_FUR = *rtd_Dtg_logic_FUL; } else { if (*rtd_Dtg_FUL <= *rtd_Dtg_logic_FUL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Dtg_FUR = (uint8_t)((double)rtb_out_j5 / (double)rtb_out_fo / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_e) * (double)tmp + (double)* rtd_Dtg_FUL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write11' incorporates: * DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_FUL = *rtd_Dtg_FUR; /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown(*rtd_LEVEL, rtd_Incar_filter_down_value); /* DataStoreWrite: '/Data Store Write14' incorporates: * DataStoreRead: '/Data Store Read3' * MATLAB Function: '/autodemist (autodefog)' */ autodemistautodefog(*rtd_LEVEL, rtd_Autodefog); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_j5 = (uint8_t)(*rtd_Mode_FL - *rtd_Mode_logic_FL); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_l(*rtd_LEVEL, &rtb_out_fo); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_f(*rtd_LEVEL, &rtb_out_f4); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write2' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if (rtb_out_j5 <= 0.01) { *rtd_Mode_FR = *rtd_Mode_logic_FL; } else { if (*rtd_Mode_FL <= *rtd_Mode_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Mode_FR = (uint8_t)((double)rtb_out_fo / (double)rtb_out_f4 / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_h) * (double)tmp + (double)* rtd_Mode_FL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_FL = *rtd_Mode_FR; /* MATLAB Function: '/window heating' incorporates: * DataStoreRead: '/Data Store Read6' */ windowheating_k(*rtd_LEVEL, &rtb_out_j5); /* DataStoreWrite: '/Data Store Write4' */ *rtd_El_window_heating = rtb_out_j5; /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_g1 = (uint16_t)(*rtd_Blower_FL - *rtd_Blower_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_Cond_prev_private_l2 = (rtb_out_g1 <= 0.01); /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep(*rtd_LEVEL, &rtb_out_apg); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep(*rtd_LEVEL, &rtb_out_g1); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write5' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if (rtb_Cond_prev_private_l2) { *rtd_Blower_FR = *rtd_Blower_logic_FL; } else { if (*rtd_Blower_FL <= *rtd_Blower_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Blower_FR = (uint16_t)((double)rtb_out_apg / (double)rtb_out_g1 / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_o) * (double)tmp + (double)*rtd_Blower_FL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_FL = *rtd_Blower_FR; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Cond_prev_private_l2 = (*rtd_step_start_controle_front == 1); /* MATLAB Function: '/Time goto from step 2 to step 3 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep2tostep3(*rtd_LEVEL, &rtb_out_jl); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_RelationalOperator1_f = (*rtd_t_now - localDW->t_start_delay_private_DSTATE > (uint32_t)(1000 * rtb_out_jl)); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_Cond_prev_private_l2 && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator' */ if (rtb_RelationalOperator1_f || (*rtd_HI_logic_on)) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_e = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_h = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_o = *rtd_t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Cond_prev_private_l2; } /* * Output and update for action system: * '/Step 3' * '/Step 3' */ void Step3(int8_t *rty_step, int8_t *rtd_start_control_finished_front) { /* DataStoreWrite: '/Data Store Write10' incorporates: * Constant: '/True' */ *rtd_start_control_finished_front = 1; /* SignalConversion generated from: '/step' incorporates: * Constant: '/Constant1' */ *rty_step = 3; } /* * Output and update for atomic system: * '/g_ausSTART_ENTER_SETTEMP' * '/g_ausSTART_ENTER_SETTEMP' * '/g_ausSTART_ENTER_SETTEMP' */ void g_ausSTART_ENTER_SETTEMP_p(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; int32_t tmp_0; uint16_t tmp_1; /* : out = int16(g_ausSTART_ENTER_SETTEMP(LVL+1+6)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } tmp_1 = g_ausSTART_ENTER_SETTEMP[tmp_0 - 1]; if (tmp_1 > 32767) { tmp_1 = 32767U; } *rty_out = (int16_t)tmp_1; } /* * Output and update for atomic system: * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' */ void g_assSTART_ENTER_INCAR_l(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = int16(g_assSTART_ENTER_INCAR(LVL+1+6)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_assSTART_ENTER_INCAR[tmp_0 - 1]; } /* * Output and update for atomic system: * '/g_assSTART_ENTER_COOLANT ' * '/g_assSTART_ENTER_COOLANT ' * '/g_assSTART_ENTER_COOLANT ' */ void g_assSTART_ENTER_COOLANT_i(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; /* : out = int16(g_assSTART_ENTER_COOLANT(LVL + 1)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_assSTART_ENTER_COOLANT[tmp - 1]; } /* * Output and update for action system: * '/Level 4' * '/Level 5' */ void Level4_i(int8_t *rty_step1, const uint16_t *rtd_ECT, const int16_t *rtd_Incar_RR, const uint8_t *rtd_LEVEL, const double *rtd_MODE_RR_passenger) { int16_t rtb_out_dtd; int16_t rtb_out_mu; /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read4' */ g_assSTART_ENTER_INCAR_l(*rtd_LEVEL, &rtb_out_mu); /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_COOLANT_i(*rtd_LEVEL, &rtb_out_dtd); /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * Logic: '/AND' * Logic: '/AND1' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if (((*rtd_Incar_RR < rtb_out_mu) || (*rtd_ECT < rtb_out_dtd)) && (*rtd_MODE_RR_passenger == 1.0)) { *rty_step1 = 0; } else { *rty_step1 = -1; } /* End of Switch: '/Switch' */ } /* * Output and update for atomic system: * '/incar filter down' * '/incar filter down' * '/incar filter down' * '/incar filter down' */ void incarfilterdown_j(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_INCAR_FLT_DN(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_INCAR_FLT_DN[tmp_0 - 1]; } /* * Output and update for atomic system: * '/incar filter up' * '/incar filter up' * '/incar filter up' * '/incar filter up' */ void incarfilterup_d(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_INCAR_FLT_UP(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_INCAR_FLT_UP[tmp_0 - 1]; } /* * Output and update for atomic system: * '/g_assSTART_COOLANT_STEP0_TO_1 ' * '/g_assSTART_COOLANT_STEP0_TO_1 ' * '/g_assSTART_COOLANT_STEP0_TO_1 ' */ void g_assSTART_COOLANT_STEP0_TO_1_g(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; /* : out = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 3)); */ tmp = (int32_t)(rtu_LVL + 3U); if (rtu_LVL + 3U > 255U) { tmp = 255; } *rty_out = g_assSTART_COOLANT_STEP0_TO_1[tmp - 1]; } /* * Output and update for action system: * '/Level 4' * '/Level 5' */ void Level4_h(int8_t *rty_step1, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR, uint8_t *rtd_Dtg_RL, uint8_t *rtd_Dtg_RR, const uint16_t *rtd_ECT, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_RL, uint8_t *rtd_Mode_RR, uint8_t *rtd_Valve_2_way, uint8_t *rtd_Valve_3_way) { int16_t rtb_out_dfj; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ *rtd_Blower_RR = 10U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant3' */ *rtd_Blower_RL = 10U; /* DataStoreWrite: '/Data Store Write10' incorporates: * Constant: '/Constant4' */ *rtd_Dtg_RR = 80U; /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant5' */ *rtd_Dtg_RL = 80U; /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup_d(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_j(*rtd_LEVEL, rtd_Incar_filter_down_value); /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Mode - foot' */ *rtd_Mode_RR = 60U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Mode - foot' */ *rtd_Mode_RL = 60U; /* DataStoreWrite: '/Data Store Write8' incorporates: * Constant: '/Valve open' */ *rtd_Valve_3_way = 1U; /* DataStoreWrite: '/Data Store Write9' incorporates: * Constant: '/Valve open' */ *rtd_Valve_2_way = 1U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_COOLANT_STEP0_TO_1_g(*rtd_LEVEL, &rtb_out_dfj); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' */ *rty_step1 = (int8_t)(*rtd_ECT > rtb_out_dfj); } /* * Output and update for atomic system: * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * '/2 way valve' * ... */ void uwayvalve(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_2WAY_OPEN(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_2WAY_OPEN[tmp - 1]; } /* * Output and update for atomic system: * '/Dtg_rear' * '/Dtg_rear' * '/Dtg_rear' * '/Dtg_rear' * '/Dtg_rear' * '/Dtg_rear' */ void Dtg_rear(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_DUCT_TGT_STEP2_RX(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_RX[tmp - 1]; } /* * Output and update for atomic system: * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' * '/Incar temp goto from step 1 to step 2 ' */ void Incartempgotofromstep1tostep2_b(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = int16(g_assSTART_INCAR_STEP1_TO_2(LVL + 1 + 6)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_assSTART_INCAR_STEP1_TO_2[tmp_0 - 1]; } /* * Output and update for atomic system: * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * '/Time goto from step 1 to step 2 ' * ... */ void Timegotofromstep1tostep2_h(uint8_t rtu_LVL, int16_t *rty_out) { int32_t tmp; int32_t tmp_0; uint16_t tmp_1; /* : out = int16(g_ausSTART_TIME_STEP1_TO_2(LVL + 1 + 6)); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } tmp_1 = g_ausSTART_TIME_STEP1_TO_2[tmp_0 - 1]; if (tmp_1 > 32767) { tmp_1 = 32767U; } *rty_out = (int16_t)tmp_1; } /* * Output and update for atomic system: * '/mode rear step 1' * '/mode rear step 1' * '/mode rear step 1' * '/mode rear step 1' * '/mode rear step 1' * '/mode rear step 1' */ void moderearstep1(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_VALVE_IDX_STEP1(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_VALVE_IDX_STEP1[tmp_0 - 1]; } /* * Output and update for action system: * '/Level 0' * '/Level 1' */ void Level0_h(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR, uint8_t *rtd_Dtg_RL, uint8_t *rtd_Dtg_RR, const int16_t *rtd_Incar_RR, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_RL, uint8_t *rtd_Mode_RR, double *rtd_Recirculation, uint8_t *rtd_Valve_2_way, const int8_t *rtd_step_start_controle_rear, const uint32_t *rtd_t_now, DW_Level0_p *localDW) { int32_t tmp; uint32_t rtb_dt_dl; int16_t rtb_out_gl; int16_t rtb_out_ni; uint16_t rtb_out_it; uint8_t rtb_out_c5o; bool rtb_Equal_ix; /* DataStoreWrite: '/Data Store Write9' incorporates: * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' */ uwayvalve(*rtd_LEVEL, rtd_Valve_2_way); /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup_d(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_j(*rtd_LEVEL, rtd_Incar_filter_down_value); /* MATLAB Function: '/mode rear step 1' incorporates: * DataStoreRead: '/Data Store Read5' */ moderearstep1(*rtd_LEVEL, &rtb_out_c5o); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RR = rtb_out_c5o; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_RL = rtb_out_c5o; /* MATLAB Function: '/blower rear' incorporates: * DataStoreRead: '/Data Store Read7' */ /* : out = g_ausSTART_BLR_AF_STEP12_R(LVL + 1); */ tmp = (int32_t)(*rtd_LEVEL + 1U); if (*rtd_LEVEL + 1U > 255U) { tmp = 255; } rtb_out_it = g_ausSTART_BLR_AF_STEP12_R[tmp - 1]; /* End of MATLAB Function: '/blower rear' */ /* DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RR = rtb_out_it; /* DataStoreWrite: '/Data Store Write6' */ *rtd_Blower_RL = rtb_out_it; /* MATLAB Function: '/Dtg_rear' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(*rtd_LEVEL, &rtb_out_c5o); /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RR = rtb_out_c5o; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_RL = rtb_out_c5o; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_ix = (*rtd_step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_b(*rtd_LEVEL, &rtb_out_ni); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dl = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(*rtd_LEVEL, &rtb_out_gl); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_Equal_ix && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * DataStoreRead: '/incar temp' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ if ((*rtd_Incar_RR < rtb_out_ni) || (rtb_dt_dl > (uint16_t)(1000 * rtb_out_gl))) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_ix; } /* * Output and update for atomic system: * '/blower start finish' * '/blower start finish' * '/blower start finish' * '/blower start finish' */ void blowerstartfinish(uint8_t rtu_LVL, uint16_t rty_out[2]) { int32_t tmp; int32_t tmp_0; /* : start = g_ausSTART_BLR_AF_STEP12_R(LVL + 1); */ /* : finish = g_ausSTART_BLR_AF_STEP12_R(LVL + 1 + 6); */ /* : out = [start, finish]; */ tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } rty_out[0] = g_ausSTART_BLR_AF_STEP12_R[tmp_0 - 1]; tmp_0 = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp_0 = 255; } tmp = (int32_t)((uint32_t)tmp_0 + 6U); if ((uint32_t)tmp_0 + 6U > 255U) { tmp = 255; } rty_out[1] = g_ausSTART_BLR_AF_STEP12_R[tmp - 1]; } /* * Output and update for atomic system: * '/ECT min max' * '/ECT min max' * '/ECT min max' */ void ECTminmax_h(uint8_t rtu_LVL, int16_t rty_out[2]) { int32_t tmp; /* : min = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 3)); */ /* : max = int16(g_assSTART_COOLANT_TO_STEP2(3)); */ /* : out = [min, max]; */ tmp = (int32_t)(rtu_LVL + 3U); if (rtu_LVL + 3U > 255U) { tmp = 255; } rty_out[0] = g_assSTART_COOLANT_STEP0_TO_1[tmp - 1]; rty_out[1] = g_assSTART_COOLANT_TO_STEP2[2]; } /* * Output and update for action system: * '/Level 4' * '/Level 5' */ void Level4_d(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR, uint8_t *rtd_Dtg_RL, uint8_t *rtd_Dtg_RR, const uint16_t *rtd_ECT, const int16_t *rtd_Incar_RR, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_RL, uint8_t *rtd_Mode_RR, double *rtd_Recirculation, uint8_t *rtd_Valve_2_way, const int8_t *rtd_step_start_controle_rear, const uint32_t *rtd_t_now, DW_Level4_m *localDW) { uint32_t rtb_dt_k; int16_t rtb_out_l1[2]; int16_t rtb_out_a4; int16_t rtb_out_hj; uint16_t rtb_out_bd[2]; uint8_t rtb_out_m1; bool rtb_Equal_hg; /* DataStoreWrite: '/Data Store Write9' incorporates: * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' */ uwayvalve(*rtd_LEVEL, rtd_Valve_2_way); /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup_d(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_j(*rtd_LEVEL, rtd_Incar_filter_down_value); /* MATLAB Function: '/mode rear step 1' incorporates: * DataStoreRead: '/Data Store Read5' */ moderearstep1(*rtd_LEVEL, &rtb_out_m1); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RR = rtb_out_m1; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_RL = rtb_out_m1; /* MATLAB Function: '/blower start finish' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstartfinish(*rtd_LEVEL, rtb_out_bd); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax_h(*rtd_LEVEL, rtb_out_l1); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RR = look1_iu16bs16lu64n32_binlcse(*rtd_ECT, rtb_out_l1, rtb_out_bd, 1U); /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RL = *rtd_Blower_RR; /* MATLAB Function: '/Dtg_rear' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(*rtd_LEVEL, &rtb_out_m1); /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RR = rtb_out_m1; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_RL = rtb_out_m1; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_hg = (*rtd_step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_b(*rtd_LEVEL, &rtb_out_hj); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_k = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(*rtd_LEVEL, &rtb_out_a4); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_Equal_hg && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * DataStoreRead: '/incar temp' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ if ((*rtd_Incar_RR > rtb_out_hj) || (rtb_dt_k > (uint16_t)(1000 * rtb_out_a4))) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_hg; } /* * Output and update for atomic system: * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' */ void timeforstep_fu(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_DUCT_TGT_STEP2_RX(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_DUCT_TGT_STEP2_RX[tmp_0 - 1]; } /* * Output and update for atomic system: * '/blower step' * '/blower step' * '/blower step' * '/blower step' * '/blower step' * '/blower step' */ void blowerstep_j(uint8_t rtu_LVL, uint16_t *rty_out) { int32_t tmp; /* : out = g_ausSTART_BLR_SPD_STEP2_R(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_ausSTART_BLR_SPD_STEP2_R[tmp - 1]; } /* * Output and update for atomic system: * '/blower time for step' * '/blower time for step' * '/blower time for step' * '/blower time for step' * '/blower time for step' * '/blower time for step' */ void blowertimeforstep_a(uint8_t rtu_LVL, uint16_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_ausSTART_BLR_SPD_STEP2_R(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_ausSTART_BLR_SPD_STEP2_R[tmp_0 - 1]; } /* * Output and update for atomic system: * '/step' * '/step' * '/step' * '/step' * '/step' * '/step' */ void step_c(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; /* : out = g_aucSTART_VALVE_CHANGE_SPD_R(LVL + 1); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } *rty_out = g_aucSTART_VALVE_CHANGE_SPD_R[tmp - 1]; } /* * Output and update for atomic system: * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' * '/time for step' */ void timeforstep_h(uint8_t rtu_LVL, uint8_t *rty_out) { int32_t tmp; int32_t tmp_0; /* : out = g_aucSTART_VALVE_CHANGE_SPD_R(LVL + 1 + 6); */ tmp = (int32_t)(rtu_LVL + 1U); if (rtu_LVL + 1U > 255U) { tmp = 255; } tmp_0 = (int32_t)((uint32_t)tmp + 6U); if ((uint32_t)tmp + 6U > 255U) { tmp_0 = 255; } *rty_out = g_aucSTART_VALVE_CHANGE_SPD_R[tmp_0 - 1]; } /* * Output and update for action system: * '/Level 0' * '/Level 1' */ void Level0_j(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR, const uint16_t *rtd_Blower_logic_RR, uint8_t *rtd_Dtg_RL, uint8_t * rtd_Dtg_RR, const uint8_t *rtd_Dtg_logic_RR, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_RL, uint8_t *rtd_Mode_RR, const uint8_t *rtd_Mode_logic_RR, double *rtd_Recirculation, uint8_t *rtd_Valve_2_way, const int8_t *rtd_step_start_controle_rear, const uint32_t *rtd_t_now, DW_Level0_n *localDW) { int32_t tmp; uint32_t rtb_dt_l; int16_t rtb_out_gw; uint16_t rtb_out_jki; uint16_t rtb_out_ma; uint8_t rtb_out_ke; uint8_t rtb_out_mz; bool rtb_RelationalOperator1_em; /* DataStoreWrite: '/Data Store Write9' incorporates: * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' */ uwayvalve(*rtd_LEVEL, rtd_Valve_2_way); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(*rtd_LEVEL, &rtb_out_mz); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_fu(*rtd_LEVEL, &rtb_out_ke); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write10' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint8_t)(*rtd_Dtg_RR - *rtd_Dtg_logic_RR) <= 0.01) { *rtd_Dtg_RR = *rtd_Dtg_logic_RR; } else { if (*rtd_Dtg_RR <= *rtd_Dtg_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Dtg_RR = (uint8_t)((double)rtb_out_mz / (double)rtb_out_ke / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE) * (double)tmp + (double)* rtd_Dtg_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write11' incorporates: * DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RL = *rtd_Dtg_RR; /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup_d(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_j(*rtd_LEVEL, rtd_Incar_filter_down_value); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_mz = (uint8_t)(*rtd_Mode_RR - *rtd_Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_RelationalOperator1_em = (rtb_out_mz <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_c(*rtd_LEVEL, &rtb_out_ke); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(*rtd_LEVEL, &rtb_out_mz); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write2' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if (rtb_RelationalOperator1_em) { *rtd_Mode_RR = *rtd_Mode_logic_RR; } else { if (*rtd_Mode_RR <= *rtd_Mode_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Mode_RR = (uint8_t)((double)rtb_out_ke / (double)rtb_out_mz / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_a) * (double)tmp + (double)* rtd_Mode_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RL = *rtd_Mode_RR; /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep_j(*rtd_LEVEL, &rtb_out_ma); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_a(*rtd_LEVEL, &rtb_out_jki); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write5' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint16_t)(*rtd_Blower_RR - *rtd_Blower_logic_RR) <= 0.01) { *rtd_Blower_RR = *rtd_Blower_logic_RR; } else { if (*rtd_Blower_RR <= *rtd_Blower_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Blower_RR = (uint16_t)((double)rtb_out_ma / (double)rtb_out_jki / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_l) * (double)tmp + (double)*rtd_Blower_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RL = *rtd_Blower_RR; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_RelationalOperator1_em = (*rtd_step_start_controle_rear == 1); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_l = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_RelationalOperator1_em && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(*rtd_LEVEL, &rtb_out_gw); /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ if (rtb_dt_l > (uint16_t)(1000 * rtb_out_gw)) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_a = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_l = *rtd_t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_RelationalOperator1_em; } /* * Output and update for action system: * '/Level 2' * '/Level 3' * '/Level 4' * '/Level 5' */ void Level2(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR, const uint16_t *rtd_Blower_logic_RR, uint8_t *rtd_Dtg_RL, uint8_t *rtd_Dtg_RR, const uint8_t *rtd_Dtg_logic_RR, const bool *rtd_HI_logic_on, uint8_t *rtd_Incar_filter_down_value, uint8_t *rtd_Incar_filter_up_value, const uint8_t *rtd_LEVEL, uint8_t *rtd_Mode_RL, uint8_t *rtd_Mode_RR, const uint8_t *rtd_Mode_logic_RR, double *rtd_Recirculation, uint8_t *rtd_Valve_2_way, const int8_t *rtd_step_start_controle_rear, const uint32_t *rtd_t_now, DW_Level2 * localDW) { int32_t tmp; uint32_t rtb_dt_h; int16_t rtb_out_aa; uint16_t rtb_out_i3; uint16_t rtb_out_oi; uint8_t rtb_out_b2p; uint8_t rtb_out_cy; bool rtb_Cond_prev_private_ax; /* DataStoreWrite: '/Data Store Write9' incorporates: * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' */ uwayvalve(*rtd_LEVEL, rtd_Valve_2_way); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(*rtd_LEVEL, &rtb_out_b2p); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_fu(*rtd_LEVEL, &rtb_out_cy); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write10' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint8_t)(*rtd_Dtg_RR - *rtd_Dtg_logic_RR) <= 0.01) { *rtd_Dtg_RR = *rtd_Dtg_logic_RR; } else { if (*rtd_Dtg_RR <= *rtd_Dtg_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Dtg_RR = (uint8_t)((double)rtb_out_b2p / (double)rtb_out_cy / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE) * (double)tmp + (double)* rtd_Dtg_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write11' incorporates: * DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RL = *rtd_Dtg_RR; /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' * MATLAB Function: '/incar filter up' */ incarfilterup_d(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_j(*rtd_LEVEL, rtd_Incar_filter_down_value); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_b2p = (uint8_t)(*rtd_Mode_RR - *rtd_Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_Cond_prev_private_ax = (rtb_out_b2p <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_c(*rtd_LEVEL, &rtb_out_cy); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(*rtd_LEVEL, &rtb_out_b2p); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write2' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if (rtb_Cond_prev_private_ax) { *rtd_Mode_RR = *rtd_Mode_logic_RR; } else { if (*rtd_Mode_RR <= *rtd_Mode_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Mode_RR = (uint8_t)((double)rtb_out_cy / (double)rtb_out_b2p / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_j) * (double)tmp + (double)* rtd_Mode_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RL = *rtd_Mode_RR; /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep_j(*rtd_LEVEL, &rtb_out_i3); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_a(*rtd_LEVEL, &rtb_out_oi); /* Switch: '/Switch' incorporates: * Constant: '/Constant' * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * DataStoreRead: '/текущее время в мс' * DataStoreWrite: '/Data Store Write5' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ if ((uint16_t)(*rtd_Blower_RR - *rtd_Blower_logic_RR) <= 0.01) { *rtd_Blower_RR = *rtd_Blower_logic_RR; } else { if (*rtd_Blower_RR <= *rtd_Blower_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ tmp = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ tmp = -1; } *rtd_Blower_RR = (uint16_t)((double)rtb_out_i3 / (double)rtb_out_oi / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_m) * (double)tmp + (double)*rtd_Blower_RR); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RL = *rtd_Blower_RR; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Cond_prev_private_ax = (*rtd_step_start_controle_rear == 1); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_h = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(*rtd_LEVEL, &rtb_out_aa); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_Cond_prev_private_ax && (!localDW->Cond_prev_private_DSTATE)) { localDW->t_start_delay_private_DSTATE = *rtd_t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * Constant: '/go to next step' * Constant: '/stay at step 1' * DataStoreRead: '/Data Store Read' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator1' */ if ((rtb_dt_h > (uint16_t)(1000 * rtb_out_aa)) || (*rtd_HI_logic_on)) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_j = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_m = *rtd_t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Cond_prev_private_ax; } /* Model step function */ void HVAC_model_step(void) { double rtb_Divide1_ja[9]; double rtb_Divide1; double rtb_Divide3; int32_t i; int32_t tmp_0; uint32_t rtb_dt_du; uint32_t rtb_dt_h; int16_t tmp[6]; int16_t rtb_out_nh[2]; int16_t AMB; int16_t Eva_F; int16_t Eva_R; int16_t Incar_FL; int16_t Incar_FR; int16_t Incar_RL; int16_t Incar_RR; int16_t Pressure; uint16_t Merge[9]; uint16_t rtb_vals_m[9]; uint16_t rtb_out_fw[2]; uint16_t Blower_FR; uint16_t rtb_out_jk; int8_t rtb_Switch_hx; uint8_t rtb_get_modes_for_levels[78]; uint8_t Autodefog; uint8_t Dtg_FUR; uint8_t El_window_heating; uint8_t Mode_FR; uint8_t Valve_2_way; uint8_t rtb_Gain2; uint8_t rtb_Gain_l; uint8_t rtb_u_pe; bool rtb_RelationalOperator_htm[9]; bool rtb_FailCond; bool rtb_FailCond_a; bool rtb_FailCond_b; bool rtb_FailCond_e; bool rtb_FailCond_f; bool rtb_FailCond_g; bool rtb_FailCond_l; bool rtb_FailCond_mg; bool rtb_LogicalOperator1; bool rtb_LogicalOperator1_ca; bool rtb_LogicalOperator1_f; bool rtb_LogicalOperator1_k; bool rtb_LogicalOperator1_lc; bool rtb_LogicalOperator1_lk; bool rtb_LogicalOperator3_f3; bool rtb_LogicalOperator3_oi; /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Ambient_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1 = (rtb_FailCond && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1) { AMB = 100; } else { AMB = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Ambient_Temp, rtConstP.pooled32, rtConstP.uDLookupTable_tableData, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write Ambient' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Ambient = %d * 0.1 C\n',Ambient); */ printf("Ambient = %d * 0.1 C\n", AMB); fflush(stdout); } /* End of MATLAB Function: '/Write Ambient' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1) { /* : if(AmbientErr) */ /* : fprintf('CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %f V\n',Sensor_Ambient_Temp); */ printf("CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond && (!rtDW.Cond_prev_private_DSTATE)) { rtDW.t_start_delay_private_DSTATE = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Evap_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_f = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_f = (rtb_FailCond_f && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_p >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_f) { Eva_F = -100; } else { Eva_F = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Evap_Temp, rtConstP.pooled32, rtConstP.pooled3, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1_f) { /* : if(EvapFErr) */ /* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %f V\n',Sensor_Evap_Temp); */ printf("CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* MATLAB Function: '/Write Eva_F' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Eva_F = %d * 0.1 C\n',Eva_F); */ printf("Eva_F = %d * 0.1 C\n", Eva_F); fflush(stdout); } /* End of MATLAB Function: '/Write Eva_F' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_f && (!rtDW.Cond_prev_private_DSTATE_h)) { rtDW.t_start_delay_private_DSTATE_p = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_g = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_k = (rtb_FailCond_g && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_pk >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_k) { Eva_R = -100; } else { Eva_R = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp, rtConstP.pooled32, rtConstP.pooled3, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1_k) { /* : if(EvapRErr) */ /* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %f V\n',Sensor_Rear_Evap_Temp); */ printf("CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* MATLAB Function: '/Write Eva_F' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Eva_R = %d * 0.1 C\n',Eva_R); */ printf("Eva_R = %d * 0.1 C\n", Eva_R); fflush(stdout); } /* End of MATLAB Function: '/Write Eva_F' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_g && (!rtDW.Cond_prev_private_DSTATE_i)) { rtDW.t_start_delay_private_DSTATE_pk = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_AC_Pressure / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_mg = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_lk = (rtb_FailCond_mg && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_e >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_lk) { Pressure = 32; } else { Pressure = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_AC_Pressure, rtConstP.pooled32, rtConstP.uDLookupTable_tableData_f, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('AC_Pressure = %d * ATM\n',AC_Pressure); */ printf("AC_Pressure = %d * ATM\n", Pressure); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1_lk) { /* : if(AC_PressureErr) */ /* : fprintf('CCU_Body_Err.CCU_PressSenErr_Stat = 0x1 (Failure), Sensor_AC_Pressure = %f V\n',Sensor_AC_Pressure); */ printf("CCU_Body_Err.CCU_PressSenErr_Stat = 0x1 (Failure), Sensor_AC_Pressure = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_mg && (!rtDW.Cond_prev_private_DSTATE_e)) { rtDW.t_start_delay_private_DSTATE_e = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_e = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_ca = (rtb_FailCond_e && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_b >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_ca) { Incar_FL = 200; } else { Incar_FL = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL, rtConstP.pooled32, rtConstP.pooled4, 1023U); } /* End of Switch: '/Switch' */ /* Product: '/Divide3' incorporates: * Constant: '/Constant3' * Constant: '/Constant4' * DataStoreRead: '/Data Store Read1' * Product: '/Divide2' */ rtb_Divide3 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL / 4095.0 * 5.0; /* Logic: '/Logical Operator2' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_a = ((rtb_Divide3 < 0.15) || (rtb_Divide3 > 4.9)); /* Logic: '/Logical Operator3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator3_f3 = (rtb_FailCond_a && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_j >= 3000U)); /* Switch: '/Switch1' incorporates: * Constant: '/Constant5' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * Lookup_n-D: '/1-D Lookup Table1' */ if (rtb_LogicalOperator3_f3) { Incar_RL = 200; } else { Incar_RL = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL, rtConstP.pooled32, rtConstP.pooled4, 1023U); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1_ca) { /* : if(IncarFLErr) */ /* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %f V\n',Sensor_Incar_Temp_FL); */ printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* MATLAB Function: '/Write ERROR1' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator3_f3) { /* : if(IncarRLErr) */ /* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %f V\n',Sensor_Incar_Temp_RL); */ printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %f V\n", rtb_Divide3); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR1' */ /* MATLAB Function: '/Write IncarFL' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('IncarFL = %d * 0.1 C\n',IncarFL); */ printf("IncarFL = %d * 0.1 C\n", Incar_FL); fflush(stdout); } /* End of MATLAB Function: '/Write IncarFL' */ /* MATLAB Function: '/Write IncarRL' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('IncarRL = %d * 0.1 C\n',IncarRL); */ printf("IncarRL = %d * 0.1 C\n", Incar_RL); fflush(stdout); } /* End of MATLAB Function: '/Write IncarRL' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_e && (!rtDW.Cond_prev_private_DSTATE_c)) { rtDW.t_start_delay_private_DSTATE_b = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_a && (!rtDW.Cond_prev_private_DSTATE_b)) { rtDW.t_start_delay_private_DSTATE_j = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_l = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_lc = (rtb_FailCond_l && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_bh >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_lc) { Incar_FR = 200; } else { Incar_FR = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR, rtConstP.pooled32, rtConstP.pooled4, 1023U); } /* End of Switch: '/Switch' */ /* Product: '/Divide3' incorporates: * Constant: '/Constant3' * Constant: '/Constant4' * DataStoreRead: '/Data Store Read1' * Product: '/Divide2' */ rtb_Divide3 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR / 4095.0 * 5.0; /* Logic: '/Logical Operator2' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond_b = ((rtb_Divide3 < 0.15) || (rtb_Divide3 > 4.9)); /* Logic: '/Logical Operator3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator3_oi = (rtb_FailCond_b && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_bx >= 3000U)); /* Switch: '/Switch1' incorporates: * Constant: '/Constant5' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write2' * Lookup_n-D: '/1-D Lookup Table1' */ if (rtb_LogicalOperator3_oi) { Incar_RR = 200; } else { Incar_RR = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR, rtConstP.pooled32, rtConstP.pooled4, 1023U); } /* End of Switch: '/Switch1' */ /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator1_lc) { /* : if(IncarRLErr) */ /* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %f V\n',Sensor_Incar_Temp_FR); */ printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %f V\n", rtb_Divide1); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* MATLAB Function: '/Write ERROR1' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : if(LOGGER) */ if ((rtDW.LOGGER_ACP != 0.0) && rtb_LogicalOperator3_oi) { /* : if(IncarRLErr) */ /* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %f V\n',Sensor_Incar_Temp_RR); */ printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %f V\n", rtb_Divide3); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR1' */ /* MATLAB Function: '/Write IncarFR' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('IncarFR = %d * 0.1 C\n',IncarFR); */ printf("IncarFR = %d * 0.1 C\n", Incar_FR); fflush(stdout); } /* End of MATLAB Function: '/Write IncarFR' */ /* MATLAB Function: '/Write IncarRR' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write2' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('IncarRR = %d * 0.1 C\n',IncarRR); */ printf("IncarRR = %d * 0.1 C\n", Incar_RR); fflush(stdout); } /* End of MATLAB Function: '/Write IncarRR' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_l && (!rtDW.Cond_prev_private_DSTATE_j)) { rtDW.t_start_delay_private_DSTATE_bh = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond_b && (!rtDW.Cond_prev_private_DSTATE_f)) { rtDW.t_start_delay_private_DSTATE_bx = rtDW.t_now; } /* End of Switch: '/Switch' */ /* BusCreator: '/Bus Creator' incorporates: * DataStoreRead: '/Data Store Read10' * DataStoreRead: '/Data Store Read11' * DataStoreRead: '/Data Store Read4' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * DataStoreRead: '/Data Store Read7' * DataStoreRead: '/Data Store Read8' * DataStoreRead: '/Data Store Read9' * DataStoreWrite: '/Data Store Write2' */ Status_Sensor_Model.Battery = 0; Status_Sensor_Model.AMB = AMB; Status_Sensor_Model.Incar_FL = Incar_FL; Status_Sensor_Model.Incar_FR = Incar_FR; Status_Sensor_Model.Incar_RL = Incar_RL; Status_Sensor_Model.Incar_RR = Incar_RR; Status_Sensor_Model.Eva_F = Eva_F; Status_Sensor_Model.Eva_R = Eva_R; Status_Sensor_Model.Pressure = Pressure; Status_Sensor_Model.Duct_FL_Upper = 0; Status_Sensor_Model.Duct_FL_Lower = 0; Status_Sensor_Model.Duct_FR_Upper = 0; Status_Sensor_Model.Duct_FR_Lower = 0; Status_Sensor_Model.Duct_RL = 0; Status_Sensor_Model.Duct_RR = 0; Status_Sensor_Model.Duct_Side_FL = 0; Status_Sensor_Model.Duct_Side_FR = 0; Status_Sensor_Model.Duct_Side_RL = 0; Status_Sensor_Model.Duct_Side_RR = 0; Status_Sensor_Model.AQS = 0; /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.LOGGER_ACP = 0.0; /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV1 / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5120_2EKA_ShutoffValvePowerTXV1 V = %f Iout = %f\n',U,I); */ printf("BTS5120_2EKA_ShutoffValvePowerTXV1 V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV2 / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5120_2EKA_ShutoffValvePowerTXV2 V = %f Iout = %f\n',U,I); */ printf("BTS5120_2EKA_ShutoffValvePowerTXV2 V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower1 / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_ChannelPTCPower1 V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_ChannelPTCPower1 V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower2 / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_ChannelPTCPower2 V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_ChannelPTCPower2 V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_FrontIncarMotor / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_FrontIncarMotor V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_FrontIncarMotor V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_RearIncarMotor / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_RearIncarMotor V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_RearIncarMotor V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_ReservePowerSupply / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_ReservePowerSupply V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_ReservePowerSupply V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveFront / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_ShutOFFValveFront V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_ShutOFFValveFront V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveRear / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_ShutOFFValveRear V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_ShutOFFValveRear V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.BTS5180_2EKA_TwoWayValve / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('BTS5180_2EKA_TwoWayValve V = %f Iout = %f\n',U,I); */ printf("BTS5180_2EKA_TwoWayValve V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 1200.0 * 550.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('IGN_ANS = %f V\n',data); */ printf("IGN_ANS = %f V\n", (double)rtDW.ADC_Data_Model.IGN_ANS / 4095.0 * 27.75); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('PBATT_CHECK V = %f\n',U); */ printf("PBATT_CHECK V = %f\n", (double)rtDW.ADC_Data_Model.PBATT_CHECK / 4095.0 * 33.4375); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Pressure_DIAG V = %f\n',U); */ printf("Pressure_DIAG V = %f\n", (double)rtDW.ADC_Data_Model.Pressure_DIAG / 4095.0 * 6.0638); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Reserve_Sensor_Duct_Temp_1 V = %f\n',U); */ printf("Reserve_Sensor_Duct_Temp_1 V = %f\n", (double) rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_1 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Reserve_Sensor_Duct_Temp_2 V = %f\n',U); */ printf("Reserve_Sensor_Duct_Temp_2 V = %f\n", (double) rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_2 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct1 V = %f\n',U); */ printf("Sensor_Front_Duct1 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct1 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct2 V = %f\n',U); */ printf("Sensor_Front_Duct2 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct2 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct3 V = %f\n',U); */ printf("Sensor_Front_Duct3 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct3 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct4 V = %f\n',U); */ printf("Sensor_Front_Duct4 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct4 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct5 V = %f\n',U); */ printf("Sensor_Front_Duct5 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct5 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Front_Duct V = %f\n',U); */ printf("Sensor_Front_Duct V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Front_Duct6 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct1 V = %f\n',U); */ printf("Sensor_Rear_Duct1 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct1 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct2 V = %f\n',U); */ printf("Sensor_Rear_Duct2 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct2 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct3 V = %f\n',U); */ printf("Sensor_Rear_Duct3 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct3 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct4 V = %f\n',U); */ printf("Sensor_Rear_Duct4 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct4 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct5 V = %f\n',U); */ printf("Sensor_Rear_Duct5 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct5 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Sensor_Rear_Duct6 V = %f\n',U); */ printf("Sensor_Rear_Duct6 V = %f\n", (double) rtDW.ADC_Data_Model.Sensor_Rear_Duct6 / 4095.0 * 5.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB V = %f\n',U); */ printf("VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB V = %f\n", (double) rtDW.ADC_Data_Model.VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB / 4095.0 * 17.5); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' * Product: '/Divide1' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('VN7008AJ_DIAG_RearLINActuatorPowerDriverC V = %f\n',U); */ printf("VN7008AJ_DIAG_RearLINActuatorPowerDriverC V = %f\n", (double) rtDW.ADC_Data_Model.VN7008AJ_DIAG_RearLINActuatorPowerDriverC / 4095.0 * 17.5); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double) rtDW.ADC_Data_Model.VN7008AJ_FrontLINActuatorPowerDriverAB / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('VN7008AJ_FrontLINActuatorPowerDriverAB V = %f Iout = %f\n',U,I); */ printf("VN7008AJ_FrontLINActuatorPowerDriverAB V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 2490.0 * 5890.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.VN7008AJ_RearLINActuatorPowerDriverC / 4095.0 * 5.0; /* MATLAB Function: '/Write' incorporates: * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read' * Product: '/Divide2' * Product: '/Divide3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('VN7008AJ_RearLINActuatorPowerDriverC V = %f Iout = %f\n',U,I); */ printf("VN7008AJ_RearLINActuatorPowerDriverC V = %f Iout = %f\n", rtb_Divide1, rtb_Divide1 / 2490.0 * 5890.0); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('ST_ReservePower = %u \n',data); */ printf("ST_ReservePower = %u \n", rtDW.ADC_Key_Data_Model.ST_ReservePower); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* MATLAB Function: '/Write1' incorporates: * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('ST_BATTChiller = %u \n',data); */ printf("ST_BATTChiller = %u \n", rtDW.ADC_Key_Data_Model.ST_BATTChiller); fflush(stdout); } /* End of MATLAB Function: '/Write1' */ /* MATLAB Function: '/Write2' incorporates: * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('EmergencyAirCleanSwitch = %u \n',data); */ printf("EmergencyAirCleanSwitch = %u \n", rtDW.ADC_Key_Data_Model.EmergencyAirCleanSwitch); fflush(stdout); } /* End of MATLAB Function: '/Write2' */ /* MATLAB Function: '/Write3' incorporates: * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('FireExtinguishSwitch = %u \n',data); */ printf("FireExtinguishSwitch = %u \n", rtDW.ADC_Key_Data_Model.FireExtinguishSwitch); fflush(stdout); } /* End of MATLAB Function: '/Write3' */ /* MATLAB Function: '/Write4' incorporates: * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER) */ if (rtDW.LOGGER_ACP != 0.0) { /* : fprintf('Ign_Wakeup = %u \n',data); */ printf("Ign_Wakeup = %u \n", rtDW.ADC_Key_Data_Model.Ign_Wakeup); fflush(stdout); } /* End of MATLAB Function: '/Write4' */ /* BusCreator: '/Bus Creator' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion' * Logic: '/Logical Operator4' * Logic: '/Logical Operator4' */ CCU_Errors_Model.CCU_IncarTempErrF_Stat = (uint8_t)(rtb_LogicalOperator1_ca || rtb_LogicalOperator3_f3); CCU_Errors_Model.CCU_IncarTempErrR_Stat = (uint8_t)(rtb_LogicalOperator1_lc || rtb_LogicalOperator3_oi); CCU_Errors_Model.CCU_DuctTempSenErrF_Stat = 0U; CCU_Errors_Model.CCU_DuctTempSenErrR_Stat = 0U; CCU_Errors_Model.CCU_EvaTempSenErrF_Stat = rtb_LogicalOperator1_f; CCU_Errors_Model.CCU_EvaTempSenErrR_Stat = rtb_LogicalOperator1_k; CCU_Errors_Model.CCU_DeflectorSwErrF_Stat = 0U; CCU_Errors_Model.CCU_DeflectorSwErrR_Stat = 0U; CCU_Errors_Model.CCU_PressSenErr_Stat = rtb_LogicalOperator1_lk; CCU_Errors_Model.CCU_AmbienTemptSenErr_Stat = rtb_LogicalOperator1; CCU_Errors_Model.CCU_SealingValveErr_Stat = 0U; CCU_Errors_Model.CCU_ETXVerr_Stat = 0U; CCU_Errors_Model.CCU_HVACfanOrTXVerrF_Stat = 0U; CCU_Errors_Model.CCU_HVACfanOrTXVerrR_Stat = 0U; CCU_Errors_Model.CCU_ActuatorErrF_Stat = rtDW.CCU_ActuatorErrF_Stat_private; CCU_Errors_Model.CCU_ActuatorErrR_Stat = 0U; CCU_Errors_Model.CCU_UltravioletErr_Stat = 0U; CCU_Errors_Model.CCU_VinRecordErr_Stat = 0U; CCU_Errors_Model.CCU_AirQualSenErr_Stat = 0U; CCU_Errors_Model.CCU_CommErr_Stat = 0U; CCU_Errors_Model.CCU_TWVerr_Stat = 0U; CCU_Errors_Model.CCU_IonizationErr_Stat = 0U; CCU_Errors_Model.CCU_AromaErr_Stat = 0U; /* BusCreator: '/Bus Creator' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * Constant: '/Constant2' * Constant: '/Constant3' * DataStoreWrite: '/Data Store Write' */ PWM_Get.pwmPercentFront = 30U; PWM_Get.pwmPercentRear = 30U; PWM_Get.pwmPercentFrontReserved = 30U; PWM_Get.pwmPercentRearReserved = 30U; /* Saturate: '/Saturation' incorporates: * DataStoreRead: '/Data Store Read' */ /* : if(LOGGER) */ if (AMB > 1000) { Eva_F = 1000; } else if (AMB < -1000) { Eva_F = -1000; } else { Eva_F = AMB; } /* End of Saturate: '/Saturation' */ /* MATLAB Function: '/Convert_g_assAMB_LV_UP' */ /* : c_g_assAMB_LV_UP = [-1000, g_assAMB_LV_UP(5), g_assAMB_LV_UP(4), g_assAMB_LV_UP(3), g_assAMB_LV_UP(2), g_assAMB_LV_UP(1)]; */ tmp[0] = -1000; tmp[1] = g_assAMB_LV_UP[4]; tmp[2] = g_assAMB_LV_UP[3]; tmp[3] = g_assAMB_LV_UP[2]; tmp[4] = g_assAMB_LV_UP[1]; tmp[5] = g_assAMB_LV_UP[0]; /* SwitchCase: '/Switch Case' incorporates: * Lookup_n-D: '/1-D Lookup Table' * Saturate: '/Saturation' */ switch ((int8_t)rtConstP.uDLookupTable_tableData_h[plook_u32s16_bincka(Eva_F, tmp, 5U)]) { case 0: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_UP_1' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ /* : c_g_assAMB_LV_UP_1 = g_assAMB_LV_UP(1); */ rtB.Merge_b = (uint8_t)(Eva_F <= g_assAMB_LV_UP[0]); /* End of Outputs for SubSystem: '/Switch Case Action Subsystem' */ break; case 1: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem1' incorporates: * ActionPort: '/Action Port' */ /* Switch: '/Switch' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_UP_2' * RelationalOperator: '/Relational Operator' */ /* : c_g_assAMB_LV_DN_1 = g_assAMB_LV_DN(1); */ /* : c_g_assAMB_LV_UP_2 = g_assAMB_LV_UP(2); */ if (Eva_F > g_assAMB_LV_UP[1]) { /* Merge: '/Merge' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_DN_1' * RelationalOperator: '/Relational Operator1' */ rtB.Merge_b = (uint8_t)(Eva_F <= g_assAMB_LV_DN[0]); } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv2' */ rtB.Merge_b = 2U; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* Switch: '/Switch2' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_UP_3' * RelationalOperator: '/Relational Operator' */ /* : c_g_assAMB_LV_DN_2 = g_assAMB_LV_DN(2); */ /* : c_g_assAMB_LV_UP_3 = g_assAMB_LV_UP(3); */ if (Eva_F > g_assAMB_LV_UP[2]) { /* Switch: '/Switch3' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_DN_2' * RelationalOperator: '/Relational Operator1' */ if (Eva_F > g_assAMB_LV_DN[1]) { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv1' */ rtB.Merge_b = 1U; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv2' */ rtB.Merge_b = 2U; } /* End of Switch: '/Switch3' */ } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv3' */ rtB.Merge_b = 3U; } /* End of Switch: '/Switch2' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Switch: '/Switch2' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_UP_4' * RelationalOperator: '/Relational Operator' */ /* : c_g_assAMB_LV_DN_3 = g_assAMB_LV_DN(3); */ /* : c_g_assAMB_LV_UP_4 = g_assAMB_LV_UP(4); */ if (Eva_F > g_assAMB_LV_UP[3]) { /* Switch: '/Switch3' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_DN_3' * RelationalOperator: '/Relational Operator1' */ if (Eva_F > g_assAMB_LV_DN[2]) { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv2' */ rtB.Merge_b = 2U; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv3' */ rtB.Merge_b = 3U; } /* End of Switch: '/Switch3' */ } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv4' */ rtB.Merge_b = 4U; } /* End of Switch: '/Switch2' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem4' incorporates: * ActionPort: '/Action Port' */ /* Switch: '/Switch2' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_UP_5' * RelationalOperator: '/Relational Operator' */ /* : c_g_assAMB_LV_DN_4 = g_assAMB_LV_DN(4); */ /* : c_g_assAMB_LV_UP_5 = g_assAMB_LV_UP(5); */ if (Eva_F > g_assAMB_LV_UP[4]) { /* Switch: '/Switch3' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_DN_4' * RelationalOperator: '/Relational Operator1' */ if (Eva_F > g_assAMB_LV_DN[3]) { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv3' */ rtB.Merge_b = 3U; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv4' */ rtB.Merge_b = 4U; } /* End of Switch: '/Switch3' */ } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv5' */ rtB.Merge_b = 5U; } /* End of Switch: '/Switch2' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem5' incorporates: * ActionPort: '/Action Port' */ /* Switch: '/Switch1' incorporates: * MATLAB Function: '/Convert_g_assAMB_LV_DN_5' * RelationalOperator: '/Relational Operator' */ /* : c_g_assAMB_LV_DN_5 = g_assAMB_LV_DN(5); */ if (Eva_F > g_assAMB_LV_DN[4]) { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv4' */ rtB.Merge_b = 4U; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant_Lv5' */ rtB.Merge_b = 5U; } /* End of Switch: '/Switch1' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* Saturate: '/Saturation' incorporates: * DataStoreRead: '/Data Store Read1' */ if (rtDW.SET_FL > 290.0) { rtb_Divide1 = 290.0; } else if (rtDW.SET_FL < 170.0) { rtb_Divide1 = 170.0; } else { rtb_Divide1 = rtDW.SET_FL; } /* Gain: '/Gain' incorporates: * Saturate: '/Saturation' */ i = 13107 * (int16_t)floor(rtb_Divide1); rtb_Gain_l = (uint8_t)((((uint32_t)i & 65536U) != 0U) + (i >> 17)); /* MATLAB Function: '/Modes for levels' */ /* : get_modes_for_levels = [g_aucMODE_BY_SET_F_LV0; */ /* : g_aucMODE_BY_SET_F_LV1; */ /* : g_aucMODE_BY_SET_F_LV2; */ /* : g_aucMODE_BY_SET_F_LV3; */ /* : g_aucMODE_BY_SET_F_LV4; */ /* : g_aucMODE_BY_SET_F_LV5; */ /* : ]; */ for (i = 0; i < 13; i++) { rtb_get_modes_for_levels[6 * i] = g_aucMODE_BY_SET_F_LV0[i]; rtb_get_modes_for_levels[6 * i + 1] = g_aucMODE_BY_SET_F_LV1[i]; rtb_get_modes_for_levels[6 * i + 2] = g_aucMODE_BY_SET_F_LV2[i]; rtb_get_modes_for_levels[6 * i + 3] = g_aucMODE_BY_SET_F_LV3[i]; rtb_get_modes_for_levels[6 * i + 4] = g_aucMODE_BY_SET_F_LV4[i]; rtb_get_modes_for_levels[6 * i + 5] = g_aucMODE_BY_SET_F_LV5[i]; } /* End of MATLAB Function: '/Modes for levels' */ /* Lookup_n-D: '/Выбор режима Left' incorporates: * Gain: '/Gain' * Merge: '/Merge' */ rtb_u_pe = look2_iu8bu8s16lu64n32_binlcse(rtB.Merge_b, rtb_Gain_l, rtConstP.pooled61, rtConstP.pooled29, rtb_get_modes_for_levels, rtConstP.pooled23, 6U); /* MATLAB Function: '/Начальные положения заслонок left' */ left(rtb_u_pe, rtb_vals_m); /* Saturate: '/Saturation1' incorporates: * DataStoreRead: '/Data Store Read2' */ if (rtDW.SET_FR >= 170) { i = rtDW.SET_FR; } else { i = 170; } /* Gain: '/Gain2' incorporates: * Saturate: '/Saturation1' */ i *= 13107; rtb_Gain2 = (uint8_t)((((uint32_t)i & 65536U) != 0U) + (i >> 17)); /* SwitchCase: '/Switch for Left ' incorporates: * DataStoreRead: '/Data Store Read' */ switch (rtb_u_pe) { case 10: break; case 20: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Bilevel' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Bilevel' */ } /* Outputs for IfAction SubSystem: '/Bilevel' incorporates: * ActionPort: '/Action Port' */ Bilevel(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Bilevel' */ break; case 30: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Bilevel2' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Bilevel2' */ } /* Outputs for IfAction SubSystem: '/Bilevel2' incorporates: * ActionPort: '/Action Port' */ Bilevel2(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Bilevel2' */ break; case 40: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Afoot' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Afoot' */ } /* Outputs for IfAction SubSystem: '/Afoot' incorporates: * ActionPort: '/Action Port' */ Afoot(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Afoot' */ break; case 50: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Afoot_Summer' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Afoot_Summer' */ } /* Outputs for IfAction SubSystem: '/Afoot_Summer' incorporates: * ActionPort: '/Action Port' */ Afoot_Summer(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Afoot_Summer' */ break; } /* End of SwitchCase: '/Switch for Left ' */ /* Lookup_n-D: '/Выбор режима Right' incorporates: * Gain: '/Gain2' * Merge: '/Merge' */ rtb_u_pe = look2_iu8bu8s16lu64n32_binlcse(rtB.Merge_b, rtb_Gain2, rtConstP.pooled61, rtConstP.pooled29, rtb_get_modes_for_levels, rtConstP.pooled23, 6U); /* MATLAB Function: '/Начальные положения заслонок right' */ left(rtb_u_pe, rtb_vals_m); /* SwitchCase: '/Switch for Left ' incorporates: * DataStoreRead: '/Data Store Read' */ switch (rtb_u_pe) { case 10: break; case 20: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Bilevel' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Bilevel' */ } /* Outputs for IfAction SubSystem: '/Bilevel' incorporates: * ActionPort: '/Action Port' */ Bilevel(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Bilevel' */ break; case 30: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Bilevel2' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Bilevel2' */ } /* Outputs for IfAction SubSystem: '/Bilevel2' incorporates: * ActionPort: '/Action Port' */ Bilevel2(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Bilevel2' */ break; case 40: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Afoot' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Afoot' */ } /* Outputs for IfAction SubSystem: '/Afoot' incorporates: * ActionPort: '/Action Port' */ Afoot(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Afoot' */ break; case 50: for (i = 0; i < 9; i++) { /* Outputs for IfAction SubSystem: '/Afoot_Summer' incorporates: * ActionPort: '/Action Port' */ Merge[i] = rtb_vals_m[i]; /* End of Outputs for SubSystem: '/Afoot_Summer' */ } /* Outputs for IfAction SubSystem: '/Afoot_Summer' incorporates: * ActionPort: '/Action Port' */ Afoot_Summer(AMB, rtB.Merge_b, Merge, rtb_Gain_l, rtb_Gain2); /* End of Outputs for SubSystem: '/Afoot_Summer' */ break; } /* End of SwitchCase: '/Switch for Left ' */ /* MATLAB Function: '/Log Ambient Lv' */ /* : if (isempty(current_Ambient_Lv)) */ if (!rtDW.current_Ambient_Lv_not_empty) { /* : current_Ambient_Lv = Ambient_Lv; */ rtDW.current_Ambient_Lv = rtB.Merge_b; rtDW.current_Ambient_Lv_not_empty = true; /* : fprintf("13.1.3.1 Ambient level: in_Amb_Fb = %d; Set Ambient lvl (init) = %u \n", in_Amb_Fb, Ambient_Lv); */ printf("13.1.3.1 Ambient level: in_Amb_Fb = %d; Set Ambient lvl (init) = %u \n", Eva_F, rtB.Merge_b); fflush(stdout); /* : else */ /* : if (current_Ambient_Lv ~= Ambient_Lv) */ } else if (rtDW.current_Ambient_Lv != rtB.Merge_b) { /* : current_Ambient_Lv = Ambient_Lv; */ rtDW.current_Ambient_Lv = rtB.Merge_b; /* : fprintf("13.1.3.1 Ambient level: in_Amb_Fb = %d; Set Ambient lvl = %u \n", in_Amb_Fb, Ambient_Lv); */ printf("13.1.3.1 Ambient level: in_Amb_Fb = %d; Set Ambient lvl = %u \n", Eva_F, rtB.Merge_b); fflush(stdout); } /* End of MATLAB Function: '/Log Ambient Lv' */ /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' */ rtDW.SET_FR = rtDW.FIU_CCU1_MODEL.FIU_TargetTempFR_Val_ro; /* Gain: '/Gain1' incorporates: * Bias: '/Bias' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * Gain: '/Gain' */ rtDW.SET_FL = (0.5 * (double)rtDW.FIU_CCU1_MODEL.FIU_TargetTempFL_Val_ro + 15.5) * 10.0; /* Switch: '/Switch' incorporates: * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read2' */ if (rtDW.stepSig_private > 0) { rtb_Switch_hx = rtDW.stepSig_private; } else { rtb_Switch_hx = 1; } /* End of Switch: '/Switch' */ /* SwitchCase: '/Switch Case' */ switch (rtb_Switch_hx) { case 1: /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 2U; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read' */ rtDW.COM_private[i] = rtDW.ErrorCalibration_private[i]; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Stop Mode' */ break; case 2: /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private[i] = 6000U; /* Product: '/Divide' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private[i] = (uint8_t)(rtDW.ErrorCalibration_private[i] << 1); } /* MATLAB Function: '/Initial CPOS Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Initial CPOS Min - 6000\n'); */ printf("LIN1 SIMULINK Initial CPOS Min - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Merge: '/Merge' * SignalConversion generated from: '/stepIn1' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Initial CPOS Min' */ break; case 3: /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 0U; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read' */ rtDW.COM_private[i] = rtDW.ErrorCalibration_private[i]; } /* MATLAB Function: '/Normal Mode' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Normal Mode\n'); */ printf("LIN1 SIMULINK Normal Mode\n"); fflush(stdout); } /* End of MATLAB Function: '/Normal Mode' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Normal Mode' */ break; case 4: /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private[i] = 1U; /* Product: '/Divide' incorporates: * Constant: '/Constant9' * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private[i] = (uint8_t)(rtDW.ErrorCalibration_private[i] * 3U); } /* MATLAB Function: '/Move to position Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Move to position Min - 1\n'); */ printf("LIN1 SIMULINK Move to position Min - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Min' */ break; case 5: /* Outputs for IfAction SubSystem: '/Check Stall Min' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch0_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i] == 1); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtDW.MinPositionCh0_private[i] = rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i]; } /* End of DataStoreWrite: '/Data Store Write1' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Min_position_Ch0 '); */ printf("LIN1 SIMULINK Min_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Min' */ break; case 6: /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* Product: '/Divide' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private[i] = (uint8_t)(rtDW.ErrorCalibration_private[i] << 1); /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private[i] = 1U; } /* MATLAB Function: '/Initial CPOS Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Initial CPOS Max - 1\n'); */ printf("LIN1 SIMULINK Initial CPOS Max - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Initial CPOS Max' */ break; case 7: /* Outputs for IfAction SubSystem: '/Move to position Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private[i] = 6000U; /* Product: '/Divide' incorporates: * Constant: '/Constant9' * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private[i] = (uint8_t)(rtDW.ErrorCalibration_private[i] * 3U); } /* MATLAB Function: '/Move to position Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Move to position Max - 6000\n'); */ printf("LIN1 SIMULINK Move to position Max - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Max' */ break; case 8: /* Outputs for IfAction SubSystem: '/Check Stall Max' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch0_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i] == 6000); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) && (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtDW.MinPositionCh0_private[i] = rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i]; } /* End of DataStoreWrite: '/Data Store Write1' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK Max_position_Ch0 '); */ printf("LIN1 SIMULINK Max_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_l = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Max' */ break; case 9: /* Outputs for IfAction SubSystem: '/Homing' incorporates: * ActionPort: '/Action Port' */ /* Product: '/Divide1' incorporates: * Constant: '/ACT2' * Constant: '/ACT1' * DataStoreRead: '/MIN ACT1T ' * DataStoreWrite: '/Data Store Write1' * Sum: '/ACT1T' */ for (i = 0; i < 9; i++) { rtb_Divide1_ja[i] = (double)(int16_t)(rtConstP.ACT2_Value[i] - rtDW.MinPositionCh0_private[i]) / (double)rtConstP.ACT1_Value[i]; } /* End of Product: '/Divide1' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read4' */ switch (rtDW.stepHoming_private) { case 0: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* RelationalOperator: '/Compare' */ rtb_Divide1 = rtb_Divide1_ja[i]; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1 = ((rtb_Divide1 >= 0.9) && (rtb_Divide1 <= 1.1)); rtb_RelationalOperator_htm[i] = rtb_LogicalOperator1; /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' */ rtDW.ErrorCalibration_private[i] = (uint8_t)((!rtb_LogicalOperator1) && (rtDW.ErrorCalibration_private[i] != 0)); } /* Logic: '/Logical Operator1' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && rtb_RelationalOperator_htm[i + 1]); } /* Switch: '/Switch' incorporates: * Logic: '/Logical Operator1' */ if (rtb_LogicalOperator1) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h = 4; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_h = 1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem' */ break; case 1: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem1' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtb_Divide1_ja[i] > 1.5); } /* End of RelationalOperator: '/Compare' */ /* Logic: '/Logical Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreWrite: '/Data Store Write1' * Logic: '/Logical Operator' */ rtDW.CCU_ActuatorErrF_Stat_private = rtb_LogicalOperator1; for (i = 0; i < 9; i++) { /* DataTypeConversion: '/Data Type Conversion1' incorporates: * DataStoreWrite: '/Data Store Write2' */ rtDW.COM_private[i] = rtb_RelationalOperator_htm[i]; /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 2U; } /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read6' */ /* : if(LOGGER==1) */ if (rtDW.LOGGER_LIN == 1.0) { /* : for i = 1:numel(ErrCallibration) */ for (i = 0; i < 9; i++) { /* : if ErrCallibration(i) == 1 */ if (rtb_RelationalOperator_htm[i]) { /* : fprintf('LIN1 Failure with actuator #%d\n', int16(i)); */ printf("LIN1 Failure with actuator #%d\n", (int16_t)(i + 1)); fflush(stdout); } } } /* End of MATLAB Function: '/Write ERROR' */ /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' */ for (i = 0; i < 9; i++) { rtDW.ErrorCalibration_private[i] = (uint8_t) ((!rtb_RelationalOperator_htm[i]) && (rtDW.ErrorCalibration_private[i] != 0)); } /* End of DataTypeConversion: '/Data Type Conversion' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Constant: '/Constant2' * Sum: '/step inc' */ rtB.Merge_h = 2; /* End of Outputs for SubSystem: '/Switch Case Action Subsystem1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* Logic: '/Logical Operator3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1 = ((rtb_Divide1_ja[i] <= 0.97) && (rtDW.ErrorCalibration_private[i] != 0)); rtb_RelationalOperator_htm[i] = rtb_LogicalOperator1; /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreWrite: '/Data Store Write1' */ rtDW.ErrorCalibration_private[i] = rtb_LogicalOperator1; } /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && rtb_RelationalOperator_htm[i + 1]); } /* Switch: '/Switch' incorporates: * Logic: '/Logical Operator2' */ if (rtb_LogicalOperator1) { /* Merge: '/Merge' incorporates: * Constant: '/Constant3' */ rtB.Merge_h = 4; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h = 3; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* If: '/If' incorporates: * DataStoreRead: '/Data Store Read1' */ if (rtDW.ErrorHomming_private < 10.0) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ /* Logic: '/AND' incorporates: * DataStoreRead: '/Data Store Read' */ rtb_LogicalOperator1 = (rtDW.ErrorCalibration_private[0] != 0); for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && (rtDW.ErrorCalibration_private[i + 1] != 0)); } rtb_LogicalOperator1 = !rtb_LogicalOperator1; /* End of Logic: '/AND' */ /* If: '/If' incorporates: * DataStoreRead: '/Data Store Read' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ if (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_h > 3000U) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.stepSig_private = 1; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * Sum: '/step inc' */ rtDW.ErrorHomming_private++; /* SignalConversion generated from: '/Out1' */ rtB.OutportBufferForOut1 = 2; /* End of Outputs for SubSystem: '/If Action Subsystem' */ } /* End of If: '/If' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/Out2' */ rtB.Merge_h = rtB.OutportBufferForOut1; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_dq)) { rtDW.t_start_delay_private_DSTATE_h = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_dq = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: * ActionPort: '/Action Port' */ /* Logic: '/Logical Operator' incorporates: * DataStoreRead: '/Data Store Read' */ rtb_LogicalOperator1 = (rtDW.ErrorCalibration_private[0] != 0); for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || (rtDW.ErrorCalibration_private[i + 1] != 0)); } /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreWrite: '/Data Store Write1' * Logic: '/Logical Operator' */ rtDW.CCU_ActuatorErrF_Stat_private = rtb_LogicalOperator1; for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write2' incorporates: * DataStoreRead: '/Data Store Read' */ rtDW.COM_private[i] = rtDW.ErrorCalibration_private[i]; /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 2U; } /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read6' */ /* : if(LOGGER==1) */ if (rtDW.LOGGER_LIN == 1.0) { /* : for i = 1:numel(ErrCallibration) */ for (i = 0; i < 9; i++) { /* : if ErrCallibration(i) == 1 */ if (rtDW.ErrorCalibration_private[i] == 1) { /* : fprintf('LIN1 Failure with actuator #%d\n', int16(i)); */ printf("LIN1 Failure with actuator #%d\n", (int16_t)(i + 1)); fflush(stdout); } } } /* End of MATLAB Function: '/Write ERROR' */ /* DataStoreWrite: '/Data Store Write' */ for (i = 0; i < 9; i++) { rtDW.ErrorCalibration_private[i] = 0U; } /* End of DataStoreWrite: '/Data Store Write' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/Output' */ rtB.Merge_h = 4; /* End of Outputs for SubSystem: '/If Action Subsystem1' */ } /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem4' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/step' */ rtB.Merge_h = 0; /* End of Outputs for SubSystem: '/Switch Case Action Subsystem4' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write2' */ rtDW.stepHoming_private = rtB.Merge_h; /* Merge: '/Merge' incorporates: * DataStoreRead: '/Data Store Read7' */ rtB.Merge_l = rtDW.stepSig_private; /* MATLAB Function: '/MAX POSITION' incorporates: * Constant: '/ACT2' * DataStoreRead: '/Data Store Read5' * DataStoreWrite: '/Data Store Write1' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK MAX POSITION '); */ printf("LIN1 SIMULINK MAX POSITION "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtConstP.ACT2_Value[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MAX POSITION' */ /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' * DataStoreRead: '/Data Store Read6' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 SIMULINK MIN POSITION '); */ printf("LIN1 SIMULINK MIN POSITION "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.MinPositionCh0_private[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/Homing' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Finish write stepSig' */ rtDW.stepSig_private = rtB.Merge_l; for (i = 0; i < 9; i++) { /* BusCreator: '/Bus Creator' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' * DataStoreRead: '/Data Store Read4' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * DataStoreRead: '/Data Store Read7' * DataStoreRead: '/Data Store Read8' * DataStoreWrite: '/Data Store Write' */ Actuator_Ch0_Command_Model.POS[i] = rtDW.POS_private[i]; Actuator_Ch0_Command_Model.BUS_ADR[i] = rtDW.BUS_ADR_private[i]; Actuator_Ch0_Command_Model.MODE[i] = rtDW.MODE_private[i]; Actuator_Ch0_Command_Model.COM[i] = rtDW.COM_private[i]; Actuator_Ch0_Command_Model.Stall_SET[i] = rtDW.Stall_private[i]; Actuator_Ch0_Command_Model.Lnoise_SET[i] = rtDW.Lnoise_private[i]; Actuator_Ch0_Command_Model.Autos_SET[i] = rtDW.Autos_private[i]; Actuator_Ch0_Command_Model.Speed_SET[i] = rtDW.Speed_private[i]; Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = rtDW.Coils_private[i]; /* DataStoreWrite: '/Data Store Write' */ rtDW.COM_private[i] = 0U; } /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN1 step = %d\n',step); */ printf("LIN1 step = %d\n", rtb_Switch_hx); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' */ rtb_Gain_l = rtDW.Actuator_Ch1_Status_Model.Busy; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read1' */ rtb_Gain2 = rtDW.Actuator_Ch1_Status_Model.Error_Connect; /* Switch: '/Switch' incorporates: * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read2' */ if (rtDW.stepSig_private_c > 0) { rtb_Switch_hx = rtDW.stepSig_private_c; } else { rtb_Switch_hx = 1; } /* End of Switch: '/Switch' */ /* SwitchCase: '/Switch Case' */ switch (rtb_Switch_hx) { case 1: /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ StopMode(rtb_Switch_hx, &rtB.Merge_c, &rtb_Gain_l, rtDW.COM_private_h, &rtb_Gain2, rtDW.MODE_private_a); /* End of Outputs for SubSystem: '/Stop Mode' */ break; case 2: /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_c[i] = 6000U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_h[i] = 2U; } /* MATLAB Function: '/Initial CPOS Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Initial CPOS Min - 6000\n'); */ printf("LIN2 SIMULINK Initial CPOS Min - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Merge: '/Merge' * SignalConversion generated from: '/stepIn1' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Initial CPOS Min' */ break; case 3: /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private_a[i] = 0U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_h[i] = 1U; } /* MATLAB Function: '/Normal Mode' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Normal Mode\n'); */ printf("LIN2 SIMULINK Normal Mode\n"); fflush(stdout); } /* End of MATLAB Function: '/Normal Mode' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Normal Mode' */ break; case 4: /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private_m[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private_j[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private_d[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private_n[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private_o[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_c[i] = 1U; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private_h[i] = 3U; } /* MATLAB Function: '/Move to position Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Move to position Min - 1\n'); */ printf("LIN2 SIMULINK Move to position Min - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Min' */ break; case 5: /* Outputs for IfAction SubSystem: '/Check Stall Min' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch1_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch1_Status_Model.in_CPOS_ALL[i] == 1); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Min_position_Ch0 '); */ printf("LIN2 SIMULINK Min_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch1_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Min' */ break; case 6: /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_h[i] = 2U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_c[i] = 1U; } /* MATLAB Function: '/Initial CPOS Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Initial CPOS Max - 1\n'); */ printf("LIN2 SIMULINK Initial CPOS Max - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Initial CPOS Max' */ break; case 7: /* Outputs for IfAction SubSystem: '/Move to position Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private_m[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private_j[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private_d[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private_n[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private_o[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_c[i] = 6000U; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private_h[i] = 3U; } /* MATLAB Function: '/Move to position Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Move to position Max - 6000\n'); */ printf("LIN2 SIMULINK Move to position Max - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Max' */ break; case 8: /* Outputs for IfAction SubSystem: '/Check Stall Max' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch1_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch1_Status_Model.in_CPOS_ALL[i] == 6000); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch1_Status_Model.Busy == 0) && (rtDW.Actuator_Ch1_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_c = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 SIMULINK Max_position_Ch0 '); */ printf("LIN2 SIMULINK Max_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch1_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_c = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Max' */ break; case 9: break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Finish write stepSig' */ rtDW.stepSig_private_c = rtB.Merge_c; for (i = 0; i < 9; i++) { /* BusCreator: '/Bus Creator' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' * DataStoreRead: '/Data Store Read4' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * DataStoreRead: '/Data Store Read7' * DataStoreRead: '/Data Store Read8' * DataStoreWrite: '/Data Store Write' */ Actuator_Ch1_Command_Model.POS[i] = rtDW.POS_private_c[i]; Actuator_Ch1_Command_Model.BUS_ADR[i] = rtDW.BUS_ADR_private_p[i]; Actuator_Ch1_Command_Model.MODE[i] = rtDW.MODE_private_a[i]; Actuator_Ch1_Command_Model.COM[i] = rtDW.COM_private_h[i]; Actuator_Ch1_Command_Model.Stall_SET[i] = rtDW.Stall_private_j[i]; Actuator_Ch1_Command_Model.Lnoise_SET[i] = rtDW.Lnoise_private_d[i]; Actuator_Ch1_Command_Model.Autos_SET[i] = rtDW.Autos_private_m[i]; Actuator_Ch1_Command_Model.Speed_SET[i] = rtDW.Speed_private_o[i]; Actuator_Ch1_Command_Model.Coils_Stop_SET[i] = rtDW.Coils_private_n[i]; /* DataStoreWrite: '/Data Store Write' */ rtDW.COM_private_h[i] = 0U; } /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN2 step = %d\n',step); */ printf("LIN2 step = %d\n", rtb_Switch_hx); fflush(stdout); } /* End of MATLAB Function: '/Write Ignition' */ /* DataStoreWrite: '/Data Store Write' incorporates: * DataStoreRead: '/Data Store Read1' */ rtb_Gain_l = rtDW.Actuator_Ch2_Status_Model.Busy; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read1' */ rtb_Gain2 = rtDW.Actuator_Ch2_Status_Model.Error_Connect; /* Switch: '/Switch' incorporates: * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read2' */ if (rtDW.stepSig_private_p > 0) { rtb_Switch_hx = rtDW.stepSig_private_p; } else { rtb_Switch_hx = 1; } /* End of Switch: '/Switch' */ /* SwitchCase: '/Switch Case' */ switch (rtb_Switch_hx) { case 1: /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ StopMode(rtb_Switch_hx, &rtB.Merge_cs, &rtb_Gain_l, rtDW.COM_private_j, &rtb_Gain2, rtDW.MODE_private_an); /* End of Outputs for SubSystem: '/Stop Mode' */ break; case 2: /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_a[i] = 6000U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_j[i] = 2U; } /* MATLAB Function: '/Initial CPOS Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Initial CPOS Min - 6000\n'); */ printf("LIN3 SIMULINK Initial CPOS Min - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Merge: '/Merge' * SignalConversion generated from: '/stepIn1' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Initial CPOS Min' */ break; case 3: /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read3' * DataStoreWrite: '/Data Store Write' */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Busy_private = %u\n',step); */ printf("Busy_private = %u\n", rtDW.Actuator_Ch2_Status_Model.Busy); fflush(stdout); } /* End of MATLAB Function: '/Write Ignition' */ /* MATLAB Function: '/Write Ignition1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ /* : if(LOGGER==2) */ if (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 2) { /* : fprintf('Error_Connect_private = %u\n',step); */ printf("Error_Connect_private = %u\n", rtDW.Actuator_Ch2_Status_Model.Error_Connect); fflush(stdout); } /* End of MATLAB Function: '/Write Ignition1' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private_an[i] = 0U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_j[i] = 1U; } /* MATLAB Function: '/Normal Mode' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Normal Mode\n'); */ printf("LIN3 SIMULINK Normal Mode\n"); fflush(stdout); } /* End of MATLAB Function: '/Normal Mode' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Normal Mode' */ break; case 4: /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private_j[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private_n[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private_j[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private_f[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private_e[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_a[i] = 1U; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private_j[i] = 3U; } /* MATLAB Function: '/Move to position Min' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Move to position Min - 1\n'); */ printf("LIN3 SIMULINK Move to position Min - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Min' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Min' */ break; case 5: /* Outputs for IfAction SubSystem: '/Check Stall Min' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch2_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch2_Status_Model.in_CPOS_ALL[i] == 1); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Min_position_Ch0 '); */ printf("LIN3 SIMULINK Min_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch2_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Min' */ break; case 6: /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private_j[i] = 2U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_a[i] = 1U; } /* MATLAB Function: '/Initial CPOS Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Initial CPOS Max - 1\n'); */ printf("LIN3 SIMULINK Initial CPOS Max - 1\n"); fflush(stdout); } /* End of MATLAB Function: '/Initial CPOS Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Initial CPOS Max' */ break; case 7: /* Outputs for IfAction SubSystem: '/Move to position Max' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant1' */ rtDW.Autos_private_j[i] = 1U; /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Constant10' */ rtDW.Stall_private_n[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant11' */ rtDW.Lnoise_private_j[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant14' */ rtDW.Coils_private_f[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Speed_private_e[i] = 3U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private_a[i] = 6000U; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private_j[i] = 3U; } /* MATLAB Function: '/Move to position Max' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Move to position Max - 6000\n'); */ printf("LIN3 SIMULINK Move to position Max - 6000\n"); fflush(stdout); } /* End of MATLAB Function: '/Move to position Max' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Max' */ break; case 8: /* Outputs for IfAction SubSystem: '/Check Stall Max' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * RelationalOperator: '/Relational Operator' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch2_Status_Model.in_Act_Stall_Slave[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1 = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_RelationalOperator_htm[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_htm[i] = (rtDW.Actuator_Ch2_Status_Model.in_CPOS_ALL[i] == 6000); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' incorporates: * RelationalOperator: '/Relational Operator' */ rtb_LogicalOperator1_f = rtb_RelationalOperator_htm[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_f = (rtb_LogicalOperator1_f || rtb_RelationalOperator_htm[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Actuator_Ch2_Status_Model.Busy == 0) && (rtDW.Actuator_Ch2_Status_Model.Error_Connect == 0) && (rtb_LogicalOperator1 || rtb_LogicalOperator1_f)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_cs = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 SIMULINK Max_position_Ch0 '); */ printf("LIN3 SIMULINK Max_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Actuator_Ch2_Status_Model.in_CPOS_ALL[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge_cs = rtb_Switch_hx; /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* End of Outputs for SubSystem: '/Check Stall Max' */ break; case 9: break; } /* End of SwitchCase: '/Switch Case' */ /* Outport: '/Out1' incorporates: * DataStoreRead: '/Data Store Read10' */ rtY.Out1 = CCU_Errors_Model; /* DataStoreWrite: '/Finish write stepSig' */ rtDW.stepSig_private_p = rtB.Merge_cs; for (i = 0; i < 9; i++) { /* BusCreator: '/Bus Creator' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read3' * DataStoreRead: '/Data Store Read4' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * DataStoreRead: '/Data Store Read7' * DataStoreRead: '/Data Store Read8' * DataStoreWrite: '/Data Store Write' */ Actuator_Ch2_Command_Model.POS[i] = rtDW.POS_private_a[i]; Actuator_Ch2_Command_Model.BUS_ADR[i] = rtDW.BUS_ADR_private_f[i]; Actuator_Ch2_Command_Model.MODE[i] = rtDW.MODE_private_an[i]; Actuator_Ch2_Command_Model.COM[i] = rtDW.COM_private_j[i]; Actuator_Ch2_Command_Model.Stall_SET[i] = rtDW.Stall_private_n[i]; Actuator_Ch2_Command_Model.Lnoise_SET[i] = rtDW.Lnoise_private_j[i]; Actuator_Ch2_Command_Model.Autos_SET[i] = rtDW.Autos_private_j[i]; Actuator_Ch2_Command_Model.Speed_SET[i] = rtDW.Speed_private_e[i]; Actuator_Ch2_Command_Model.Coils_Stop_SET[i] = rtDW.Coils_private_f[i]; /* DataStoreWrite: '/Data Store Write' */ rtDW.COM_private_j[i] = 0U; } /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER==2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('LIN3 step = %d\n',step); */ printf("LIN3 step = %d\n", rtb_Switch_hx); fflush(stdout); } /* End of MATLAB Function: '/Write Ignition' */ /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.LOGGER_LIN = 2.0; /* If: '/если SC front не завершен' incorporates: * DataStoreRead: '/Data Store Read1' */ if (rtDW.start_control_finished_front == 0) { /* Outputs for IfAction SubSystem: '/Start Control Front' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read' */ switch (rtDW.step_start_controle_front) { case -1: /* Outputs for IfAction SubSystem: '/Step -1 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreWrite: '/Data Store Write' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_assSTART_ENTER_INCAR' */ g_assSTART_ENTER_INCAR_a(rtB.Merge_b, &AMB); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' */ /* : out = g_ausSTART_ENTER_SETTEMP(LVL+1); */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * Logic: '/AND' * MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_FL > AMB) && (rtDW.MODE_DRIVER == 1.0) && (rtDW.SET_FL < g_ausSTART_ENTER_SETTEMP[i - 1])) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' * SignalConversion generated from: '/step' */ rtB.Merge_i = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' */ rtB.Merge_i = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_assSTART_ENTER_INCAR' */ g_assSTART_ENTER_INCAR_a(rtB.Merge_b, &AMB); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' */ /* : out = int16(g_ausSTART_ENTER_SETTEMP(LVL+1)); */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } Blower_FR = g_ausSTART_ENTER_SETTEMP[i - 1]; if (Blower_FR > 32767) { Blower_FR = 32767U; } /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * Logic: '/AND' * MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_FL > AMB) && (rtDW.MODE_DRIVER == 1.0) && (rtDW.SET_FL < Blower_FR)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_i = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_i = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' */ rtB.Merge_i = 0; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ Level3(&rtB.Merge_i, &rtDW.ECT, &rtB.Merge_b, &rtDW.MODE_DRIVER); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level3(&rtB.Merge_i, &rtDW.ECT, &rtB.Merge_b, &rtDW.MODE_DRIVER); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level3(&rtB.Merge_i, &rtDW.ECT, &rtB.Merge_b, &rtDW.MODE_DRIVER); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step -1 F' */ break; case 0: /* Outputs for IfAction SubSystem: '/Step 0 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreWrite: '/Data Store Write' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_i); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_i); /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_i); /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant3' */ rtDW.Blower_FL = 20U; /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant5' */ rtDW.Dtg_FUL = 60U; /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant7' */ rtDW.Dtg_FLL = 80U; /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Mode - def' */ rtDW.Mode_FL = 80U; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* DataStoreWrite: '/Data Store Write8' incorporates: * Constant: '/Valve open' */ rtb_u_pe = 1U; /* DataStoreWrite: '/Data Store Write9' incorporates: * Constant: '/Valve open' */ Valve_2_way = 1U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' */ /* : out = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 1 - 2)); */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } rtb_dt_du = (uint32_t)i - 2U; if ((uint32_t)i - 2U > (uint32_t)i) { rtb_dt_du = 0U; } /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_i = (int8_t)(rtDW.ECT > g_assSTART_COOLANT_STEP0_TO_1[(int32_t) rtb_dt_du - 1]); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant3' */ rtDW.Blower_FL = 20U; /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant5' */ rtDW.Dtg_FUL = 60U; /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant7' */ rtDW.Dtg_FLL = 80U; /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Mode - def' */ rtDW.Mode_FL = 80U; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* DataStoreWrite: '/Data Store Write8' incorporates: * Constant: '/Valve open' */ rtb_u_pe = 1U; /* DataStoreWrite: '/Data Store Write9' incorporates: * Constant: '/Valve open' */ Valve_2_way = 1U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' */ g_assSTART_COOLANT_STEP0_TO_1_k(rtB.Merge_b, &Incar_FL); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_i = (int8_t)(rtDW.ECT > Incar_FL); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant3' */ rtDW.Blower_FL = 20U; /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant5' */ rtDW.Dtg_FUL = 80U; /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant7' */ rtDW.Dtg_FLL = 80U; /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Mode - def' */ rtDW.Mode_FL = 80U; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* DataStoreWrite: '/Data Store Write8' incorporates: * Constant: '/Valve open' */ rtb_u_pe = 1U; /* DataStoreWrite: '/Data Store Write9' incorporates: * Constant: '/Valve open' */ Valve_2_way = 1U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' */ g_assSTART_COOLANT_STEP0_TO_1_k(rtB.Merge_b, &Incar_FL); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_i = (int8_t)(rtDW.ECT > Incar_FL); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 0 F' */ break; case 1: /* Outputs for IfAction SubSystem: '/Step 1 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreWrite: '/Data Store Write' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus(rtB.Merge_b, &rtb_u_pe); /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * MATLAB Function: '/mode FR step 1' */ modeFRstep1(rtB.Merge_b, &rtDW.Mode_FL); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/window heating' */ windowheating(rtB.Merge_b, &rtDW.Dtg_FUL); /* DataStoreWrite: '/Data Store Write6' incorporates: * MATLAB Function: '/blower FR' */ blowerFR(rtB.Merge_b, &rtDW.Blower_FL); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/Dtg_FrontUpper_X' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtDW.Dtg_FUL); /* DataStoreWrite: '/Data Store Write13' incorporates: * MATLAB Function: '/Dtg_FrontLower_X' */ Dtg_FrontLower_X(rtB.Merge_b, &rtDW.Dtg_FLL); /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' */ Incartempgotofromstep1tostep2(rtB.Merge_b, &AMB); /* MATLAB Function: '/Time goto from step 1 to step 2 ' */ /* : out = int16(g_ausSTART_TIME_STEP1_TO_2(LVL + 1)); */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } Blower_FR = g_ausSTART_TIME_STEP1_TO_2[i - 1]; if (Blower_FR > 32767) { Blower_FR = 32767U; } /* Switch: '/Switch' incorporates: * DataStoreRead: '/incar temp' * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * MATLAB Function: '/Time goto from step 1 to step 2 ' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ if ((Incar_FL < AMB) || (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_i > (uint16_t)(1000 * Blower_FR))) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' * SignalConversion generated from: '/step' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' * SignalConversion generated from: '/step' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_it)) { rtDW.t_start_delay_private_DSTATE_i = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_it = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus(rtB.Merge_b, &rtb_u_pe); /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * MATLAB Function: '/mode FR step 1' */ modeFRstep1(rtB.Merge_b, &rtDW.Mode_FL); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/window heating' */ windowheating(rtB.Merge_b, &rtDW.Dtg_FUL); /* DataStoreWrite: '/Data Store Write6' incorporates: * MATLAB Function: '/blower FR' */ blowerFR(rtB.Merge_b, &rtDW.Blower_FL); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/Dtg_FrontUpper_X' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtDW.Dtg_FUL); /* DataStoreWrite: '/Data Store Write13' incorporates: * MATLAB Function: '/Dtg_FrontLower_X' */ Dtg_FrontLower_X(rtB.Merge_b, &rtDW.Dtg_FLL); /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' */ Incartempgotofromstep1tostep2(rtB.Merge_b, &AMB); /* MATLAB Function: '/Time goto from step 1 to step 2 ' */ Timegotofromstep1tostep2(rtB.Merge_b, &Eva_F); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_f = (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_gu > (uint32_t)(1000 * Eva_F)); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_l)) { rtDW.t_start_delay_private_DSTATE_gu = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/incar temp' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator' */ if ((Incar_FL < AMB) || rtb_LogicalOperator1_f) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_l = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' */ rtB.Merge_i = 2; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus(rtB.Merge_b, &rtb_u_pe); /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* DataStoreWrite: '/Data Store Write3' incorporates: * MATLAB Function: '/mode FR step 1' */ modeFRstep1(rtB.Merge_b, &rtDW.Mode_FL); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/window heating' */ windowheating(rtB.Merge_b, &rtDW.Dtg_FUL); /* MATLAB Function: '/blower min max' */ blowerminmax(rtB.Merge_b, rtb_out_fw); /* MATLAB Function: '/ECT min max' */ ECTminmax(rtB.Merge_b, rtb_out_nh); /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreRead: '/engine coolant temp' * Lookup_n-D: '/blower для текущего ECT' */ rtDW.Blower_FL = look1_iu16bs16lu64n32_binlcse(rtDW.ECT, rtb_out_nh, rtb_out_fw, 1U); /* DataStoreWrite: '/Data Store Write11' incorporates: * MATLAB Function: '/Dtg_FrontUpper_X' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtDW.Dtg_FUL); /* DataStoreWrite: '/Data Store Write13' incorporates: * MATLAB Function: '/Dtg_FrontLower_X' */ Dtg_FrontLower_X(rtB.Merge_b, &rtDW.Dtg_FLL); /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' */ Incartempgotofromstep1tostep2(rtB.Merge_b, &AMB); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_h = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_nk; /* MATLAB Function: '/Time goto from step 1 to step 2 ' */ Timegotofromstep1tostep2(rtB.Merge_b, &Eva_F); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ /* : out = int16(g_assSTART_COOLANT_TO_STEP2(LVL + 1 - 3)); */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_a)) { rtDW.t_start_delay_private_DSTATE_nk = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/g_assSTART_COOLANT_TO_STEP2 ' */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ rtb_dt_du = (uint32_t)i - 3U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)i - 3U > (uint32_t)i) { rtb_dt_du = 0U; } /* Switch: '/Switch' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreRead: '/incar temp' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * MATLAB Function: '/g_assSTART_COOLANT_TO_STEP2 ' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_FL < AMB) || (rtb_dt_h > (uint32_t)(1000 * Eva_F)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[(int32_t)rtb_dt_du - 1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step 2' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_a = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level4(&rtB.Merge_i, &rtDW.Blower_FL, &Blower_FR, &rtDW.Dtg_FLL, &Valve_2_way, &rtDW.Dtg_FUL, &Dtg_FUR, &rtDW.ECT, &El_window_heating, &Incar_FL, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &rtDW.Mode_FL, &Mode_FR, &rtb_Divide1, &rtb_u_pe, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level4_lz); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4(&rtB.Merge_i, &rtDW.Blower_FL, &Blower_FR, &rtDW.Dtg_FLL, &Valve_2_way, &rtDW.Dtg_FUL, &Dtg_FUR, &rtDW.ECT, &El_window_heating, &Incar_FL, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &rtDW.Mode_FL, &Mode_FR, &rtb_Divide1, &rtb_u_pe, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level5_l); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 1 F' */ break; case 2: /* Outputs for IfAction SubSystem: '/Step 2 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreWrite: '/Data Store Write' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus_m(rtB.Merge_b, &rtb_u_pe); /* MATLAB Function: '/step' */ Dtg_FrontLower_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FLL - rtDW.Dtg_logic_FLL) <= 0.01) { /* DataStoreWrite: '/Data Store Write13' */ rtDW.Dtg_FLL = rtDW.Dtg_logic_FLL; } else { if (rtDW.Dtg_FLL <= rtDW.Dtg_logic_FLL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FLL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_lc) * (double)i + (double)rtDW.Dtg_FLL); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/step' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep_a(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FUL - rtDW.Dtg_logic_FUL) <= 0.01) { /* DataStoreWrite: '/Data Store Write11' */ rtDW.Dtg_FUL = rtDW.Dtg_logic_FUL; } else { if (rtDW.Dtg_FUL <= rtDW.Dtg_logic_FUL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FUL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_jz) * (double)i + (double)rtDW.Dtg_FUL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain_l = (uint8_t)(rtDW.Mode_FL - rtDW.Mode_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (rtb_Gain_l <= 0.01); /* MATLAB Function: '/step' */ step_l(rtB.Merge_b, &rtb_Gain2); /* MATLAB Function: '/time for step' */ timeforstep_f(rtB.Merge_b, &rtb_Gain_l); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_LogicalOperator1) { /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Mode_FL = rtDW.Mode_logic_FL; } else { if (rtDW.Mode_FL <= rtDW.Mode_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Mode_FL = (uint8_t)((double)rtb_Gain2 / (double)rtb_Gain_l / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_d) * (double)i + (double)rtDW.Mode_FL); } /* End of Switch: '/Switch' */ /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ /* : out = g_aucSTART_ELEC_WINDOW(LVL + 1 + 6); */ Blower_FR = (uint16_t)(rtDW.Blower_FL - rtDW.Blower_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (Blower_FR <= 0.01); /* MATLAB Function: '/blower step' */ blowerstep(rtB.Merge_b, &rtb_out_jk); /* MATLAB Function: '/blower time for step' */ blowertimeforstep(rtB.Merge_b, &Blower_FR); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_LogicalOperator1) { /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Blower_FL = rtDW.Blower_logic_FL; } else { if (rtDW.Blower_FL <= rtDW.Blower_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Blower_FL = (uint16_t)((double)rtb_out_jk / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_n) * (double)i + (double)rtDW.Blower_FL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_du = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_n; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_p)) { rtDW.t_start_delay_private_DSTATE_n = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Time goto from step 2 to step 3 ' */ Timegotofromstep2tostep3(rtB.Merge_b, &Incar_FL); /* Switch: '/Switch' incorporates: * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ if (rtb_dt_du > (uint32_t)(1000 * Incar_FL)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_lc = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_jz = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_d = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_n = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_p = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus_m(rtB.Merge_b, &rtb_u_pe); /* MATLAB Function: '/step' */ Dtg_FrontLower_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FLL - rtDW.Dtg_logic_FLL) <= 0.01) { /* DataStoreWrite: '/Data Store Write13' */ rtDW.Dtg_FLL = rtDW.Dtg_logic_FLL; } else { if (rtDW.Dtg_FLL <= rtDW.Dtg_logic_FLL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FLL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_p) * (double)i + (double)rtDW.Dtg_FLL); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/step' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep_a(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FUL - rtDW.Dtg_logic_FUL) <= 0.01) { /* DataStoreWrite: '/Data Store Write11' */ rtDW.Dtg_FUL = rtDW.Dtg_logic_FUL; } else { if (rtDW.Dtg_FUL <= rtDW.Dtg_logic_FUL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FUL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_g) * (double)i + (double)rtDW.Dtg_FUL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain_l = (uint8_t)(rtDW.Mode_FL - rtDW.Mode_logic_FL); /* MATLAB Function: '/step' */ step_l(rtB.Merge_b, &rtb_Gain2); /* MATLAB Function: '/time for step' */ timeforstep_f(rtB.Merge_b, &rtb_u_pe); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_Gain_l <= 0.01) { /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Mode_FL = rtDW.Mode_logic_FL; } else { if (rtDW.Mode_FL <= rtDW.Mode_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Mode_FL = (uint8_t)((double)rtb_Gain2 / (double)rtb_u_pe / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_l) * (double)i + (double)rtDW.Mode_FL); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/window heating' */ windowheating_k(rtB.Merge_b, &rtb_Gain_l); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ Blower_FR = (uint16_t)(rtDW.Blower_FL - rtDW.Blower_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (Blower_FR <= 0.01); /* MATLAB Function: '/blower step' */ blowerstep(rtB.Merge_b, &rtb_out_jk); /* MATLAB Function: '/blower time for step' */ blowertimeforstep(rtB.Merge_b, &Blower_FR); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_LogicalOperator1) { /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Blower_FL = rtDW.Blower_logic_FL; } else { if (rtDW.Blower_FL <= rtDW.Blower_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Blower_FL = (uint16_t)((double)rtb_out_jk / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_gw) * (double)i + (double)rtDW.Blower_FL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_du = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_bd; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_d)) { rtDW.t_start_delay_private_DSTATE_bd = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Time goto from step 2 to step 3 ' */ Timegotofromstep2tostep3(rtB.Merge_b, &Incar_FL); /* Switch: '/Switch' incorporates: * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ if (rtb_dt_du > (uint32_t)(1000 * Incar_FL)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_p = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_g = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_l = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_gw = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_d = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' */ rtB.Merge_i = 3; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ Level3_d(&rtB.Merge_i, &Autodefog, &rtDW.Blower_FL, &Blower_FR, &rtDW.Blower_logic_FL, &rtDW.Dtg_FLL, &Valve_2_way, &rtDW.Dtg_FUL, &Dtg_FUR, &rtDW.Dtg_logic_FLL, &rtDW.Dtg_logic_FUL, &El_window_heating, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &rtDW.Mode_FL, &Mode_FR, &rtDW.Mode_logic_FL, &rtb_Divide1, &rtb_u_pe, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level3_dl); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level3_d(&rtB.Merge_i, &Autodefog, &rtDW.Blower_FL, &Blower_FR, &rtDW.Blower_logic_FL, &rtDW.Dtg_FLL, &Valve_2_way, &rtDW.Dtg_FUL, &Dtg_FUR, &rtDW.Dtg_logic_FLL, &rtDW.Dtg_logic_FUL, &El_window_heating, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &rtDW.Mode_FL, &Mode_FR, &rtDW.Mode_logic_FL, &rtb_Divide1, &rtb_u_pe, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level4_g); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write8' incorporates: * MATLAB Function: '/3 way valve status' */ uwayvalvestatus_m(rtB.Merge_b, &rtb_u_pe); /* MATLAB Function: '/step' */ Dtg_FrontLower_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FLL - rtDW.Dtg_logic_FLL) <= 0.01) { /* DataStoreWrite: '/Data Store Write13' */ rtDW.Dtg_FLL = rtDW.Dtg_logic_FLL; } else { if (rtDW.Dtg_FLL <= rtDW.Dtg_logic_FLL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write13' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FLL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE) * (double)i + (double)rtDW.Dtg_FLL); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/step' */ Dtg_FrontUpper_X(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep_a(rtB.Merge_b, &rtb_Gain2); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Sum: '/Add' * Switch: '/Switch' */ if ((uint8_t)(rtDW.Dtg_FUL - rtDW.Dtg_logic_FUL) <= 0.01) { /* DataStoreWrite: '/Data Store Write11' */ rtDW.Dtg_FUL = rtDW.Dtg_logic_FUL; } else { if (rtDW.Dtg_FUL <= rtDW.Dtg_logic_FUL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write11' incorporates: * Constant: '/Constant' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (dtg//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Dtg_FUL = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_b) * (double)i + (double)rtDW.Dtg_FUL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write' incorporates: * MATLAB Function: '/incar filter up' */ incarfilterup(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write1' incorporates: * MATLAB Function: '/incar filter down' */ incarfilterdown(rtB.Merge_b, &rtb_Gain2); /* MATLAB Function: '/autodemist (autodefog)' */ autodemistautodefog(rtB.Merge_b, &rtb_Gain_l); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain2 = (uint8_t)(rtDW.Mode_FL - rtDW.Mode_logic_FL); /* MATLAB Function: '/step' */ step_l(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep_f(rtB.Merge_b, &rtb_u_pe); /* Switch: '/Switch' incorporates: * Constant: '/epsilon' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_Gain2 <= 0.01) { /* DataStoreWrite: '/Data Store Write3' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Mode_FL = rtDW.Mode_logic_FL; } else { if (rtDW.Mode_FL <= rtDW.Mode_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Mode_FL = (uint8_t)((double)rtb_Gain_l / (double)rtb_u_pe / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_m) * (double)i + (double)rtDW.Mode_FL); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/window heating' */ windowheating_k(rtB.Merge_b, &rtb_Gain2); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ Blower_FR = (uint16_t)(rtDW.Blower_FL - rtDW.Blower_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (Blower_FR <= 0.01); /* MATLAB Function: '/blower step' */ blowerstep(rtB.Merge_b, &rtb_out_jk); /* MATLAB Function: '/blower time for step' */ blowertimeforstep(rtB.Merge_b, &Blower_FR); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ if (rtb_LogicalOperator1) { /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtDW.Blower_FL = rtDW.Blower_logic_FL; } else { if (rtDW.Blower_FL <= rtDW.Blower_logic_FL) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant' * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/текущее время в мс' * Product: '/Product1' * Product: '/change rate (step//sec)' * Product: '/скорость в мс' * Product: '/шаг изменения' * Sum: '/Add' * Sum: '/Subtract' * Switch: '/Switch' * UnitDelay: '/Unit Delay' */ rtDW.Blower_FL = (uint16_t)((double)rtb_out_jk / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_j) * (double)i + (double)rtDW.Blower_FL); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ rtb_Divide1 = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_front == 1); /* MATLAB Function: '/Time goto from step 2 to step 3 ' */ Timegotofromstep2tostep3(rtB.Merge_b, &Incar_FL); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_f = (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_g > (uint32_t)(1000 * Incar_FL)); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_fw)) { rtDW.t_start_delay_private_DSTATE_g = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator' */ if (rtb_LogicalOperator1_f || rtDW.HI_logic_on) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_i = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_i = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_b = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_m = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_j = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_fw = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 2 F' */ break; case 3: /* Outputs for IfAction SubSystem: '/Step 3' incorporates: * ActionPort: '/Action Port' */ Step3(&rtB.Merge_i, &rtDW.start_control_finished_front); /* End of Outputs for SubSystem: '/Step 3' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write' */ rtDW.step_start_controle_front = rtB.Merge_i; /* End of Outputs for SubSystem: '/Start Control Front' */ } /* End of If: '/если SC front не завершен' */ /* If: '/если SC rear не завершен1' incorporates: * DataStoreRead: '/Data Store Read3' */ if (rtDW.start_control_finished_rear == 0.0) { /* Outputs for IfAction SubSystem: '/Start Control Rear' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read' */ switch (rtDW.step_start_controle_rear) { case -1: /* Outputs for IfAction SubSystem: '/Step -1 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read1' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read4' */ /* : out = int16(g_assSTART_ENTER_INCAR(LVL + 1 + 6)); */ g_ausSTART_ENTER_SETTEMP_p(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read3' */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } tmp_0 = (int32_t)((uint32_t)i + 6U); if ((uint32_t)i + 6U > 255U) { tmp_0 = 255; } /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write2' * Logic: '/AND' * MATLAB Function: '/g_assSTART_ENTER_INCAR' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_RR > g_assSTART_ENTER_INCAR[tmp_0 - 1]) && (rtDW.MODE_RR_passenger == 1.0) && (rtDW.FIU_CCU2_MODEL.FIU_TargetTempRR_Val_ro < Incar_FL)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_d = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_d = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_INCAR_l(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read4' */ g_ausSTART_ENTER_SETTEMP_p(rtB.Merge_b, &AMB); /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write2' * Logic: '/AND' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_RR > Incar_FL) && (rtDW.MODE_RR_passenger == 1.0) && (rtDW.FIU_CCU2_MODEL.FIU_TargetTempRR_Val_ro < AMB)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_d = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_d = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_INCAR_l(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read4' */ g_ausSTART_ENTER_SETTEMP_p(rtB.Merge_b, &AMB); /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write2' * Logic: '/AND' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_RR < Incar_FL) && (rtDW.MODE_RR_passenger == 1.0) && (rtDW.FIU_CCU2_MODEL.FIU_TargetTempRR_Val_ro > AMB)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_d = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_d = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read4' */ g_assSTART_ENTER_INCAR_l(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_COOLANT_i(rtB.Merge_b, &AMB); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read6' */ /* : out = int16(g_ausSTART_ENTER_SETTEMP(LVL+1+6)); */ i = (int32_t)(rtB.Merge_b + 1U); if (rtB.Merge_b + 1U > 255U) { i = 255; } tmp_0 = (int32_t)((uint32_t)i + 6U); if ((uint32_t)i + 6U > 255U) { tmp_0 = 255; } Blower_FR = g_ausSTART_ENTER_SETTEMP[tmp_0 - 1]; if (Blower_FR > 32767) { Blower_FR = 32767U; } /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreWrite: '/Data Store Write2' * Logic: '/AND' * Logic: '/AND1' * MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' * RelationalOperator: '/Relational Operator3' */ if (((Incar_RR < Incar_FL) || (rtDW.ECT < AMB)) && (rtDW.MODE_RR_passenger == 1.0) && (rtDW.FIU_CCU2_MODEL.FIU_TargetTempRR_Val_ro > Blower_FR)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_d = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_d = -1; } /* End of Switch: '/Switch' */ /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level4_i(&rtB.Merge_d, &rtDW.ECT, &Incar_RR, &rtB.Merge_b, &rtDW.MODE_RR_passenger); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_i(&rtB.Merge_d, &rtDW.ECT, &Incar_RR, &rtB.Merge_b, &rtDW.MODE_RR_passenger); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step -1 F' */ break; case 0: /* Outputs for IfAction SubSystem: '/Step 0 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read1' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_d); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_d); /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Blower_RR = 10U; /* DataStoreWrite: '/Data Store Write10' incorporates: * Constant: '/Constant4' */ rtDW.Dtg_RR = 65U; /* MATLAB Function: '/incar filter up' incorporates: * DataStoreRead: '/Data Store Read1' */ incarfilterup_d(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_j(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Mode - foot' */ rtDW.Mode_RR = 60U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : out = int16(g_assSTART_COOLANT_STEP0_TO_1(LVL + 3)); */ i = (int32_t)(rtB.Merge_b + 3U); if (rtB.Merge_b + 3U > 255U) { i = 255; } /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_d = (int8_t)(rtDW.ECT > g_assSTART_COOLANT_STEP0_TO_1[i - 1]); /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant2' */ rtDW.Blower_RR = 10U; /* DataStoreWrite: '/Data Store Write10' incorporates: * Constant: '/Constant4' */ rtDW.Dtg_RR = 65U; /* MATLAB Function: '/incar filter up' incorporates: * DataStoreRead: '/Data Store Read1' */ incarfilterup_d(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_j(rtB.Merge_b, &rtb_Gain_l); /* DataStoreWrite: '/Data Store Write2' incorporates: * Constant: '/Mode - foot' */ rtDW.Mode_RR = 60U; /* MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_COOLANT_STEP0_TO_1_g(rtB.Merge_b, &Incar_RR); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_d = (int8_t)(rtDW.ECT > Incar_RR); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level4_h(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.ECT, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &Valve_2_way, &rtb_u_pe); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_h(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.ECT, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &Valve_2_way, &rtb_u_pe); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 0 F' */ break; case 1: /* Outputs for IfAction SubSystem: '/Step 1 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read1' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ Level0_h(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &Incar_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level0_he); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0_h(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &Incar_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level1_h); /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' * MATLAB Function: '/incar filter down' * MATLAB Function: '/incar filter up' * MATLAB Function: '/mode rear step 1' */ uwayvalve(rtB.Merge_b, &rtDW.Mode_RR); incarfilterup_d(rtB.Merge_b, &rtDW.Mode_RR); incarfilterdown_j(rtB.Merge_b, &rtDW.Mode_RR); moderearstep1(rtB.Merge_b, &rtDW.Mode_RR); /* MATLAB Function: '/blower start finish' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstartfinish(rtB.Merge_b, rtb_out_fw); /* MATLAB Function: '/ECT min max' */ /* : min = int16(g_assSTART_COOLANT_STEP0_TO_1(5)); */ /* : max = int16(g_assSTART_COOLANT_TO_STEP2(2)); */ /* : out = [min, max]; */ rtb_out_nh[0] = g_assSTART_COOLANT_STEP0_TO_1[4]; rtb_out_nh[1] = g_assSTART_COOLANT_TO_STEP2[1]; /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ rtDW.Blower_RR = look1_iu16bs16lu64n32_binlcse(rtDW.ECT, rtb_out_nh, rtb_out_fw, 1U); /* DataStoreWrite: '/Data Store Write10' incorporates: * DataStoreRead: '/Data Store Read8' * MATLAB Function: '/Dtg_rear' */ Dtg_rear(rtB.Merge_b, &rtDW.Dtg_RR); /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_b(rtB.Merge_b, &Incar_FL); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_du = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_l; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(rtB.Merge_b, &AMB); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ /* : out = int16(g_assSTART_COOLANT_TO_STEP2(2)); */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_hp)) { rtDW.t_start_delay_private_DSTATE_l = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreRead: '/incar temp' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * MATLAB Function: '/g_assSTART_COOLANT_TO_STEP2 ' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_RR > Incar_FL) || (rtb_dt_du > (uint16_t)(1000 * AMB)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_d = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_d = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_hp = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/Data Store Read6' * MATLAB Function: '/2 way valve' * MATLAB Function: '/incar filter down' * MATLAB Function: '/incar filter up' * MATLAB Function: '/mode rear step 1' */ uwayvalve(rtB.Merge_b, &rtDW.Mode_RR); incarfilterup_d(rtB.Merge_b, &rtDW.Mode_RR); incarfilterdown_j(rtB.Merge_b, &rtDW.Mode_RR); moderearstep1(rtB.Merge_b, &rtDW.Mode_RR); /* MATLAB Function: '/blower start finish' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstartfinish(rtB.Merge_b, rtb_out_fw); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax_h(rtB.Merge_b, rtb_out_nh); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ rtDW.Blower_RR = look1_iu16bs16lu64n32_binlcse(rtDW.ECT, rtb_out_nh, rtb_out_fw, 1U); /* DataStoreWrite: '/Data Store Write10' incorporates: * DataStoreRead: '/Data Store Read8' * MATLAB Function: '/Dtg_rear' */ Dtg_rear(rtB.Merge_b, &rtDW.Dtg_RR); /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_b(rtB.Merge_b, &Incar_FL); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_du = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_m; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_h(rtB.Merge_b, &AMB); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ /* : out = int16(g_assSTART_COOLANT_TO_STEP2(3)); */ if (rtb_LogicalOperator1 && (!rtDW.Cond_prev_private_DSTATE_im)) { rtDW.t_start_delay_private_DSTATE_m = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreRead: '/incar temp' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * MATLAB Function: '/g_assSTART_COOLANT_TO_STEP2 ' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ if ((Incar_RR > Incar_FL) || (rtb_dt_du > (uint16_t)(1000 * AMB)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[2])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_d = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_d = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_im = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level4_d(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.ECT, &Incar_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level4_di); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_d(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.ECT, &Incar_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level5_p); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 1 F' */ break; case 2: /* Outputs for IfAction SubSystem: '/Step 2 F' incorporates: * ActionPort: '/Action Port' */ /* SwitchCase: '/Switch Case' incorporates: * DataStoreRead: '/Data Store Read1' */ switch (rtB.Merge_b) { case 0: /* Outputs for IfAction SubSystem: '/Level 0' incorporates: * ActionPort: '/Action Port' */ Level0_j(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level0_jq); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0_j(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level1_ha); /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ Level2(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level2_al); /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ Level2(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level3_n); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level2(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level4_c); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level2(&rtB.Merge_d, &Blower_FR, &rtDW.Blower_RR, &rtDW.Blower_logic_RR, &Dtg_FUR, &rtDW.Dtg_RR, &rtDW.Dtg_logic_RR, &rtDW.HI_logic_on, &rtb_Gain2, &rtb_Gain_l, &rtB.Merge_b, &El_window_heating, &rtDW.Mode_RR, &rtDW.Mode_logic_RR, &rtb_Divide1, &Valve_2_way, &rtDW.step_start_controle_rear, &rtDW.t_now, &rtDW.Level5_e); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 2 F' */ break; case 3: /* Outputs for IfAction SubSystem: '/Step 3' incorporates: * ActionPort: '/Action Port' */ Step3(&rtB.Merge_d, &rtDW.start_control_finished_front); /* End of Outputs for SubSystem: '/Step 3' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write' */ rtDW.step_start_controle_rear = rtB.Merge_d; /* End of Outputs for SubSystem: '/Start Control Rear' */ } /* End of If: '/если SC rear не завершен1' */ /* Test Sequence: '/Test Sequence' */ if (rtDW.temporalCounter_i1 < 7U) { rtDW.temporalCounter_i1++; } if (rtDW.is_active_c371_HVAC_model == 0U) { rtDW.is_active_c371_HVAC_model = 1U; rtDW.temporalCounter_i1 = 0U; rtDW.is_c371_HVAC_model = IN_step_1; /* : ADC_Data_Model.Sensor_Ambient_Temp= uint16(300); */ rtDW.ADC_Data_Model.Sensor_Ambient_Temp = 300U; /* : FIU_CCU1_MODEL.FIU_TargetTempFL_Val_ro = uint8(13); */ rtDW.FIU_CCU1_MODEL.FIU_TargetTempFL_Val_ro = 13U; /* : ADC_Data_Model.IGN_ANS = uint16(300); */ rtDW.ADC_Data_Model.IGN_ANS = 300U; /* : t_now = uint32(0); */ rtDW.t_now = 0U; } else { switch (rtDW.is_c371_HVAC_model) { case IN_step_1: /* : sf_internal_predicateOutput = after(2, sec); */ if (rtDW.temporalCounter_i1 >= 2U) { rtDW.temporalCounter_i1 = 0U; rtDW.is_c371_HVAC_model = IN_step_2; /* : ADC_Data_Model.Sensor_Ambient_Temp = uint16(800); */ rtDW.ADC_Data_Model.Sensor_Ambient_Temp = 800U; /* : t_now = uint32(2000); */ rtDW.t_now = 2000U; } else { /* : ADC_Data_Model.Sensor_Ambient_Temp= uint16(300); */ rtDW.ADC_Data_Model.Sensor_Ambient_Temp = 300U; /* : FIU_CCU1_MODEL.FIU_TargetTempFL_Val_ro = uint8(13); */ rtDW.FIU_CCU1_MODEL.FIU_TargetTempFL_Val_ro = 13U; /* : ADC_Data_Model.IGN_ANS = uint16(300); */ rtDW.ADC_Data_Model.IGN_ANS = 300U; /* : t_now = uint32(0); */ rtDW.t_now = 0U; } break; case IN_step_2: /* : sf_internal_predicateOutput = after(5, sec); */ if (rtDW.temporalCounter_i1 >= 5U) { rtDW.is_c371_HVAC_model = IN_step_3; /* : ADC_Data_Model.IGN_ANS = uint16(0); */ rtDW.ADC_Data_Model.IGN_ANS = 0U; } else { /* : ADC_Data_Model.Sensor_Ambient_Temp = uint16(800); */ rtDW.ADC_Data_Model.Sensor_Ambient_Temp = 800U; /* : t_now = uint32(2000); */ rtDW.t_now = 2000U; } break; default: /* case IN_step_3: */ /* : ADC_Data_Model.IGN_ANS = uint16(0); */ rtDW.ADC_Data_Model.IGN_ANS = 0U; break; } } /* End of Test Sequence: '/Test Sequence' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE = rtb_FailCond; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_h = rtb_FailCond_f; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_i = rtb_FailCond_g; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_e = rtb_FailCond_mg; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_c = rtb_FailCond_e; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_b = rtb_FailCond_a; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_j = rtb_FailCond_l; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_f = rtb_FailCond_b; } /* Model initialize function */ void HVAC_model_initialize(void) { { int32_t i; /* Start for DataStoreMemory: '/Data Store Memory1' */ for (i = 0; i < 9; i++) { rtDW.ErrorCalibration_private[i] = 1U; } /* End of Start for DataStoreMemory: '/Data Store Memory1' */ /* Start for DataStoreMemory: '/Data Store Memory' */ rtDW.step_start_controle_front = -1; /* Start for DataStoreMemory: '/Data Store Memory1' */ rtDW.step_start_controle_rear = -1; /* Start for DataStoreMemory: '/Data Store Memory42' */ rtDW.ADC_Data_Model = rtConstP.DataStoreMemory42_InitialValue; /* Start for DataStoreMemory: '/Data Store Memory5' */ rtDW.t_now = 10U; /* SystemInitialize for IfAction SubSystem: '/Homing' */ /* SystemInitialize for IfAction SubSystem: '/Switch Case Action Subsystem3' */ /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ /* SystemInitialize for SignalConversion generated from: '/Out1' */ rtB.OutportBufferForOut1 = 2; /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ /* End of SystemInitialize for SubSystem: '/Switch Case Action Subsystem3' */ /* End of SystemInitialize for SubSystem: '/Homing' */ } } /* Model terminate function */ void HVAC_model_terminate(void) { /* (no terminate code required) */ } /* * File trailer for generated code. * * [EOF] */