static void sf_gateway_c2_DYNctl_ver4_etud_nonlineaire (SFc2_DYNctl_ver4_etud_nonlineaireInstanceStruct *chartInstance) { real_T c2_hoistedGlobal; real_T c2_b_angle; uint32_T c2_debug_family_var_map[4]; real_T c2_nargin = 1.0; real_T c2_nargout = 1.0; real_T c2_b_f; boolean_T guard1 = false; _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent); _SFD_DATA_RANGE_CHECK(*chartInstance->c2_angle, 0U); chartInstance->c2_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); c2_hoistedGlobal = *chartInstance->c2_angle; c2_b_angle = c2_hoistedGlobal; _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c2_debug_family_names, c2_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 0U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 1U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML(&c2_b_angle, 2U, c2_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_b_f, 3U, c2_sf_marshallOut, c2_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4); guard1 = false; if (CV_EML_COND(0, 1, 0, CV_RELATIONAL_EVAL(4U, 0U, 0, c2_b_angle, 0.087266462599716474, -1, 5U, c2_b_angle >= 0.087266462599716474))) { guard1 = true; } else if (CV_EML_COND(0, 1, 1, CV_RELATIONAL_EVAL(4U, 0U, 1, c2_b_angle, -0.087266462599716474, -1, 3U, c2_b_angle <= -0.087266462599716474))) { guard1 = true; } else { CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 0, false); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 7); c2_b_f = 0.0; } if (guard1 == true) { CV_EML_MCDC(0, 1, 0, true); CV_EML_IF(0, 1, 0, true); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5); c2_b_f = 1.0; } _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -7); _SFD_SYMBOL_SCOPE_POP(); *chartInstance->c2_f = c2_b_f; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_DYNctl_ver4_etud_nonlineaireMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); _SFD_DATA_RANGE_CHECK(*chartInstance->c2_f, 1U); }
static void sf_gateway_c3_RaspPiPilot(SFc3_RaspPiPilotInstanceStruct *chartInstance) { uint32_T c3_debug_family_var_map[3]; real_T c3_nargin = 0.0; real_T c3_nargout = 1.0; uint8_T c3_result; uint8_T *c3_b_result; c3_b_result = (uint8_T *)ssGetOutputPortSignal(chartInstance->S, 1); _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent); chartInstance->c3_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent); _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 3U, 3U, c3_debug_family_names, c3_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargin, 0U, c3_b_sf_marshallOut, c3_b_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargout, 1U, c3_b_sf_marshallOut, c3_b_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_result, 2U, c3_sf_marshallOut, c3_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 2); c3_result = 0U; _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 3); CV_EML_COND(0, 1, 0, true); CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 0, false); _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -4); _SFD_SYMBOL_SCOPE_POP(); *c3_b_result = c3_result; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_RaspPiPilotMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); _SFD_DATA_RANGE_CHECK((real_T)*c3_b_result, 0U); }
static void sf_gateway_c2_Demo_AU_VA1(SFc2_Demo_AU_VA1InstanceStruct *chartInstance) { real_T c2_hoistedGlobal; real_T c2_randv; uint32_T c2_debug_family_var_map[6]; real_T c2_randTrigger; real_T c2_nargin = 1.0; real_T c2_nargout = 2.0; real_T c2_v_trigW; real_T c2_v_trig; real_T c2_x; real_T c2_b_x; real_T c2_c_x; real_T c2_d_x; real_T *c2_b_randv; real_T *c2_b_v_trigW; real_T *c2_b_v_trig; boolean_T guard1 = false; boolean_T guard2 = false; c2_b_v_trig = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); c2_b_v_trigW = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); c2_b_randv = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent); _SFD_DATA_RANGE_CHECK(*c2_b_randv, 0U); chartInstance->c2_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); c2_hoistedGlobal = *c2_b_randv; c2_randv = c2_hoistedGlobal; _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c2_debug_family_names, c2_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_randTrigger, 0U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 1U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 2U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML(&c2_randv, 3U, c2_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_v_trigW, 4U, c2_sf_marshallOut, c2_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_v_trig, 5U, c2_sf_marshallOut, c2_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3); c2_v_trigW = 0.0; _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5); c2_x = c2_randv; c2_randTrigger = c2_x; c2_b_x = c2_randTrigger; c2_randTrigger = c2_b_x; c2_randTrigger = muDoubleScalarFloor(c2_randTrigger); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 7); guard2 = false; if (CV_EML_COND(0, 1, 0, 0.0 < c2_randTrigger)) { if (CV_EML_COND(0, 1, 1, c2_randTrigger < 30.0)) { CV_EML_MCDC(0, 1, 0, true); CV_EML_IF(0, 1, 0, true); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 8); c2_v_trigW += 0.1; } else { guard2 = true; } } else { guard2 = true; } if (guard2 == true) { CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 0, false); } _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 10); guard1 = false; if (CV_EML_COND(0, 1, 2, 30.0 < c2_randTrigger)) { if (CV_EML_COND(0, 1, 3, c2_randTrigger < 60.0)) { CV_EML_MCDC(0, 1, 1, true); CV_EML_IF(0, 1, 1, true); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 11); c2_v_trigW -= 0.1; } else { guard1 = true; } } else { guard1 = true; } if (guard1 == true) { CV_EML_MCDC(0, 1, 1, false); CV_EML_IF(0, 1, 1, false); } _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 14); if (CV_EML_IF(0, 1, 2, c2_v_trigW > 0.0)) { _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 15); c2_v_trig = 1.0; } else { _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 16); if (CV_EML_IF(0, 1, 3, c2_v_trigW < 0.0)) { _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 17); c2_v_trig = -1.0; _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 18); c2_c_x = c2_v_trigW; c2_d_x = c2_c_x; c2_v_trigW = muDoubleScalarAbs(c2_d_x); } else { _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 20); c2_v_trig = 0.0; _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 20); c2_v_trigW = 0.0; } } _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -20); _SFD_SYMBOL_SCOPE_POP(); *c2_b_v_trigW = c2_v_trigW; *c2_b_v_trig = c2_v_trig; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_AU_VA1MachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); _SFD_DATA_RANGE_CHECK(*c2_b_v_trigW, 1U); _SFD_DATA_RANGE_CHECK(*c2_b_v_trig, 2U); }
static void sf_c3_car_model(SFc3_car_modelInstanceStruct *chartInstance) { int32_T c3_i3; int32_T c3_i4; int32_T c3_i5; int32_T c3_previousEvent; int32_T c3_i6; real_T c3_hoistedGlobal[4]; int32_T c3_i7; real_T c3_b_hoistedGlobal[3]; int32_T c3_i8; real_T c3_X[4]; int32_T c3_i9; real_T c3_u[3]; uint32_T c3_debug_family_var_map[22]; real_T c3_l_F; real_T c3_l_R; real_T c3_Vx; real_T c3_Vy; real_T c3_r; real_T c3_psi; real_T c3_f_Fx; real_T c3_f_Rx; real_T c3_delta; real_T c3_beta; real_T c3_V; real_T c3_s_Fy_num; real_T c3_s_Fy_denum; real_T c3_s_Fy; real_T c3_s_Ry_num; real_T c3_s_Ry_denum; real_T c3_s_Ry; real_T c3_nargin = 2.0; real_T c3_nargout = 1.0; real_T c3_s[2]; real_T c3_A; real_T c3_B; real_T c3_x; real_T c3_y; real_T c3_b_x; real_T c3_b_y; real_T c3_c_x; real_T c3_c_y; real_T c3_d_y; real_T c3_d_x; real_T c3_e_x; real_T c3_f_x; real_T c3_g_x; real_T c3_h_x; real_T c3_i_x; real_T c3_j_x; real_T c3_a; real_T c3_b; real_T c3_e_y; real_T c3_b_a; real_T c3_f_y; real_T c3_k_x; real_T c3_l_x; real_T c3_m_x; real_T c3_c_a; real_T c3_b_b; real_T c3_g_y; real_T c3_n_x; real_T c3_o_x; real_T c3_p_x; real_T c3_d_a; real_T c3_c_b; real_T c3_h_y; real_T c3_e_a; real_T c3_i_y; real_T c3_q_x; real_T c3_r_x; real_T c3_s_x; real_T c3_f_a; real_T c3_d_b; real_T c3_j_y; real_T c3_b_A; real_T c3_b_B; real_T c3_t_x; real_T c3_k_y; real_T c3_u_x; real_T c3_l_y; real_T c3_v_x; real_T c3_m_y; real_T c3_w_x; real_T c3_x_x; real_T c3_y_x; real_T c3_g_a; real_T c3_e_b; real_T c3_n_y; real_T c3_h_a; real_T c3_o_y; real_T c3_ab_x; real_T c3_bb_x; real_T c3_cb_x; real_T c3_i_a; real_T c3_f_b; real_T c3_c_A; real_T c3_c_B; real_T c3_db_x; real_T c3_p_y; real_T c3_eb_x; real_T c3_q_y; real_T c3_fb_x; real_T c3_r_y; int32_T c3_i10; real_T (*c3_b_s)[2]; real_T (*c3_b_u)[3]; real_T (*c3_b_X)[4]; c3_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1); c3_b_s = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1); c3_b_X = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0); _sfTime_ = (real_T)ssGetT(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,2); for (c3_i3 = 0; c3_i3 < 4; c3_i3 = c3_i3 + 1) { _SFD_DATA_RANGE_CHECK((*c3_b_X)[c3_i3], 0U); } for (c3_i4 = 0; c3_i4 < 2; c3_i4 = c3_i4 + 1) { _SFD_DATA_RANGE_CHECK((*c3_b_s)[c3_i4], 1U); } for (c3_i5 = 0; c3_i5 < 3; c3_i5 = c3_i5 + 1) { _SFD_DATA_RANGE_CHECK((*c3_b_u)[c3_i5], 2U); } c3_previousEvent = _sfEvent_; _sfEvent_ = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,2); for (c3_i6 = 0; c3_i6 < 4; c3_i6 = c3_i6 + 1) { c3_hoistedGlobal[c3_i6] = (*c3_b_X)[c3_i6]; } for (c3_i7 = 0; c3_i7 < 3; c3_i7 = c3_i7 + 1) { c3_b_hoistedGlobal[c3_i7] = (*c3_b_u)[c3_i7]; } for (c3_i8 = 0; c3_i8 < 4; c3_i8 = c3_i8 + 1) { c3_X[c3_i8] = c3_hoistedGlobal[c3_i8]; } for (c3_i9 = 0; c3_i9 < 3; c3_i9 = c3_i9 + 1) { c3_u[c3_i9] = c3_b_hoistedGlobal[c3_i9]; } sf_debug_symbol_scope_push_eml(0U, 22U, 22U, c3_debug_family_names, c3_debug_family_var_map); sf_debug_symbol_scope_add_eml(&c3_l_F, c3_d_sf_marshall, 0U); sf_debug_symbol_scope_add_eml(&c3_l_R, c3_d_sf_marshall, 1U); sf_debug_symbol_scope_add_eml(&c3_Vx, c3_d_sf_marshall, 2U); sf_debug_symbol_scope_add_eml(&c3_Vy, c3_d_sf_marshall, 3U); sf_debug_symbol_scope_add_eml(&c3_r, c3_d_sf_marshall, 4U); sf_debug_symbol_scope_add_eml(&c3_psi, c3_d_sf_marshall, 5U); sf_debug_symbol_scope_add_eml(&c3_f_Fx, c3_d_sf_marshall, 6U); sf_debug_symbol_scope_add_eml(&c3_f_Rx, c3_d_sf_marshall, 7U); sf_debug_symbol_scope_add_eml(&c3_delta, c3_d_sf_marshall, 8U); sf_debug_symbol_scope_add_eml(&c3_beta, c3_d_sf_marshall, 9U); sf_debug_symbol_scope_add_eml(&c3_V, c3_d_sf_marshall, 10U); sf_debug_symbol_scope_add_eml(&c3_s_Fy_num, c3_d_sf_marshall, 11U); sf_debug_symbol_scope_add_eml(&c3_s_Fy_denum, c3_d_sf_marshall, 12U); sf_debug_symbol_scope_add_eml(&c3_s_Fy, c3_d_sf_marshall, 13U); sf_debug_symbol_scope_add_eml(&c3_s_Ry_num, c3_d_sf_marshall, 14U); sf_debug_symbol_scope_add_eml(&c3_s_Ry_denum, c3_d_sf_marshall, 15U); sf_debug_symbol_scope_add_eml(&c3_s_Ry, c3_d_sf_marshall, 16U); sf_debug_symbol_scope_add_eml(&c3_nargin, c3_d_sf_marshall, 17U); sf_debug_symbol_scope_add_eml(&c3_nargout, c3_d_sf_marshall, 18U); sf_debug_symbol_scope_add_eml(&c3_X, c3_c_sf_marshall, 19U); sf_debug_symbol_scope_add_eml(&c3_u, c3_b_sf_marshall, 20U); sf_debug_symbol_scope_add_eml(&c3_s, c3_sf_marshall, 21U); CV_EML_FCN(0, 0); /* l_F = param.l_F; */ /* l_R = param.l_R; */ _SFD_EML_CALL(0,7); c3_l_F = 1.1; _SFD_EML_CALL(0,8); c3_l_R = 1.6; _SFD_EML_CALL(0,10); c3_Vx = c3_X[0]; _SFD_EML_CALL(0,11); c3_Vy = c3_X[1]; _SFD_EML_CALL(0,12); c3_r = c3_X[2]; _SFD_EML_CALL(0,13); c3_psi = c3_X[3]; _SFD_EML_CALL(0,15); c3_f_Fx = c3_u[0]; _SFD_EML_CALL(0,16); c3_f_Rx = c3_u[1]; _SFD_EML_CALL(0,17); c3_delta = c3_u[2]; _SFD_EML_CALL(0,20); if (CV_EML_COND(0, 0, c3_Vx == 0.0)) { if (CV_EML_COND(0, 1, c3_Vy == 0.0)) { CV_EML_MCDC(0, 0, TRUE); CV_EML_IF(0, 0, TRUE); _SFD_EML_CALL(0,21); c3_beta = 0.0; goto label_1; } } CV_EML_MCDC(0, 0, FALSE); CV_EML_IF(0, 0, FALSE); _SFD_EML_CALL(0,23); c3_A = c3_Vy; c3_B = c3_Vx; c3_x = c3_A; c3_y = c3_B; c3_b_x = c3_x; c3_b_y = c3_y; c3_c_x = c3_b_x; c3_c_y = c3_b_y; c3_d_y = c3_c_x / c3_c_y; c3_d_x = c3_d_y; c3_beta = c3_d_x; c3_e_x = c3_beta; c3_beta = c3_e_x; c3_beta = muDoubleScalarAtan(c3_beta); label_1: ; _SFD_EML_CALL(0,26); c3_f_x = c3_mpower(chartInstance, c3_Vx) + c3_mpower(chartInstance, c3_Vy); c3_V = c3_f_x; if (c3_V < 0.0) { c3_eml_error(chartInstance); } c3_g_x = c3_V; c3_V = c3_g_x; c3_V = muDoubleScalarSqrt(c3_V); _SFD_EML_CALL(0,28); c3_h_x = c3_beta - c3_delta; c3_i_x = c3_h_x; c3_j_x = c3_i_x; c3_i_x = c3_j_x; c3_i_x = muDoubleScalarSin(c3_i_x); c3_a = c3_V; c3_b = c3_i_x; c3_e_y = c3_a * c3_b; c3_b_a = c3_r; c3_f_y = c3_b_a * 1.1; c3_k_x = c3_delta; c3_l_x = c3_k_x; c3_m_x = c3_l_x; c3_l_x = c3_m_x; c3_l_x = muDoubleScalarCos(c3_l_x); c3_c_a = c3_f_y; c3_b_b = c3_l_x; c3_g_y = c3_c_a * c3_b_b; c3_s_Fy_num = c3_e_y + c3_g_y; _SFD_EML_CALL(0,29); c3_n_x = c3_beta - c3_delta; c3_o_x = c3_n_x; c3_p_x = c3_o_x; c3_o_x = c3_p_x; c3_o_x = muDoubleScalarCos(c3_o_x); c3_d_a = c3_V; c3_c_b = c3_o_x; c3_h_y = c3_d_a * c3_c_b; c3_e_a = c3_r; c3_i_y = c3_e_a * 1.1; c3_q_x = c3_delta; c3_r_x = c3_q_x; c3_s_x = c3_r_x; c3_r_x = c3_s_x; c3_r_x = muDoubleScalarSin(c3_r_x); c3_f_a = c3_i_y; c3_d_b = c3_r_x; c3_j_y = c3_f_a * c3_d_b; c3_s_Fy_denum = c3_h_y + c3_j_y; _SFD_EML_CALL(0,31); if (CV_EML_COND(0, 2, c3_s_Fy_num == 0.0)) { if (CV_EML_COND(0, 3, c3_s_Fy_denum == 0.0)) { CV_EML_MCDC(0, 1, TRUE); CV_EML_IF(0, 1, TRUE); _SFD_EML_CALL(0,32); c3_s_Fy = 0.0; goto label_2; } } CV_EML_MCDC(0, 1, FALSE); CV_EML_IF(0, 1, FALSE); _SFD_EML_CALL(0,34); c3_b_A = c3_s_Fy_num; c3_b_B = c3_s_Fy_denum; c3_t_x = c3_b_A; c3_k_y = c3_b_B; c3_u_x = c3_t_x; c3_l_y = c3_k_y; c3_v_x = c3_u_x; c3_m_y = c3_l_y; c3_s_Fy = c3_v_x / c3_m_y; label_2: ; _SFD_EML_CALL(0,37); c3_w_x = c3_beta; c3_x_x = c3_w_x; c3_y_x = c3_x_x; c3_x_x = c3_y_x; c3_x_x = muDoubleScalarSin(c3_x_x); c3_g_a = c3_V; c3_e_b = c3_x_x; c3_n_y = c3_g_a * c3_e_b; c3_h_a = c3_r; c3_o_y = c3_h_a * 1.6; c3_s_Ry_num = c3_n_y - c3_o_y; _SFD_EML_CALL(0,38); c3_ab_x = c3_beta; c3_bb_x = c3_ab_x; c3_cb_x = c3_bb_x; c3_bb_x = c3_cb_x; c3_bb_x = muDoubleScalarCos(c3_bb_x); c3_i_a = c3_V; c3_f_b = c3_bb_x; c3_s_Ry_denum = c3_i_a * c3_f_b; _SFD_EML_CALL(0,40); if (CV_EML_COND(0, 4, c3_s_Ry_num == 0.0)) { if (CV_EML_COND(0, 5, c3_s_Ry_denum == 0.0)) { CV_EML_MCDC(0, 2, TRUE); CV_EML_IF(0, 2, TRUE); _SFD_EML_CALL(0,41); c3_s_Ry = 0.0; goto label_3; } } CV_EML_MCDC(0, 2, FALSE); CV_EML_IF(0, 2, FALSE); _SFD_EML_CALL(0,43); c3_c_A = c3_s_Ry_num; c3_c_B = c3_s_Ry_denum; c3_db_x = c3_c_A; c3_p_y = c3_c_B; c3_eb_x = c3_db_x; c3_q_y = c3_p_y; c3_fb_x = c3_eb_x; c3_r_y = c3_q_y; c3_s_Ry = c3_fb_x / c3_r_y; label_3: ; _SFD_EML_CALL(0,46); c3_s[0] = c3_s_Fy; c3_s[1] = c3_s_Ry; _SFD_EML_CALL(0,-46); sf_debug_symbol_scope_pop(); for (c3_i10 = 0; c3_i10 < 2; c3_i10 = c3_i10 + 1) { (*c3_b_s)[c3_i10] = c3_s[c3_i10]; } _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,2); _sfEvent_ = c3_previousEvent; sf_debug_check_for_state_inconsistency(_car_modelMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); }
static void sf_c1_object_tracker_intensity(void) { uint8_T c1_previousEvent; real_T c1_b_DirectionCode; int32_T c1_b_BlobCount; real_T c1_BRAKEDIFF; real_T c1_DIFFTHING; _sfTime_ = (real_T)ssGetT(chartInstance.S); _SFD_DATA_RANGE_CHECK(*c1_DirectionCode(), 1U); _SFD_DATA_RANGE_CHECK((real_T)*c1_BlobCount(), 0U); c1_previousEvent = _sfEvent_; _sfEvent_ = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0); c1_b_DirectionCode = *c1_DirectionCode(); c1_b_BlobCount = *c1_BlobCount(); sf_debug_push_symbol_scope(7U, 0U); sf_debug_symbol_scope_add_symbol("movecount", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &chartInstance.c1_movecount, 0); sf_debug_symbol_scope_add_symbol("brakecount", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &chartInstance.c1_brakecount, 0); sf_debug_symbol_scope_add_symbol("startflag", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &chartInstance.c1_startflag, 0); sf_debug_symbol_scope_add_symbol("BRAKEDIFF", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c1_BRAKEDIFF, 0); sf_debug_symbol_scope_add_symbol("DIFFTHING", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c1_DIFFTHING, 0); sf_debug_symbol_scope_add_symbol("BlobCount", 6, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c1_b_BlobCount, 0); sf_debug_symbol_scope_add_symbol("DirectionCode", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c1_b_DirectionCode, 0); CV_EML_FCN(0, 0); /* This block supports an embeddable subset of the MATLAB language. */ /* See the help menu for details. */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,4); c1_DIFFTHING = 5.0; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,5); c1_BRAKEDIFF = 2.0; /* no of frames after which the position of the car is updated. */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,12); if(CV_EML_IF(0, 0, !chartInstance.c1_startflag_not_empty)) { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,13); chartInstance.c1_startflag = 1.0; chartInstance.c1_startflag_not_empty = true; } else { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,15); chartInstance.c1_startflag = 0.0; chartInstance.c1_startflag_not_empty = true; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,18); if(CV_EML_IF(0, 1, !chartInstance.c1_brakecount_not_empty)) { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,19); chartInstance.c1_brakecount = 0.0; chartInstance.c1_brakecount_not_empty = true; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,22); if(CV_EML_IF(0, 2, !chartInstance.c1_movecount_not_empty)) { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,23); chartInstance.c1_movecount = 0.0; chartInstance.c1_movecount_not_empty = true; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,26); if(CV_EML_IF(0, 3, (real_T)c1_b_BlobCount == 0.0)) { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,27); chartInstance.c1_movecount = c1_DIFFTHING; chartInstance.c1_movecount_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,28); chartInstance.c1_brakecount = 0.0; chartInstance.c1_brakecount_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,29); chartInstance.c1_startflag = 1.0; chartInstance.c1_startflag_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,30); sf_mex_call("BrakeAll", 0U, 0U); } else { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,34); chartInstance.c1_movecount = chartInstance.c1_movecount + 1.0; chartInstance.c1_movecount_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,35); chartInstance.c1_brakecount = chartInstance.c1_brakecount + 1.0; chartInstance.c1_brakecount_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,37); if(CV_EML_IF(0, 4, chartInstance.c1_brakecount >= c1_BRAKEDIFF)) { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,38); sf_mex_call("BrakeAll", 0U, 0U); } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,42); if(CV_EML_COND(0, 0, chartInstance.c1_movecount >= c1_DIFFTHING) || CV_EML_COND(0, 1, chartInstance.c1_startflag == 1.0)) { CV_EML_MCDC(0, 0, true); CV_EML_IF(0, 5, true); _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,44); if(CV_EML_IF(0, 6, c1_b_DirectionCode == 1.0)) { /* Forward */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,45); sf_mex_call("MoveForward", 0U, 1U, 6, 1.0); } else { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,46); if(CV_EML_IF(0, 7, c1_b_DirectionCode == 2.0)) { /* Left */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,47); sf_mex_call("MoveLeft", 0U, 1U, 6, 1.0); } else { _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,48); if(CV_EML_IF(0, 8, c1_b_DirectionCode == 3.0)) { /* Right */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,49); sf_mex_call("MoveRight", 0U, 1U, 6, 1.0); } } } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,52); sf_mex_call("MoveForward", 0U, 1U, 6, 1.0); _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,53); chartInstance.c1_movecount = 0.0; chartInstance.c1_movecount_not_empty = true; } else { CV_EML_MCDC(0, 0, false); CV_EML_IF(0, 5, false); } } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,-53); sf_debug_pop_symbol_scope(); _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0); _sfEvent_ = c1_previousEvent; sf_debug_check_for_state_inconsistency(_object_tracker_intensityMachineNumber_, chartInstance.chartNumber, chartInstance. instanceNumber); }
static void sf_c1_my_demo_ref(SFc1_my_demo_refInstanceStruct *chartInstance) { int32_T c1_i0; real_T c1_hoistedGlobal; real_T c1_b_hoistedGlobal; real_T c1_x; real_T c1_y; int32_T c1_i1; real_T c1_fpath[170]; uint32_T c1_debug_family_var_map[13]; real_T c1_dmin; real_T c1_xx[85]; real_T c1_yy[85]; real_T c1_d; real_T c1_nargin = 3.0; real_T c1_nargout = 3.0; real_T c1_x_g; real_T c1_y_g; real_T c1_stop; int32_T c1_i2; int32_T c1_i3; real_T c1_c_hoistedGlobal; real_T c1_d_hoistedGlobal; real_T c1_b_x; real_T c1_c_x; real_T *c1_b_x_g; real_T *c1_b_y_g; real_T *c1_d_x; real_T *c1_b_y; real_T *c1_b_stop; real_T (*c1_b_fpath)[170]; boolean_T guard1 = FALSE; boolean_T guard2 = FALSE; c1_b_stop = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); c1_b_fpath = (real_T (*)[170])ssGetInputPortSignal(chartInstance->S, 2); c1_b_y = (real_T *)ssGetInputPortSignal(chartInstance->S, 1); c1_d_x = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); c1_b_y_g = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); c1_b_x_g = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); _sfTime_ = (real_T)ssGetT(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent); _SFD_DATA_RANGE_CHECK(*c1_b_x_g, 0U); _SFD_DATA_RANGE_CHECK(*c1_b_y_g, 1U); _SFD_DATA_RANGE_CHECK(*c1_d_x, 2U); _SFD_DATA_RANGE_CHECK(*c1_b_y, 3U); for (c1_i0 = 0; c1_i0 < 170; c1_i0++) { _SFD_DATA_RANGE_CHECK((*c1_b_fpath)[c1_i0], 4U); } _SFD_DATA_RANGE_CHECK(*c1_b_stop, 5U); chartInstance->c1_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent); c1_hoistedGlobal = *c1_d_x; c1_b_hoistedGlobal = *c1_b_y; c1_x = c1_hoistedGlobal; c1_y = c1_b_hoistedGlobal; for (c1_i1 = 0; c1_i1 < 170; c1_i1++) { c1_fpath[c1_i1] = (*c1_b_fpath)[c1_i1]; } sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c1_debug_family_names, c1_debug_family_var_map); sf_debug_symbol_scope_add_eml_importable(&c1_dmin, 0U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(c1_xx, 1U, c1_d_sf_marshallOut, c1_c_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(c1_yy, 2U, c1_d_sf_marshallOut, c1_c_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c1_d, 3U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 4U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 5U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml(&c1_x, 6U, c1_b_sf_marshallOut); sf_debug_symbol_scope_add_eml(&c1_y, 7U, c1_b_sf_marshallOut); sf_debug_symbol_scope_add_eml(c1_fpath, 8U, c1_c_sf_marshallOut); sf_debug_symbol_scope_add_eml_importable(&c1_x_g, 9U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c1_y_g, 10U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c1_stop, 11U, c1_b_sf_marshallOut, c1_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&chartInstance->c1_i, 12U, c1_sf_marshallOut, c1_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6); _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7); if (CV_EML_IF(0, 1, 0, !chartInstance->c1_i_not_empty)) { _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 8); chartInstance->c1_i = 1.0; chartInstance->c1_i_not_empty = TRUE; } _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 12); c1_stop = 0.0; _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 13); c1_dmin = 0.1; _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 26); for (c1_i2 = 0; c1_i2 < 85; c1_i2++) { c1_xx[c1_i2] = c1_fpath[c1_i2]; } _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 27); for (c1_i3 = 0; c1_i3 < 85; c1_i3++) { c1_yy[c1_i3] = c1_fpath[c1_i3 + 85]; } _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 29); c1_c_hoistedGlobal = chartInstance->c1_i; c1_d_hoistedGlobal = chartInstance->c1_i; c1_b_x = c1_mpower(chartInstance, c1_x - c1_xx[_SFD_EML_ARRAY_BOUNDS_CHECK( "xx", (int32_T)_SFD_INTEGER_CHECK("i", c1_c_hoistedGlobal), 1, 85, 1, 0) - 1]) + c1_mpower(chartInstance, c1_y - c1_yy[_SFD_EML_ARRAY_BOUNDS_CHECK("yy", (int32_T)_SFD_INTEGER_CHECK("i", c1_d_hoistedGlobal), 1, 85, 1, 0) - 1]); c1_d = c1_b_x; if (c1_d < 0.0) { c1_eml_error(chartInstance); } c1_c_x = c1_d; c1_d = c1_c_x; c1_d = muDoubleScalarSqrt(c1_d); _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 31); guard2 = FALSE; if (CV_EML_COND(0, 1, 0, c1_d < c1_dmin)) { if (CV_EML_COND(0, 1, 1, chartInstance->c1_i < 85.0)) { CV_EML_MCDC(0, 1, 0, TRUE); CV_EML_IF(0, 1, 1, TRUE); _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 32); chartInstance->c1_i++; } else { guard2 = TRUE; } } else { guard2 = TRUE; } if (guard2 == TRUE) { CV_EML_MCDC(0, 1, 0, FALSE); CV_EML_IF(0, 1, 1, FALSE); } _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 36); c1_x_g = c1_xx[_SFD_EML_ARRAY_BOUNDS_CHECK("xx", (int32_T)_SFD_INTEGER_CHECK( "i", chartInstance->c1_i), 1, 85, 1, 0) - 1]; _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 37); c1_y_g = c1_yy[_SFD_EML_ARRAY_BOUNDS_CHECK("yy", (int32_T)_SFD_INTEGER_CHECK( "i", chartInstance->c1_i), 1, 85, 1, 0) - 1]; _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 40); guard1 = FALSE; if (CV_EML_COND(0, 1, 2, c1_d < c1_dmin)) { if (CV_EML_COND(0, 1, 3, chartInstance->c1_i == 85.0)) { CV_EML_MCDC(0, 1, 1, TRUE); CV_EML_IF(0, 1, 2, TRUE); _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 41); c1_stop = 1.0; } else { guard1 = TRUE; } } else { guard1 = TRUE; } if (guard1 == TRUE) { CV_EML_MCDC(0, 1, 1, FALSE); CV_EML_IF(0, 1, 2, FALSE); } _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -41); sf_debug_symbol_scope_pop(); *c1_b_x_g = c1_x_g; *c1_b_y_g = c1_y_g; *c1_b_stop = c1_stop; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent); sf_debug_check_for_state_inconsistency(_my_demo_refMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); }
static void sf_c2_SATest(SFc2_SATestInstanceStruct *chartInstance) { int32_T c2_previousEvent; real_T c2_hoistedGlobal; real_T c2_b_hoistedGlobal; real_T c2_c_hoistedGlobal; real_T c2_d_hoistedGlobal; real_T c2_d1; real_T c2_d2; real_T c2_d3; real_T c2_d4; uint32_T c2_debug_family_var_map[8]; real_T c2_nargin = 4.0; real_T c2_nargout = 1.0; real_T c2_i; real_T *c2_b_d1; real_T *c2_b_i; real_T *c2_b_d2; real_T *c2_b_d3; real_T *c2_b_d4; c2_b_d4 = (real_T *)ssGetInputPortSignal(chartInstance->S, 3); c2_b_d3 = (real_T *)ssGetInputPortSignal(chartInstance->S, 2); c2_b_d2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1); c2_b_i = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); c2_b_d1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); _sfTime_ = (real_T)ssGetT(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0); _SFD_DATA_RANGE_CHECK(*c2_b_d1, 0U); _SFD_DATA_RANGE_CHECK(*c2_b_i, 1U); _SFD_DATA_RANGE_CHECK(*c2_b_d2, 2U); _SFD_DATA_RANGE_CHECK(*c2_b_d3, 3U); _SFD_DATA_RANGE_CHECK(*c2_b_d4, 4U); c2_previousEvent = _sfEvent_; _sfEvent_ = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0); c2_hoistedGlobal = *c2_b_d1; c2_b_hoistedGlobal = *c2_b_d2; c2_c_hoistedGlobal = *c2_b_d3; c2_d_hoistedGlobal = *c2_b_d4; c2_d1 = c2_hoistedGlobal; c2_d2 = c2_b_hoistedGlobal; c2_d3 = c2_c_hoistedGlobal; c2_d4 = c2_d_hoistedGlobal; sf_debug_symbol_scope_push_eml(0U, 8U, 8U, c2_debug_family_names, c2_debug_family_var_map); sf_debug_symbol_scope_add_eml(&c2_nargin, c2_b_sf_marshall, 0U); sf_debug_symbol_scope_add_eml(&c2_nargout, c2_b_sf_marshall, 1U); sf_debug_symbol_scope_add_eml(&c2_d1, c2_b_sf_marshall, 2U); sf_debug_symbol_scope_add_eml(&c2_d2, c2_b_sf_marshall, 3U); sf_debug_symbol_scope_add_eml(&c2_d3, c2_b_sf_marshall, 4U); sf_debug_symbol_scope_add_eml(&c2_d4, c2_b_sf_marshall, 5U); sf_debug_symbol_scope_add_eml(&c2_i, c2_b_sf_marshall, 6U); sf_debug_symbol_scope_add_eml(&chartInstance->c2_j, c2_sf_marshall, 7U); CV_EML_FCN(0, 0); _SFD_EML_CALL(0, 6); if (CV_EML_IF(0, 0, !chartInstance->c2_j_not_empty)) { _SFD_EML_CALL(0, 7); chartInstance->c2_j = 1.0; chartInstance->c2_j_not_empty = TRUE; } _SFD_EML_CALL(0, 10); if (CV_EML_COND(0, 0, chartInstance->c2_j == 1.0)) { if (CV_EML_COND(0, 1, c2_d1 < 20.0)) { CV_EML_MCDC(0, 0, TRUE); CV_EML_IF(0, 1, TRUE); _SFD_EML_CALL(0, 11); chartInstance->c2_j = chartInstance->c2_j + 1.0; goto label_1; } } CV_EML_MCDC(0, 0, FALSE); CV_EML_IF(0, 1, FALSE); label_1: ; _SFD_EML_CALL(0, 14); if (CV_EML_COND(0, 2, chartInstance->c2_j == 2.0)) { if (CV_EML_COND(0, 3, c2_d2 < 20.0)) { CV_EML_MCDC(0, 1, TRUE); CV_EML_IF(0, 2, TRUE); _SFD_EML_CALL(0, 15); chartInstance->c2_j = chartInstance->c2_j + 1.0; goto label_2; } } CV_EML_MCDC(0, 1, FALSE); CV_EML_IF(0, 2, FALSE); label_2: ; _SFD_EML_CALL(0, 18); if (CV_EML_COND(0, 4, chartInstance->c2_j == 3.0)) { if (CV_EML_COND(0, 5, c2_d3 < 20.0)) { CV_EML_MCDC(0, 2, TRUE); CV_EML_IF(0, 3, TRUE); _SFD_EML_CALL(0, 19); chartInstance->c2_j = chartInstance->c2_j + 1.0; goto label_3; } } CV_EML_MCDC(0, 2, FALSE); CV_EML_IF(0, 3, FALSE); label_3: ; _SFD_EML_CALL(0, 22); if (CV_EML_COND(0, 6, chartInstance->c2_j == 4.0)) { if (CV_EML_COND(0, 7, c2_d4 < 20.0)) { CV_EML_MCDC(0, 3, TRUE); CV_EML_IF(0, 4, TRUE); _SFD_EML_CALL(0, 23); chartInstance->c2_j = 1.0; goto label_4; } } CV_EML_MCDC(0, 3, FALSE); CV_EML_IF(0, 4, FALSE); label_4: ; _SFD_EML_CALL(0, 26); c2_i = chartInstance->c2_j; _SFD_EML_CALL(0, -26); sf_debug_symbol_scope_pop(); *c2_b_i = c2_i; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0); _sfEvent_ = c2_previousEvent; sf_debug_check_for_state_inconsistency(_SATestMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); }
static void sf_c2_chooseTapB(SFc2_chooseTapBInstanceStruct *chartInstance) { int32_T c2_previousEvent; real_T c2_hoistedGlobal; real_T c2_ave; uint32_T c2_debug_family_var_map[4]; real_T c2_nargin = 1.0; real_T c2_nargout = 1.0; real_T c2_tap; real_T *c2_b_ave; real_T *c2_b_tap; c2_b_tap = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); c2_b_ave = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); _sfTime_ = (real_T)ssGetT(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0); _SFD_DATA_RANGE_CHECK(*c2_b_ave, 0U); _SFD_DATA_RANGE_CHECK(*c2_b_tap, 1U); c2_previousEvent = _sfEvent_; _sfEvent_ = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0); c2_hoistedGlobal = *c2_b_ave; c2_ave = c2_hoistedGlobal; sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names, c2_debug_family_var_map); sf_debug_symbol_scope_add_eml(&c2_nargin, c2_sf_marshall, 0U); sf_debug_symbol_scope_add_eml(&c2_nargout, c2_sf_marshall, 1U); sf_debug_symbol_scope_add_eml(&c2_ave, c2_sf_marshall, 2U); sf_debug_symbol_scope_add_eml(&c2_tap, c2_sf_marshall, 3U); CV_EML_FCN(0, 0); _SFD_EML_CALL(0, 4); if (CV_EML_IF(0, 0, c2_ave >= 60.0)) { _SFD_EML_CALL(0, 5); c2_tap = 4.0; } else { _SFD_EML_CALL(0, 6); if (CV_EML_COND(0, 0, c2_ave < 60.0)) { if (CV_EML_COND(0, 1, c2_ave > 20.0)) { CV_EML_MCDC(0, 0, TRUE); CV_EML_IF(0, 1, TRUE); _SFD_EML_CALL(0, 7); c2_tap = 3.0; goto label_1; } } CV_EML_MCDC(0, 0, FALSE); CV_EML_IF(0, 1, FALSE); _SFD_EML_CALL(0, 8); if (CV_EML_COND(0, 2, c2_ave <= 20.0)) { if (CV_EML_COND(0, 3, c2_ave >= -20.0)) { CV_EML_MCDC(0, 1, TRUE); CV_EML_IF(0, 2, TRUE); _SFD_EML_CALL(0, 9); c2_tap = 2.0; goto label_2; } } CV_EML_MCDC(0, 1, FALSE); CV_EML_IF(0, 2, FALSE); _SFD_EML_CALL(0, 10); if (CV_EML_COND(0, 4, c2_ave < -20.0)) { if (CV_EML_COND(0, 5, c2_ave > -60.0)) { CV_EML_MCDC(0, 2, TRUE); CV_EML_IF(0, 3, TRUE); _SFD_EML_CALL(0, 11); c2_tap = 1.0; goto label_3; } } CV_EML_MCDC(0, 2, FALSE); CV_EML_IF(0, 3, FALSE); _SFD_EML_CALL(0, 13); c2_tap = 0.0; label_3: ; label_2: ; label_1: ; } _SFD_EML_CALL(0, -13); sf_debug_symbol_scope_pop(); *c2_b_tap = c2_tap; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0); _sfEvent_ = c2_previousEvent; sf_debug_check_for_state_inconsistency(_chooseTapBMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); }
static void sf_c2_object_tracker_intensity(void) { int32_T c2_em_i0; int32_T c2_em_i1; int32_T c2_em_i2; int32_T c2_em_i3; int32_T c2_em_i4; int32_T c2_em_i5; uint8_T c2_previousEvent; int32_T c2_em_i6; int32_T c2_em_i7; uint16_T c2_b_CentroidArray[10][2]; real_T c2_b_booleof; int32_T c2_em_i8; uint16_T c2_b_StartCoords[2]; uint16_T c2_b_VidSize[2]; uint16_T c2_centroid[2]; real_T c2_i; uint16_T c2_m; uint16_T c2_myvector[10][1]; uint16_T c2_ally[10][1]; uint16_T c2_allx[10][1]; uint16_T c2_z[2]; uint16_T c2_b_CentroidCol; uint16_T c2_b_LineVector[4][1]; uint16_T c2_b_CentroidCoords[2]; boolean_T c2_r; int32_T c2_em_i9; int32_T c2_em_i10; int32_T c2_em_i11; uint16_T c2_c_CentroidArray[10][1]; uint16_T c2_b_z; int32_T c2_em_i12; uint32_T c2_em_u0; uint32_T c2_em_u1; uint32_T c2_em_u2; uint16_T c2_em_u3; int32_T c2_em_i13; uint16_T c2_d_CentroidArray[10][1]; uint16_T c2_c_z; int32_T c2_em_i14; uint32_T c2_em_u4; uint32_T c2_em_u5; uint32_T c2_em_u6; uint16_T c2_em_u7; int32_T c2_em_i15; uint16_T c2_b_allx[10][1]; uint16_T c2_em_uv0[10][1]; int32_T c2_em_i16; uint16_T c2_b_ally[10][1]; uint16_T c2_em_uv1[10][1]; int32_T c2_em_i17; uint32_T c2_em_u8; uint16_T c2_em_u9; int32_T c2_em_i18; uint16_T c2_x[10][1]; uint16_T c2_b_x[10][1]; real_T c2_jstart; uint16_T c2_minval; real_T c2_indx; real_T c2_j1; real_T c2_b_j1; uint16_T c2_a; uint16_T c2_b; boolean_T c2_p; uint16_T c2_b_minval; real_T c2_b_indx; int32_T c2_em_i19; static int32_T c2_em_iv0[2][1] = { { 0 }, { 1 } }; int32_T c2_em_i20; int32_T c2_em_i21; int32_T c2_em_i22; uint16_T c2_A; real_T c2_B; uint16_T c2_c_x; real_T c2_y; uint16_T c2_d_x; real_T c2_b_y; real_T c2_k; real_T c2_b_k; uint16_T c2_e_x; real_T c2_c_y; real_T c2_c_k; real_T c2_d_k; uint16_T c2_f_x; uint16_T c2_xk; real_T c2_b_xk; real_T c2_g_x; real_T c2_c_xk; real_T c2_yk; real_T c2_zk; real_T c2_em_d0; real_T c2_em_d1; uint16_T c2_d_z; uint16_T c2_e_z; uint16_T c2_f_z; uint16_T c2_d_y; int32_T c2_em_i23; int32_T c2_em_i24; _sfTime_ = (real_T)ssGetT(chartInstance.S); for(c2_em_i0 = 0; c2_em_i0 < 2; c2_em_i0 = c2_em_i0 + 1) { _SFD_DATA_RANGE_CHECK((real_T)c2_CentroidCoords()[c2_em_i0], 1U); } for(c2_em_i1 = 0; c2_em_i1 < 10; c2_em_i1 = c2_em_i1 + 1) { for(c2_em_i2 = 0; c2_em_i2 < 2; c2_em_i2 = c2_em_i2 + 1) { _SFD_DATA_RANGE_CHECK((real_T)c2_CentroidArray()[(c2_em_i1 << 1) + c2_em_i2], 5U); } } for(c2_em_i3 = 0; c2_em_i3 < 4; c2_em_i3 = c2_em_i3 + 1) { _SFD_DATA_RANGE_CHECK((real_T)c2_LineVector()[c2_em_i3], 2U); } _SFD_DATA_RANGE_CHECK(*c2_booleof(), 3U); for(c2_em_i4 = 0; c2_em_i4 < 2; c2_em_i4 = c2_em_i4 + 1) { _SFD_DATA_RANGE_CHECK((real_T)c2_StartCoords()[c2_em_i4], 6U); } for(c2_em_i5 = 0; c2_em_i5 < 2; c2_em_i5 = c2_em_i5 + 1) { _SFD_DATA_RANGE_CHECK((real_T)c2_VidSize()[c2_em_i5], 0U); } _SFD_DATA_RANGE_CHECK((real_T)*c2_CentroidCol(), 4U); c2_previousEvent = _sfEvent_; _sfEvent_ = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1); for(c2_em_i6 = 0; c2_em_i6 < 10; c2_em_i6 = c2_em_i6 + 1) { for(c2_em_i7 = 0; c2_em_i7 < 2; c2_em_i7 = c2_em_i7 + 1) { c2_b_CentroidArray[c2_em_i6][c2_em_i7] = c2_CentroidArray()[(c2_em_i6 << 1) + c2_em_i7]; } } c2_b_booleof = *c2_booleof(); for(c2_em_i8 = 0; c2_em_i8 < 2; c2_em_i8 = c2_em_i8 + 1) { c2_b_StartCoords[c2_em_i8] = c2_StartCoords()[c2_em_i8]; c2_b_VidSize[c2_em_i8] = c2_VidSize()[c2_em_i8]; } sf_debug_push_symbol_scope(15U, 0U); sf_debug_symbol_scope_add_symbol("LastCentroid", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &chartInstance.c2_LastCentroid, 0); sf_debug_symbol_scope_add_symbol("centroid", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_centroid, 0); sf_debug_symbol_scope_add_symbol("i", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c2_i, 0); sf_debug_symbol_scope_add_symbol("m", 5, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c2_m, 0); sf_debug_symbol_scope_add_symbol("myvector", 5, 2U, 1U, 10U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_myvector, 0); sf_debug_symbol_scope_add_symbol("ally", 5, 2U, 1U, 10U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_ally, 0); sf_debug_symbol_scope_add_symbol("allx", 5, 2U, 1U, 10U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_allx, 0); sf_debug_symbol_scope_add_symbol("z", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_z, 0); sf_debug_symbol_scope_add_symbol("CentroidCol", 5, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c2_b_CentroidCol, 0); sf_debug_symbol_scope_add_symbol("LineVector", 5, 2U, 1U, 4U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_b_LineVector, 0); sf_debug_symbol_scope_add_symbol("CentroidCoords", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_b_CentroidCoords, 0); sf_debug_symbol_scope_add_symbol("VidSize", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_b_VidSize, 0); sf_debug_symbol_scope_add_symbol("StartCoords", 5, 1U, 2U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_b_StartCoords, 0); sf_debug_symbol_scope_add_symbol("booleof", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 0, &c2_b_booleof, 0); sf_debug_symbol_scope_add_symbol("CentroidArray", 5, 2U, 2U, 10U, 0U, 1.0, 0, 0.0, 0U, 0, 0U, 1, &c2_b_CentroidArray, 0); CV_EML_FCN(0, 0); /* This block supports an embeddable subset of the MATLAB language. */ /* See the help menu for details. */ _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,6); if(CV_EML_COND(0, 0, !chartInstance.c2_LastCentroid_not_empty)) { } else { c2_r = true; if(CV_EML_COND(0, 1, c2_b_booleof == (real_T)c2_r)) { } else { CV_EML_MCDC(0, 0, false); CV_EML_IF(0, 0, false); goto label_1; } } CV_EML_MCDC(0, 0, true); CV_EML_IF(0, 0, true); _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,7); for(c2_em_i9 = 0; c2_em_i9 < 2; c2_em_i9 = c2_em_i9 + 1) { chartInstance.c2_LastCentroid[c2_em_i9] = c2_b_StartCoords[c2_em_i9]; } chartInstance.c2_LastCentroid_not_empty = true; label_1:; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,10); for(c2_em_i10 = 0; c2_em_i10 < 2; c2_em_i10 = c2_em_i10 + 1) { c2_z[c2_em_i10] = chartInstance.c2_LastCentroid[c2_em_i10]; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,12); for(c2_em_i11 = 0; c2_em_i11 < 10; c2_em_i11 = c2_em_i11 + 1) { c2_c_CentroidArray[c2_em_i11][0] = c2_b_CentroidArray[c2_em_i11][0]; } c2_b_z = c2_z[0]; for(c2_em_i12 = 0; c2_em_i12 < 10; c2_em_i12 = c2_em_i12 + 1) { c2_em_u0 = (uint32_T)c2_c_CentroidArray[c2_em_i12][0]; c2_em_u1 = c2_em_u0 - (uint32_T)c2_b_z; if(c2_em_u1 > c2_em_u0) { c2_em_u1 = 0U; } c2_em_u2 = c2_em_u1; if(c2_em_u2 > 65535U) { c2_em_u3 = MAX_uint16_T; } else { c2_em_u3 = (uint16_T)c2_em_u2; } c2_allx[c2_em_i12][0] = c2_em_u3; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,13); for(c2_em_i13 = 0; c2_em_i13 < 10; c2_em_i13 = c2_em_i13 + 1) { c2_d_CentroidArray[c2_em_i13][0] = c2_b_CentroidArray[c2_em_i13][1]; } c2_c_z = c2_z[1]; for(c2_em_i14 = 0; c2_em_i14 < 10; c2_em_i14 = c2_em_i14 + 1) { c2_em_u4 = (uint32_T)c2_d_CentroidArray[c2_em_i14][0]; c2_em_u5 = c2_em_u4 - (uint32_T)c2_c_z; if(c2_em_u5 > c2_em_u4) { c2_em_u5 = 0U; } c2_em_u6 = c2_em_u5; if(c2_em_u6 > 65535U) { c2_em_u7 = MAX_uint16_T; } else { c2_em_u7 = (uint16_T)c2_em_u6; } c2_ally[c2_em_i14][0] = c2_em_u7; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,14); for(c2_em_i15 = 0; c2_em_i15 < 10; c2_em_i15 = c2_em_i15 + 1) { c2_b_allx[c2_em_i15][0] = c2_allx[c2_em_i15][0]; } c2_power((uint16_T *)c2_b_allx, 2.0, (uint16_T *)c2_em_uv0); for(c2_em_i16 = 0; c2_em_i16 < 10; c2_em_i16 = c2_em_i16 + 1) { c2_b_ally[c2_em_i16][0] = c2_ally[c2_em_i16][0]; } c2_power((uint16_T *)c2_b_ally, 2.0, (uint16_T *)c2_em_uv1); for(c2_em_i17 = 0; c2_em_i17 < 10; c2_em_i17 = c2_em_i17 + 1) { c2_em_u8 = (uint32_T)c2_em_uv0[c2_em_i17][0] + (uint32_T)c2_em_uv1[c2_em_i17][0]; if(c2_em_u8 > 65535U) { c2_em_u9 = MAX_uint16_T; } else { c2_em_u9 = (uint16_T)c2_em_u8; } c2_myvector[c2_em_i17][0] = c2_em_u9; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,15); for(c2_em_i18 = 0; c2_em_i18 < 10; c2_em_i18 = c2_em_i18 + 1) { c2_x[c2_em_i18][0] = c2_myvector[c2_em_i18][0]; c2_b_x[c2_em_i18][0] = c2_x[c2_em_i18][0]; } c2_jstart = 1.0; c2_minval = (*(uint16_T (*)[10])&c2_b_x)[0]; c2_indx = c2_jstart; c2_j1 = 2.0; while(c2_j1 <= 10.0) { c2_b_j1 = c2_j1; c2_a = (*(uint16_T (*)[10])&c2_b_x)[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("x", (int32_T)_SFD_INTEGER_CHECK("j1", c2_b_j1), 1, 10, 1) - 1]; c2_b = c2_minval; c2_p = (c2_a < c2_b); if(c2_p) { c2_minval = (*(uint16_T (*)[10])&c2_b_x)[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("x", (int32_T)_SFD_INTEGER_CHECK("j1", c2_b_j1), 1, 10 , 1) - 1]; c2_indx = c2_b_j1; } c2_j1 = c2_j1 + 1.0; sf_mex_listen_for_ctrl_c(chartInstance.S); } c2_b_minval = c2_minval; c2_b_indx = c2_indx; c2_m = c2_b_minval; c2_i = c2_b_indx; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,16); for(c2_em_i19 = 0; c2_em_i19 < 2; c2_em_i19 = c2_em_i19 + 1) { c2_centroid[c2_em_i19] = c2_b_CentroidArray[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("CentroidArray", (int32_T)_SFD_INTEGER_CHECK("i", c2_i), 1, 10, 2) - 1][c2_em_iv0[c2_em_i19][0]]; } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,18); if(CV_EML_COND(0, 2, (real_T)(*(uint16_T (*)[10])&c2_myvector)[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("myvector", (int32_T) _SFD_INTEGER_CHECK("i", c2_i), 1, 10, 1) - 1] < 10000.0) && CV_EML_COND(0, 3, (real_T)c2_centroid[0] > 0.0) && CV_EML_COND(0, 4, ( real_T)c2_centroid[1] > 10.0)) { CV_EML_MCDC(0, 1, true); CV_EML_IF(0, 1, true); _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,19); for(c2_em_i20 = 0; c2_em_i20 < 2; c2_em_i20 = c2_em_i20 + 1) { chartInstance.c2_LastCentroid[c2_em_i20] = c2_centroid[c2_em_i20]; } chartInstance.c2_LastCentroid_not_empty = true; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,20); for(c2_em_i21 = 0; c2_em_i21 < 2; c2_em_i21 = c2_em_i21 + 1) { c2_b_CentroidCoords[c2_em_i21] = c2_centroid[c2_em_i21]; } } else { CV_EML_MCDC(0, 1, false); CV_EML_IF(0, 1, false); _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,22); for(c2_em_i22 = 0; c2_em_i22 < 2; c2_em_i22 = c2_em_i22 + 1) { c2_b_CentroidCoords[c2_em_i22] = c2_z[c2_em_i22]; } } _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,25); c2_A = c2_b_VidSize[1]; c2_B = 2.0; c2_c_x = c2_A; c2_y = c2_B; c2_d_x = c2_c_x; c2_b_y = c2_y; c2_k = 1.0; c2_b_k = c2_k; _SFD_EML_ARRAY_BOUNDS_CHECK("y", (int32_T)_SFD_INTEGER_CHECK("k", c2_b_k), 1, 1, 1); if(c2_b_y == 0.0) { sf_mex_call("warning", 0U, 1U, 15, "Divide by zero."); } c2_e_x = c2_d_x; c2_c_y = c2_b_y; c2_c_k = 1.0; c2_d_k = c2_c_k; c2_f_x = c2_e_x; c2_xk = c2_f_x; c2_b_xk = (real_T)c2_xk; c2_g_x = c2_c_y; c2_c_xk = c2_g_x; c2_yk = c2_c_xk; c2_zk = c2_b_xk / c2_yk; _SFD_EML_ARRAY_BOUNDS_CHECK("z", (int32_T)_SFD_INTEGER_CHECK("k", c2_d_k), 1, 1, 1); c2_em_d0 = c2_zk; c2_em_d1 = c2_em_d0 < 0.0 ? ceil(c2_em_d0 - 0.5) : floor(c2_em_d0 + 0.5); c2_d_z = (uint16_T)(c2_em_d1 <= 65535.0 ? c2_em_d1 >= 0.0 ? c2_em_d1 : 0.0 : 65535.0); c2_e_z = c2_d_z; c2_f_z = c2_e_z; c2_d_y = c2_f_z; c2_b_LineVector[0][0] = c2_b_VidSize[0]; c2_b_LineVector[1][0] = c2_d_y; c2_b_LineVector[2][0] = c2_b_CentroidCoords[0]; c2_b_LineVector[3][0] = c2_b_CentroidCoords[1]; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,26); c2_b_CentroidCol = c2_b_CentroidCoords[1]; _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,-26); sf_debug_pop_symbol_scope(); for(c2_em_i23 = 0; c2_em_i23 < 2; c2_em_i23 = c2_em_i23 + 1) { c2_CentroidCoords()[c2_em_i23] = c2_b_CentroidCoords[c2_em_i23]; } for(c2_em_i24 = 0; c2_em_i24 < 4; c2_em_i24 = c2_em_i24 + 1) { c2_LineVector()[c2_em_i24] = c2_b_LineVector[c2_em_i24][0]; } *c2_CentroidCol() = c2_b_CentroidCol; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1); _sfEvent_ = c2_previousEvent; sf_debug_check_for_state_inconsistency(_object_tracker_intensityMachineNumber_, chartInstance.chartNumber, chartInstance. instanceNumber); }
static void sf_c8_WorkstationModel(SFc8_WorkstationModelInstanceStruct *chartInstance) { real_T c8_hoistedGlobal; real_T c8_b_hoistedGlobal; real_T c8_CustomerClass; real_T c8_JobClass; uint32_T c8_debug_family_var_map[7]; boolean_T c8_aVarTruthTableCondition_1; boolean_T c8_aVarTruthTableCondition_2; real_T c8_nargin = 2.0; real_T c8_nargout = 1.0; real_T c8_QueueRoute; real_T *c8_b_CustomerClass; real_T *c8_b_QueueRoute; real_T *c8_b_JobClass; boolean_T guard1 = FALSE; boolean_T guard2 = FALSE; boolean_T guard3 = FALSE; c8_b_JobClass = (real_T *)ssGetInputPortSignal(chartInstance->S, 1); c8_b_QueueRoute = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); c8_b_CustomerClass = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); _sfTime_ = (real_T)ssGetT(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 7U, chartInstance->c8_sfEvent); _SFD_DATA_RANGE_CHECK(*c8_b_CustomerClass, 0U); _SFD_DATA_RANGE_CHECK(*c8_b_QueueRoute, 1U); _SFD_DATA_RANGE_CHECK(*c8_b_JobClass, 2U); chartInstance->c8_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 7U, chartInstance->c8_sfEvent); c8_hoistedGlobal = *c8_b_CustomerClass; c8_b_hoistedGlobal = *c8_b_JobClass; c8_CustomerClass = c8_hoistedGlobal; c8_JobClass = c8_b_hoistedGlobal; sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c8_debug_family_names, c8_debug_family_var_map); sf_debug_symbol_scope_add_eml_importable(&c8_aVarTruthTableCondition_1, 0U, c8_b_sf_marshallOut, c8_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c8_aVarTruthTableCondition_2, 1U, c8_b_sf_marshallOut, c8_b_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c8_nargin, 2U, c8_sf_marshallOut, c8_sf_marshallIn); sf_debug_symbol_scope_add_eml_importable(&c8_nargout, 3U, c8_sf_marshallOut, c8_sf_marshallIn); sf_debug_symbol_scope_add_eml(&c8_CustomerClass, 4U, c8_sf_marshallOut); sf_debug_symbol_scope_add_eml(&c8_JobClass, 5U, c8_sf_marshallOut); sf_debug_symbol_scope_add_eml_importable(&c8_QueueRoute, 6U, c8_sf_marshallOut, c8_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 3); c8_aVarTruthTableCondition_1 = FALSE; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 4); c8_aVarTruthTableCondition_2 = FALSE; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 9); c8_aVarTruthTableCondition_1 = (c8_CustomerClass == 1.0); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 13); c8_aVarTruthTableCondition_2 = (c8_JobClass == 1.0); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 15); guard1 = FALSE; if (CV_EML_COND(0, 1, 0, c8_aVarTruthTableCondition_1)) { if (CV_EML_COND(0, 1, 1, c8_aVarTruthTableCondition_2)) { CV_EML_MCDC(0, 1, 0, TRUE); CV_EML_IF(0, 1, 0, TRUE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 16); CV_EML_FCN(0, 1); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 29); c8_QueueRoute = 1.0; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -29); } else { guard1 = TRUE; } } else { guard1 = TRUE; } if (guard1 == TRUE) { CV_EML_MCDC(0, 1, 0, FALSE); CV_EML_IF(0, 1, 0, FALSE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 17); guard2 = FALSE; if (CV_EML_COND(0, 1, 2, c8_aVarTruthTableCondition_1)) { if (!CV_EML_COND(0, 1, 3, c8_aVarTruthTableCondition_2)) { CV_EML_MCDC(0, 1, 1, TRUE); CV_EML_IF(0, 1, 1, TRUE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 18); CV_EML_FCN(0, 2); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 35); c8_QueueRoute = 2.0; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -35); } else { guard2 = TRUE; } } else { guard2 = TRUE; } if (guard2 == TRUE) { CV_EML_MCDC(0, 1, 1, FALSE); CV_EML_IF(0, 1, 1, FALSE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 19); guard3 = FALSE; if (!CV_EML_COND(0, 1, 4, c8_aVarTruthTableCondition_1)) { if (CV_EML_COND(0, 1, 5, c8_aVarTruthTableCondition_2)) { CV_EML_MCDC(0, 1, 2, TRUE); CV_EML_IF(0, 1, 2, TRUE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 20); CV_EML_FCN(0, 3); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 41); c8_QueueRoute = 3.0; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -41); } else { guard3 = TRUE; } } else { guard3 = TRUE; } if (guard3 == TRUE) { CV_EML_MCDC(0, 1, 2, FALSE); CV_EML_IF(0, 1, 2, FALSE); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 22); CV_EML_FCN(0, 4); _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 47); c8_QueueRoute = 4.0; _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -47); } } } _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -22); sf_debug_symbol_scope_pop(); *c8_b_QueueRoute = c8_QueueRoute; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 7U, chartInstance->c8_sfEvent); sf_debug_check_for_state_inconsistency(_WorkstationModelMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); }
static void sf_gateway_c2_Serial(SFc2_SerialInstanceStruct *chartInstance) { uint8_T c2_hoistedGlobal; int32_T c2_i2; uint8_T c2_dataOut[256]; uint8_T c2_lengthOut; uint32_T c2_debug_family_var_map[6]; real_T c2_nargin = 2.0; real_T c2_nargout = 2.0; uint8_T c2_data[256]; int32_T c2_length; int32_T c2_i3; int32_T c2_i4; int32_T c2_i5; int32_T c2_i6; int32_T *c2_b_length; uint8_T *c2_b_lengthOut; uint8_T (*c2_b_data)[256]; uint8_T (*c2_b_dataOut)[256]; c2_b_lengthOut = (uint8_T *)ssGetInputPortSignal(chartInstance->S, 1); c2_b_dataOut = (uint8_T (*)[256])ssGetInputPortSignal(chartInstance->S, 0); c2_b_length = (int32_T *)ssGetOutputPortSignal(chartInstance->S, 2); c2_b_data = (uint8_T (*)[256])ssGetOutputPortSignal(chartInstance->S, 1); _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent); chartInstance->c2_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); c2_hoistedGlobal = *c2_b_lengthOut; for (c2_i2 = 0; c2_i2 < 256; c2_i2++) { c2_dataOut[c2_i2] = (*c2_b_dataOut)[c2_i2]; } c2_lengthOut = c2_hoistedGlobal; _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c2_debug_family_names, c2_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 0U, c2_d_sf_marshallOut, c2_c_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 1U, c2_d_sf_marshallOut, c2_c_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML(c2_dataOut, 2U, c2_b_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML(&c2_lengthOut, 3U, c2_c_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c2_data, 4U, c2_b_sf_marshallOut, c2_b_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_length, 5U, c2_sf_marshallOut, c2_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 2); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3); for (c2_i3 = 0; c2_i3 < 256; c2_i3++) { c2_data[c2_i3] = 0U; } _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4); c2_length = 0; _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5); CV_EML_COND(0, 1, 0, true); CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 0, false); _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -21); _SFD_SYMBOL_SCOPE_POP(); for (c2_i4 = 0; c2_i4 < 256; c2_i4++) { (*c2_b_data)[c2_i4] = c2_data[c2_i4]; } *c2_b_length = c2_length; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_SerialMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); for (c2_i5 = 0; c2_i5 < 256; c2_i5++) { _SFD_DATA_RANGE_CHECK((real_T)(*c2_b_data)[c2_i5], 0U); } _SFD_DATA_RANGE_CHECK((real_T)*c2_b_length, 1U); for (c2_i6 = 0; c2_i6 < 256; c2_i6++) { _SFD_DATA_RANGE_CHECK((real_T)(*c2_b_dataOut)[c2_i6], 2U); } _SFD_DATA_RANGE_CHECK((real_T)*c2_b_lengthOut, 3U); }
static void sf_gateway_c7_NMPC_Controller(SFc7_NMPC_ControllerInstanceStruct *chartInstance) { int32_T c7_i0; int32_T c7_i1; real_T c7_b_u[3]; uint32_T c7_debug_family_var_map[6]; real_T c7_factor; real_T c7_increment; real_T c7_nargin = 1.0; real_T c7_nargout = 1.0; real_T c7_b_y; boolean_T guard1 = false; boolean_T guard2 = false; boolean_T guard3 = false; boolean_T guard4 = false; _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 6U, chartInstance->c7_sfEvent); for (c7_i0 = 0; c7_i0 < 3; c7_i0++) { _SFD_DATA_RANGE_CHECK((*chartInstance->c7_u)[c7_i0], 0U); } chartInstance->c7_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent); for (c7_i1 = 0; c7_i1 < 3; c7_i1++) { c7_b_u[c7_i1] = (*chartInstance->c7_u)[c7_i1]; } _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c7_debug_family_names, c7_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_factor, 0U, c7_sf_marshallOut, c7_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_increment, 1U, c7_sf_marshallOut, c7_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargin, 2U, c7_sf_marshallOut, c7_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargout, 3U, c7_sf_marshallOut, c7_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML(c7_b_u, 4U, c7_b_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_b_y, 5U, c7_sf_marshallOut, c7_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 4); c7_factor = 1.0; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 5); c7_increment = 0.0; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 7); guard1 = false; if (CV_EML_COND(0, 1, 0, CV_RELATIONAL_EVAL(4U, 0U, 0, c7_b_u[1], 0.0, -1, 4U, c7_b_u[1] > 0.0))) { if (CV_EML_COND(0, 1, 1, CV_RELATIONAL_EVAL(4U, 0U, 1, c7_b_u[2], 0.0, -1, 4U, c7_b_u[2] > 0.0))) { CV_EML_MCDC(0, 1, 0, true); CV_EML_IF(0, 1, 0, true); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 8); c7_increment = 0.0; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 9); c7_factor = 1.0; } else { guard1 = true; } } else { guard1 = true; } if (guard1 == true) { CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 0, false); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 10); guard2 = false; if (CV_EML_COND(0, 1, 2, CV_RELATIONAL_EVAL(4U, 0U, 2, c7_b_u[1], 0.0, -1, 4U, c7_b_u[1] > 0.0))) { if (CV_EML_COND(0, 1, 3, CV_RELATIONAL_EVAL(4U, 0U, 3, c7_b_u[2], 0.0, -1, 2U, c7_b_u[2] < 0.0))) { CV_EML_MCDC(0, 1, 1, true); CV_EML_IF(0, 1, 1, true); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 11); c7_increment = 3.1415926535897931; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 12); c7_factor = -1.0; } else { guard2 = true; } } else { guard2 = true; } if (guard2 == true) { CV_EML_MCDC(0, 1, 1, false); CV_EML_IF(0, 1, 1, false); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 13); guard3 = false; if (CV_EML_COND(0, 1, 4, CV_RELATIONAL_EVAL(4U, 0U, 4, c7_b_u[1], 0.0, -1, 2U, c7_b_u[1] < 0.0))) { if (CV_EML_COND(0, 1, 5, CV_RELATIONAL_EVAL(4U, 0U, 5, c7_b_u[2], 0.0, -1, 2U, c7_b_u[2] < 0.0))) { CV_EML_MCDC(0, 1, 2, true); CV_EML_IF(0, 1, 2, true); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 14); c7_increment = -3.1415926535897931; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 15); c7_factor = -1.0; } else { guard3 = true; } } else { guard3 = true; } if (guard3 == true) { CV_EML_MCDC(0, 1, 2, false); CV_EML_IF(0, 1, 2, false); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 16); guard4 = false; if (CV_EML_COND(0, 1, 6, CV_RELATIONAL_EVAL(4U, 0U, 6, c7_b_u[1], 0.0, -1, 2U, c7_b_u[1] < 0.0))) { if (CV_EML_COND(0, 1, 7, CV_RELATIONAL_EVAL(4U, 0U, 7, c7_b_u[2], 0.0, -1, 4U, c7_b_u[2] > 0.0))) { CV_EML_MCDC(0, 1, 3, true); CV_EML_IF(0, 1, 3, true); _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 17); c7_increment = 0.0; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 18); c7_factor = 1.0; } else { guard4 = true; } } else { guard4 = true; } if (guard4 == true) { CV_EML_MCDC(0, 1, 3, false); CV_EML_IF(0, 1, 3, false); } } } } _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 20); c7_b_y = c7_b_u[0] * c7_factor + c7_increment; _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -20); _SFD_SYMBOL_SCOPE_POP(); *chartInstance->c7_y = c7_b_y; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_NMPC_ControllerMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); _SFD_DATA_RANGE_CHECK(*chartInstance->c7_y, 1U); }
static void sf_gateway_c5_testYarpReadSHORE(SFc5_testYarpReadSHOREInstanceStruct *chartInstance) { real_T c5_hoistedGlobal; real_T c5_b_hoistedGlobal; real_T c5_c_hoistedGlobal; real_T c5_nextX; real_T c5_currentX; real_T c5_oldX; uint32_T c5_debug_family_var_map[9]; real_T c5_nx; real_T c5_cx; real_T c5_ox; real_T c5_nargin = 3.0; real_T c5_nargout = 1.0; real_T c5_y; real_T *c5_b_nextX; real_T *c5_b_currentX; real_T *c5_b_y; real_T *c5_b_oldX; boolean_T guard1 = false; c5_b_oldX = (real_T *)ssGetInputPortSignal(chartInstance->S, 2); c5_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); c5_b_currentX = (real_T *)ssGetInputPortSignal(chartInstance->S, 1); c5_b_nextX = (real_T *)ssGetInputPortSignal(chartInstance->S, 0); _SFD_SYMBOL_SCOPE_PUSH(0U, 0U); _sfTime_ = sf_get_time(chartInstance->S); _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c5_sfEvent); _SFD_DATA_RANGE_CHECK(*c5_b_nextX, 0U); _SFD_DATA_RANGE_CHECK(*c5_b_currentX, 1U); chartInstance->c5_sfEvent = CALL_EVENT; _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent); c5_hoistedGlobal = *c5_b_nextX; c5_b_hoistedGlobal = *c5_b_currentX; c5_c_hoistedGlobal = *c5_b_oldX; c5_nextX = c5_hoistedGlobal; c5_currentX = c5_b_hoistedGlobal; c5_oldX = c5_c_hoistedGlobal; _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c5_debug_family_names, c5_debug_family_var_map); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nx, 0U, c5_sf_marshallOut, c5_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_cx, 1U, c5_sf_marshallOut, c5_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_ox, 2U, c5_sf_marshallOut, c5_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargin, 3U, c5_sf_marshallOut, c5_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargout, 4U, c5_sf_marshallOut, c5_sf_marshallIn); _SFD_SYMBOL_SCOPE_ADD_EML(&c5_nextX, 5U, c5_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML(&c5_currentX, 6U, c5_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML(&c5_oldX, 7U, c5_sf_marshallOut); _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_y, 8U, c5_sf_marshallOut, c5_sf_marshallIn); CV_EML_FCN(0, 0); _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 7); if (CV_EML_IF(0, 1, 0, c5_nextX > 0.0)) { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 8); c5_nx = 1.0; } else { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 10); c5_nx = 0.0; } _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 12); if (CV_EML_IF(0, 1, 1, c5_currentX > 0.0)) { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 13); c5_cx = 1.0; } else { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 15); c5_cx = 0.0; } _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 17); if (CV_EML_IF(0, 1, 2, c5_oldX > 0.0)) { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 18); c5_ox = 1.0; } else { _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 20); c5_ox = 0.0; } _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 23); guard1 = false; if (CV_EML_COND(0, 1, 0, c5_nx != c5_cx)) { if (CV_EML_COND(0, 1, 1, c5_cx != c5_ox)) { CV_EML_MCDC(0, 1, 0, true); CV_EML_IF(0, 1, 3, true); _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 24); c5_currentX = c5_oldX; } else { guard1 = true; } } else { guard1 = true; } if (guard1 == true) { CV_EML_MCDC(0, 1, 0, false); CV_EML_IF(0, 1, 3, false); } _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 26); c5_y = c5_currentX; _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, -26); _SFD_SYMBOL_SCOPE_POP(); *c5_b_y = c5_y; _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent); _SFD_SYMBOL_SCOPE_POP(); _SFD_CHECK_FOR_STATE_INCONSISTENCY(_testYarpReadSHOREMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber); _SFD_DATA_RANGE_CHECK(*c5_b_y, 2U); _SFD_DATA_RANGE_CHECK(*c5_b_oldX, 3U); }