diff --git a/HVAC_model.c b/HVAC_model.c index 56dc9db..8ca9699 100644 --- a/HVAC_model.c +++ b/HVAC_model.c @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.848 + * Model version : 1.850 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Fri Apr 24 14:46:20 2026 + * C/C++ source code generated on : Fri Apr 24 16:29:01 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -2496,142 +2496,115 @@ void left(uint8_t rtu_idx, uint16_t rty_vals[9]) } /* - * System initialize for action system: - * '/If Action Subsystem' - * '/If Action Subsystem' - * '/If Action Subsystem' + * Output and update for action system: + * '/If Action Subsystem' + * '/If Action Subsystem' + * '/If Action Subsystem' */ -void IfActionSubsystem_Init(DW_IfActionSubsystem *localDW) +void IfActionSubsystem(int8_t *rty_Out1, double *rtd_ErrorHomming_private, + double *rtd_Start_timer_i, int8_t *rtd_stepSig_private) { - /* Start for DataStoreMemory: '/Data Store Memory' */ - localDW->Start_timer = 1.0; + /* DataStoreWrite: '/Data Store Write' incorporates: + * Constant: '/Constant' + */ + *rtd_stepSig_private = 1; - /* SystemInitialize for MATLAB Function: '/MATLAB Function' */ + /* DataStoreWrite: '/Data Store Write1' incorporates: + * Constant: '/Constant2' + * DataStoreRead: '/Data Store Read1' + * Sum: '/step inc' + */ + (*rtd_ErrorHomming_private)++; + + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant3' + */ + *rtd_Start_timer_i = 0.0; + + /* SignalConversion generated from: '/Out1' incorporates: + * Constant: '/Constant1' + */ + *rty_Out1 = 2; +} + +/* + * Output and update for action system: + * '/If Action Subsystem1' + * '/If Action Subsystem1' + * '/If Action Subsystem1' + */ +void IfActionSubsystem1(int8_t *rty_Out1, double *rtd_Start_timer_i) +{ + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant3' + */ + *rtd_Start_timer_i = 1.0; + + /* SignalConversion generated from: '/Out1' incorporates: + * Constant: '/Constant1' + */ + *rty_Out1 = 3; +} + +/* + * System initialize for atomic system: + * '/MATLAB Function' + * '/MATLAB Function' + * '/MATLAB Function' + */ +void MATLABFunction_Init(DW_MATLABFunction *localDW) +{ localDW->t_start_not_empty = false; localDW->cond_prev = 0.0; } /* - * Output and update for action system: - * '/If Action Subsystem' - * '/If Action Subsystem' - * '/If Action Subsystem' + * Output and update for atomic system: + * '/MATLAB Function' + * '/MATLAB Function' + * '/MATLAB Function' */ -void IfActionSubsystem(int8_t *rty_Out2, double *rtd_ErrorHomming_private, const - double *rtd_LOGGER_LIN, int8_t *rtd_stepSig_private, const uint32_t *rtd_t_now, - DW_IfActionSubsystem *localDW) +void MATLABFunction(double rtu_cond, uint32_t rtu_t_now, uint32_t *rty_dt, + DW_MATLABFunction *localDW) { - uint32_t rtb_dt_a4; - - /* MATLAB Function: '/MATLAB Function' incorporates: - * DataStoreRead: '/Data Store Read' - * DataStoreRead: '/Data Store Read1' - */ /* : dt = uint32(0); */ /* : if isempty(t_start) */ if (!localDW->t_start_not_empty) { /* : t_start = t_now; */ - localDW->t_start = *rtd_t_now; + localDW->t_start = rtu_t_now; localDW->t_start_not_empty = true; /* : cond_prev = 0; */ } /* : if cond > 0.5 && cond_prev <= 0.5 */ - if ((localDW->Start_timer > 0.5) && (localDW->cond_prev <= 0.5)) { + if ((rtu_cond > 0.5) && (localDW->cond_prev <= 0.5)) { /* : t_start = t_now; */ - localDW->t_start = *rtd_t_now; + localDW->t_start = rtu_t_now; } /* : if cond > 0.5 */ - if (localDW->Start_timer > 0.5) { + if (rtu_cond > 0.5) { + uint32_t qY; + /* : dt = uint32(t_now - t_start); */ /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ - rtb_dt_a4 = *rtd_t_now - /*MW:OvSatOk*/ localDW->t_start; + qY = rtu_t_now - /*MW:OvSatOk*/ localDW->t_start; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ - if (rtb_dt_a4 > *rtd_t_now) { - rtb_dt_a4 = 0U; + if (qY > rtu_t_now) { + qY = 0U; } + + *rty_dt = qY; } else { /* : else */ /* : dt = uint32(0); */ - rtb_dt_a4 = 0U; + *rty_dt = 0U; } /* : cond_prev = cond; */ - localDW->cond_prev = localDW->Start_timer; - - /* End of MATLAB Function: '/MATLAB Function' */ - - /* MATLAB Function: '/MAX POSITION' incorporates: - * DataStoreRead: '/Data Store Read5' - */ - /* : if(LOGGER>1) */ - if (*rtd_LOGGER_LIN > 1.0) { - uint32_t tmp; - - /* : fprintf("Homing 3. Start TIme dt = %d \n",int32(data)); */ - tmp = rtb_dt_a4; - if (rtb_dt_a4 > 2147483647U) { - tmp = 2147483647U; - } - - printf("Homing 3. Start TIme dt = %d \n", (int32_t)tmp); - fflush(stdout); - } - - /* End of MATLAB Function: '/MAX POSITION' */ - - /* If: '/If' */ - if (rtb_dt_a4 > 30000U) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: - * ActionPort: '/Action Port' - */ - /* DataStoreWrite: '/Data Store Write' incorporates: - * Constant: '/Constant' - */ - *rtd_stepSig_private = 1; - - /* DataStoreWrite: '/Data Store Write1' incorporates: - * Constant: '/Constant2' - * Sum: '/step inc' - */ - (*rtd_ErrorHomming_private)++; - - /* DataStoreWrite: '/Data Store Write2' incorporates: - * Constant: '/Constant3' - */ - localDW->Start_timer = 0.0; - - /* SignalConversion generated from: '/Out2' incorporates: - * Constant: '/Constant1' - * Merge: '/Merge' - * SignalConversion generated from: '/Out1' - */ - *rty_Out2 = 2; - - /* End of Outputs for SubSystem: '/If Action Subsystem' */ - } else { - /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: - * ActionPort: '/Action Port' - */ - /* DataStoreWrite: '/Data Store Write2' incorporates: - * Constant: '/Constant3' - */ - localDW->Start_timer = 1.0; - - /* SignalConversion generated from: '/Out2' incorporates: - * Constant: '/Constant1' - * Merge: '/Merge' - * SignalConversion generated from: '/Out1' - */ - *rty_Out2 = 3; - - /* End of Outputs for SubSystem: '/If Action Subsystem1' */ - } - - /* End of If: '/If' */ + localDW->cond_prev = rtu_cond; } /* @@ -2640,7 +2613,7 @@ void IfActionSubsystem(int8_t *rty_Out2, double *rtd_ErrorHomming_private, const * '/If Action Subsystem1' * '/If Action Subsystem1' */ -void IfActionSubsystem1(int8_t *rty_Output, uint8_t +void IfActionSubsystem1_d(int8_t *rty_Output, uint8_t *rtd_CCU_ActuatorErrF_Stat_private, uint8_t rtd_COM_private[9], uint8_t rtd_ErrorActuator[9], uint8_t rtd_ErrorCalibration_private[9], const double *rtd_LOGGER_LIN, uint8_t rtd_MODE_private[9], uint8_t @@ -2719,675 +2692,6 @@ void IfActionSubsystem1(int8_t *rty_Output, uint8_t *rty_Output = 4; } -/* - * Output and update for action system: - * '/Stop Mode' - * '/Stop Mode' - */ -void StopMode(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, - uint8_t rtd_MODE_private_a[9]) -{ - int32_t i; - - /* If: '/If1' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read2' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 0)) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: - * ActionPort: '/Action Port' - */ - for (i = 0; i < 9; i++) { - /* DataStoreWrite: '/Data Store Write1' */ - rtd_COM_private_n[i] = 1U; - - /* DataStoreWrite: '/Data Store Write' */ - rtd_MODE_private_a[i] = 2U; - } - - /* Sum: '/step inc' incorporates: - * Constant: '/Constant' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/stepIn' */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If1' */ -} - -/* - * Output and update for action system: - * '/Initial CPOS Min' - * '/Initial CPOS Min' - */ -void InitialCPOSMin(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const - uint8_t *rtd_Error_Connect_private_m, const double - *rtd_LOGGER_LIN, uint16_t rtd_POS_private_o[9]) -{ - int32_t i; - - /* If: '/If' incorporates: - * DataStoreRead: '/Data Store Read' - * DataStoreRead: '/Data Store Read1' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 0)) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: - * ActionPort: '/Action Port' - */ - for (i = 0; i < 9; i++) { - /* DataStoreWrite: '/Data Store Write' */ - rtd_POS_private_o[i] = 6000U; - - /* DataStoreWrite: '/Data Store Write1' */ - rtd_COM_private_n[i] = 2U; - } - - /* SignalConversion generated from: '/step' incorporates: - * Constant: '/Constant' - * Merge: '/Merge' - * Sum: '/step inc' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/step' incorporates: - * Merge: '/Merge' - * SignalConversion generated from: '/stepIn1' - */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If' */ -} - -/* - * Output and update for action system: - * '/Normal Mode' - * '/Normal Mode' - */ -void NormalMode(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, - uint8_t rtd_MODE_private_a[9]) -{ - int32_t i; - - /* If: '/If1' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read2' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 0)) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: - * ActionPort: '/Action Port' - */ - for (i = 0; i < 9; i++) { - /* DataStoreWrite: '/Data Store Write' */ - rtd_MODE_private_a[i] = 0U; - - /* DataStoreWrite: '/Data Store Write1' */ - rtd_COM_private_n[i] = 1U; - } - - /* Sum: '/step inc' incorporates: - * Constant: '/Constant' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/stepIn' */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If1' */ -} - -/* - * Output and update for action system: - * '/Move to position Min' - * '/Move to position Min' - */ -void MovetopositionMin(int8_t rtu_stepIn, int8_t *rty_step, uint8_t - rtd_Autos_private_a[9], const uint8_t *rtd_Busy_private_i, uint8_t - rtd_COM_private_n[9], uint8_t rtd_Coils_private_e[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint8_t - rtd_Lnoise_private_p[9], uint16_t rtd_POS_private_o[9], uint8_t - rtd_Speed_private_e[9], uint8_t rtd_Stall_private_h[9]) -{ - int32_t i; - - /* If: '/If1' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read2' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 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' - */ - rtd_Autos_private_a[i] = 1U; - - /* DataStoreWrite: '/Data Store Write2' incorporates: - * Constant: '/Constant10' - */ - rtd_Stall_private_h[i] = 1U; - - /* DataStoreWrite: '/Data Store Write3' */ - rtd_Lnoise_private_p[i] = 0U; - - /* DataStoreWrite: '/Data Store Write5' incorporates: - * Constant: '/Constant2' - */ - rtd_Speed_private_e[i] = 3U; - - /* DataStoreWrite: '/Data Store Write6' incorporates: - * Constant: '/Constant3' - */ - rtd_Coils_private_e[i] = 3U; - - /* DataStoreWrite: '/Data Store Write' */ - rtd_POS_private_o[i] = 0U; - - /* DataStoreWrite: '/Data Store Write1' incorporates: - * Constant: '/Constant9' - */ - rtd_COM_private_n[i] = 3U; - } - - /* Sum: '/step inc' incorporates: - * Constant: '/Constant' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/stepIn' */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If1' */ -} - -/* - * Output and update for atomic system: - * '/Write' - * '/Write' - */ -void Write(double rtu_LOGGER, const int16_t rtu_data[9]) -{ - int32_t i; - - /* : if(LOGGER == 2) */ - if (rtu_LOGGER == 2.0) { - /* : fprintf('Check Stall Min\n'); */ - printf("Check Stall Min\n"); - fflush(stdout); - - /* : for i = 1:numel(data) */ - for (i = 0; i < 9; i++) { - /* : fprintf('MIN = %d ', int16(data(i))); */ - printf("MIN = %d ", rtu_data[i]); - fflush(stdout); - } - - /* : fprintf('\n'); */ - printf("\n"); - fflush(stdout); - } -} - -/* - * Output and update for action system: - * '/Initial CPOS Max' - * '/Initial CPOS Max' - */ -void InitialCPOSMax(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const - uint8_t *rtd_Error_Connect_private_m, const double - *rtd_LOGGER_LIN, uint16_t rtd_POS_private_o[9]) -{ - int32_t i; - - /* If: '/If1' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read2' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 0)) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: - * ActionPort: '/Action Port' - */ - for (i = 0; i < 9; i++) { - /* DataStoreWrite: '/Data Store Write1' */ - rtd_COM_private_n[i] = 2U; - - /* DataStoreWrite: '/Data Store Write' */ - rtd_POS_private_o[i] = 0U; - } - - /* Sum: '/step inc' incorporates: - * Constant: '/Constant' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/stepIn' */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If1' */ -} - -/* - * Output and update for action system: - * '/Move to position Max' - * '/Move to position Max' - */ -void MovetopositionMax(int8_t rtu_stepIn, int8_t *rty_step, uint8_t - rtd_Autos_private_a[9], const uint8_t *rtd_Busy_private_i, uint8_t - rtd_COM_private_n[9], uint8_t rtd_Coils_private_e[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint8_t - rtd_Lnoise_private_p[9], uint16_t rtd_POS_private_o[9], uint8_t - rtd_Speed_private_e[9], uint8_t rtd_Stall_private_h[9]) -{ - int32_t i; - - /* If: '/If1' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read2' - */ - if ((*rtd_Busy_private_i == 0) && (*rtd_Error_Connect_private_m == 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' - */ - rtd_Autos_private_a[i] = 1U; - - /* DataStoreWrite: '/Data Store Write2' incorporates: - * Constant: '/Constant10' - */ - rtd_Stall_private_h[i] = 1U; - - /* DataStoreWrite: '/Data Store Write3' */ - rtd_Lnoise_private_p[i] = 0U; - - /* DataStoreWrite: '/Data Store Write5' incorporates: - * Constant: '/Constant2' - */ - rtd_Speed_private_e[i] = 3U; - - /* DataStoreWrite: '/Data Store Write6' incorporates: - * Constant: '/Constant3' - */ - rtd_Coils_private_e[i] = 3U; - - /* DataStoreWrite: '/Data Store Write' */ - rtd_POS_private_o[i] = 6000U; - - /* DataStoreWrite: '/Data Store Write1' incorporates: - * Constant: '/Constant9' - */ - rtd_COM_private_n[i] = 3U; - } - - /* Sum: '/step inc' incorporates: - * Constant: '/Constant' - */ - *rty_step = (int8_t)(rtu_stepIn + 1); - - /* MATLAB Function: '/Write' */ - /* : if(LOGGER == 2) */ - if (*rtd_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' - */ - /* SignalConversion generated from: '/stepIn' */ - *rty_step = rtu_stepIn; - - /* End of Outputs for SubSystem: '/If Action Subsystem3' */ - } - - /* End of If: '/If1' */ -} - -/* - * Output and update for atomic system: - * '/Write' - * '/Write' - */ -void Write_c(double rtu_LOGGER, const int16_t rtu_data[9]) -{ - int32_t i; - - /* : if(LOGGER == 2) */ - if (rtu_LOGGER == 2.0) { - /* : fprintf('Check Stall MAX\n'); */ - printf("Check Stall MAX\n"); - fflush(stdout); - - /* : for i = 1:numel(data) */ - for (i = 0; i < 9; i++) { - /* : fprintf('MAX = %d ', int16(data(i))); */ - printf("MAX = %d ", rtu_data[i]); - fflush(stdout); - } - - /* : fprintf('\n'); */ - printf("\n"); - fflush(stdout); - } -} - -/* - * Output and update for atomic system: - * '/MAX POSITION' - * '/MAX POSITION' - */ -void MAXPOSITION(double rtu_LOGGER, const int16_t rtu_MAX[6], const bool - rtu_ERRORS[9], const double rtu_KOEF[9]) -{ - int32_t i; - - /* : if(LOGGER>0) */ - if (rtu_LOGGER > 0.0) { - /* : fprintf("Homing 0\n"); */ - printf("Homing 0\n"); - fflush(stdout); - - /* : for i = 1:numel(MAX) */ - for (i = 0; i < 6; 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), - rtu_MAX[i], rtu_KOEF[i], (int16_t)rtu_ERRORS[i]); - fflush(stdout); - } - } -} - -/* - * Output and update for atomic system: - * '/Write ERROR' - * '/Write ERROR' - */ -void WriteERROR(const bool rtu_ErrCallibration[9], double rtu_LOGGER) -{ - int32_t i; - - /* : if(LOGGER>=0) */ - if (rtu_LOGGER >= 0.0) { - /* : for i = 1:numel(ErrCallibration) */ - for (i = 0; i < 9; i++) { - /* : if ErrCallibration(i) == 1 */ - if (rtu_ErrCallibration[i]) { - /* : fprintf('LIN1 Failure with actuator #%d\n', int16(i)); */ - printf("LIN1 Failure with actuator #%d\n", (int16_t)(i + 1)); - fflush(stdout); - } - } - } -} - -/* - * Output and update for atomic system: - * '/MAX POSITION' - * '/MAX POSITION' - */ -void MAXPOSITION_k(double rtu_LOGGER, const int16_t rtu_MAX[6], const uint8_t - rtu_ERRORS[9], const double rtu_KOEF[9]) -{ - int32_t i; - - /* : if(LOGGER>0) */ - if (rtu_LOGGER > 0.0) { - /* : fprintf("Homing 1. Start Callibration \n"); */ - printf("Homing 1. Start Callibration \n"); - fflush(stdout); - - /* : for i = 1:numel(MAX) */ - for (i = 0; i < 6; i++) { - /* : if(ERRORS(i)==1) */ - if (rtu_ERRORS[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), - rtu_MAX[i], rtu_KOEF[i], 1); - fflush(stdout); - } - } - } -} - -/* - * Output and update for atomic system: - * '/MAX POSITION' - * '/MAX POSITION' - */ -void MAXPOSITION_d(double rtu_LOGGER, const int16_t rtu_MAX[6], const bool - rtu_ERRORS[9], const double rtu_KOEF[9]) -{ - int32_t i; - - /* : if(LOGGER>0) */ - if (rtu_LOGGER > 0.0) { - /* : fprintf("Homing 3. Callibration \n"); */ - printf("Homing 3. Callibration \n"); - fflush(stdout); - - /* : for i = 1:numel(MAX) */ - for (i = 0; i < 6; i++) { - /* : if(ERRORS(i)==1) */ - if (rtu_ERRORS[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), - rtu_MAX[i], rtu_KOEF[i], 1); - fflush(stdout); - } - } - } -} - -/* - * System initialize for action system: - * '/Switch Case Action Subsystem3' - * '/Switch Case Action Subsystem3' - */ -void SwitchCaseActionSubsystem3_Init(DW_SwitchCaseActionSubsystem3 *localDW) -{ - /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ - IfActionSubsystem_Init(&localDW->IfActionSubsystem_e); - - /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ -} - -/* - * Output and update for action system: - * '/Switch Case Action Subsystem3' - * '/Switch Case Action Subsystem3' - */ -void SwitchCaseActionSubsystem3(int8_t *rty_step, uint8_t - *rtd_CCU_ActuatorErrF_Stat_private, uint8_t rtd_COM_private_n[9], uint8_t - rtd_ErrorActuator_c[9], uint8_t rtd_ErrorCalibration_private_b[9], double - *rtd_ErrorHomming_private_j, const double *rtd_LOGGER_LIN, uint8_t - rtd_MODE_private_a[9], uint8_t rtd_dtc_state_error_model[127], int8_t - *rtd_stepSig_private_j, const uint32_t *rtd_t_now, - DW_SwitchCaseActionSubsystem3 *localDW) -{ - double tmp; - int16_t tmp_0; - - /* MATLAB Function: '/MAX POSITION' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreRead: '/Data Store Read5' - */ - /* : if(LOGGER>1) */ - if (*rtd_LOGGER_LIN > 1.0) { - /* : fprintf("Homing 3. Start Time on step %d\n",int16(step)); */ - tmp = rt_roundd(*rtd_ErrorHomming_private_j); - if (tmp < 32768.0) { - if (tmp >= -32768.0) { - tmp_0 = (int16_t)tmp; - } else { - tmp_0 = INT16_MIN; - } - } else { - tmp_0 = INT16_MAX; - } - - printf("Homing 3. Start Time on step %d\n", tmp_0); - fflush(stdout); - } - - /* End of MATLAB Function: '/MAX POSITION' */ - - /* If: '/If' incorporates: - * DataStoreRead: '/Data Store Read1' - */ - if (*rtd_ErrorHomming_private_j < 10.0) { - /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: - * ActionPort: '/Action Port' - */ - IfActionSubsystem(rty_step, rtd_ErrorHomming_private_j, (double *) - rtd_LOGGER_LIN, rtd_stepSig_private_j, (uint32_t *) - rtd_t_now, &localDW->IfActionSubsystem_e); - - /* End of Outputs for SubSystem: '/If Action Subsystem' */ - } else { - /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: - * ActionPort: '/Action Port' - */ - IfActionSubsystem1(rty_step, rtd_CCU_ActuatorErrF_Stat_private, - rtd_COM_private_n, rtd_ErrorActuator_c, - rtd_ErrorCalibration_private_b, (double *)rtd_LOGGER_LIN, - rtd_MODE_private_a, rtd_dtc_state_error_model); - - /* End of Outputs for SubSystem: '/If Action Subsystem1' */ - } - - /* End of If: '/If' */ -} - -/* - * Output and update for action system: - * '/Switch Case Action Subsystem4' - * '/Switch Case Action Subsystem4' - */ -void SwitchCaseActionSubsystem4(int8_t *rty_step, const double *rtd_LOGGER_LIN, - int8_t *rtd_stepSig_private_j) -{ - /* DataStoreWrite: '/Data Store Write' incorporates: - * Constant: '/Constant' - */ - *rtd_stepSig_private_j = 10; - - /* SignalConversion generated from: '/step' incorporates: - * Constant: '/Constant1' - */ - *rty_step = 5; - - /* MATLAB Function: '/MAX POSITION' incorporates: - * DataStoreRead: '/Data Store Read5' - */ - /* : if(LOGGER>0) */ - if (*rtd_LOGGER_LIN > 0.0) { - /* : fprintf("Homing. Callibration successful \n"); */ - printf("Homing. Callibration successful \n"); - fflush(stdout); - } - - /* End of MATLAB Function: '/MAX POSITION' */ -} - /* * Output and update for atomic system: * '/g_assSTART_ENTER_INCAR' @@ -5034,7 +4338,7 @@ void Level0_b(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR DW_Level0_c *localDW) { int32_t tmp; - uint32_t rtb_dt_ia; + uint32_t rtb_dt_b; int16_t rtb_out_gb; int16_t rtb_out_kdi; uint16_t rtb_out_ne; @@ -5119,7 +4423,7 @@ void Level0_b(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_ia = *rtd_t_now - localDW->t_start_delay_private_DSTATE; + rtb_dt_b = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' @@ -5148,7 +4452,7 @@ void Level0_b(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ - if ((*rtd_Incar_RR < rtb_out_kdi) || (rtb_dt_ia > (uint16_t)(1000 * rtb_out_gb))) + if ((*rtd_Incar_RR < rtb_out_kdi) || (rtb_dt_b > (uint16_t)(1000 * rtb_out_gb))) { *rty_step = 2; } else { @@ -5231,7 +4535,7 @@ void Level4_d(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR *rtd_step_start_controle_rear, const uint32_t *rtd_t_now, DW_Level4_a *localDW) { - uint32_t rtb_dt_hx; + uint32_t rtb_dt_ha; int16_t rtb_out_ij[2]; int16_t rtb_out_ck; int16_t rtb_out_pf; @@ -5320,7 +4624,7 @@ void Level4_d(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_hx = *rtd_t_now - localDW->t_start_delay_private_DSTATE; + rtb_dt_ha = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' @@ -5349,7 +4653,7 @@ void Level4_d(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * RelationalOperator: '/Relational Operator' * RelationalOperator: '/Relational Operator1' */ - if ((*rtd_Incar_RR > rtb_out_pf) || (rtb_dt_hx > (uint16_t)(1000 * rtb_out_ck))) + if ((*rtd_Incar_RR > rtb_out_pf) || (rtb_dt_ha > (uint16_t)(1000 * rtb_out_ck))) { *rty_step = 2; } else { @@ -5507,7 +4811,7 @@ void Level3_i(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR const uint32_t *rtd_t_now, DW_Level3_n *localDW) { int32_t tmp; - uint32_t rtb_dt_j3; + uint32_t rtb_dt_ho; int16_t rtb_out_cw; uint16_t rtb_out_bz; uint16_t rtb_out_gx; @@ -5723,7 +5027,7 @@ void Level3_i(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_j3 = *rtd_t_now - localDW->t_start_delay_private_DSTATE; + rtb_dt_ho = *rtd_t_now - localDW->t_start_delay_private_DSTATE; /* MATLAB Function: '/Time goto from step 1 to step 2 ' incorporates: * DataStoreRead: '/Data Store Read4' @@ -5751,7 +5055,7 @@ void Level3_i(int8_t *rty_step, uint16_t *rtd_Blower_RL, uint16_t *rtd_Blower_RR * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator1' */ - if ((rtb_dt_j3 > (uint16_t)(1000 * rtb_out_cw)) || (*rtd_HI_logic_on)) { + if ((rtb_dt_ho > (uint16_t)(1000 * rtb_out_cw)) || (*rtd_HI_logic_on)) { *rty_step = 3; } else { *rty_step = 2; @@ -5790,8 +5094,8 @@ void HVAC_model_step(void) double rtb_Divide8; int32_t i; int32_t tmp_0; - uint32_t rtb_dt_av; - uint32_t rtb_dt_pc; + uint32_t rtb_dt_fa; + uint32_t rtb_dt_ih; int16_t tmp[6]; int16_t rtb_out_js[2]; int16_t AMB; @@ -5820,7 +5124,6 @@ void HVAC_model_step(void) uint8_t rtb_Gain2; uint8_t rtb_Gain_l; uint8_t rtb_u_cuz; - bool ErrorCalibration_private_b_tmp[9]; bool rtb_LogicalOperator3_a0[9]; bool rtb_Compare_l2[8]; bool rtb_LogicalOperator3_ev[6]; @@ -10007,19 +9310,60 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: * ActionPort: '/Action Port' */ - IfActionSubsystem(&rtB.Merge_h1, &rtDW.ErrorHomming_private, - &rtDW.LOGGER_LIN, &rtDW.stepSig_private, &rtDW.t_now, - &rtDW.IfActionSubsystem_p); + /* MATLAB Function: '/MATLAB Function' incorporates: + * DataStoreRead: '/Data Store Read' + * DataStoreRead: '/Data Store Read1' + */ + MATLABFunction(rtDW.Start_timer_i, rtDW.t_now, &rtb_dt_ih, + &rtDW.sf_MATLABFunction); + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>1) */ + if (rtDW.LOGGER_LIN > 1.0) { + /* : fprintf("[LIN 1] Homing 3. Start TIme dt = %d \n",int32(data)); */ + rtb_dt_fa = rtb_dt_ih; + if (rtb_dt_ih > 2147483647U) { + rtb_dt_fa = 2147483647U; + } + + printf("[LIN 1] Homing 3. Start TIme dt = %d \n", (int32_t)rtb_dt_fa); + fflush(stdout); + } + + /* End of MATLAB Function: '/MAX POSITION' */ + + /* If: '/If' */ + if (rtb_dt_ih > 30000U) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem(&rtB.Merge_h1, &rtDW.ErrorHomming_private, + &rtDW.Start_timer_i, &rtDW.stepSig_private); + + /* End of Outputs for SubSystem: '/If Action Subsystem' */ + } else { + /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem1(&rtB.Merge_h1, &rtDW.Start_timer_i); + + /* End of Outputs for SubSystem: '/If Action Subsystem1' */ + } + + /* End of If: '/If' */ /* End of Outputs for SubSystem: '/If Action Subsystem' */ } else { /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: * ActionPort: '/Action Port' */ - IfActionSubsystem1(&rtB.Merge_h1, &rtDW.CCU_ActuatorErrF_Stat_private, - rtDW.COM_private, rtDW.ErrorActuator, - rtDW.ErrorCalibration_private, &rtDW.LOGGER_LIN, - rtDW.MODE_private, rtDW.dtc_state_error_model); + IfActionSubsystem1_d(&rtB.Merge_h1, &rtDW.CCU_ActuatorErrF_Stat_private, + rtDW.COM_private, rtDW.ErrorActuator, + rtDW.ErrorCalibration_private, &rtDW.LOGGER_LIN, + rtDW.MODE_private, rtDW.dtc_state_error_model); /* End of Outputs for SubSystem: '/If Action Subsystem1' */ } @@ -10135,17 +9479,6 @@ void HVAC_model_step(void) rtDW.COM_private[i] = 0U; } - /* SignalConversion generated from: '/Bus Selector' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreWrite: '/Data Store Write' - */ - rtb_Gain_l = Actuator_Ch1_Status_Model.Busy; - - /* DataStoreWrite: '/Data Store Write1' incorporates: - * DataStoreRead: '/Data Store Read1' - */ - rtb_Gain2 = Actuator_Ch1_Status_Model.Error_Connect; - /* Switch: '/Switch' incorporates: * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' @@ -10165,9 +9498,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ - StopMode(rtb_Switch_hx, &rtB.Merge_h, &rtb_Gain_l, rtDW.COM_private_n, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.MODE_private_a); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_n[i] = 1U; + /* DataStoreWrite: '/Data Store Write' */ + rtDW.MODE_private_a[i] = 2U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Stop Mode\n'); */ + printf("[LIN 2] 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_h = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Stop Mode' */ break; @@ -10175,9 +9554,57 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates: * ActionPort: '/Action Port' */ - InitialCPOSMin(rtb_Switch_hx, &rtB.Merge_h, &rtb_Gain_l, rtDW.COM_private_n, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.POS_private_o); + /* If: '/If' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_o[i] = 6000U; + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_n[i] = 2U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Merge: '/Merge' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Initial CPOS Min\n'); */ + printf("[LIN 2] 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_h = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Initial CPOS Min' */ break; @@ -10185,9 +9612,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates: * ActionPort: '/Action Port' */ - NormalMode(rtb_Switch_hx, &rtB.Merge_h, &rtb_Gain_l, rtDW.COM_private_n, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.MODE_private_a); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write' */ + rtDW.MODE_private_a[i] = 0U; + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_n[i] = 1U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('LIN 2] Normal Mode\n'); */ + printf("LIN 2] 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_h = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Normal Mode' */ break; @@ -10195,12 +9668,80 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates: * ActionPort: '/Action Port' */ - MovetopositionMin(rtb_Switch_hx, &rtB.Merge_h, rtDW.Autos_private_a, - &rtb_Gain_l, rtDW.COM_private_n, rtDW.Coils_private_e, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.Lnoise_private_p, - rtDW.POS_private_o, rtDW.Speed_private_e, - rtDW.Stall_private_h); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write4' incorporates: + * Constant: '/Constant1' + */ + rtDW.Autos_private_a[i] = 1U; + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant10' + */ + rtDW.Stall_private_h[i] = 1U; + + /* DataStoreWrite: '/Data Store Write3' */ + rtDW.Lnoise_private_p[i] = 0U; + + /* DataStoreWrite: '/Data Store Write5' incorporates: + * Constant: '/Constant2' + */ + rtDW.Speed_private_e[i] = 3U; + + /* DataStoreWrite: '/Data Store Write6' incorporates: + * Constant: '/Constant3' + */ + rtDW.Coils_private_e[i] = 3U; + + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_o[i] = 0U; + + /* DataStoreWrite: '/Data Store Write1' incorporates: + * Constant: '/Constant9' + */ + rtDW.COM_private_n[i] = 3U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Move to position Min\n'); */ + printf("[LIN 2] 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_h = 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; @@ -10272,8 +9813,25 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ - Write(rtDW.LOGGER_LIN, Actuator_Ch1_Status_Model.in_CPOS_ALL); + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Check Stall Min\n'); */ + printf("[LIN 2] Check Stall Min\n"); + fflush(stdout); + /* : for i = 1:numel(data) */ + for (i = 0; i < 9; i++) { + /* : fprintf('[LIN 2] MIN = %d ', int16(data(i))); */ + printf("[LIN 2] MIN = %d ", Actuator_Ch1_Status_Model.in_CPOS_ALL[i]); + fflush(stdout); + } + + /* : fprintf('\n'); */ + printf("\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: @@ -10295,9 +9853,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates: * ActionPort: '/Action Port' */ - InitialCPOSMax(rtb_Switch_hx, &rtB.Merge_h, &rtb_Gain_l, rtDW.COM_private_n, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.POS_private_o); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_n[i] = 2U; + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_o[i] = 0U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Initial CPOS Max\n'); */ + printf("[LIN 2] 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_h = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Initial CPOS Max' */ break; @@ -10305,12 +9909,80 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Move to position Max' incorporates: * ActionPort: '/Action Port' */ - MovetopositionMax(rtb_Switch_hx, &rtB.Merge_h, rtDW.Autos_private_a, - &rtb_Gain_l, rtDW.COM_private_n, rtDW.Coils_private_e, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.Lnoise_private_p, - rtDW.POS_private_o, rtDW.Speed_private_e, - rtDW.Stall_private_h); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch1_Status_Model.Busy == 0) && + (Actuator_Ch1_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write4' incorporates: + * Constant: '/Constant1' + */ + rtDW.Autos_private_a[i] = 1U; + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant10' + */ + rtDW.Stall_private_h[i] = 1U; + + /* DataStoreWrite: '/Data Store Write3' */ + rtDW.Lnoise_private_p[i] = 0U; + + /* DataStoreWrite: '/Data Store Write5' incorporates: + * Constant: '/Constant2' + */ + rtDW.Speed_private_e[i] = 3U; + + /* DataStoreWrite: '/Data Store Write6' incorporates: + * Constant: '/Constant3' + */ + rtDW.Coils_private_e[i] = 3U; + + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_o[i] = 6000U; + + /* DataStoreWrite: '/Data Store Write1' incorporates: + * Constant: '/Constant9' + */ + rtDW.COM_private_n[i] = 3U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_h = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Move to position Max\n'); */ + printf("[LIN 2] 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_h = 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; @@ -10384,8 +10056,25 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ - Write_c(rtDW.LOGGER_LIN, Actuator_Ch1_Status_Model.in_CPOS_ALL); + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 2] Check Stall MAX\n'); */ + printf("[LIN 2] Check Stall MAX\n"); + fflush(stdout); + /* : for i = 1:numel(data) */ + for (i = 0; i < 9; i++) { + /* : fprintf('[LIN 2] MAX = %d ', int16(data(i))); */ + printf("[LIN 2] MAX = %d ", Actuator_Ch1_Status_Model.in_CPOS_ALL[i]); + fflush(stdout); + } + + /* : fprintf('\n'); */ + printf("\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: @@ -10446,28 +10135,38 @@ void HVAC_model_step(void) rtb_LogicalOperator1 = ((rtb_Divide1 >= 0.9) && (rtb_Divide1 <= 1.1)); rtb_LogicalOperator3_a0[i] = rtb_LogicalOperator1; - /* Logic: '/Logical Operator' incorporates: - * Logic: '/Logical Operator2' - */ - rtb_LogicalOperator1 = !rtb_LogicalOperator1; - ErrorCalibration_private_b_tmp[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_b[i] = (uint8_t)(rtb_LogicalOperator1 && + rtDW.ErrorCalibration_private_b[i] = (uint8_t)((!rtb_LogicalOperator1) && (rtDW.ErrorCalibration_private_b[i] != 0)); } /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' + * Logic: '/Logical Operator2' */ - MAXPOSITION(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh1_private[0], - ErrorCalibration_private_b_tmp, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 2] Homing 0\n"); */ + printf("[LIN 2] Homing 0\n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : fprintf('[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh1_private[i], + rtb_Divide1_gdi[i], (int16_t)!rtb_LogicalOperator3_a0[i]); + fflush(stdout); + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator1' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_a0[0]; @@ -10542,7 +10241,20 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read6' */ - WriteERROR(rtb_LogicalOperator3_a0, rtDW.LOGGER_LIN); + /* : 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_a0[i]) { + /* : fprintf('[LIN 2] Failure with actuator #%d\n', int16(i)); */ + printf("[LIN 2] 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_a0[i]; @@ -10572,8 +10284,27 @@ void HVAC_model_step(void) * DataStoreRead: '/MIN ACT1T 1' * DataStoreWrite: '/Data Store Write' */ - MAXPOSITION_k(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh1_private[0], - rtDW.ErrorCalibration_private_b, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 2] Homing 1. Start Callibration \n"); */ + printf("[LIN 2] Homing 1. Start Callibration \n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : if(ERRORS(i)==1) */ + if (rtDW.ErrorCalibration_private_b[i] == 1) { + /* : fprintf('[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh1_private[i], + rtb_Divide1_gdi[i], (int16_t) + rtDW.ErrorCalibration_private_b[i]); + fflush(stdout); + } + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' incorporates: * DataStoreWrite: '/Data Store Write' @@ -10634,8 +10365,26 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' */ - MAXPOSITION_d(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh1_private[0], - rtb_LogicalOperator3_a0, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 2] Homing 3. Callibration \n"); */ + printf("[LIN 2] Homing 3. Callibration \n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : if(ERRORS(i)==1) */ + if (rtb_LogicalOperator3_a0[i]) { + /* : fprintf('[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 2] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh1_private[i], + rtb_Divide1_gdi[i], 1); + fflush(stdout); + } + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_a0[0]; @@ -10667,13 +10416,96 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ - SwitchCaseActionSubsystem3(&rtB.Merge_hu, - &rtDW.CCU_ActuatorErrF_Stat_private, rtDW.COM_private_n, - rtDW.ErrorActuator_c, rtDW.ErrorCalibration_private_b, - &rtDW.ErrorHomming_private_j, &rtDW.LOGGER_LIN, rtDW.MODE_private_a, - rtDW.dtc_state_error_model, &rtDW.stepSig_private_j, &rtDW.t_now, - &rtDW.SwitchCaseActionSubsystem3_e); + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>1) */ + if (rtDW.LOGGER_LIN > 1.0) { + /* : fprintf("[LIN 2] Homing 3. Start Time on step %d\n",int16(step)); */ + rtb_Divide1 = rt_roundd(rtDW.ErrorHomming_private_j); + if (rtb_Divide1 < 32768.0) { + if (rtb_Divide1 >= -32768.0) { + AMB = (int16_t)rtb_Divide1; + } else { + AMB = INT16_MIN; + } + } else { + AMB = INT16_MAX; + } + printf("[LIN 2] 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_j < 10.0) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + /* MATLAB Function: '/MATLAB Function' incorporates: + * DataStoreRead: '/Data Store Read' + * DataStoreRead: '/Data Store Read1' + */ + MATLABFunction(rtDW.Start_timer_l, rtDW.t_now, &rtb_dt_ih, + &rtDW.sf_MATLABFunction_i); + + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>1) */ + if (rtDW.LOGGER_LIN > 1.0) { + /* : fprintf("[LIN 2] Homing 3. Start TIme dt = %d \n",int32(data)); */ + rtb_dt_fa = rtb_dt_ih; + if (rtb_dt_ih > 2147483647U) { + rtb_dt_fa = 2147483647U; + } + + printf("[LIN 2] Homing 3. Start TIme dt = %d \n", (int32_t)rtb_dt_fa); + fflush(stdout); + } + + /* End of MATLAB Function: '/MAX POSITION' */ + + /* If: '/If' */ + if (rtb_dt_ih > 30000U) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem(&rtB.Merge_hu, &rtDW.ErrorHomming_private_j, + &rtDW.Start_timer_l, &rtDW.stepSig_private_j); + + /* End of Outputs for SubSystem: '/If Action Subsystem' */ + } else { + /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem1(&rtB.Merge_hu, &rtDW.Start_timer_l); + + /* End of Outputs for SubSystem: '/If Action Subsystem1' */ + } + + /* End of If: '/If' */ + /* End of Outputs for SubSystem: '/If Action Subsystem' */ + } else { + /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: + * ActionPort: '/Action Port' + */ + IfActionSubsystem1_d(&rtB.Merge_hu, &rtDW.CCU_ActuatorErrF_Stat_private, + rtDW.COM_private_n, rtDW.ErrorActuator_c, + rtDW.ErrorCalibration_private_b, &rtDW.LOGGER_LIN, + rtDW.MODE_private_a, rtDW.dtc_state_error_model); + + /* End of Outputs for SubSystem: '/If Action Subsystem1' */ + } + + /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem3' */ break; @@ -10681,9 +10513,28 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem4' incorporates: * ActionPort: '/Action Port' */ - SwitchCaseActionSubsystem4(&rtB.Merge_hu, &rtDW.LOGGER_LIN, - &rtDW.stepSig_private_j); + /* DataStoreWrite: '/Data Store Write' incorporates: + * Constant: '/Constant' + */ + rtDW.stepSig_private_j = 10; + /* Merge: '/Merge' incorporates: + * Constant: '/Constant1' + * SignalConversion generated from: '/step' + */ + rtB.Merge_hu = 5; + + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 2] Homing. Callibration successful \n"); */ + printf("[LIN 2] Homing. Callibration successful \n"); + fflush(stdout); + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem4' */ break; } @@ -10781,17 +10632,6 @@ void HVAC_model_step(void) rtDW.COM_private_n[i] = 0U; } - /* SignalConversion generated from: '/Bus Selector' incorporates: - * DataStoreRead: '/Data Store Read1' - * DataStoreWrite: '/Data Store Write' - */ - rtb_Gain_l = Actuator_Ch2_Status_Model.Busy; - - /* DataStoreWrite: '/Data Store Write1' incorporates: - * DataStoreRead: '/Data Store Read1' - */ - rtb_Gain2 = Actuator_Ch2_Status_Model.Error_Connect; - /* Switch: '/Switch' incorporates: * Constant: '/Constant1' * DataStoreRead: '/Data Store Read' @@ -10811,9 +10651,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates: * ActionPort: '/Action Port' */ - StopMode(rtb_Switch_hx, &rtB.Merge_bj, &rtb_Gain_l, rtDW.COM_private_b, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.MODE_private_p); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_b[i] = 1U; + /* DataStoreWrite: '/Data Store Write' */ + rtDW.MODE_private_p[i] = 2U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Stop Mode\n'); */ + printf("[LIN 3] 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_bj = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Stop Mode' */ break; @@ -10821,9 +10707,57 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates: * ActionPort: '/Action Port' */ - InitialCPOSMin(rtb_Switch_hx, &rtB.Merge_bj, &rtb_Gain_l, rtDW.COM_private_b, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.POS_private_g); + /* If: '/If' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_g[i] = 6000U; + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_b[i] = 2U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Merge: '/Merge' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Initial CPOS Min\n'); */ + printf("[LIN 3] 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_bj = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Initial CPOS Min' */ break; @@ -10831,9 +10765,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates: * ActionPort: '/Action Port' */ - NormalMode(rtb_Switch_hx, &rtB.Merge_bj, &rtb_Gain_l, rtDW.COM_private_b, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.MODE_private_p); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write' */ + rtDW.MODE_private_p[i] = 0U; + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_b[i] = 1U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Normal Mode\n'); */ + printf("[LIN 3] 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_bj = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Normal Mode' */ break; @@ -10841,12 +10821,80 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates: * ActionPort: '/Action Port' */ - MovetopositionMin(rtb_Switch_hx, &rtB.Merge_bj, rtDW.Autos_private_k, - &rtb_Gain_l, rtDW.COM_private_b, rtDW.Coils_private_m, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.Lnoise_private_k, - rtDW.POS_private_g, rtDW.Speed_private_o, - rtDW.Stall_private_h3); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write4' incorporates: + * Constant: '/Constant1' + */ + rtDW.Autos_private_k[i] = 1U; + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant10' + */ + rtDW.Stall_private_h3[i] = 1U; + + /* DataStoreWrite: '/Data Store Write3' */ + rtDW.Lnoise_private_k[i] = 0U; + + /* DataStoreWrite: '/Data Store Write5' incorporates: + * Constant: '/Constant2' + */ + rtDW.Speed_private_o[i] = 3U; + + /* DataStoreWrite: '/Data Store Write6' incorporates: + * Constant: '/Constant3' + */ + rtDW.Coils_private_m[i] = 3U; + + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_g[i] = 0U; + + /* DataStoreWrite: '/Data Store Write1' incorporates: + * Constant: '/Constant9' + */ + rtDW.COM_private_b[i] = 3U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Move to position Min\n'); */ + printf("[LIN 3] 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_bj = 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; @@ -10916,8 +10964,25 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ - Write(rtDW.LOGGER_LIN, Actuator_Ch2_Status_Model.in_CPOS_ALL); + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Check Stall Min\n'); */ + printf("[LIN 3] Check Stall Min\n"); + fflush(stdout); + /* : for i = 1:numel(data) */ + for (i = 0; i < 9; i++) { + /* : fprintf('[LIN 3] MIN = %d ', int16(data(i))); */ + printf("[LIN 3] MIN = %d ", Actuator_Ch2_Status_Model.in_CPOS_ALL[i]); + fflush(stdout); + } + + /* : fprintf('\n'); */ + printf("\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: @@ -10939,9 +11004,55 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates: * ActionPort: '/Action Port' */ - InitialCPOSMax(rtb_Switch_hx, &rtB.Merge_bj, &rtb_Gain_l, rtDW.COM_private_b, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.POS_private_g); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write1' */ + rtDW.COM_private_b[i] = 2U; + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_g[i] = 0U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Initial CPOS Max\n'); */ + printf("[LIN 3] 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_bj = rtb_Switch_hx; + + /* End of Outputs for SubSystem: '/If Action Subsystem3' */ + } + + /* End of If: '/If1' */ /* End of Outputs for SubSystem: '/Initial CPOS Max' */ break; @@ -10949,12 +11060,80 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Move to position Max' incorporates: * ActionPort: '/Action Port' */ - MovetopositionMax(rtb_Switch_hx, &rtB.Merge_bj, rtDW.Autos_private_k, - &rtb_Gain_l, rtDW.COM_private_b, rtDW.Coils_private_m, - &rtb_Gain2, &rtDW.LOGGER_LIN, rtDW.Lnoise_private_k, - rtDW.POS_private_g, rtDW.Speed_private_o, - rtDW.Stall_private_h3); + /* If: '/If1' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreWrite: '/Data Store Write1' + * SignalConversion generated from: '/Bus Selector' + */ + if ((Actuator_Ch2_Status_Model.Busy == 0) && + (Actuator_Ch2_Status_Model.Error_Connect == 0)) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates: + * ActionPort: '/Action Port' + */ + for (i = 0; i < 9; i++) { + /* DataStoreWrite: '/Data Store Write4' incorporates: + * Constant: '/Constant1' + */ + rtDW.Autos_private_k[i] = 1U; + /* DataStoreWrite: '/Data Store Write2' incorporates: + * Constant: '/Constant10' + */ + rtDW.Stall_private_h3[i] = 1U; + + /* DataStoreWrite: '/Data Store Write3' */ + rtDW.Lnoise_private_k[i] = 0U; + + /* DataStoreWrite: '/Data Store Write5' incorporates: + * Constant: '/Constant2' + */ + rtDW.Speed_private_o[i] = 3U; + + /* DataStoreWrite: '/Data Store Write6' incorporates: + * Constant: '/Constant3' + */ + rtDW.Coils_private_m[i] = 3U; + + /* DataStoreWrite: '/Data Store Write' */ + rtDW.POS_private_g[i] = 6000U; + + /* DataStoreWrite: '/Data Store Write1' incorporates: + * Constant: '/Constant9' + */ + rtDW.COM_private_b[i] = 3U; + } + + /* Merge: '/Merge' incorporates: + * Constant: '/Constant' + * Sum: '/step inc' + */ + rtB.Merge_bj = (int8_t)(rtb_Switch_hx + 1); + + /* MATLAB Function: '/Write' incorporates: + * DataStoreRead: '/Data Store Read3' + */ + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Move to position Max\n'); */ + printf("[LIN 3] 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_bj = 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; @@ -11026,8 +11205,25 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write' incorporates: * DataStoreRead: '/Data Store Read3' */ - Write_c(rtDW.LOGGER_LIN, Actuator_Ch2_Status_Model.in_CPOS_ALL); + /* : if(LOGGER == 2) */ + if (rtDW.LOGGER_LIN == 2.0) { + /* : fprintf('[LIN 3] Check Stall MAX\n'); */ + printf("[LIN 3] Check Stall MAX\n"); + fflush(stdout); + /* : for i = 1:numel(data) */ + for (i = 0; i < 9; i++) { + /* : fprintf('[LIN 3] MAX = %d ', int16(data(i))); */ + printf("[LIN 3] MAX = %d ", Actuator_Ch2_Status_Model.in_CPOS_ALL[i]); + fflush(stdout); + } + + /* : fprintf('\n'); */ + printf("\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: @@ -11086,28 +11282,38 @@ void HVAC_model_step(void) rtb_LogicalOperator1 = ((rtb_Divide1 >= 0.9) && (rtb_Divide1 <= 1.1)); rtb_LogicalOperator3_a0[i] = rtb_LogicalOperator1; - /* Logic: '/Logical Operator' incorporates: - * Logic: '/Logical Operator2' - */ - rtb_LogicalOperator1 = !rtb_LogicalOperator1; - ErrorCalibration_private_b_tmp[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_h[i] = (uint8_t)(rtb_LogicalOperator1 && + rtDW.ErrorCalibration_private_h[i] = (uint8_t)((!rtb_LogicalOperator1) && (rtDW.ErrorCalibration_private_h[i] != 0)); } /* MATLAB Function: '/MAX POSITION' incorporates: * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' + * Logic: '/Logical Operator2' */ - MAXPOSITION(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh2_private[0], - ErrorCalibration_private_b_tmp, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 3] Homing 0\n"); */ + printf("[LIN 3] Homing 0\n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : fprintf('[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh2_private[i], + rtb_Divide1_gdi[i], (int16_t)!rtb_LogicalOperator3_a0[i]); + fflush(stdout); + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator1' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_a0[0]; @@ -11182,7 +11388,20 @@ void HVAC_model_step(void) /* MATLAB Function: '/Write ERROR' incorporates: * DataStoreRead: '/Data Store Read6' */ - WriteERROR(rtb_LogicalOperator3_a0, rtDW.LOGGER_LIN); + /* : 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_a0[i]) { + /* : fprintf('[LIN 3] Failure with actuator #%d\n', int16(i)); */ + printf("[LIN 3] 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_a0[i]; @@ -11212,8 +11431,27 @@ void HVAC_model_step(void) * DataStoreRead: '/MIN ACT1T 1' * DataStoreWrite: '/Data Store Write' */ - MAXPOSITION_k(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh2_private[0], - rtDW.ErrorCalibration_private_h, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 3] Homing 1. Start Callibration \n"); */ + printf("[LIN 3] Homing 1. Start Callibration \n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : if(ERRORS(i)==1) */ + if (rtDW.ErrorCalibration_private_h[i] == 1) { + /* : fprintf('[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh2_private[i], + rtb_Divide1_gdi[i], (int16_t) + rtDW.ErrorCalibration_private_h[i]); + fflush(stdout); + } + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' incorporates: * DataStoreWrite: '/Data Store Write' @@ -11274,8 +11512,26 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read5' * DataStoreRead: '/MIN ACT1T 1' */ - MAXPOSITION_d(rtDW.LOGGER_LIN, &rtDW.MaxPositionCh2_private[0], - rtb_LogicalOperator3_a0, rtb_Divide1_gdi); + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 3] Homing 3. Callibration \n"); */ + printf("[LIN 3] Homing 3. Callibration \n"); + fflush(stdout); + + /* : for i = 1:numel(MAX) */ + for (i = 0; i < 6; i++) { + /* : if(ERRORS(i)==1) */ + if (rtb_LogicalOperator3_a0[i]) { + /* : fprintf('[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n', int16(i), int16(MAX(i)), KOEF(i), int16(ERRORS(i))); */ + printf("[LIN 3] ACT%d MAX = %d KOEF = %f Callibration = %d \n", + (int16_t)(i + 1), rtDW.MaxPositionCh2_private[i], + rtb_Divide1_gdi[i], 1); + fflush(stdout); + } + } + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* Logic: '/Logical Operator2' */ rtb_LogicalOperator1 = rtb_LogicalOperator3_a0[0]; @@ -11307,13 +11563,96 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem3' incorporates: * ActionPort: '/Action Port' */ - SwitchCaseActionSubsystem3(&rtB.Merge_j, - &rtDW.CCU_ActuatorErrF_Stat_private, rtDW.COM_private_b, - rtDW.ErrorActuator_o, rtDW.ErrorCalibration_private_h, - &rtDW.ErrorHomming_private_m, &rtDW.LOGGER_LIN, rtDW.MODE_private_p, - rtDW.dtc_state_error_model, &rtDW.stepSig_private_o, &rtDW.t_now, - &rtDW.SwitchCaseActionSubsystem3_k); + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read1' + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>1) */ + if (rtDW.LOGGER_LIN > 1.0) { + /* : fprintf("[LIN 3] Homing 3. Start Time on step %d\n",int16(step)); */ + rtb_Divide1 = rt_roundd(rtDW.ErrorHomming_private_m); + if (rtb_Divide1 < 32768.0) { + if (rtb_Divide1 >= -32768.0) { + AMB = (int16_t)rtb_Divide1; + } else { + AMB = INT16_MIN; + } + } else { + AMB = INT16_MAX; + } + printf("[LIN 3] 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_m < 10.0) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + /* MATLAB Function: '/MATLAB Function' incorporates: + * DataStoreRead: '/Data Store Read' + * DataStoreRead: '/Data Store Read1' + */ + MATLABFunction(rtDW.Start_timer, rtDW.t_now, &rtb_dt_ih, + &rtDW.sf_MATLABFunction_c); + + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>1) */ + if (rtDW.LOGGER_LIN > 1.0) { + /* : fprintf("[LIN 3] Homing 3. Start TIme dt = %d \n",int32(data)); */ + rtb_dt_fa = rtb_dt_ih; + if (rtb_dt_ih > 2147483647U) { + rtb_dt_fa = 2147483647U; + } + + printf("[LIN 3] Homing 3. Start TIme dt = %d \n", (int32_t)rtb_dt_fa); + fflush(stdout); + } + + /* End of MATLAB Function: '/MAX POSITION' */ + + /* If: '/If' */ + if (rtb_dt_ih > 30000U) { + /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem(&rtB.Merge_j, &rtDW.ErrorHomming_private_m, + &rtDW.Start_timer, &rtDW.stepSig_private_o); + + /* End of Outputs for SubSystem: '/If Action Subsystem' */ + } else { + /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: + * ActionPort: '/Action Port' + */ + /* Merge: '/Merge' */ + IfActionSubsystem1(&rtB.Merge_j, &rtDW.Start_timer); + + /* End of Outputs for SubSystem: '/If Action Subsystem1' */ + } + + /* End of If: '/If' */ + /* End of Outputs for SubSystem: '/If Action Subsystem' */ + } else { + /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates: + * ActionPort: '/Action Port' + */ + IfActionSubsystem1_d(&rtB.Merge_j, &rtDW.CCU_ActuatorErrF_Stat_private, + rtDW.COM_private_b, rtDW.ErrorActuator_o, + rtDW.ErrorCalibration_private_h, &rtDW.LOGGER_LIN, + rtDW.MODE_private_p, rtDW.dtc_state_error_model); + + /* End of Outputs for SubSystem: '/If Action Subsystem1' */ + } + + /* End of If: '/If' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem3' */ break; @@ -11321,9 +11660,28 @@ void HVAC_model_step(void) /* Outputs for IfAction SubSystem: '/Switch Case Action Subsystem4' incorporates: * ActionPort: '/Action Port' */ - SwitchCaseActionSubsystem4(&rtB.Merge_j, &rtDW.LOGGER_LIN, - &rtDW.stepSig_private_o); + /* DataStoreWrite: '/Data Store Write' incorporates: + * Constant: '/Constant' + */ + rtDW.stepSig_private_o = 10; + /* Merge: '/Merge' incorporates: + * Constant: '/Constant1' + * SignalConversion generated from: '/step' + */ + rtB.Merge_j = 5; + + /* MATLAB Function: '/MAX POSITION' incorporates: + * DataStoreRead: '/Data Store Read5' + */ + /* : if(LOGGER>0) */ + if (rtDW.LOGGER_LIN > 0.0) { + /* : fprintf("[LIN 3] Homing. Callibration successful \n"); */ + printf("[LIN 3] Homing. Callibration successful \n"); + fflush(stdout); + } + + /* End of MATLAB Function: '/MAX POSITION' */ /* End of Outputs for SubSystem: '/Switch Case Action Subsystem4' */ break; } @@ -11713,9 +12071,9 @@ void HVAC_model_step(void) i = 255; } - rtb_dt_av = (uint32_t)i - 2U; + rtb_dt_fa = (uint32_t)i - 2U; if ((uint32_t)i - 2U > (uint32_t)i) { - rtb_dt_av = 0U; + rtb_dt_fa = 0U; } /* Merge: '/Merge' incorporates: @@ -11725,7 +12083,7 @@ void HVAC_model_step(void) * Switch: '/Switch' */ rtB.Merge_ho = (int8_t)(rtDW.ECT > g_assSTART_COOLANT_STEP0_TO_1 - [(int32_t)rtb_dt_av - 1]); + [(int32_t)rtb_dt_fa - 1]); /* End of Outputs for SubSystem: '/Level 3' */ break; @@ -12173,7 +12531,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_pc = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_fm; + rtb_dt_ih = 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); @@ -12199,11 +12557,11 @@ void HVAC_model_step(void) } /* MW:begin MISRA2012:D4.1 CERT-C:INT30-C 'Justifying MISRA CPP rule violation' */ - rtb_dt_av = (uint32_t)i - 3U; + rtb_dt_fa = (uint32_t)i - 3U; /* MW:end MISRA2012:D4.1 CERT-C:INT30-C */ if ((uint32_t)i - 3U > (uint32_t)i) { - rtb_dt_av = 0U; + rtb_dt_fa = 0U; } /* Switch: '/Switch' incorporates: @@ -12216,8 +12574,8 @@ void HVAC_model_step(void) * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ - if ((Duct1_F < AMB) || (rtb_dt_pc > (uint32_t)(1000 * Eva_F)) || - (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[(int32_t)rtb_dt_av - 1])) { + if ((Duct1_F < AMB) || (rtb_dt_ih > (uint32_t)(1000 * Eva_F)) || + (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[(int32_t)rtb_dt_fa - 1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step 2' */ @@ -12532,7 +12890,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_g; + rtb_dt_fa = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_g; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' @@ -12554,7 +12912,7 @@ void HVAC_model_step(void) * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ - if (rtb_dt_av > (uint32_t)(1000 * AMB)) { + if (rtb_dt_fa > (uint32_t)(1000 * AMB)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ @@ -12849,7 +13207,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_mz; + rtb_dt_fa = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_mz; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' @@ -12871,7 +13229,7 @@ void HVAC_model_step(void) * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ - if (rtb_dt_av > (uint32_t)(1000 * AMB)) { + if (rtb_dt_fa > (uint32_t)(1000 * AMB)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ @@ -13785,7 +14143,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_em; + rtb_dt_fa = 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' @@ -13816,7 +14174,7 @@ void HVAC_model_step(void) * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ - if ((Duct2_F > AMB) || (rtb_dt_av > (uint16_t)(1000 * Eva_F)) || + if ((Duct2_F > AMB) || (rtb_dt_fa > (uint16_t)(1000 * Eva_F)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[1])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' @@ -13893,7 +14251,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_o; + rtb_dt_fa = 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' @@ -13924,7 +14282,7 @@ void HVAC_model_step(void) * RelationalOperator: '/Relational Operator1' * RelationalOperator: '/Relational Operator2' */ - if ((Duct2_F > AMB) || (rtb_dt_av > (uint16_t)(1000 * Eva_F)) || + if ((Duct2_F > AMB) || (rtb_dt_fa > (uint16_t)(1000 * Eva_F)) || (rtDW.ECT > g_assSTART_COOLANT_TO_STEP2[2])) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' @@ -14173,7 +14531,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_fvm; + rtb_dt_fa = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_fvm; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' @@ -14197,7 +14555,7 @@ void HVAC_model_step(void) * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ - if (rtb_dt_av > (uint16_t)(1000 * Duct2_F)) { + if (rtb_dt_fa > (uint16_t)(1000 * Duct2_F)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ @@ -14421,7 +14779,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_jh; + rtb_dt_fa = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_jh; /* Switch: '/Switch' incorporates: * DataStoreRead: '/Data Store Read4' @@ -14445,7 +14803,7 @@ void HVAC_model_step(void) * Gain: '/из сек в мс' * RelationalOperator: '/Relational Operator1' */ - if (rtb_dt_av > (uint16_t)(1000 * Duct2_F)) { + if (rtb_dt_fa > (uint16_t)(1000 * Duct2_F)) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ @@ -14669,7 +15027,7 @@ void HVAC_model_step(void) * DataStoreRead: '/Data Store Read4' * UnitDelay: '/t_start_delay_private ' */ - rtb_dt_av = rtDW.t_now - rtDW.t_start_delay_private_DSTATE_ed; + rtb_dt_fa = 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' @@ -14695,7 +15053,7 @@ void HVAC_model_step(void) * Logic: '/Logical Operator' * RelationalOperator: '/Relational Operator1' */ - if ((rtb_dt_av > (uint16_t)(1000 * Duct2_F)) || rtDW.HI_logic_on) { + if ((rtb_dt_fa > (uint16_t)(1000 * Duct2_F)) || rtDW.HI_logic_on) { /* Merge: '/Merge' incorporates: * Constant: '/go to next step' */ @@ -14913,7 +15271,11 @@ void HVAC_model_initialize(void) /* SystemInitialize for IfAction SubSystem: '/Homing' */ /* SystemInitialize for IfAction SubSystem: '/Switch Case Action Subsystem3' */ /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ - IfActionSubsystem_Init(&rtDW.IfActionSubsystem_p); + /* Start for DataStoreMemory: '/Data Store Memory' */ + rtDW.Start_timer_i = 1.0; + + /* SystemInitialize for MATLAB Function: '/MATLAB Function' */ + MATLABFunction_Init(&rtDW.sf_MATLABFunction); /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ /* End of SystemInitialize for SubSystem: '/Switch Case Action Subsystem3' */ @@ -14928,8 +15290,14 @@ void HVAC_model_initialize(void) /* SystemInitialize for IfAction SubSystem: '/Homing' */ /* SystemInitialize for IfAction SubSystem: '/Switch Case Action Subsystem3' */ - SwitchCaseActionSubsystem3_Init(&rtDW.SwitchCaseActionSubsystem3_e); + /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ + /* Start for DataStoreMemory: '/Data Store Memory' */ + rtDW.Start_timer_l = 1.0; + /* SystemInitialize for MATLAB Function: '/MATLAB Function' */ + MATLABFunction_Init(&rtDW.sf_MATLABFunction_i); + + /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ /* End of SystemInitialize for SubSystem: '/Switch Case Action Subsystem3' */ /* SystemInitialize for Merge: '/Merge' */ @@ -14942,8 +15310,14 @@ void HVAC_model_initialize(void) /* SystemInitialize for IfAction SubSystem: '/Homing' */ /* SystemInitialize for IfAction SubSystem: '/Switch Case Action Subsystem3' */ - SwitchCaseActionSubsystem3_Init(&rtDW.SwitchCaseActionSubsystem3_k); + /* SystemInitialize for IfAction SubSystem: '/If Action Subsystem' */ + /* Start for DataStoreMemory: '/Data Store Memory' */ + rtDW.Start_timer = 1.0; + /* SystemInitialize for MATLAB Function: '/MATLAB Function' */ + MATLABFunction_Init(&rtDW.sf_MATLABFunction_c); + + /* End of SystemInitialize for SubSystem: '/If Action Subsystem' */ /* End of SystemInitialize for SubSystem: '/Switch Case Action Subsystem3' */ /* SystemInitialize for Merge: '/Merge' */ diff --git a/HVAC_model.h b/HVAC_model.h index c13101f..de0a917 100644 --- a/HVAC_model.h +++ b/HVAC_model.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.848 + * Model version : 1.850 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Fri Apr 24 14:46:20 2026 + * C/C++ source code generated on : Fri Apr 24 16:29:01 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -40,18 +40,12 @@ /* user code (top of header file) */ #include -/* Block states (default storage) for system '/If Action Subsystem' */ +/* Block states (default storage) for system '/MATLAB Function' */ typedef struct { - double Start_timer; /* '/Data Store Memory' */ double cond_prev; /* '/MATLAB Function' */ uint32_t t_start; /* '/MATLAB Function' */ bool t_start_not_empty; /* '/MATLAB Function' */ -} DW_IfActionSubsystem; - -/* Block states (default storage) for system '/Switch Case Action Subsystem3' */ -typedef struct { - DW_IfActionSubsystem IfActionSubsystem_e;/* '/If Action Subsystem' */ -} DW_SwitchCaseActionSubsystem3; +} DW_MATLABFunction; /* Block states (default storage) for system '/Level 4' */ typedef struct { @@ -118,6 +112,9 @@ typedef struct { double MODE_RR_passenger; /* '/Data Store Memory19' */ double SKIPPED_FIRST_SIMULATION_STEP;/* '/Data Store Memory64' */ double start_control_finished_rear; /* '/SC Rear' */ + double Start_timer; /* '/Data Store Memory' */ + double Start_timer_l; /* '/Data Store Memory' */ + double Start_timer_i; /* '/Data Store Memory' */ CmdBusADCDataKey ADC_Key_Data_Model; /* '/Data Store Memory3' */ uint32_t t_start_delay_private_DSTATE;/* '/t_start_delay_private ' */ uint32_t t_start_delay_private_DSTATE_j;/* '/t_start_delay_private ' */ @@ -280,30 +277,21 @@ typedef struct { DW_Level3 Level3_l; /* '/Level 3' */ DW_Level4_n Level5_g; /* '/Level 5' */ DW_Level4_n Level4_cw; /* '/Level 4' */ - DW_SwitchCaseActionSubsystem3 SwitchCaseActionSubsystem3_k; - /* '/Switch Case Action Subsystem3' */ - DW_SwitchCaseActionSubsystem3 SwitchCaseActionSubsystem3_e; - /* '/Switch Case Action Subsystem3' */ - DW_IfActionSubsystem IfActionSubsystem_p;/* '/If Action Subsystem' */ + DW_MATLABFunction sf_MATLABFunction_c;/* '/MATLAB Function' */ + DW_MATLABFunction sf_MATLABFunction_i;/* '/MATLAB Function' */ + DW_MATLABFunction sf_MATLABFunction; /* '/MATLAB Function' */ } DW; /* Invariant block signals for system '/If Action Subsystem1' */ typedef struct { const uint8_t DataTypeConversion[9]; /* '/Data Type Conversion' */ -} ConstB_IfActionSubsystem1; - -/* Invariant block signals for system '/Switch Case Action Subsystem3' */ -typedef struct { - ConstB_IfActionSubsystem1 IfActionSubsystem1_n;/* '/If Action Subsystem1' */ -} ConstB_SwitchCaseActionSubsystem3; +} ConstB_IfActionSubsystem1_c; /* Invariant block signals (default storage) */ typedef struct { - ConstB_SwitchCaseActionSubsystem3 SwitchCaseActionSubsystem3_k; - /* '/Switch Case Action Subsystem3' */ - ConstB_SwitchCaseActionSubsystem3 SwitchCaseActionSubsystem3_e; - /* '/Switch Case Action Subsystem3' */ - ConstB_IfActionSubsystem1 IfActionSubsystem1_d;/* '/If Action Subsystem1' */ + ConstB_IfActionSubsystem1_c IfActionSubsystem1_c;/* '/If Action Subsystem1' */ + ConstB_IfActionSubsystem1_c IfActionSubsystem1_n;/* '/If Action Subsystem1' */ + ConstB_IfActionSubsystem1_c IfActionSubsystem1_dc;/* '/If Action Subsystem1' */ } ConstB; /* Constant parameters (default storage) */ diff --git a/HVAC_model_data.c b/HVAC_model_data.c index aadd7bb..df020a9 100644 --- a/HVAC_model_data.c +++ b/HVAC_model_data.c @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.848 + * Model version : 1.850 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Fri Apr 24 14:46:20 2026 + * C/C++ source code generated on : Fri Apr 24 16:29:01 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -19,29 +19,21 @@ /* Invariant block signals (default storage) */ const ConstB rtConstB = { - /* Start of '/Switch Case Action Subsystem3' */ + /* Start of '/If Action Subsystem1' */ { - /* Start of '/If Action Subsystem1' */ - { - { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U }/* '/Data Type Conversion' */ - } - /* End of '/If Action Subsystem1' */ + { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U }/* '/Data Type Conversion' */ } , - /* End of '/Switch Case Action Subsystem3' */ + /* End of '/If Action Subsystem1' */ - /* Start of '/Switch Case Action Subsystem3' */ + /* Start of '/If Action Subsystem1' */ { - /* Start of '/If Action Subsystem1' */ - { - { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U }/* '/Data Type Conversion' */ - } - /* End of '/If Action Subsystem1' */ + { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U }/* '/Data Type Conversion' */ } , - /* End of '/Switch Case Action Subsystem3' */ + /* End of '/If Action Subsystem1' */ /* Start of '/If Action Subsystem1' */ { diff --git a/HVAC_model_private.h b/HVAC_model_private.h index 32598f1..0eb14f1 100644 --- a/HVAC_model_private.h +++ b/HVAC_model_private.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.848 + * Model version : 1.850 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Fri Apr 24 14:46:20 2026 + * C/C++ source code generated on : Fri Apr 24 16:29:01 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -108,63 +108,17 @@ extern void g_aucFLOW_AFSM_FOOT_VALVE_MAX_f(uint8_t rtu_LVL, uint8_t extern 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); extern void left(uint8_t rtu_idx, uint16_t rty_vals[9]); -extern void IfActionSubsystem_Init(DW_IfActionSubsystem *localDW); -extern void IfActionSubsystem(int8_t *rty_Out2, double *rtd_ErrorHomming_private, - const double *rtd_LOGGER_LIN, int8_t *rtd_stepSig_private, const uint32_t - *rtd_t_now, DW_IfActionSubsystem *localDW); -extern void IfActionSubsystem1(int8_t *rty_Output, uint8_t +extern void IfActionSubsystem(int8_t *rty_Out1, double *rtd_ErrorHomming_private, + double *rtd_Start_timer_i, int8_t *rtd_stepSig_private); +extern void IfActionSubsystem1(int8_t *rty_Out1, double *rtd_Start_timer_i); +extern void MATLABFunction_Init(DW_MATLABFunction *localDW); +extern void MATLABFunction(double rtu_cond, uint32_t rtu_t_now, uint32_t *rty_dt, + DW_MATLABFunction *localDW); +extern void IfActionSubsystem1_d(int8_t *rty_Output, uint8_t *rtd_CCU_ActuatorErrF_Stat_private, uint8_t rtd_COM_private[9], uint8_t rtd_ErrorActuator[9], uint8_t rtd_ErrorCalibration_private[9], const double *rtd_LOGGER_LIN, uint8_t rtd_MODE_private[9], uint8_t rtd_dtc_state_error_model[127]); -extern void StopMode(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const - uint8_t *rtd_Error_Connect_private_m, const double - *rtd_LOGGER_LIN, uint8_t rtd_MODE_private_a[9]); -extern void InitialCPOSMin(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint16_t - rtd_POS_private_o[9]); -extern void NormalMode(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint8_t - rtd_MODE_private_a[9]); -extern void MovetopositionMin(int8_t rtu_stepIn, int8_t *rty_step, uint8_t - rtd_Autos_private_a[9], const uint8_t *rtd_Busy_private_i, uint8_t - rtd_COM_private_n[9], uint8_t rtd_Coils_private_e[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint8_t - rtd_Lnoise_private_p[9], uint16_t rtd_POS_private_o[9], uint8_t - rtd_Speed_private_e[9], uint8_t rtd_Stall_private_h[9]); -extern void Write(double rtu_LOGGER, const int16_t rtu_data[9]); -extern void InitialCPOSMax(int8_t rtu_stepIn, int8_t *rty_step, const uint8_t - *rtd_Busy_private_i, uint8_t rtd_COM_private_n[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint16_t - rtd_POS_private_o[9]); -extern void MovetopositionMax(int8_t rtu_stepIn, int8_t *rty_step, uint8_t - rtd_Autos_private_a[9], const uint8_t *rtd_Busy_private_i, uint8_t - rtd_COM_private_n[9], uint8_t rtd_Coils_private_e[9], const uint8_t - *rtd_Error_Connect_private_m, const double *rtd_LOGGER_LIN, uint8_t - rtd_Lnoise_private_p[9], uint16_t rtd_POS_private_o[9], uint8_t - rtd_Speed_private_e[9], uint8_t rtd_Stall_private_h[9]); -extern void Write_c(double rtu_LOGGER, const int16_t rtu_data[9]); -extern void MAXPOSITION(double rtu_LOGGER, const int16_t rtu_MAX[6], const bool - rtu_ERRORS[9], const double rtu_KOEF[9]); -extern void WriteERROR(const bool rtu_ErrCallibration[9], double rtu_LOGGER); -extern void MAXPOSITION_k(double rtu_LOGGER, const int16_t rtu_MAX[6], const - uint8_t rtu_ERRORS[9], const double rtu_KOEF[9]); -extern void MAXPOSITION_d(double rtu_LOGGER, const int16_t rtu_MAX[6], const - bool rtu_ERRORS[9], const double rtu_KOEF[9]); -extern void SwitchCaseActionSubsystem3_Init(DW_SwitchCaseActionSubsystem3 - *localDW); -extern void SwitchCaseActionSubsystem3(int8_t *rty_step, uint8_t - *rtd_CCU_ActuatorErrF_Stat_private, uint8_t rtd_COM_private_n[9], uint8_t - rtd_ErrorActuator_c[9], uint8_t rtd_ErrorCalibration_private_b[9], double - *rtd_ErrorHomming_private_j, const double *rtd_LOGGER_LIN, uint8_t - rtd_MODE_private_a[9], uint8_t rtd_dtc_state_error_model[127], int8_t - *rtd_stepSig_private_j, const uint32_t *rtd_t_now, - DW_SwitchCaseActionSubsystem3 *localDW); -extern void SwitchCaseActionSubsystem4(int8_t *rty_step, const double - *rtd_LOGGER_LIN, int8_t *rtd_stepSig_private_j); extern void g_assSTART_ENTER_INCAR_j(uint8_t rtu_LVL, int16_t *rty_out); extern void g_assSTART_ENTER_COOLANT_p(uint8_t rtu_LVL, int16_t *rty_out); extern void Level4(int8_t *rty_step1, const uint16_t *rtd_ECT, const uint8_t diff --git a/HVAC_model_types.h b/HVAC_model_types.h index 5b744a1..26a3890 100644 --- a/HVAC_model_types.h +++ b/HVAC_model_types.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.848 + * Model version : 1.850 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Fri Apr 24 14:46:20 2026 + * C/C++ source code generated on : Fri Apr 24 16:29:01 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M diff --git a/Model_Task.c b/Model_Task.c index 9348389..33b94e3 100644 --- a/Model_Task.c +++ b/Model_Task.c @@ -45,12 +45,34 @@ static bool setActuatorBusy(tModelTask *env) { #if (LOG_LIN_ACTUATOR == 1) #if (LOG_LIN1_ACTUATOR == 1) - LoggerInfoStatic(LOGGER, LOG_SIGN, "ACT1: TRIGGERED COMMAND (SET BUSY)") + for (uint8_t j = 0; j < env->linTaskActuator1->LIN_ISSR_ALL; ++j) { + switch (Actuator_Ch0_Command_Model.COM[j]) { + case LIN_ACT_CFR_MOD: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT1 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_MOD (SET BUSY)", j, Actuator_Ch0_Command_Model.BUS_ADR[j]) + break; + } + case LIN_ACT_CFR_INI: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT1 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_INI (SET BUSY)", j, Actuator_Ch0_Command_Model.BUS_ADR[j]) + break; + } + + case LIN_ACT_CFR_SET: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT1 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_SET (SET BUSY)", j, Actuator_Ch0_Command_Model.BUS_ADR[j]) + break; + } + + default: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT1 (ADR[%d] = %d): TRIGGERED COMMAND = %d UNKNOWN !!! (SET BUSY)", j, Actuator_Ch0_Command_Model.BUS_ADR[j], Actuator_Ch2_Command_Model.COM[i]) + } + } + } #endif #endif + + Actuator_Ch0_Status_Model.Busy = 1; - return true; + break; } } } @@ -67,12 +89,34 @@ static bool setActuatorBusy(tModelTask *env) { #if (LOG_LIN_ACTUATOR == 1) #if (LOG_LIN2_ACTUATOR == 1) - LoggerInfoStatic(LOGGER, LOG_SIGN, "ACT2: TRIGGERED COMMAND (SET BUSY)") + + for (uint8_t j = 0; j < env->linTaskActuator2->LIN_ISSR_ALL; ++j) { + switch (Actuator_Ch1_Command_Model.COM[j]) { + case LIN_ACT_CFR_MOD: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT2 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_MOD (SET BUSY)", j, Actuator_Ch1_Command_Model.BUS_ADR[j]) + break; + } + case LIN_ACT_CFR_INI: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT2 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_INI (SET BUSY)", j, Actuator_Ch1_Command_Model.BUS_ADR[j]) + break; + } + + case LIN_ACT_CFR_SET: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT2 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_SET (SET BUSY)", j, Actuator_Ch1_Command_Model.BUS_ADR[j]) + break; + } + + default: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT2 (ADR[%d] = %d): TRIGGERED COMMAND = %d UNKNOWN !!! (SET BUSY)", j, Actuator_Ch1_Command_Model.BUS_ADR[j], Actuator_Ch2_Command_Model.COM[i]) + } + } + } #endif #endif + Actuator_Ch1_Status_Model.Busy = 1; - return true; + break; } } } @@ -89,11 +133,34 @@ static bool setActuatorBusy(tModelTask *env) { #if (LOG_LIN_ACTUATOR == 1) #if (LOG_LIN3_ACTUATOR == 1) - LoggerInfoStatic(LOGGER, LOG_SIGN, "ACT3: TRIGGERED COMMAND (SET BUSY)") + + for (uint8_t j = 0; j < env->linTaskActuator1->LIN_ISSR_ALL; ++j) { + switch (Actuator_Ch2_Command_Model.COM[j]) { + case LIN_ACT_CFR_MOD: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT3 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_MOD (SET BUSY)", j, Actuator_Ch2_Command_Model.BUS_ADR[j]) + break; + } + case LIN_ACT_CFR_INI: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT3 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_INI (SET BUSY)", j, Actuator_Ch2_Command_Model.BUS_ADR[j]) + break; + } + + case LIN_ACT_CFR_SET: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT3 (ADR[%d] = %d): TRIGGERED COMMAND LIN_ACT_CFR_SET (SET BUSY)", j, Actuator_Ch2_Command_Model.BUS_ADR[j]) + break; + } + + default: { + LoggerFormatInfo(LOGGER, LOG_SIGN, "ACT3 (ADR[%d] = %d): TRIGGERED COMMAND = %d UNKNOWN !!! (SET BUSY)", j, Actuator_Ch2_Command_Model.BUS_ADR[j], Actuator_Ch2_Command_Model.COM[i]) + } + } + } + #endif #endif + Actuator_Ch2_Status_Model.Busy = 1; - return true; + break; } } }