/* * File: HVAC_model.c * * Code generated for Simulink model 'HVAC_model'. * * Model version : 1.815 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 * C/C++ source code generated on : Fri Apr 17 14:51:19 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 #include "HVAC_model_types.h" #include "Rs_Cal_Base.h" const CmdBusError HVAC_model_rtZCmdBusError = { 0U, /* CCU_IncarTempErrF_Stat */ 0U, /* CCU_IncarTempErrR_Stat */ 0U, /* CCU_DuctTempSenErrF_Stat */ 0U, /* CCU_DuctTempSenErrR_Stat */ 0U, /* CCU_EvaTempSenErrF_Stat */ 0U, /* CCU_EvaTempSenErrR_Stat */ 0U, /* CCU_DeflectorSwErrF_Stat */ 0U, /* CCU_DeflectorSwErrR_Stat */ 0U, /* CCU_PressSenErr_Stat */ 0U, /* CCU_AmbienTemptSenErr_Stat */ 0U, /* CCU_SealingValveErr_Stat */ 0U, /* CCU_ETXVerr_Stat */ 0U, /* CCU_HVACfanOrTXVerrF_Stat */ 0U, /* CCU_HVACfanOrTXVerrR_Stat */ 0U, /* CCU_ActuatorErrF_Stat */ 0U, /* CCU_ActuatorErrR_Stat */ 0U, /* CCU_UltravioletErr_Stat */ 0U, /* CCU_VinRecordErr_Stat */ 0U, /* CCU_AirQualSenErr_Stat */ 0U, /* CCU_CommErr_Stat */ 0U, /* CCU_TWVerr_Stat */ 0U, /* CCU_IonizationErr_Stat */ 0U /* CCU_AromaErr_Stat */ }; /* CmdBusError ground */ const ActuatorCmdBusInput HVAC_model_rtZActuatorCmdBusInput = { { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_CPOS_ALL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Emrf_Slave */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Mode_Slave */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Err1_Supply */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Err2_Communication */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Err3_Temperature */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Err4_Permanent_Electrical */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Stall_Slave */ { 0, 0, 0, 0, 0, 0, 0, 0, 0 } , /* in_Act_Reset */ 0U, /* Busy */ 0U /* Error_Connect */ }; /* ActuatorCmdBusInput ground */ const CmdBusStatus HVAC_model_rtZCmdBusStatus = { 0, /* Battery */ 0, /* AMB */ 0, /* Incar_FL */ 0, /* Incar_FR */ 0, /* Incar_RL */ 0, /* Incar_RR */ 0, /* Eva_F */ 0, /* Eva_R */ 0, /* Pressure */ 0, /* Duct_FL_Upper */ 0, /* Duct_FL_Lower */ 0, /* Duct_FR_Upper */ 0, /* Duct_FR_Lower */ 0, /* Duct_RL */ 0, /* Duct_RR */ 0, /* Duct_Side_FL */ 0, /* Duct_Side_FR */ 0, /* Duct_Side_RL */ 0, /* Duct_Side_RR */ 0 /* AQS */ }; /* CmdBusStatus ground */ const ActuatorCmdBus HVAC_model_rtZActuatorCmdBus = { { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* POS */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* BUS_ADR */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* MODE */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* COM */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* Stall_SET */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* Lnoise_SET */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* Autos_SET */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } , /* Speed_SET */ { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U } /* Coils_Stop_SET */ }; /* ActuatorCmdBus ground */ const CmdBusPWMGet HVAC_model_rtZCmdBusPWMGet = { 0U, /* pwmPercentFront */ 0U, /* pwmPercentRear */ 0U, /* pwmPercentFrontReserved */ 0U /* pwmPercentRearReserved */ }; /* CmdBusPWMGet ground */ /* Exported block states */ ActuatorCmdBusInput Actuator_Ch1_Status_Model;/* '/Data Store Memory62' */ ActuatorCmdBusInput Actuator_Ch2_Status_Model;/* '/Data Store Memory63' */ ActuatorCmdBusInput Actuator_Ch0_Status_Model;/* '/Data Store Memory61' */ ActuatorCmdBus Actuator_Ch0_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_fou; 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_fou); /* 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_fou = (int16_t)(g_assFLOW_BI_TEMP_TGT[tmp_0 - 1] - rtb_u_fou); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_fou; 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_fou); /* 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_fou = (int16_t)(g_assFLOW_BI_TEMP_TGT[tmp - 1] - rtb_u_fou); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_fou; 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_fou); /* 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_fou - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_fou = (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_fou) >> 1) << 1); rtb_Switch2_a_idx_1 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_fou) >> 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_fou); /* 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_fou - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_fou = (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_fou) >> 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_fou) >> 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_cgj; 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_cgj); /* 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_cgj = (int16_t)(g_assFLOW_BI2_TEMP_TGT[tmp_0 - 1] - rtb_u_cgj); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_cgj; 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_cgj); /* 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_cgj = (int16_t)(g_assFLOW_BI2_TEMP_TGT[tmp - 1] - rtb_u_cgj); /* Gain: '/Gain6' */ tmp_0 = 13107 * rtb_u_cgj; 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_cgj); /* 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_cgj - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_cgj = (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_cgj) >> 1) << 1); rtb_Switch2_i_idx_1 = (uint16_t)((uint16_t)((rty_Out1[1] - rtb_u_cgj) >> 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_cgj); /* 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_cgj - rtu_Amb_Fb) * 13107; /* Product: '/Умножили' incorporates: * Gain: '/Gain' * Gain: '/Gain2' * MATLAB Function: '/g_aucFLOW_BI_VENT_PLUS' */ rtb_u_cgj = (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_cgj) >> 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_cgj) >> 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 atomic system: * '/g_assSTART_ENTER_INCAR' * '/g_assSTART_ENTER_INCAR' */ void g_assSTART_ENTER_INCAR_j(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 atomic system: * '/g_assSTART_ENTER_COOLANT ' * '/g_assSTART_ENTER_COOLANT ' * '/g_assSTART_ENTER_COOLANT ' */ void g_assSTART_ENTER_COOLANT_p(uint8_t rtu_LVL, int16_t *rty_out) { int32_t q0; uint32_t qY; /* : out = int16(g_assSTART_ENTER_COOLANT(LVL + 1 - 3)); */ 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 - 3U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)q0 - 3U > (uint32_t)q0) { qY = 0U; } *rty_out = g_assSTART_ENTER_COOLANT[(int32_t)qY - 1]; } /* * Output and update for action system: * '/Level 4' * '/Level 5' */ void Level4(int8_t *rty_step1, const uint16_t *rtd_ECT, const uint8_t *rtd_LEVEL, const double *rtd_MODE_DRIVER) { int16_t rtb_out_p2; /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_COOLANT_p(*rtd_LEVEL, &rtb_out_p2); /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Logic: '/AND' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator2' */ if ((*rtd_ECT < rtb_out_p2) && (*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_h(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_c(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_n *localDW) { int32_t tmp; int16_t rtb_out_jl[2]; int16_t rtb_out_nl; int16_t rtb_out_pe; uint16_t rtb_out_nm[2]; uint8_t rtb_out_fa; bool rtb_Equal_b; bool rtb_RelationalOperator1_mub; /* 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_fa); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_FR = rtb_out_fa; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_FL = rtb_out_fa; /* MATLAB Function: '/window heating' incorporates: * DataStoreRead: '/Data Store Read6' */ windowheating(*rtd_LEVEL, &rtb_out_fa); /* DataStoreWrite: '/Data Store Write4' */ *rtd_El_window_heating = rtb_out_fa; /* MATLAB Function: '/blower min max' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerminmax(*rtd_LEVEL, rtb_out_nm); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax(*rtd_LEVEL, rtb_out_jl); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_FR = look1_iu16bs16lu64n32_binlcse(*rtd_ECT, rtb_out_jl, rtb_out_nm, 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_fa = g_aucSTART_DUCT_TGT_STEP2_FX_U[tmp - 1]; /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_FUR = rtb_out_fa; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_FUL = rtb_out_fa; /* 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_fa = 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_fa; /* DataStoreWrite: '/Data Store Write13' */ *rtd_Dtg_FLL = rtb_out_fa; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_b = (*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_nl); /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2(*rtd_LEVEL, &rtb_out_pe); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_RelationalOperator1_mub = (*rtd_t_now - localDW->t_start_delay_private_DSTATE > (uint32_t)(1000 * rtb_out_pe)); /* 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_b && (!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_nl) || rtb_RelationalOperator1_mub) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_b; } /* * 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_a(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_j(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_j(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_g(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(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 *localDW) { int32_t tmp; int16_t rtb_out_cw; uint16_t rtb_out_gqg; uint16_t rtb_out_ov4; uint8_t rtb_out_ac; uint8_t rtb_out_ln5; uint8_t rtb_out_oq; bool rtb_Cond_prev_private_gh; bool rtb_RelationalOperator1_df; /* DataStoreWrite: '/Data Store Write8' incorporates: * DataStoreRead: '/Data Store Read10' * MATLAB Function: '/3 way valve status' */ uwayvalvestatus_a(*rtd_LEVEL, rtd_Valve_3_way); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read9' */ Dtg_FrontLower_X(*rtd_LEVEL, &rtb_out_oq); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read9' */ timeforstep(*rtd_LEVEL, &rtb_out_ac); /* 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_oq / (double)rtb_out_ac / 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_oq); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_j(*rtd_LEVEL, &rtb_out_ac); /* 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_oq / (double)rtb_out_ac / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_i) * (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_oq = (uint8_t)(*rtd_Mode_FL - *rtd_Mode_logic_FL); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_j(*rtd_LEVEL, &rtb_out_ac); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_g(*rtd_LEVEL, &rtb_out_ln5); /* 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_oq <= 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_ac / (double)rtb_out_ln5 / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_j) * (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_oq); /* DataStoreWrite: '/Data Store Write4' */ *rtd_El_window_heating = rtb_out_oq; /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_ov4 = (uint16_t)(*rtd_Blower_FL - *rtd_Blower_logic_FL); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_Cond_prev_private_gh = (rtb_out_ov4 <= 0.01); /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep(*rtd_LEVEL, &rtb_out_gqg); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep(*rtd_LEVEL, &rtb_out_ov4); /* 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_gh) { *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_gqg / (double)rtb_out_ov4 / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_a) * (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_gh = (*rtd_step_start_controle_front == 2); /* MATLAB Function: '/Time goto from step 2 to step 3 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep2tostep3(*rtd_LEVEL, &rtb_out_cw); /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read4' * Gain: '/из сек в мс' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_RelationalOperator1_df = (*rtd_t_now - localDW->t_start_delay_private_DSTATE > (uint32_t)(1000 * rtb_out_cw)); /* 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_gh && (!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' * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator' */ if (rtb_RelationalOperator1_df || (*rtd_HI_logic_on)) { *rty_step = 3; } else { *rty_step = 2; } /* 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_i = *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_a = *rtd_t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Cond_prev_private_gh; } /* * Output and update for action system: * '/Step 3 F' * '/Step 3 R' */ void Step3F(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_b(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_p(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_e(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_e(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_cv; int16_t rtb_out_jz; /* MATLAB Function: '/g_assSTART_ENTER_INCAR' incorporates: * DataStoreRead: '/Data Store Read4' */ g_assSTART_ENTER_INCAR_p(*rtd_LEVEL, &rtb_out_jz); /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_COOLANT_e(*rtd_LEVEL, &rtb_out_cv); /* 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_jz) || (*rtd_ECT < rtb_out_cv)) && (*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_c(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_i(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_e(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_m(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_pr; /* 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_i(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_c(*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_e(*rtd_LEVEL, &rtb_out_pr); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' */ *rty_step1 = (int8_t)(*rtd_ECT > rtb_out_pr); } /* * 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_j(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_l(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_b(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_c *localDW) { int32_t tmp; uint32_t rtb_dt_j0; int16_t rtb_out_gb; int16_t rtb_out_kdi; uint16_t rtb_out_ne; uint8_t rtb_out_jlu; bool rtb_Equal_eo; /* 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_i(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_c(*rtd_LEVEL, rtd_Incar_filter_down_value); /* MATLAB Function: '/mode rear step 1' incorporates: * DataStoreRead: '/Data Store Read5' */ moderearstep1(*rtd_LEVEL, &rtb_out_jlu); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RR = rtb_out_jlu; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_RL = rtb_out_jlu; /* 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_ne = g_ausSTART_BLR_AF_STEP12_R[tmp - 1]; /* End of MATLAB Function: '/blower rear' */ /* DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RR = rtb_out_ne; /* DataStoreWrite: '/Data Store Write6' */ *rtd_Blower_RL = rtb_out_ne; /* MATLAB Function: '/Dtg_rear' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(*rtd_LEVEL, &rtb_out_jlu); /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RR = rtb_out_jlu; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_RL = rtb_out_jlu; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_eo = (*rtd_step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_j(*rtd_LEVEL, &rtb_out_kdi); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_j0 = *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_l(*rtd_LEVEL, &rtb_out_gb); /* 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_eo && (!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_kdi) || (rtb_dt_j0 > (uint16_t)(1000 * rtb_out_gb))) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_eo; } /* * 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_l(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_a *localDW) { uint32_t rtb_dt_md; int16_t rtb_out_ij[2]; int16_t rtb_out_ck; int16_t rtb_out_pf; uint16_t rtb_out_dq[2]; uint8_t rtb_out_gz; bool rtb_Equal_m3; /* 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_i(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_c(*rtd_LEVEL, rtd_Incar_filter_down_value); /* MATLAB Function: '/mode rear step 1' incorporates: * DataStoreRead: '/Data Store Read5' */ moderearstep1(*rtd_LEVEL, &rtb_out_gz); /* DataStoreWrite: '/Data Store Write2' */ *rtd_Mode_RR = rtb_out_gz; /* DataStoreWrite: '/Data Store Write3' */ *rtd_Mode_RL = rtb_out_gz; /* MATLAB Function: '/blower start finish' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstartfinish(*rtd_LEVEL, rtb_out_dq); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax_l(*rtd_LEVEL, rtb_out_ij); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ *rtd_Blower_RR = look1_iu16bs16lu64n32_binlcse(*rtd_ECT, rtb_out_ij, rtb_out_dq, 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_gz); /* DataStoreWrite: '/Data Store Write10' */ *rtd_Dtg_RR = rtb_out_gz; /* DataStoreWrite: '/Data Store Write11' */ *rtd_Dtg_RL = rtb_out_gz; /* DataStoreWrite: '/Data Store Write7' incorporates: * Constant: '/Recirc logic Partial REC' */ *rtd_Recirculation = 1.0; /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_Equal_m3 = (*rtd_step_start_controle_rear == 1); /* MATLAB Function: '/Incar temp goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read3' */ Incartempgotofromstep1tostep2_j(*rtd_LEVEL, &rtb_out_pf); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_md = *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_l(*rtd_LEVEL, &rtb_out_ck); /* 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_m3 && (!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_pf) || (rtb_dt_md > (uint16_t)(1000 * rtb_out_ck))) { *rty_step = 2; } else { *rty_step = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Equal_m3; } /* * 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_jn(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_d(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_l(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_a(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 3' * '/Level 4' * '/Level 5' */ void Level3_i(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_Level3_n *localDW) { int32_t tmp; uint32_t rtb_dt_jh; int16_t rtb_out_cw; uint16_t rtb_out_bz; uint16_t rtb_out_gx; uint8_t rtb_out_cn; uint8_t rtb_out_i4; bool rtb_Cond_prev_private_a4; /* 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_i4); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_jn(*rtd_LEVEL, &rtb_out_cn); /* 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_i4 / (double)rtb_out_cn / 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_i(*rtd_LEVEL, rtd_Incar_filter_up_value); /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read2' * MATLAB Function: '/incar filter down' */ incarfilterdown_c(*rtd_LEVEL, rtd_Incar_filter_down_value); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_out_i4 = (uint8_t)(*rtd_Mode_RR - *rtd_Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_Cond_prev_private_a4 = (rtb_out_i4 <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_a(*rtd_LEVEL, &rtb_out_cn); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(*rtd_LEVEL, &rtb_out_i4); /* 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_a4) { *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_cn / (double)rtb_out_i4 / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_i) * (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_d(*rtd_LEVEL, &rtb_out_gx); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_l(*rtd_LEVEL, &rtb_out_bz); /* 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_gx / (double)rtb_out_bz / 1000.0 * (double)(*rtd_t_now - localDW->UnitDelay_DSTATE_e) * (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_a4 = (*rtd_step_start_controle_rear == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_jh = *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_l(*rtd_LEVEL, &rtb_out_cw); /* 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_a4 && (!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' * DataStoreRead: '/Data Store Read' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator1' */ if ((rtb_dt_jh > (uint16_t)(1000 * rtb_out_cw)) || (*rtd_HI_logic_on)) { *rty_step = 3; } else { *rty_step = 2; } /* 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_i = *rtd_t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ localDW->UnitDelay_DSTATE_e = *rtd_t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ localDW->Cond_prev_private_DSTATE = rtb_Cond_prev_private_a4; } /* 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_dv; uint32_t rtb_dt_l; int16_t tmp[6]; int16_t rtb_out_js[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_en[2]; uint16_t Blower_FR; uint16_t rtb_out_flm; 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_cuz; bool rtb_LogicalOperator3_c[9]; bool rtb_Compare; bool rtb_Compare_b; bool rtb_Compare_bj; bool rtb_Compare_cm4; bool rtb_Compare_g5; bool rtb_Compare_h; bool rtb_Compare_hb; bool rtb_Compare_ie; bool rtb_Compare_jh; bool rtb_Compare_l; bool rtb_Compare_n2; bool rtb_FailCond; 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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare = (rtb_Divide1 < 0.1); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_ie = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_FailCond = (rtb_Compare || rtb_Compare_ie); /* 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.pooled31, rtConstP.uDLookupTable_tableData, 1023U); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[10] = rtb_LogicalOperator1; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[11] = rtb_Compare; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[10] = rtb_Compare_ie; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[11] = 0U; } /* 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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_ie = (rtb_Divide1 < 0.1); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_g5 = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_Compare = (rtb_Compare_ie || rtb_Compare_g5); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_f = (rtb_Compare && (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.pooled31, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[12] = rtb_LogicalOperator1_f; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1_f) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[13] = rtb_Compare_ie; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[12] = rtb_Compare_g5; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[13] = 0U; } /* 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_Compare && (!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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_g5 = (rtb_Divide1 < 0.1); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_cm4 = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_Compare_ie = (rtb_Compare_g5 || rtb_Compare_cm4); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_k = (rtb_Compare_ie && (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.pooled31, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[14] = rtb_LogicalOperator1_k; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1_k) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[15] = rtb_Compare_g5; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[14] = rtb_Compare_cm4; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[15] = 0U; } /* 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_Compare_ie && (!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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_cm4 = (rtb_Divide1 < 0.1); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_n2 = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_Compare_g5 = (rtb_Compare_cm4 || rtb_Compare_n2); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_lk = (rtb_Compare_g5 && (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.pooled31, rtConstP.uDLookupTable_tableData_f, 1023U); } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[51] = rtb_LogicalOperator1_lk; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1_lk) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[50] = rtb_Compare_cm4; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[51] = rtb_Compare_n2; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[50] = 0U; } /* 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_Compare_g5 && (!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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_l = (rtb_Divide1 < 0.15); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_b = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_Compare_cm4 = (rtb_Compare_l || rtb_Compare_b); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_ca = (rtb_Compare_cm4 && (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.pooled31, rtConstP.pooled3, 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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_bj = (rtb_Divide3 < 0.15); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_hb = (rtb_Divide3 > 4.9); /* Logic: '/Logical Operator2' */ rtb_Compare_n2 = (rtb_Compare_bj || rtb_Compare_hb); /* Logic: '/Logical Operator3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator3_f3 = (rtb_Compare_n2 && (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.pooled31, rtConstP.pooled3, 1023U); } /* End of Switch: '/Switch1' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[2] = rtb_LogicalOperator1_ca; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1_ca) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[3] = rtb_Compare_l; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[2] = rtb_Compare_b; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[3] = 0U; } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[6] = rtb_LogicalOperator3_f3; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator3_f3) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[7] = rtb_Compare_bj; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[6] = rtb_Compare_hb; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[7] = 0U; } /* End of Switch: '/Switch' */ /* 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_Compare_cm4 && (!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_Compare_n2 && (!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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_bj = (rtb_Divide1 < 0.15); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_hb = (rtb_Divide1 > 4.9); /* Logic: '/Logical Operator' */ rtb_Compare_l = (rtb_Compare_bj || rtb_Compare_hb); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_lc = (rtb_Compare_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.pooled31, rtConstP.pooled3, 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; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_h = (rtb_Divide3 < 0.15); /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' */ rtb_Compare_jh = (rtb_Divide3 > 4.9); /* Logic: '/Logical Operator2' */ rtb_Compare_b = (rtb_Compare_h || rtb_Compare_jh); /* Logic: '/Logical Operator3' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator3_oi = (rtb_Compare_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.pooled31, rtConstP.pooled3, 1023U); } /* End of Switch: '/Switch1' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[4] = rtb_LogicalOperator1_lc; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator1_lc) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[5] = rtb_Compare_bj; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[4] = rtb_Compare_hb; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[5] = 0U; } /* End of Switch: '/Switch' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[8] = rtb_LogicalOperator3_oi; /* Switch: '/Switch' incorporates: * DataTypeConversion: '/Data Type Conversion' * Switch: '/Switch1' */ if (rtb_LogicalOperator3_oi) { /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion1' */ rtDW.dtc_state_error_model[9] = rtb_Compare_h; /* DataStoreWrite: '/Data Store Write1' incorporates: * DataTypeConversion: '/Data Type Conversion2' */ rtDW.dtc_state_error_model[8] = rtb_Compare_jh; } else { /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.dtc_state_error_model[9] = 0U; } /* End of Switch: '/Switch' */ /* 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_Compare_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_Compare_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_cuz = look2_iu8bu8s16lu64n32_binlcse(rtB.Merge_b, rtb_Gain_l, rtConstP.pooled59, rtConstP.pooled28, rtb_get_modes_for_levels, rtConstP.pooled22, 6U); /* MATLAB Function: '/Начальные положения заслонок left' */ left(rtb_u_cuz, 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_cuz) { 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_cuz = look2_iu8bu8s16lu64n32_binlcse(rtB.Merge_b, rtb_Gain2, rtConstP.pooled59, rtConstP.pooled28, rtb_get_modes_for_levels, rtConstP.pooled22, 6U); /* MATLAB Function: '/Начальные положения заслонок right' */ left(rtb_u_cuz, rtb_vals_m); /* SwitchCase: '/Switch for Left ' incorporates: * DataStoreRead: '/Data Store Read' */ switch (rtb_u_cuz) { 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 ' */ /* Outport: '/Out1' incorporates: * DataStoreRead: '/Data Store Read10' */ rtY.Out1 = CCU_Errors_Model; /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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 Write1' */ rtDW.COM_private[i] = 1U; /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 2U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Stop Mode\n'); */ printf("Stop Mode\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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; /* DataStoreWrite: '/Data Store Write1' */ rtDW.COM_private[i] = 2U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Initial CPOS Min\n'); */ printf("Initial CPOS Min\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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' */ rtDW.COM_private[i] = 1U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Normal Mode\n'); */ printf("Normal Mode\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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] = 0U; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private[i] = 3U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Move to position Min\n'); */ printf("Move to position Min\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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' */ /* Logic: '/Logical Operator3' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ for (i = 0; i < 9; i++) { rtb_LogicalOperator3_c[i] = ((Actuator_Ch0_Status_Model.in_Act_Stall_Slave[i] == 1) || (Actuator_Ch0_Status_Model.in_CPOS_ALL[i] == 0) || (rtDW.ErrorCalibration_private[i] == 0)); } /* End of Logic: '/Logical Operator3' */ /* Logic: '/Logical Operator' incorporates: * Logic: '/Logical Operator3' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && rtb_LogicalOperator3_c[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (Actuator_Ch0_Status_Model.Error_Connect == 0) && rtb_LogicalOperator1) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read1' */ if (rtDW.ErrorCalibration_private[i] != 0) { rtDW.MinPositionCh0_private[i] = Actuator_Ch0_Status_Model.in_CPOS_ALL[i]; } /* End of Switch: '/Switch' */ } /* 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: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Check Stall Min\n\r'); */ printf("Check Stall Min\n\r"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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 Write1' */ rtDW.COM_private[i] = 2U; /* DataStoreWrite: '/Data Store Write' */ rtDW.POS_private[i] = 0U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Initial CPOS Max\n'); */ printf("Initial CPOS Max\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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 Write1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (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; /* DataStoreWrite: '/Data Store Write1' incorporates: * Constant: '/Constant9' */ rtDW.COM_private[i] = 3U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge_l = (int8_t)(rtb_Switch_hx + 1); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Move to position Max\n'); */ printf("Move to position Max\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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' */ /* Logic: '/Logical Operator3' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read' * Logic: '/Logical Operator' * Logic: '/Logical Operator2' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ for (i = 0; i < 9; i++) { rtb_LogicalOperator3_c[i] = ((Actuator_Ch0_Status_Model.in_Act_Stall_Slave[i] == 1) || (Actuator_Ch0_Status_Model.in_CPOS_ALL[i] == 6000) || (rtDW.ErrorCalibration_private[i] == 0)); } /* End of Logic: '/Logical Operator3' */ /* Logic: '/Logical Operator1' incorporates: * Logic: '/Logical Operator3' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && rtb_LogicalOperator3_c[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator1' * SignalConversion generated from: '/Bus Selector' */ if ((Actuator_Ch0_Status_Model.Busy == 0) && (Actuator_Ch0_Status_Model.Error_Connect == 0) && rtb_LogicalOperator1) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read1' */ if (rtDW.ErrorCalibration_private[i] != 0) { rtDW.MaxPositionCh0_private[i] = Actuator_Ch0_Status_Model.in_CPOS_ALL[i]; } /* End of Switch: '/Switch' */ } /* 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: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : if(LOGGER == 2) */ if (rtDW.LOGGER_LIN == 2.0) { /* : fprintf('Check Stall MAX\n'); */ printf("Check Stall MAX\n"); fflush(stdout); } /* End of MATLAB Function: '/Write' */ /* 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: '/ACT1' * DataStoreRead: '/MAX ACT1T ' */ for (i = 0; i < 9; i++) { rtb_Divide1_ja[i] = (double)rtDW.MaxPositionCh0_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_LogicalOperator3_c[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)); } /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' * Logic: '/Logical Operator2' */ /* : fprintf("Homing 0\n"); */ printf("Homing 0\n"); fflush(stdout); /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : for i = 1:numel(MAX) */ for (i = 0; i < 9; i++) { /* : fprintf('ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ printf("ACT%d MAX = %d KOEF = %f Callibration = %d \n", (int16_t)(i + 1), rtDW.MaxPositionCh0_private[i], rtb_Divide1_ja[i], (int16_t)!rtb_LogicalOperator3_c[i]); fflush(stdout); } } /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator1' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 && rtb_LogicalOperator3_c[i + 1]); } /* Switch: '/Switch' incorporates: * Logic: '/Logical Operator1' */ if (rtb_LogicalOperator1) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h1 = 4; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_h1 = 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_LogicalOperator3_c[i] = (rtb_Divide1_ja[i] > 1.5); } /* End of RelationalOperator: '/Compare' */ /* Logic: '/Logical Operator' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_LogicalOperator3_c[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' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[i]; rtDW.COM_private[i] = rtb_LogicalOperator1; /* DataTypeConversion: '/Data Type Conversion2' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreWrite: '/Data Store Write3' * Logic: '/Logical Operator1' */ rtDW.ErrorActuator[i] = (uint8_t)(rtb_LogicalOperator1 || (rtDW.ErrorActuator[i] != 0)); /* DataStoreWrite: '/Data Store Write' */ rtDW.MODE_private[i] = 2U; } /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read6' */ /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : for i = 1:numel(ErrCallibration) */ for (i = 0; i < 9; i++) { /* : if ErrCallibration(i) == 1 */ if (rtb_LogicalOperator3_c[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' */ for (i = 0; i < 9; i++) { /* Logic: '/Logical Operator1' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[i]; /* 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)); /* DataStoreWrite: '/Data Store Write' incorporates: * DataTypeConversion: '/Data Type Conversion' */ rtDW.dtc_state_error_model[i + 54] = rtb_LogicalOperator1; } /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.stepSig_private = 1; /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' * DataStoreWrite: '/Data Store Write' */ /* : fprintf("Homing 1. Start Callibration \n"); */ printf("Homing 1. Start Callibration \n"); fflush(stdout); /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : for i = 1:numel(MAX) */ for (i = 0; i < 9; i++) { /* : if(ERRORS(i)==1) */ if (rtDW.ErrorCalibration_private[i] == 1) { /* : fprintf('ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ printf("ACT%d MAX = %d KOEF = %f Callibration = %d \n", (int16_t)(i + 1), rtDW.MaxPositionCh0_private[i], rtb_Divide1_ja[i], (int16_t)rtDW.ErrorCalibration_private[i]); fflush(stdout); } } } /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' incorporates: * DataStoreWrite: '/Data Store Write' */ rtb_LogicalOperator1 = (rtDW.ErrorCalibration_private[0] != 0); for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || (rtDW.ErrorCalibration_private[i + 1] != 0)); } /* Switch: '/Switch' incorporates: * Logic: '/Logical Operator2' */ if (rtb_LogicalOperator1) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h1 = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h1 = 4; } /* 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' */ 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_LogicalOperator3_c[i] = rtb_LogicalOperator1; /* DataTypeConversion: '/Data Type Conversion' incorporates: * DataStoreWrite: '/Data Store Write1' */ rtDW.ErrorCalibration_private[i] = rtb_LogicalOperator1; } /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' */ /* : fprintf("Homing 3. Callibration \n"); */ printf("Homing 3. Callibration \n"); fflush(stdout); /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : for i = 1:numel(MAX) */ for (i = 0; i < 9; i++) { /* : if(ERRORS(i)==1) */ if (rtb_LogicalOperator3_c[i]) { /* : fprintf('ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ printf("ACT%d MAX = %d KOEF = %f Callibration = %d \n", (int16_t)(i + 1), rtDW.MaxPositionCh0_private[i], rtb_Divide1_ja[i], 1); fflush(stdout); } } } /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_LogicalOperator3_c[i + 1]); } /* Switch: '/Switch' incorporates: * Logic: '/Logical Operator2' */ if (rtb_LogicalOperator1) { /* Merge: '/Merge' incorporates: * Constant: '/Constant3' */ rtB.Merge_h1 = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h1 = 4; } /* 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' */ /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read5' */ /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : fprintf("Homing 3. Start Time on step %d\n",int16(step)); */ rtb_Divide1 = rt_roundd(rtDW.ErrorHomming_private); if (rtb_Divide1 < 32768.0) { if (rtb_Divide1 >= -32768.0) { AMB = (int16_t)rtb_Divide1; } else { AMB = INT16_MIN; } } else { AMB = INT16_MAX; } printf("Homing 3. Start Time on step %d\n", AMB); fflush(stdout); } /* End of MATLAB Function: '/MAX POSITION' */ /* 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)); } /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_h; /* If: '/If' */ if (rtb_dt_dv > 30000U) { /* 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++; /* Merge: '/Merge' incorporates: * Constant: '/Constant1' * Merge: '/Merge' * SignalConversion generated from: '/Out1' */ rtB.Merge_h1 = 2; /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant1' * Merge: '/Merge' * SignalConversion generated from: '/Out1' */ rtB.Merge_h1 = 3; /* End of Outputs for SubSystem: '/If Action Subsystem1' */ } /* End of If: '/If' */ /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' */ /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : fprintf("Homing 3. Start TIme dt = %d \n",int32(data)); */ if (rtb_dt_dv > 2147483647U) { rtb_dt_dv = 2147483647U; } printf("Homing 3. Start TIme dt = %d \n", (int32_t)rtb_dt_dv); fflush(stdout); } /* End of MATLAB Function: '/MAX POSITION' */ /* Switch: '/Switch1' incorporates: * Constant: '/Constant' * Logic: '/AND' * 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_h = 0U; } /* End of Switch: '/Switch1' */ /* Update for UnitDelay: '/Cond_prev_private ' incorporates: * Logic: '/AND' */ rtDW.Cond_prev_private_DSTATE_d = 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' */ for (i = 0; i < 9; i++) { /* Logic: '/Logical Operator1' incorporates: * DataStoreRead: '/Data Store Read' */ rtb_Gain_l = rtDW.ErrorCalibration_private[i]; /* DataTypeConversion: '/Data Type Conversion1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write3' * Logic: '/Logical Operator1' */ rtDW.ErrorActuator[i] = (uint8_t)((rtb_Gain_l != 0) || (rtDW.ErrorActuator[i] != 0)); /* DataStoreWrite: '/Data Store Write' */ rtDW.dtc_state_error_model[i + 54] = rtb_Gain_l; /* DataStoreWrite: '/Data Store Write' */ rtDW.ErrorCalibration_private[i] = 0U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/Output' */ rtB.Merge_h1 = 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' */ /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.stepSig_private = 10; /* Merge: '/Merge' incorporates: * Constant: '/Constant1' * SignalConversion generated from: '/step' */ rtB.Merge_h1 = 5; /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' */ /* : if(LOGGER>0) */ if (rtDW.LOGGER_LIN > 0.0) { /* : fprintf("Homing. Callibration successful \n"); */ printf("Homing. Callibration successful \n"); fflush(stdout); } /* End of MATLAB Function: '/MAX POSITION' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem4' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write2' */ rtDW.stepHoming_private = rtB.Merge_h1; /* Merge: '/Merge' incorporates: * DataStoreRead: '/Data Store Read7' */ rtB.Merge_l = rtDW.stepSig_private; /* 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]; /* RelationalOperator: '/Compare' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read2' */ rtb_LogicalOperator3_c[i] = (rtDW.ErrorCalibration_private[i] == 0); } /* Logic: '/Logical Operator' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_c[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1 = (rtb_LogicalOperator1 || rtb_LogicalOperator3_c[i + 1]); } for (i = 0; i < 9; i++) { /* Switch: '/Switch1' incorporates: * Constant: '/Constant' * Constant: '/Constant3' * DataStoreRead: '/Data Store Read2' * DataStoreWrite: '/Data Store Write7' * Logic: '/Logical Operator' * Product: '/Product' */ if (rtb_LogicalOperator1) { rtDW.BUS_ADR_private[i] = (uint8_t)((uint32_t) rtDW.ErrorCalibration_private[i] * rtConstP.Constant3_Value[i]); } else { rtDW.BUS_ADR_private[i] = 0U; } /* End of Switch: '/Switch1' */ /* DataStoreWrite: '/Data Store Write' */ rtDW.COM_private[i] = 0U; } /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.LOGGER_LIN = 2.0; /* Outport: '/Out2' incorporates: * DataStoreRead: '/Data Store Read1' */ memcpy(&rtY.Out2[0], &rtDW.dtc_state_error_model[0], 127U * sizeof(uint8_t)); /* If: '/если SC front не завершен' incorporates: * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * DataTypeConversion: '/Data Type Conversion' */ if ((rtDW.start_control_finished_front == 0) && (rtDW.SKIPPED_FIRST_SIMULATION_STEP == 0.0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ rtDW.SKIPPED_FIRST_SIMULATION_STEP = 1.0; /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else 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 (Entry Condition)' 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_j(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' */ rtB.Merge_h = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_h = -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_j(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_h = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_h = -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_h = 0; /* 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_COOLANT ' */ g_assSTART_ENTER_COOLANT_p(rtB.Merge_b, &Incar_FL); /* Switch: '/Switch' incorporates: * Constant: '/AUTO' * DataStoreRead: '/Data Store Read' * DataStoreRead: '/Data Store Read1' * Logic: '/AND' * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator2' */ if ((rtDW.ECT < Incar_FL) && (rtDW.MODE_DRIVER == 1.0)) { /* Merge: '/Merge' incorporates: * Constant: '/Constant1' */ rtB.Merge_h = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_h = -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(&rtB.Merge_h, &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' */ Level4(&rtB.Merge_h, &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 (Entry Condition)' */ 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_h); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_h); /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_h); /* 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_cuz = 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_dv = (uint32_t)i - 2U; if ((uint32_t)i - 2U > (uint32_t)i) { rtb_dt_dv = 0U; } /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * MATLAB Function: '/g_assSTART_COOLANT_STEP0_TO_1 ' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_h = (int8_t)(rtDW.ECT > g_assSTART_COOLANT_STEP0_TO_1[(int32_t) rtb_dt_dv - 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_cuz = 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_h(rtB.Merge_b, &Incar_FL); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_h = (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_cuz = 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_h(rtB.Merge_b, &Incar_FL); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_h = (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_cuz); /* 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_pd > (uint16_t)(1000 * Blower_FR))) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' * SignalConversion generated from: '/step' */ rtB.Merge_h = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' * SignalConversion generated from: '/step' */ rtB.Merge_h = 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_g)) { rtDW.t_start_delay_private_DSTATE_pd = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_g = 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_cuz); /* 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_mk > (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_hs)) { rtDW.t_start_delay_private_DSTATE_mk = 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_h = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_h = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_hs = 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_h = 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_cuz); /* 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_en); /* MATLAB Function: '/ECT min max' */ ECTminmax(rtB.Merge_b, rtb_out_js); /* DataStoreWrite: '/Data Store Write6' incorporates: * DataStoreRead: '/engine coolant temp' * Lookup_n-D: '/blower для текущего ECT' */ rtDW.Blower_FL = look1_iu16bs16lu64n32_binlcse(rtDW.ECT, rtb_out_js, rtb_out_en, 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_l = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_fm; /* 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_fi)) { rtDW.t_start_delay_private_DSTATE_fm = 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_dv = (uint32_t)i - 3U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)i - 3U > (uint32_t)i) { rtb_dt_dv = 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_l > (uint32_t)(1000 * Eva_F)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[(int32_t)rtb_dt_dv - 1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step 2' */ rtB.Merge_h = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_h = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_fi = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level4_c(&rtB.Merge_h, &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_cuz, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level4_cw); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_c(&rtB.Merge_h, &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_cuz, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level5_g); /* 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_a(rtB.Merge_b, &rtb_u_cuz); /* 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_k) * (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_j(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_pb) * (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_j(rtB.Merge_b, &rtb_Gain2); /* MATLAB Function: '/time for step' */ timeforstep_g(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_mk) * (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_flm); /* 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_flm / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_gm) * (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 == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_g; /* 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_m)) { rtDW.t_start_delay_private_DSTATE_g = 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_dv > (uint32_t)(1000 * Incar_FL)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_h = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_h = 2; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_k = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_pb = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_mk = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_gm = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_m = 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_a(rtB.Merge_b, &rtb_u_cuz); /* 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_m) * (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_j(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_gf) * (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_j(rtB.Merge_b, &rtb_Gain2); /* MATLAB Function: '/time for step' */ timeforstep_g(rtB.Merge_b, &rtb_u_cuz); /* 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_cuz / 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_flm); /* 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_flm / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_p0) * (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 == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_m; /* 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_b3)) { rtDW.t_start_delay_private_DSTATE_m = 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_dv > (uint32_t)(1000 * Incar_FL)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_h = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_h = 2; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_m = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_gf = 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_p0 = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_b3 = 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_h = 3; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ Level3(&rtB.Merge_h, &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_cuz, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level3_l); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level3(&rtB.Merge_h, &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_cuz, &rtDW.step_start_controle_front, &rtDW.t_now, &rtDW.Level4_a); /* 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_a(rtB.Merge_b, &rtb_u_cuz); /* 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_f) * (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_j(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_pu) * (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_j(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' */ timeforstep_g(rtB.Merge_b, &rtb_u_cuz); /* 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_cuz / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_b) * (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_flm); /* 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_flm / (double)Blower_FR / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_e) * (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 == 2); /* 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_n > (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_iy)) { rtDW.t_start_delay_private_DSTATE_n = 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_h = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_h = 2; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_f = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_pu = 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_e = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_iy = 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 F' incorporates: * ActionPort: '/Action Port' */ Step3F(&rtB.Merge_h, &rtDW.start_control_finished_front); /* End of Outputs for SubSystem: '/Step 3 F' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write' */ rtDW.step_start_controle_front = rtB.Merge_h; /* 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 R (Entry Condition)' 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_b(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_c = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_c = -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_p(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read4' */ g_ausSTART_ENTER_SETTEMP_b(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_c = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_c = -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_p(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_ausSTART_ENTER_SETTEMP' incorporates: * DataStoreRead: '/Data Store Read4' */ g_ausSTART_ENTER_SETTEMP_b(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_c = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_c = -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_p(rtB.Merge_b, &Incar_FL); /* MATLAB Function: '/g_assSTART_ENTER_COOLANT ' incorporates: * DataStoreRead: '/Data Store Read3' */ g_assSTART_ENTER_COOLANT_e(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_c = 0; } else { /* Merge: '/Merge' incorporates: * Constant: '/Constant' */ rtB.Merge_c = -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_e(&rtB.Merge_c, &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_e(&rtB.Merge_c, &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 R (Entry Condition)' */ break; case 0: /* Outputs for IfAction SubSystem: '/Step 0 R' 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_c); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0(&rtB.Merge_c); /* 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_i(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_c(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_c = (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_i(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_c(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_e(rtB.Merge_b, &Incar_RR); /* Merge: '/Merge' incorporates: * DataStoreRead: '/Engine coolant temp' * RelationalOperator: '/Relational Operator' * Switch: '/Switch' */ rtB.Merge_c = (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_m(&rtB.Merge_c, &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_cuz); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_m(&rtB.Merge_c, &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_cuz); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 0 R' */ break; case 1: /* Outputs for IfAction SubSystem: '/Step 1 R' 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_b(&rtB.Merge_c, &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_bc); /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ Level0_b(&rtB.Merge_c, &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_d3); /* 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_i(rtB.Merge_b, &rtDW.Mode_RR); incarfilterdown_c(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_en); /* 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_js[0] = g_assSTART_COOLANT_STEP0_TO_1[4]; rtb_out_js[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_js, rtb_out_en, 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_j(rtB.Merge_b, &Incar_FL); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_em; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_l(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_cp)) { rtDW.t_start_delay_private_DSTATE_em = 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_dv > (uint16_t)(1000 * AMB)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_c = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_c = 1; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_cp = 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_i(rtB.Merge_b, &rtDW.Mode_RR); incarfilterdown_c(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_en); /* MATLAB Function: '/ECT min max' incorporates: * DataStoreRead: '/Data Store Read7' */ ECTminmax_l(rtB.Merge_b, rtb_out_js); /* Lookup_n-D: '/blower для текущего ECT' incorporates: * DataStoreRead: '/engine coolant temp' * DataStoreWrite: '/Data Store Write5' */ rtDW.Blower_RR = look1_iu16bs16lu64n32_binlcse(rtDW.ECT, rtb_out_js, rtb_out_en, 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_j(rtB.Merge_b, &Incar_FL); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_o; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_l(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_a)) { rtDW.t_start_delay_private_DSTATE_o = 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_dv > (uint16_t)(1000 * AMB)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[2])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_c = 2; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step 1' */ rtB.Merge_c = 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_d(&rtB.Merge_c, &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_dp); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level4_d(&rtB.Merge_c, &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_f); /* End of Outputs for SubSystem: '/Level 5' */ break; } /* End of SwitchCase: '/Switch Case' */ /* End of Outputs for SubSystem: '/Step 1 R' */ break; case 2: /* Outputs for IfAction SubSystem: '/Step 2 R' 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: '/2 way valve' incorporates: * DataStoreRead: '/Data Store Read6' */ uwayvalve(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_jn(rtB.Merge_b, &rtb_Gain2); /* 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)(rtDW.Dtg_RR - rtDW.Dtg_logic_RR) <= 0.01) { rtDW.Dtg_RR = rtDW.Dtg_logic_RR; } else { if (rtDW.Dtg_RR <= rtDW.Dtg_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Dtg_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_d) * (double)i + (double)rtDW.Dtg_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/incar filter up' incorporates: * DataStoreRead: '/Data Store Read1' */ incarfilterup_i(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_c(rtB.Merge_b, &rtb_Gain_l); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain2 = (uint8_t)(rtDW.Mode_RR - rtDW.Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (rtb_Gain2 <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_a(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(rtB.Merge_b, &rtb_Gain2); /* 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_LogicalOperator1) { rtDW.Mode_RR = rtDW.Mode_logic_RR; } else { if (rtDW.Mode_RR <= rtDW.Mode_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Mode_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_nc) * (double)i + (double)rtDW.Mode_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep_d(rtB.Merge_b, &Blower_FR); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_l(rtB.Merge_b, &rtb_out_flm); /* 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)(rtDW.Blower_RR - rtDW.Blower_logic_RR) <= 0.01) { rtDW.Blower_RR = rtDW.Blower_logic_RR; } else { if (rtDW.Blower_RR <= rtDW.Blower_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Blower_RR = (uint16_t)((double)Blower_FR / (double)rtb_out_flm / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_hs) * (double)i + (double)rtDW.Blower_RR); } /* End of Switch: '/Switch' */ /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_rear == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_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_i5)) { rtDW.t_start_delay_private_DSTATE_f = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_l(rtB.Merge_b, &Incar_RR); /* Switch: '/Switch' incorporates: * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ if (rtb_dt_dv > (uint16_t)(1000 * Incar_RR)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_c = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_c = 2; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_d = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_nc = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_hs = rtDW.t_now; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_i5 = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 0' */ break; case 1: /* Outputs for IfAction SubSystem: '/Level 1' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/2 way valve' incorporates: * DataStoreRead: '/Data Store Read6' */ uwayvalve(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_jn(rtB.Merge_b, &rtb_Gain2); /* 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)(rtDW.Dtg_RR - rtDW.Dtg_logic_RR) <= 0.01) { rtDW.Dtg_RR = rtDW.Dtg_logic_RR; } else { if (rtDW.Dtg_RR <= rtDW.Dtg_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Dtg_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_g) * (double)i + (double)rtDW.Dtg_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/incar filter up' incorporates: * DataStoreRead: '/Data Store Read1' */ incarfilterup_i(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_c(rtB.Merge_b, &rtb_Gain_l); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain2 = (uint8_t)(rtDW.Mode_RR - rtDW.Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (rtb_Gain2 <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_a(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(rtB.Merge_b, &rtb_Gain2); /* 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_LogicalOperator1) { rtDW.Mode_RR = rtDW.Mode_logic_RR; } else { if (rtDW.Mode_RR <= rtDW.Mode_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Mode_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_p) * (double)i + (double)rtDW.Mode_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep_d(rtB.Merge_b, &Blower_FR); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_l(rtB.Merge_b, &rtb_out_flm); /* 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)(rtDW.Blower_RR - rtDW.Blower_logic_RR) <= 0.01) { rtDW.Blower_RR = rtDW.Blower_logic_RR; } else { if (rtDW.Blower_RR <= rtDW.Blower_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Blower_RR = (uint16_t)((double)Blower_FR / (double)rtb_out_flm / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_j) * (double)i + (double)rtDW.Blower_RR); } /* End of Switch: '/Switch' */ /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_rear == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_jh; /* 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_jk)) { rtDW.t_start_delay_private_DSTATE_jh = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_l(rtB.Merge_b, &Incar_RR); /* Switch: '/Switch' incorporates: * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ if (rtb_dt_dv > (uint16_t)(1000 * Incar_RR)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_c = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_c = 2; } /* End of Switch: '/Switch' */ /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_g = rtDW.t_now; /* Update for UnitDelay: '/Unit Delay' incorporates: * DataStoreRead: '/текущее время в мс' */ rtDW.UnitDelay_DSTATE_p = 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_jk = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 1' */ break; case 2: /* Outputs for IfAction SubSystem: '/Level 2' incorporates: * ActionPort: '/Action Port' */ /* MATLAB Function: '/2 way valve' incorporates: * DataStoreRead: '/Data Store Read6' */ uwayvalve(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read8' */ Dtg_rear(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read8' */ timeforstep_jn(rtB.Merge_b, &rtb_Gain2); /* 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)(rtDW.Dtg_RR - rtDW.Dtg_logic_RR) <= 0.01) { rtDW.Dtg_RR = rtDW.Dtg_logic_RR; } else { if (rtDW.Dtg_RR <= rtDW.Dtg_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Dtg_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE) * (double)i + (double)rtDW.Dtg_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/incar filter up' incorporates: * DataStoreRead: '/Data Store Read1' */ incarfilterup_i(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/incar filter down' incorporates: * DataStoreRead: '/Data Store Read2' */ incarfilterdown_c(rtB.Merge_b, &rtb_Gain_l); /* Sum: '/Add' incorporates: * DataStoreRead: '/Текущее значение blower ' * DataStoreRead: '/значение auto (в соответствии с логикой)' */ rtb_Gain2 = (uint8_t)(rtDW.Mode_RR - rtDW.Mode_logic_RR); /* RelationalOperator: '/Relational Operator' incorporates: * Constant: '/epsilon' */ rtb_LogicalOperator1 = (rtb_Gain2 <= 0.01); /* MATLAB Function: '/step' incorporates: * DataStoreRead: '/Data Store Read5' */ step_a(rtB.Merge_b, &rtb_Gain_l); /* MATLAB Function: '/time for step' incorporates: * DataStoreRead: '/Data Store Read5' */ timeforstep_h(rtB.Merge_b, &rtb_Gain2); /* 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_LogicalOperator1) { rtDW.Mode_RR = rtDW.Mode_logic_RR; } else { if (rtDW.Mode_RR <= rtDW.Mode_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Mode_RR = (uint8_t)((double)rtb_Gain_l / (double)rtb_Gain2 / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_h) * (double)i + (double)rtDW.Mode_RR); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/blower step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowerstep_d(rtB.Merge_b, &Blower_FR); /* MATLAB Function: '/blower time for step' incorporates: * DataStoreRead: '/Data Store Read7' */ blowertimeforstep_l(rtB.Merge_b, &rtb_out_flm); /* 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)(rtDW.Blower_RR - rtDW.Blower_logic_RR) <= 0.01) { rtDW.Blower_RR = rtDW.Blower_logic_RR; } else { if (rtDW.Blower_RR <= rtDW.Blower_logic_RR) { /* Switch: '/Switch' incorporates: * Constant: '/Constant' */ i = 1; } else { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ i = -1; } rtDW.Blower_RR = (uint16_t)((double)Blower_FR / (double)rtb_out_flm / 1000.0 * (double)(rtDW.t_now - rtDW.UnitDelay_DSTATE_n) * (double)i + (double)rtDW.Blower_RR); } /* End of Switch: '/Switch' */ /* RelationalOperator: '/Equal' incorporates: * DataStoreRead: '/current step' */ rtb_LogicalOperator1 = (rtDW.step_start_controle_rear == 2); /* Sum: '/Subtract' incorporates: * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ rtb_dt_dv = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_ed; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' */ Timegotofromstep1tostep2_l(rtB.Merge_b, &Incar_RR); /* 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_ei)) { rtDW.t_start_delay_private_DSTATE_ed = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read' * Gain: '/из сек в мс' * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator1' */ if ((rtb_dt_dv > (uint16_t)(1000 * Incar_RR)) || rtDW.HI_logic_on) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ rtB.Merge_c = 3; } else { /* Merge: '/Merge' incorporates: * Constant: '/stay at step' */ rtB.Merge_c = 2; } /* 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_h = 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_ei = rtb_LogicalOperator1; /* End of Outputs for SubSystem: '/Level 2' */ break; case 3: /* Outputs for IfAction SubSystem: '/Level 3' incorporates: * ActionPort: '/Action Port' */ Level3_i(&rtB.Merge_c, &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_i0); /* End of Outputs for SubSystem: '/Level 3' */ break; case 4: /* Outputs for IfAction SubSystem: '/Level 4' incorporates: * ActionPort: '/Action Port' */ Level3_i(&rtB.Merge_c, &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_j); /* End of Outputs for SubSystem: '/Level 4' */ break; case 5: /* Outputs for IfAction SubSystem: '/Level 5' incorporates: * ActionPort: '/Action Port' */ Level3_i(&rtB.Merge_c, &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 R' */ break; case 3: /* Outputs for IfAction SubSystem: '/Step 3 R' incorporates: * ActionPort: '/Action Port' */ Step3F(&rtB.Merge_c, &rtDW.start_control_finished_front); /* End of Outputs for SubSystem: '/Step 3 R' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Data Store Write' */ rtDW.step_start_controle_rear = rtB.Merge_c; /* End of Outputs for SubSystem: '/Start Control Rear' */ } /* End of If: '/если SC rear не завершен1' */ /* 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_Compare; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_i = rtb_Compare_ie; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_e = rtb_Compare_g5; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_c = rtb_Compare_cm4; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_b = rtb_Compare_n2; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_j = rtb_Compare_l; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_f = rtb_Compare_b; } /* Model initialize function */ void HVAC_model_initialize(void) { /* Registration code */ /* initialize error status */ rtmSetErrorStatus(rtM, (NULL)); /* block I/O */ (void) memset(((void *) &rtB), 0, sizeof(B)); /* states (dwork) */ (void) memset((void *)&rtDW, 0, sizeof(DW)); /* exported global states */ Actuator_Ch1_Status_Model = HVAC_model_rtZActuatorCmdBusInput; Actuator_Ch2_Status_Model = HVAC_model_rtZActuatorCmdBusInput; Actuator_Ch0_Status_Model = HVAC_model_rtZActuatorCmdBusInput; Actuator_Ch0_Command_Model = HVAC_model_rtZActuatorCmdBus; Status_Sensor_Model = HVAC_model_rtZCmdBusStatus; CCU_Errors_Model = HVAC_model_rtZCmdBusError; PWM_Get = HVAC_model_rtZCmdBusPWMGet; { 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 Merge: '/Merge' */ rtB.Merge_b = 0U; /* SystemInitialize for MATLAB Function: '/Log Ambient Lv' */ rtDW.current_Ambient_Lv_not_empty = false; /* SystemInitialize for IfAction SubSystem: '/Homing' */ /* SystemInitialize for Merge: '/Merge' */ rtB.Merge_h1 = 0; /* End of SystemInitialize for SubSystem: '/Homing' */ /* SystemInitialize for Merge: '/Merge' */ rtB.Merge_l = 0; /* SystemInitialize for IfAction SubSystem: '/Start Control Front' */ /* SystemInitialize for Merge: '/Merge' */ rtB.Merge_h = 0; /* End of SystemInitialize for SubSystem: '/Start Control Front' */ /* SystemInitialize for IfAction SubSystem: '/Start Control Rear' */ /* SystemInitialize for Merge: '/Merge' */ rtB.Merge_c = 0; /* End of SystemInitialize for SubSystem: '/Start Control Rear' */ } } /* Model terminate function */ void HVAC_model_terminate(void) { /* (no terminate code required) */ } /* * File trailer for generated code. * * [EOF] */