/* * File: Model_actuator.c * * Code generated for Simulink model 'Model_actuator'. * * Model version : 1.588 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 * C/C++ source code generated on : Thu Feb 12 13:08:42 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 "Model_actuator.h" #include #include "Model_actuator_private.h" #include #include "Model_actuator_types.h" /* Exported block states */ ActuatorCmdBus controllerData; /* '/Data Store Memory15' */ CmdBusStatus Status_Sensor_Model; /* '/Data Store Memory' */ CmdBusError CCU_Errors_Model; /* '/Data Store Memory3' */ /* Block signals (default storage) */ B rtB; /* Block states (default storage) */ DW rtDW; /* Real-time model */ static RT_MODEL rtM_; RT_MODEL *const rtM = &rtM_; 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; } /* * Output and update for action system: * '/If Action Subsystem3' * '/If Action Subsystem3' * '/If Action Subsystem3' * '/If Action Subsystem3' * '/If Action Subsystem3' * '/If Action Subsystem3' * '/If Action Subsystem3' */ void IfActionSubsystem3(int8_t rtu_stepIn, int8_t *rty_step, uint8_t rtd_com_loc[9]) { int32_t i; /* DataStoreWrite: '/Data Store Write3' */ for (i = 0; i < 9; i++) { rtd_com_loc[i] = 0U; } /* End of DataStoreWrite: '/Data Store Write3' */ /* SignalConversion generated from: '/stepIn' */ *rty_step = rtu_stepIn; } /* * Output and update for atomic system: * '/MAX POSITION' * '/MAX POSITION' */ void MAXPOSITION(const int16_t rtu_step[9], int16_t rty_y[9]) { int32_t i; /* : y = step; */ for (i = 0; i < 9; i++) { rty_y[i] = rtu_step[i]; } /* : fprintf('SIMULINK POSITION '); */ printf("SIMULINK POSITION "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtu_step[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* * Output and update for atomic system: * '/MAX POSITION1' * '/MAX POSITION1' */ void MAXPOSITION1(const int8_t rtu_step[9], int8_t rty_y[9]) { int32_t i; /* : y = step; */ for (i = 0; i < 9; i++) { rty_y[i] = rtu_step[i]; } /* : fprintf('SIMULINK Stall_Slave '); */ printf("SIMULINK Stall_Slave "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", (int16_t)rtu_step[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); } /* Model step function */ void Model_actuator_step(void) { double rtb_Divide1; int32_t i; int16_t rtb_y_ff[9]; int16_t rtb_Switch_f; int8_t rtb_y_b[9]; bool rtb_RelationalOperator_j[9]; bool rtb_FailCond; bool rtb_LogicalOperator1; bool rtb_LogicalOperator1_b; bool rtb_LogicalOperator1_f; bool rtb_LogicalOperator1_i; bool rtb_LogicalOperator1_k; bool rtb_LogicalOperator1_ln; bool rtb_LogicalOperator1_n; bool tmp; /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Ambient_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_FailCond = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1 = (rtb_FailCond && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE >= 3000U)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1) { rtb_Switch_f = 100; } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Ambient_Temp, rtConstP.pooled14, rtConstP.uDLookupTable_tableData, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write Ambient' */ /* : fprintf('Ambient = %d * 0.1�C\n',Ambient); */ printf("Ambient = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : if(AmbientErr) */ if (rtb_LogicalOperator1) { /* : fprintf('CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %u\n',Sensor_Ambient_Temp); */ printf("CCU_Body_Err.CCU_AmbienTemptSenErr_Stat = 0x1 (Failure), Sensor_Ambient_Temp = %u\n", rtDW.ADC_Data_Model.Sensor_Ambient_Temp); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator3' * Logic: '/Logical Operator4' * UnitDelay: '/Cond_prev_private ' * UnitDelay: '/t_start_delay_private ' */ if (rtb_FailCond && (!rtDW.Cond_prev_private_DSTATE)) { rtDW.t_start_delay_private_DSTATE = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Evap_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1 = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * Constant: '/Constant' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator1' * Lookup_n-D: '/1-D Lookup Table' * MATLAB Function: '/Write ERROR' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ /* : if(EvapFErr) */ if (rtb_LogicalOperator1 && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_p >= 3000U)) { rtb_Switch_f = -100; /* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %u\n',Sensor_Evap_Temp); */ printf("CCU_Body_Err.CCU_EvaTempSenErrF_Stat = 0x1 (Failure), Sensor_Evap_Temp = %u\n", rtDW.ADC_Data_Model.Sensor_Evap_Temp); fflush(stdout); } else { rtb_Switch_f = look1_iu16tdIs16_binlcs(rtDW.ADC_Data_Model.Sensor_Evap_Temp, rtConstP.pooled14, rtConstP.pooled1, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write Eva_F' */ /* : fprintf('Eva_F = %d * 0.1�C\n',Eva_F); */ printf("Eva_F = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_h)) { rtDW.t_start_delay_private_DSTATE_p = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1_f = ((rtb_Divide1 < 0.1) || (rtb_Divide1 > 4.9)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * Constant: '/Constant' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator1' * Lookup_n-D: '/1-D Lookup Table' * MATLAB Function: '/Write ERROR' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ /* : if(EvapRErr) */ if (rtb_LogicalOperator1_f && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_pk >= 3000U)) { rtb_Switch_f = -100; /* : fprintf('CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %u\n',Sensor_Rear_Evap_Temp); */ printf("CCU_Body_Err.CCU_EvaTempSenErrR_Stat = 0x1 (Failure), Sensor_Rear_Evap_Temp = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp); fflush(stdout); } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Rear_Evap_Temp, rtConstP.pooled14, rtConstP.pooled1, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write Eva_F' */ /* : fprintf('Eva_R = %d * 0.1�C\n',Eva_R); */ printf("Eva_R = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_f && (!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_Incar_Temp_FL / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1_k = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * Constant: '/Constant' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator1' * Lookup_n-D: '/1-D Lookup Table' * MATLAB Function: '/Write ERROR' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ /* : if(IncarFLErr) */ if (rtb_LogicalOperator1_k && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_b >= 3000U)) { rtb_Switch_f = 200; /* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %u\n',Sensor_Incar_Temp_FL); */ printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_FL = %u\n", rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL); fflush(stdout); } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Incar_Temp_FL, rtConstP.pooled14, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write IncarFL' */ /* : fprintf('IncarFL = %d * 0.1�C\n',IncarFL); */ printf("IncarFL = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_k && (!rtDW.Cond_prev_private_DSTATE_c)) { rtDW.t_start_delay_private_DSTATE_b = rtDW.t_now; } /* End of Switch: '/Switch' */ /* Product: '/Divide1' incorporates: * Constant: '/Constant' * Constant: '/Constant1' * DataStoreRead: '/Data Store Read1' * Product: '/Divide' */ rtb_Divide1 = (double)rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1_b = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * Constant: '/Constant' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator1' * Lookup_n-D: '/1-D Lookup Table' * MATLAB Function: '/Write ERROR' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ /* : if(IncarFRErr) */ if (rtb_LogicalOperator1_b && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_g >= 3000U)) { rtb_Switch_f = 200; /* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %u\n',Sensor_Incar_Temp_FR); */ printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_FR = %u\n", rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR); fflush(stdout); } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Incar_Temp_FR, rtConstP.pooled14, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write IncarFR' */ /* : fprintf('IncarFR = %d * 0.1�C\n',IncarFR); */ printf("IncarFR = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_b && (!rtDW.Cond_prev_private_DSTATE_hm)) { rtDW.t_start_delay_private_DSTATE_g = 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_RL / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1_ln = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * Constant: '/Constant' * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read4' * Logic: '/Logical Operator1' * Lookup_n-D: '/1-D Lookup Table' * MATLAB Function: '/Write ERROR' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ /* : if(IncarRLErr) */ if (rtb_LogicalOperator1_ln && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_j >= 3000U)) { rtb_Switch_f = 200; /* : fprintf('CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %u\n',Sensor_Incar_Temp_RL); */ printf("CCU_Body_Err.CCU_IncarTempErrF_Stat = 0x1 (Failure), Sensor_Incar_Temp_RL = %u\n", rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL); fflush(stdout); } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Incar_Temp_RL, rtConstP.pooled14, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write IncarRL' */ /* : fprintf('IncarRL = %d * 0.1�C\n',IncarRL); */ printf("IncarRL = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_ln && (!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_RR / 4095.0 * 5.0; /* Logic: '/Logical Operator' incorporates: * Constant: '/Constant' * Constant: '/Constant' * RelationalOperator: '/Compare' * RelationalOperator: '/Compare' */ rtb_LogicalOperator1_i = ((rtb_Divide1 < 0.15) || (rtb_Divide1 > 4.9)); /* Logic: '/Logical Operator1' incorporates: * Constant: '/Constant' * DataStoreRead: '/Data Store Read4' * RelationalOperator: '/Compare' * Sum: '/Subtract' * UnitDelay: '/t_start_delay_private ' */ rtb_LogicalOperator1_n = (rtb_LogicalOperator1_i && (rtDW.t_now - rtDW.t_start_delay_private_DSTATE_c >= 3000U)); /* BusCreator: '/Bus Creator' incorporates: * DataStoreWrite: '/Data Store Write' * DataTypeConversion: '/Data Type Conversion' */ CCU_Errors_Model.CCU_IncarTempErrF_Stat = 0U; CCU_Errors_Model.CCU_IncarTempErrR_Stat = rtb_LogicalOperator1_n; CCU_Errors_Model.CCU_DuctTempSenErrF_Stat = 0U; CCU_Errors_Model.CCU_DuctTempSenErrR_Stat = 0U; CCU_Errors_Model.CCU_EvaTempSenErrF_Stat = 0U; CCU_Errors_Model.CCU_EvaTempSenErrR_Stat = 0U; CCU_Errors_Model.CCU_DeflectorSwErrF_Stat = 0U; CCU_Errors_Model.CCU_DeflectorSwErrR_Stat = 0U; CCU_Errors_Model.CCU_PressSenErr_Stat = 0U; CCU_Errors_Model.CCU_AmbienTemptSenErr_Stat = 0U; 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 = 0U; 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; /* Switch: '/Switch' incorporates: * Constant: '/Constant2' * DataStoreRead: '/Data Store Read1' * Lookup_n-D: '/1-D Lookup Table' */ if (rtb_LogicalOperator1_n) { rtb_Switch_f = 200; } else { rtb_Switch_f = look1_iu16tdIs16_binlcs (rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR, rtConstP.pooled14, rtConstP.pooled2, 1023U); } /* End of Switch: '/Switch' */ /* BusCreator: '/Bus Creator' incorporates: * DataStoreWrite: '/Data Store Write' */ Status_Sensor_Model.Battery = 0; Status_Sensor_Model.AMB = 0; Status_Sensor_Model.Incar_FL = 0; Status_Sensor_Model.Incar_FR = 0; Status_Sensor_Model.Incar_RL = 0; Status_Sensor_Model.Incar_RR = rtb_Switch_f; Status_Sensor_Model.Eva_F = 0; Status_Sensor_Model.Eva_R = 0; Status_Sensor_Model.Pressure = 0; 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; /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : if(IncarRRErr) */ if (rtb_LogicalOperator1_n) { /* : fprintf('CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %u\n',Sensor_Incar_Temp_RR); */ printf("CCU_Body_Err.CCU_IncarTempErrR_Stat = 0x1 (Failure), Sensor_Incar_Temp_RR = %u\n", rtDW.ADC_Data_Model.Sensor_Incar_Temp_RR); fflush(stdout); } /* End of MATLAB Function: '/Write ERROR' */ /* MATLAB Function: '/Write IncarFL' */ /* : fprintf('IncarRR = %d * 0.1�C\n',IncarRR); */ printf("IncarRR = %d * 0.1�C\n", rtb_Switch_f); fflush(stdout); /* 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_i && (!rtDW.Cond_prev_private_DSTATE_g)) { rtDW.t_start_delay_private_DSTATE_c = rtDW.t_now; } /* End of Switch: '/Switch' */ /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5120_2EKA_ShutoffValvePowerTXV1 = %u\n',data); */ printf("ACP BTS5120_2EKA_ShutoffValvePowerTXV1 = %u\n", rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV1); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5120_2EKA_ShutoffValvePowerTXV2 = %u\n',data); */ printf("ACP BTS5120_2EKA_ShutoffValvePowerTXV2 = %u\n", rtDW.ADC_Data_Model.BTS5120_2EKA_ShutoffValvePowerTXV2); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_ChannelPTCPower1 = %u\n',data); */ printf("ACP BTS5180_2EKA_ChannelPTCPower1 = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower1); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_ChannelPTCPower2 = %u\n',data); */ printf("ACP BTS5180_2EKA_ChannelPTCPower2 = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_ChannelPTCPower2); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_FrontIncarMotor = %u\n',data); */ printf("ACP BTS5180_2EKA_FrontIncarMotor = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_FrontIncarMotor); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_RearIncarMotor = %u\n',data); */ printf("ACP BTS5180_2EKA_RearIncarMotor = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_RearIncarMotor); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_ReservePowerSupply = %u\n',data); */ printf("ACP BTS5180_2EKA_ReservePowerSupply = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_ReservePowerSupply); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_ShutOFFValveFront = %u\n',data); */ printf("ACP BTS5180_2EKA_ShutOFFValveFront = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveFront); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_ShutOFFValveRear = %u\n',data); */ printf("ACP BTS5180_2EKA_ShutOFFValveRear = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_ShutOFFValveRear); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP BTS5180_2EKA_TwoWayValve = %u\n',data); */ printf("ACP BTS5180_2EKA_TwoWayValve = %u\n", rtDW.ADC_Data_Model.BTS5180_2EKA_TwoWayValve); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP IGN_ANS = %u\n',IGN_ANS); */ printf("ACP IGN_ANS = %u\n", rtDW.ADC_Data_Model.IGN_ANS); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Ignition = %u\n',Ignition); */ // printf("ACP Ignition = %u\n", rtDW.ADC_Data_Model.Ignition); // fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP PBATT_CHECK = %u\n',data); */ printf("ACP PBATT_CHECK = %u\n", rtDW.ADC_Data_Model.PBATT_CHECK); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Pressure_DIAG = %u\n',data); */ printf("ACP Pressure_DIAG = %u\n", rtDW.ADC_Data_Model.Pressure_DIAG); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Reserve_Sensor_Duct_Temp_1 = %u\n',data); */ printf("ACP Reserve_Sensor_Duct_Temp_1 = %u\n", rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_1); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Reserve_Sensor_Duct_Temp_2 = %u\n',data); */ printf("ACP Reserve_Sensor_Duct_Temp_2 = %u\n", rtDW.ADC_Data_Model.Reserve_Sensor_Duct_Temp_2); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_AC_Pressure = %u\n',Sensor_AC_Pressure); */ printf("ACP Sensor_AC_Pressure = %u\n", rtDW.ADC_Data_Model.Sensor_AC_Pressure); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct1 = %u\n',Sensor_Front_Duct1); */ printf("ACP Sensor_Front_Duct1 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct1); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct2 = %u\n',Sensor_Front_Duct2); */ printf("ACP Sensor_Front_Duct2 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct2); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct3 = %u\n',Sensor_Front_Duct3); */ printf("ACP Sensor_Front_Duct3 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct3); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct4 = %u\n',Sensor_Front_Duct4); */ printf("ACP Sensor_Front_Duct4 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct4); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct5 = %u\n',data); */ printf("ACP Sensor_Front_Duct5 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct5); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Front_Duct6 = %u\n',data); */ printf("ACP Sensor_Front_Duct6 = %u\n", rtDW.ADC_Data_Model.Sensor_Front_Duct6); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct1 = %u\n',Sensor_Rear_Duct1); */ printf("ACP Sensor_Rear_Duct1 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct1); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct2 = %u\n',Sensor_Rear_Duct2); */ printf("ACP Sensor_Rear_Duct2 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct2); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct3 = %u\n',Sensor_Rear_Duct3); */ printf("ACP Sensor_Rear_Duct3 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct3); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct4 = %u\n',Sensor_Rear_Duct4); */ printf("ACP Sensor_Rear_Duct4 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct4); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct5 = %u\n',Sensor_Rear_Duct5); */ printf("ACP Sensor_Rear_Duct5 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct5); fflush(stdout); /* MATLAB Function: '/Write Ignition' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP Sensor_Rear_Duct6 = %u\n',Sensor_Rear_Duct6); */ printf("ACP Sensor_Rear_Duct6 = %u\n", rtDW.ADC_Data_Model.Sensor_Rear_Duct6); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB = %u\n',data); */ printf("ACP VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB = %u\n", rtDW.ADC_Data_Model.VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP VN7008AJ_DIAG_RearLINActuatorPowerDriverC = %u\n',data); */ printf("ACP VN7008AJ_DIAG_RearLINActuatorPowerDriverC = %u\n", rtDW.ADC_Data_Model.VN7008AJ_DIAG_RearLINActuatorPowerDriverC); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP VN7008AJ_FrontLINActuatorPowerDriverAB = %u\n',data); */ printf("ACP VN7008AJ_FrontLINActuatorPowerDriverAB = %u\n", rtDW.ADC_Data_Model.VN7008AJ_FrontLINActuatorPowerDriverAB); fflush(stdout); /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read1' */ /* : fprintf('ACP VN7008AJ_RearLINActuatorPowerDriverC = %u\n',data); */ printf("ACP VN7008AJ_RearLINActuatorPowerDriverC = %u\n", rtDW.ADC_Data_Model.VN7008AJ_RearLINActuatorPowerDriverC); fflush(stdout); /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read' */ if (rtDW.stepSig < 1) { /* Switch: '/Switch' incorporates: * Constant: '/Constant1' */ rtDW.UnitDelay_DSTATE = 1; } /* End of Switch: '/Switch' */ /* SwitchCase: '/Switch Case' */ switch (rtDW.UnitDelay_DSTATE) { case 1: /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ /* If: '/If1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write2' */ rtDW.mode_loc[i] = 2U; /* DataStoreWrite: '/Data Store Write3' */ rtDW.com_loc[i] = 1U; } /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* MATLAB Function: '/stop mode' */ /* : y = step; */ /* : fprintf('SIMULINK Stop Mode\n'); */ printf("SIMULINK Stop Mode\n"); fflush(stdout); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* 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 Read' * DataStoreRead: '/Data Store Read1' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.pos_loc[i] = 6000U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.com_loc[i] = 2U; } /* MATLAB Function: '/Initial CPOS Min' */ /* : y = step; */ /* : fprintf('SIMULINK Initial CPOS Min - 6000\n'); */ printf("SIMULINK Initial CPOS Min - 6000\n"); fflush(stdout); /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Merge: '/Merge' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write3' */ for (i = 0; i < 9; i++) { rtDW.com_loc[i] = 0U; } /* End of DataStoreWrite: '/Data Store Write3' */ /* Merge: '/Merge' incorporates: * Merge: '/Merge' * SignalConversion generated from: '/stepIn1' */ rtB.Merge = rtDW.UnitDelay_DSTATE; /* 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' * DataStoreRead: '/Data Store Read2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.mode_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write2' */ rtDW.com_loc[i] = 1U; } /* MATLAB Function: '/Normal Mode' */ /* : y = step; */ /* : fprintf('SIMULINK Normal Mode\n'); */ printf("SIMULINK Normal Mode\n"); fflush(stdout); /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* 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' * DataStoreRead: '/Data Store Read2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write1' */ rtDW.stall_set_loc[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant2' */ rtDW.lnoise_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write2' */ rtDW.com_loc[i] = 3U; /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant4' */ rtDW.autos_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant5' */ rtDW.speed_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant6' */ rtDW.coils_stop_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write' */ rtDW.pos_loc[i] = 1U; } /* MATLAB Function: '/Move to position Min' */ /* : y = step; */ /* : fprintf('SIMULINK Move to position Min - 1\n'); */ printf("SIMULINK Move to position Min - 1\n"); fflush(stdout); /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Min' */ break; case 5: /* Outputs for IfAction SubSystem: '/Check Stall Min' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write5' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1_n = rtb_RelationalOperator_j[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_n = (rtb_LogicalOperator1_n || rtb_RelationalOperator_j[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i] == 1); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' */ tmp = rtb_RelationalOperator_j[0]; for (i = 0; i < 8; i++) { tmp = (tmp || rtb_RelationalOperator_j[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreRead: '/Data Store Read2' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0) && (rtb_LogicalOperator1_n || tmp)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtDW.Min_position_Ch0[i] = rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]; } /* End of DataStoreWrite: '/Data Store Write1' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ /* : y = step; */ /* : fprintf('SIMULINK Min_position_Ch0 '); */ printf("SIMULINK Min_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ MAXPOSITION(rtDW.controllerDataInput.in_CPOS_ALL_Ch0, rtb_y_ff); /* MATLAB Function: '/MAX POSITION1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write5' */ MAXPOSITION1(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0, rtb_y_b); /* 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' * DataStoreRead: '/Data Store Read2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write' */ rtDW.pos_loc[i] = 1U; /* DataStoreWrite: '/Data Store Write1' */ rtDW.com_loc[i] = 2U; } /* MATLAB Function: '/Initial CPOS Max' */ /* : y = step; */ /* : fprintf('SIMULINK Initial CPOS Max - 1\n'); */ printf("SIMULINK Initial CPOS Max - 1\n"); fflush(stdout); /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* 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' * DataStoreRead: '/Data Store Read2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ for (i = 0; i < 9; i++) { /* DataStoreWrite: '/Data Store Write1' */ rtDW.stall_set_loc[i] = 1U; /* DataStoreWrite: '/Data Store Write3' incorporates: * Constant: '/Constant2' */ rtDW.lnoise_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write2' */ rtDW.com_loc[i] = 3U; /* DataStoreWrite: '/Data Store Write4' incorporates: * Constant: '/Constant4' */ rtDW.autos_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write5' incorporates: * Constant: '/Constant5' */ rtDW.speed_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write6' incorporates: * Constant: '/Constant6' */ rtDW.coils_stop_set_loc[i] = 0U; /* DataStoreWrite: '/Data Store Write' */ rtDW.pos_loc[i] = 6000U; } /* MATLAB Function: '/Move to position Max' */ /* : y = step; */ /* : fprintf('SIMULINK Move to position Max - 6000\n'); */ printf("SIMULINK Move to position Max - 6000\n"); fflush(stdout); /* Merge: '/Merge' incorporates: * Constant: '/Constant' * SignalConversion generated from: '/step' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Move to position Max' */ break; case 8: /* Outputs for IfAction SubSystem: '/Check Stall Max' incorporates: * ActionPort: '/Action Port' */ /* RelationalOperator: '/Relational Operator1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write5' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0[i] == 1); } /* End of RelationalOperator: '/Relational Operator1' */ /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1_n = rtb_RelationalOperator_j[0]; for (i = 0; i < 8; i++) { rtb_LogicalOperator1_n = (rtb_LogicalOperator1_n || rtb_RelationalOperator_j[i + 1]); } /* RelationalOperator: '/Relational Operator' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtb_RelationalOperator_j[i] = (rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i] == 6000); } /* End of RelationalOperator: '/Relational Operator' */ /* Logic: '/Logical Operator1' */ tmp = rtb_RelationalOperator_j[0]; for (i = 0; i < 8; i++) { tmp = (tmp || rtb_RelationalOperator_j[i + 1]); } /* If: '/If2' incorporates: * DataStoreRead: '/Data Store Read3' * DataStoreRead: '/Data Store Read4' * DataTypeConversion: '/Data Type Conversion' * DataTypeConversion: '/Data Type Conversion1' * Logic: '/Logical Operator' * Logic: '/Logical Operator1' * Logic: '/Logical Operator2' */ if ((rtDW.Busy_Ch0 == 0) && (rtDW.Error_Connect_Ch0 == 0) && (rtb_LogicalOperator1_n || tmp)) { /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ for (i = 0; i < 9; i++) { rtDW.Max_position_Ch0[i] = rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]; } /* End of DataStoreWrite: '/Data Store Write1' */ /* Merge: '/Merge' incorporates: * Constant: '/Constant' * Sum: '/step inc' */ rtB.Merge = (int8_t)(rtDW.UnitDelay_DSTATE + 1); /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ /* : y = step; */ /* : fprintf('SIMULINK Max_position_Ch0 '); */ printf("SIMULINK Max_position_Ch0 "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.controllerDataInput.in_CPOS_ALL_Ch0[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/If Action Subsystem2' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ IfActionSubsystem3(rtDW.UnitDelay_DSTATE, &rtB.Merge, rtDW.com_loc); /* End of Outputs for SubSystem: '/If Action Subsystem3' */ } /* End of If: '/If2' */ /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write1' */ MAXPOSITION(rtDW.controllerDataInput.in_CPOS_ALL_Ch0, rtb_y_ff); /* MATLAB Function: '/MAX POSITION1' incorporates: * DataStoreRead: '/Data Store Read1' * DataStoreWrite: '/Data Store Write5' */ MAXPOSITION1(rtDW.controllerDataInput.in_Act_Stall_Slave_Ch0, rtb_y_b); /* End of Outputs for SubSystem: '/Check Stall Max' */ break; case 9: /* Outputs for IfAction SubSystem: '/Homing' incorporates: * ActionPort: '/Action Port' */ /* DataStoreWrite: '/Data Store Write3' */ for (i = 0; i < 9; i++) { rtDW.com_loc[i] = 0U; } /* End of DataStoreWrite: '/Data Store Write3' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn1' */ rtB.Merge = 0; /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read2' */ /* : y = step; */ /* : fprintf('SIMULINK MAX POSITION '); */ printf("SIMULINK MAX POSITION "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Max_position_Ch0[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); /* End of MATLAB Function: '/MAX POSITION' */ /* MATLAB Function: '/MIN POSITION' incorporates: * DataStoreRead: '/Data Store Read3' */ /* : y = step; */ /* : fprintf('SIMULINK MIN POSITION '); */ printf("SIMULINK MIN POSITION "); fflush(stdout); /* : for i = 1:numel(step) */ for (i = 0; i < 9; i++) { /* : fprintf('%d ', int16(step(i))); */ printf("%d ", rtDW.Min_position_Ch0[i]); fflush(stdout); } /* : fprintf('\n'); */ printf("\n"); fflush(stdout); /* End of MATLAB Function: '/MIN POSITION' */ /* End of Outputs for SubSystem: '/Homing' */ break; case 0: /* Outputs for IfAction SubSystem: '/Homing1' incorporates: * ActionPort: '/Action Port' */ /* Merge: '/Merge' incorporates: * SignalConversion generated from: '/stepIn' */ rtB.Merge = rtDW.UnitDelay_DSTATE; /* End of Outputs for SubSystem: '/Homing1' */ break; } /* End of SwitchCase: '/Switch Case' */ /* DataStoreWrite: '/Start write stepSig' incorporates: * Constant: '/Constant1' */ rtDW.stepSig = 1; /* BusCreator: '/Bus Creator' incorporates: * 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' * DataStoreRead: '/Data Store Read9' * DataStoreWrite: '/Data Store Write' */ for (i = 0; i < 9; i++) { controllerData.POS[i] = rtDW.pos_loc[i]; controllerData.BUS_ADR[i] = rtDW.busAdr_loc[i]; controllerData.MODE[i] = rtDW.mode_loc[i]; controllerData.COM[i] = rtDW.com_loc[i]; controllerData.Stall_SET[i] = rtDW.stall_set_loc[i]; controllerData.Lnoise_SET[i] = rtDW.lnoise_set_loc[i]; controllerData.Autos_SET[i] = rtDW.autos_set_loc[i]; controllerData.Speed_SET[i] = rtDW.speed_set_loc[i]; controllerData.Coils_Stop_SET[i] = rtDW.coils_stop_set_loc[i]; } /* End of BusCreator: '/Bus Creator' */ /* 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_LogicalOperator1; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_i = rtb_LogicalOperator1_f; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_c = rtb_LogicalOperator1_k; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_hm = rtb_LogicalOperator1_b; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_b = rtb_LogicalOperator1_ln; /* Update for UnitDelay: '/Cond_prev_private ' */ rtDW.Cond_prev_private_DSTATE_g = rtb_LogicalOperator1_i; /* Update for Switch: '/Switch' incorporates: * UnitDelay: '/Unit Delay' */ rtDW.UnitDelay_DSTATE = rtB.Merge; } /* Model initialize function */ void Model_actuator_initialize(void) { /* (no initialization code required) */ } /* Model terminate function */ void Model_actuator_terminate(void) { /* (no terminate code required) */ } /* * File trailer for generated code. * * [EOF] */