static void sf_c17_HIL_model_error(SFc17_HIL_model_errorInstanceStruct
  *chartInstance)
{
  real_T c17_hoistedGlobal;
  real_T c17_b_hoistedGlobal;
  real_T c17_alpha_pi;
  real_T c17_accumulation;
  uint32_T c17_debug_family_var_map[6];
  real_T c17_sgn;
  real_T c17_nargin = 2.0;
  real_T c17_nargout = 1.0;
  real_T c17_alpha_inf;
  real_T c17_x;
  real_T c17_b_x;
  real_T c17_y;
  real_T c17_c_x;
  real_T c17_d_x;
  real_T c17_a;
  real_T c17_b_y;
  real_T c17_b_a;
  real_T c17_c_y;
  real_T *c17_b_alpha_pi;
  real_T *c17_b_alpha_inf;
  real_T *c17_b_accumulation;
  int32_T exitg1;
  c17_b_accumulation = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c17_b_alpha_inf = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c17_b_alpha_pi = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c17_b_alpha_pi, 0U);
  _SFD_DATA_RANGE_CHECK(*c17_b_alpha_inf, 1U);
  _SFD_DATA_RANGE_CHECK(*c17_b_accumulation, 2U);
  chartInstance->c17_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  c17_hoistedGlobal = *c17_b_alpha_pi;
  c17_b_hoistedGlobal = *c17_b_accumulation;
  c17_alpha_pi = c17_hoistedGlobal;
  c17_accumulation = c17_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c17_debug_family_names,
    c17_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c17_sgn, 0U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c17_nargin, 1U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c17_nargout, 2U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c17_alpha_pi, 3U, c17_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c17_accumulation, 4U, c17_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c17_alpha_inf, 5U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 4);
  c17_alpha_inf = c17_alpha_pi;
  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 5);
  do {
    exitg1 = 0;
    c17_x = c17_accumulation - c17_alpha_inf;
    c17_b_x = c17_x;
    c17_y = muDoubleScalarAbs(c17_b_x);
    if (CV_EML_WHILE(0, 1, 0, c17_y > 3.1415926535897931)) {
      _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 7);
      c17_c_x = c17_accumulation - c17_alpha_inf;
      c17_sgn = c17_c_x;
      c17_d_x = c17_sgn;
      c17_sgn = c17_d_x;
      c17_sgn = muDoubleScalarSign(c17_sgn);
      _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 8);
      c17_a = c17_sgn;
      c17_b_y = c17_a * 2.0;
      c17_b_a = c17_b_y;
      c17_c_y = c17_b_a * 3.1415926535897931;
      c17_alpha_inf += c17_c_y;
      _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 5);
      _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
    } else {
      exitg1 = 1;
    }
  } while (exitg1 == 0);

  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, -8);
  _SFD_SYMBOL_SCOPE_POP();
  *c17_b_alpha_inf = c17_alpha_inf;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_HIL_model_errorMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
Example #2
0
static void sf_c14_test(SFc14_testInstanceStruct *chartInstance)
{
  real_T c14_hoistedGlobal;
  real_T c14_u;
  uint32_T c14_debug_family_var_map[7];
  real_T c14_a1;
  real_T c14_a2;
  real_T c14_k3;
  real_T c14_nargin = 1.0;
  real_T c14_nargout = 1.0;
  real_T c14_y;
  real_T c14_x;
  real_T c14_b_x;
  real_T c14_b_y;
  real_T c14_c_x;
  real_T c14_d_x;
  real_T c14_A;
  real_T c14_e_x;
  real_T c14_f_x;
  real_T c14_g_x;
  real_T c14_h_x;
  real_T c14_c_y;
  real_T c14_i_x;
  real_T c14_j_x;
  real_T c14_b_A;
  real_T c14_k_x;
  real_T c14_l_x;
  real_T c14_m_x;
  real_T c14_n_x;
  real_T c14_o_x;
  real_T c14_p_x;
  real_T c14_d_y;
  real_T c14_a;
  real_T c14_b;
  real_T c14_b_a;
  real_T c14_b_b;
  real_T c14_e_y;
  real_T c14_c_a;
  real_T c14_c_b;
  real_T c14_f_y;
  real_T *c14_b_u;
  real_T *c14_g_y;
  c14_g_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c14_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 12U, chartInstance->c14_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c14_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c14_g_y, 1U);
  chartInstance->c14_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 12U, chartInstance->c14_sfEvent);
  c14_hoistedGlobal = *c14_b_u;
  c14_u = c14_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c14_debug_family_names,
    c14_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c14_a1, 0U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c14_a2, 1U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c14_k3, 2U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c14_nargin, 3U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c14_nargout, 4U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c14_u, 5U, c14_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c14_y, 6U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 3);
  c14_x = c14_u;
  c14_b_x = c14_x;
  c14_b_y = muDoubleScalarAbs(c14_b_x);
  c14_c_x = c14_b_y - 3.1415926535897931;
  c14_d_x = c14_c_x;
  c14_d_x = muDoubleScalarSign(c14_d_x);
  c14_A = 1.0 - c14_d_x;
  c14_e_x = c14_A;
  c14_f_x = c14_e_x;
  c14_a1 = c14_f_x / 2.0;
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 4);
  c14_g_x = c14_u;
  c14_h_x = c14_g_x;
  c14_c_y = muDoubleScalarAbs(c14_h_x);
  c14_i_x = c14_c_y - 3.1415926535897931;
  c14_j_x = c14_i_x;
  c14_j_x = muDoubleScalarSign(c14_j_x);
  c14_b_A = 1.0 + c14_j_x;
  c14_k_x = c14_b_A;
  c14_l_x = c14_k_x;
  c14_a2 = c14_l_x / 2.0;
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 5);
  c14_m_x = c14_u;
  c14_n_x = c14_m_x;
  c14_n_x = muDoubleScalarSign(c14_n_x);
  c14_o_x = c14_u;
  c14_p_x = c14_o_x;
  c14_d_y = muDoubleScalarAbs(c14_p_x);
  c14_a = -c14_n_x;
  c14_b = 6.2831853071795862 - c14_d_y;
  c14_k3 = c14_a * c14_b;
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 6);
  c14_b_a = c14_a1;
  c14_b_b = c14_u;
  c14_e_y = c14_b_a * c14_b_b;
  c14_c_a = c14_a2;
  c14_c_b = c14_k3;
  c14_f_y = c14_c_a * c14_c_b;
  c14_y = c14_e_y + c14_f_y;
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, -6);
  sf_debug_symbol_scope_pop();
  *c14_g_y = c14_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 12U, chartInstance->c14_sfEvent);
  sf_debug_check_for_state_inconsistency(_testMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}