static void sf_c1_main(SFc1_mainInstanceStruct *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_time;
  uint32_T c1_debug_family_var_map[4];
  real_T c1_nargin = 1.0;
  real_T c1_nargout = 1.0;
  real_T c1_y;
  real_T *c1_b_time;
  real_T *c1_b_y;
  c1_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_time = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_time, 0U);
  _SFD_DATA_RANGE_CHECK(*c1_b_y, 1U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_time;
  c1_time = c1_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c1_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 0U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 1U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_time, 2U, c1_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_y, 3U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 2);
  if (CV_EML_IF(0, 1, 0, c1_time < 200.0)) {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 3);
    c1_y = 1000.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 4);
    if (CV_EML_IF(0, 1, 1, c1_time < 30.0)) {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
      c1_y = 20.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6);
      if (CV_EML_IF(0, 1, 2, c1_time < 40.0)) {
        _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
        c1_y = 100.0;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
        c1_y = 1000.0;
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -9);
  _SFD_SYMBOL_SCOPE_POP();
  *c1_b_y = c1_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_mainMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
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_c13_ARP_02_RPSs_Bdr_GK_BIS5
  (SFc13_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct *chartInstance)
{
  real_T c13_hoistedGlobal;
  real_T c13_win;
  uint32_T c13_debug_family_var_map[4];
  real_T c13_nargin = 1.0;
  real_T c13_nargout = 1.0;
  real_T c13_sat;
  real_T *c13_b_win;
  real_T *c13_b_sat;
  c13_b_sat = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c13_b_win = (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, 9U, chartInstance->c13_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c13_b_win, 0U);
  chartInstance->c13_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 9U, chartInstance->c13_sfEvent);
  c13_hoistedGlobal = *c13_b_win;
  c13_win = c13_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c13_debug_family_names,
    c13_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargin, 0U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargout, 1U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_win, 2U, c13_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_sat, 3U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 8);
  if (CV_EML_IF(0, 1, 0, c13_win == 2.0)) {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 9);
    c13_sat = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 10);
    if (CV_EML_IF(0, 1, 1, c13_win == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 11);
      c13_sat = -1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 13);
      c13_sat = 0.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, -13);
  _SFD_SYMBOL_SCOPE_POP();
  *c13_b_sat = c13_sat;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 9U, chartInstance->c13_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_ARP_02_RPSs_Bdr_GK_BIS5MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c13_b_sat, 1U);
}
예제 #4
0
static void sf_gateway_c3_NMPC_Controller(SFc3_NMPC_ControllerInstanceStruct
  *chartInstance)
{
  real_T c3_hoistedGlobal;
  real_T c3_b_u;
  uint32_T c3_debug_family_var_map[4];
  real_T c3_nargin = 1.0;
  real_T c3_nargout = 1.0;
  real_T c3_b_etaLat;
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c3_u, 0U);
  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *chartInstance->c3_u;
  c3_b_u = c3_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c3_debug_family_names,
    c3_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargin, 0U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargout, 1U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c3_b_u, 2U, c3_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_b_etaLat, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 3);
  c3_b_etaLat = c3_b_u;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  if (CV_EML_IF(0, 1, 0, CV_RELATIONAL_EVAL(4U, 0U, 0, c3_b_u,
        3.1415926535897931, -1, 4U, c3_b_u > 3.1415926535897931))) {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 6);
    c3_b_etaLat = c3_b_u - 6.2831853071795862;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
  if (CV_EML_IF(0, 1, 1, CV_RELATIONAL_EVAL(4U, 0U, 1, c3_b_u,
        -3.1415926535897931, -1, 2U, c3_b_u < -3.1415926535897931))) {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 10);
    c3_b_etaLat = c3_b_u + 6.2831853071795862;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -10);
  _SFD_SYMBOL_SCOPE_POP();
  *chartInstance->c3_etaLat = c3_b_etaLat;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_NMPC_ControllerMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c3_etaLat, 1U);
}
예제 #5
0
static void sf_c22_BuckBoost1(SFc22_BuckBoost1InstanceStruct *chartInstance)
{
  real_T c22_hoistedGlobal;
  real_T c22_b_hoistedGlobal;
  real_T c22_Carrier;
  real_T c22_Duty;
  uint32_T c22_debug_family_var_map[6];
  real_T c22_Err1;
  real_T c22_nargin = 2.0;
  real_T c22_nargout = 1.0;
  real_T c22_PWM;
  real_T *c22_b_PWM;
  real_T *c22_b_Carrier;
  real_T *c22_b_Duty;
  c22_b_Duty = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c22_b_Carrier = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c22_b_PWM = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c22_b_PWM, 0U);
  _SFD_DATA_RANGE_CHECK(*c22_b_Carrier, 1U);
  _SFD_DATA_RANGE_CHECK(*c22_b_Duty, 2U);
  chartInstance->c22_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  c22_hoistedGlobal = *c22_b_Carrier;
  c22_b_hoistedGlobal = *c22_b_Duty;
  c22_Carrier = c22_hoistedGlobal;
  c22_Duty = c22_b_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 6U, 6U, c22_debug_family_names,
    c22_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c22_Err1, 0U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c22_nargin, 1U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c22_nargout, 2U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c22_Carrier, 3U, c22_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c22_Duty, 4U, c22_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c22_PWM, 5U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 3);
  c22_Err1 = c22_Duty - c22_Carrier;
  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 5);
  if (CV_EML_IF(0, 1, 0, c22_Err1 > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 6);
    c22_PWM = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 8);
    c22_PWM = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, -8);
  sf_debug_symbol_scope_pop();
  *c22_b_PWM = c22_PWM;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  sf_debug_check_for_state_inconsistency(_BuckBoost1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #6
0
static void sf_c2_linearproto(SFc2_linearprotoInstanceStruct *chartInstance)
{
  real_T c2_hoistedGlobal;
  real_T c2_x;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_y;
  real_T c2_b;
  real_T c2_b_y;
  real_T c2_u;
  const mxArray *c2_c_y = NULL;
  real_T *c2_b_x;
  real_T *c2_d_y;
  c2_d_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_x = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c2_b_x, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_d_y, 1U);
  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  c2_hoistedGlobal = *c2_b_x;
  c2_x = 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_x, 2U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_y, 3U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  if (CV_EML_IF(0, 1, 0, c2_x < 0.9)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 6);
    c2_b = c2_x;
    c2_b_y = 13.8125 * c2_b;
    c2_y = c2_b_y - 9.93;
    sf_mex_printf("%s =\\n", "y");
    c2_u = c2_y;
    c2_c_y = NULL;
    sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), FALSE);
    sf_mex_call_debug("disp", 0U, 1U, 14, c2_c_y);
  } else {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 9);
    c2_y = 2.5;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -9);
  _SFD_SYMBOL_SCOPE_POP();
  *c2_d_y = c2_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_linearprotoMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #7
0
static void sf_gateway_c24_DemoSmile_KS(SFc24_DemoSmile_KSInstanceStruct
  *chartInstance)
{
  real_T c24_hoistedGlobal;
  real_T c24_u;
  uint32_T c24_debug_family_var_map[5];
  real_T c24_smile;
  real_T c24_nargin = 1.0;
  real_T c24_nargout = 1.0;
  real_T c24_y;
  real_T *c24_b_u;
  real_T *c24_b_y;
  c24_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c24_b_u = (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, 15U, chartInstance->c24_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c24_b_u, 0U);
  chartInstance->c24_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 15U, chartInstance->c24_sfEvent);
  c24_hoistedGlobal = *c24_b_u;
  c24_u = c24_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 5U, 5U, c24_debug_family_names,
    c24_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_smile, 0U, c24_sf_marshallOut,
    c24_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_nargin, 1U, c24_sf_marshallOut,
    c24_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_nargout, 2U, c24_sf_marshallOut,
    c24_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c24_u, 3U, c24_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_y, 4U, c24_sf_marshallOut,
    c24_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 3);
  if (CV_EML_IF(0, 1, 0, c24_u > 0.5)) {
    _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 4);
    c24_smile = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 6);
    c24_smile = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 8);
  c24_y = c24_smile;
  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, -8);
  _SFD_SYMBOL_SCOPE_POP();
  *c24_b_y = c24_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 15U, chartInstance->c24_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_DemoSmile_KSMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c24_b_y, 1U);
}
static void sf_c6_adcs_v15_integral_Power_no_charge_in_detumb(void)
{
  int32_T c6_previousEvent;
  real_T c6_a;
  real_T c6_b;
  real_T c6_nargout = 1.0;
  real_T c6_nargin = 2.0;
  real_T c6_c;
  real_T c6_y;
  real_T *c6_b_a;
  real_T *c6_b_y;
  real_T *c6_b_b;
  c6_b_y = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c6_b_a = (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
  c6_b_b = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,4);
  _SFD_DATA_RANGE_CHECK(*c6_b_a, 0U);
  _SFD_DATA_RANGE_CHECK(*c6_b_y, 1U);
  _SFD_DATA_RANGE_CHECK(*c6_b_b, 2U);
  c6_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,4);
  c6_a = *c6_b_a;
  c6_b = *c6_b_b;
  sf_debug_symbol_scope_push(6U, 0U);
  sf_debug_symbol_scope_add("nargout", &c6_nargout, c6_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c6_nargin, c6_sf_marshall);
  sf_debug_symbol_scope_add("c", &c6_c, c6_sf_marshall);
  sf_debug_symbol_scope_add("y", &c6_y, c6_sf_marshall);
  sf_debug_symbol_scope_add("b", &c6_b, c6_sf_marshall);
  sf_debug_symbol_scope_add("a", &c6_a, c6_sf_marshall);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0,4);
  c6_c = 1.0 - c6_a;
  _SFD_EML_CALL(0,6);
  c6_y = c6_c + c6_b;
  _SFD_EML_CALL(0,7);
  if (CV_EML_IF(0, 0, c6_y > 1.0)) {
    _SFD_EML_CALL(0,8);
    c6_y = 1.0;
  }

  _SFD_EML_CALL(0,-8);
  sf_debug_symbol_scope_pop();
  *c6_b_y = c6_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,4);
  _sfEvent_ = c6_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_no_charge_in_detumbMachineNumber_,
     chartInstance.chartNumber,
     chartInstance.instanceNumber);
}
static void sf_gateway_c19_Demo_GazeFWaveIdleRand
  (SFc19_Demo_GazeFWaveIdleRandInstanceStruct *chartInstance)
{
  real_T c19_hoistedGlobal;
  real_T c19_state;
  uint32_T c19_debug_family_var_map[4];
  real_T c19_nargin = 1.0;
  real_T c19_nargout = 1.0;
  real_T c19_stateOver;
  real_T *c19_b_state;
  real_T *c19_b_stateOver;
  c19_b_stateOver = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c19_b_state = (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, 12U, chartInstance->c19_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c19_b_state, 0U);
  chartInstance->c19_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 12U, chartInstance->c19_sfEvent);
  c19_hoistedGlobal = *c19_b_state;
  c19_state = c19_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c19_debug_family_names,
    c19_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c19_nargin, 0U, c19_sf_marshallOut,
    c19_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c19_nargout, 1U, c19_sf_marshallOut,
    c19_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c19_state, 2U, c19_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c19_stateOver, 3U, c19_sf_marshallOut,
    c19_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, 13);
  if (CV_EML_IF(0, 1, 0, c19_state == 3.0)) {
    _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, 15);
    c19_stateOver = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, 17);
    c19_stateOver = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, -17);
  _SFD_SYMBOL_SCOPE_POP();
  *c19_b_stateOver = c19_stateOver;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 12U, chartInstance->c19_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_GazeFWaveIdleRandMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c19_b_stateOver, 1U);
}
예제 #10
0
static void sf_c17_ekffedepre(SFc17_ekffedepreInstanceStruct *chartInstance)
{
  real_T c17_hoistedGlobal;
  real_T c17_u;
  uint32_T c17_debug_family_var_map[4];
  real_T c17_nargin = 1.0;
  real_T c17_nargout = 1.0;
  real_T c17_y;
  real_T *c17_b_u;
  real_T *c17_b_y;
  c17_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c17_b_u = (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_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c17_b_y, 1U);
  chartInstance->c17_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  c17_hoistedGlobal = *c17_b_u;
  c17_u = c17_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c17_debug_family_names,
    c17_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c17_nargin, 0U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c17_nargout, 1U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c17_u, 2U, c17_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c17_y, 3U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 4);
  if (CV_EML_IF(0, 0, c17_u > 1.5)) {
    _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 5);
    c17_y = 0.85;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 7);
    c17_y = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, -7);
  sf_debug_symbol_scope_pop();
  *c17_b_y = c17_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  sf_debug_check_for_state_inconsistency(_ekffedepreMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #11
0
static void sf_c2_function_call_test(void)
{
  uint8_T c2_previousEvent;
  real_T c2_b_a;
  real_T c2_b_b;
  real_T c2_b_y;
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_DATA_RANGE_CHECK(*c2_a(), 2U);
  _SFD_DATA_RANGE_CHECK(*c2_y(), 1U);
  _SFD_DATA_RANGE_CHECK(*c2_b(), 0U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
  c2_b_a = *c2_a();
  c2_b_b = *c2_b();
  sf_debug_push_symbol_scope(3U, 0U);
  sf_debug_symbol_scope_add_symbol("y", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c2_b_y, 0);
  sf_debug_symbol_scope_add_symbol("b", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c2_b_b, 0);
  sf_debug_symbol_scope_add_symbol("a", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c2_b_a, 0);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,4);
  if(CV_EML_IF(0, 0, c2_b_a != c2_b_b)) {
    /*  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);
    c2_b_y = 1.0;
  } else {
    _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,5);
    c2_b_y = 0.0;
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,-5);
  sf_debug_pop_symbol_scope();
  *c2_y() = c2_b_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_function_call_testMachineNumber_,
   chartInstance.chartNumber, chartInstance.instanceNumber);
}
예제 #12
0
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);
}
예제 #13
0
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_QPSK_Transmit_v5_w_FIFO
  (SFc1_QPSK_Transmit_v5_w_FIFOInstanceStruct *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_d_in;
  uint32_T c1_debug_family_var_map[7];
  real_T c1_OS_RATE;
  real_T c1_f[17];
  real_T c1_nargin = 1.0;
  real_T c1_nargout = 1.0;
  creal_T c1_d_out;
  uint32_T c1_b_debug_family_var_map[3];
  real_T c1_y[17];
  real_T c1_b_nargin = 0.0;
  real_T c1_b_nargout = 1.0;
  int32_T c1_i2;
  static real_T c1_b[17] = { 0.006690562067, -0.00576859381, -0.011827354519,
    0.020586915021, 0.016726405168, -0.053692342207, -0.020253031546,
    0.196043589067, 0.33682241319, 0.196043589067, -0.020253031546,
    -0.053692342207, 0.016726405168, 0.020586915021, -0.011827354519,
    -0.00576859381, 0.006690562067 };

  int32_T c1_i3;
  int32_T c1_i4;
  int32_T c1_i5;
  creal_T c1_dcv1[17];
  int32_T c1_i6;
  int32_T c1_i7;
  creal_T c1_b_hoistedGlobal[17];
  creal_T c1_dc0;
  int32_T c1_i8;
  creal_T c1_b_b;
  creal_T c1_c_hoistedGlobal;
  real_T *c1_b_d_in;
  creal_T *c1_b_d_out;
  c1_b_d_out = (creal_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_d_in = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_d_in, 0U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_d_in;
  c1_d_in = c1_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c1_debug_family_names,
    c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c1_OS_RATE, 0U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c1_f, 1U, c1_d_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 2U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 3U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c1_d_in, 4U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_d_out, 5U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(chartInstance->c1_buf, 6U,
    c1_sf_marshallOut, c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 3);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
  c1_OS_RATE = 8.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6);
  sf_debug_symbol_scope_push_eml(0U, 3U, 3U, c1_b_debug_family_names,
    c1_b_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c1_y, 0U, c1_d_sf_marshallOut,
    c1_d_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_b_nargin, 1U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_b_nargout, 2U,
    c1_c_sf_marshallOut, c1_c_sf_marshallIn);
  CV_SCRIPT_FCN(0, 0);
  _SFD_SCRIPT_CALL(0U, chartInstance->c1_sfEvent, 3);
  for (c1_i2 = 0; c1_i2 < 17; c1_i2++) {
    c1_y[c1_i2] = c1_b[c1_i2];
  }

  _SFD_SCRIPT_CALL(0U, chartInstance->c1_sfEvent, -3);
  sf_debug_symbol_scope_pop();
  for (c1_i3 = 0; c1_i3 < 17; c1_i3++) {
    c1_f[c1_i3] = c1_b[c1_i3];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 8);
  if (CV_EML_IF(0, 1, 0, !chartInstance->c1_buf_not_empty)) {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
    for (c1_i4 = 0; c1_i4 < 17; c1_i4++) {
      chartInstance->c1_buf[c1_i4].re = 0.0;
      chartInstance->c1_buf[c1_i4].im = 0.0;
    }

    chartInstance->c1_buf_not_empty = TRUE;
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 12);
  for (c1_i5 = 0; c1_i5 < 16; c1_i5++) {
    c1_dcv1[c1_i5] = chartInstance->c1_buf[c1_i5 + 1];
  }

  c1_dcv1[16].re = c1_d_in;
  c1_dcv1[16].im = 0.0;
  for (c1_i6 = 0; c1_i6 < 17; c1_i6++) {
    chartInstance->c1_buf[c1_i6] = c1_dcv1[c1_i6];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 14);
  for (c1_i7 = 0; c1_i7 < 17; c1_i7++) {
    c1_b_hoistedGlobal[c1_i7] = chartInstance->c1_buf[c1_i7];
  }

  c1_dc0.re = 0.0;
  c1_dc0.im = 0.0;
  for (c1_i8 = 0; c1_i8 < 17; c1_i8++) {
    c1_b_b.re = c1_b[c1_i8];
    c1_b_b.im = 0.0;
    c1_c_hoistedGlobal.re = c1_b_hoistedGlobal[c1_i8].re * c1_b_b.re -
      c1_b_hoistedGlobal[c1_i8].im * c1_b_b.im;
    c1_c_hoistedGlobal.im = c1_b_hoistedGlobal[c1_i8].re * c1_b_b.im +
      c1_b_hoistedGlobal[c1_i8].im * c1_b_b.re;
    c1_dc0.re += c1_c_hoistedGlobal.re;
    c1_dc0.im += c1_c_hoistedGlobal.im;
  }

  c1_d_out = c1_dc0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -14);
  sf_debug_symbol_scope_pop();
  c1_b_d_out->re = c1_d_out.re;
  c1_b_d_out->im = c1_d_out.im;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  sf_debug_check_for_state_inconsistency(_QPSK_Transmit_v5_w_FIFOMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #15
0
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_gateway_c3_Engine_Vehicle_CVT_Wit_System1_trial1
(SFc3_Engine_Vehicle_CVT_Wit_System1_trial1InstanceStruct *chartInstance)
{
    uint32_T c3_debug_family_var_map[3];
    real_T c3_nargin = 0.0;
    real_T c3_nargout = 1.0;
    boolean_T c3_out;
    uint32_T c3_b_debug_family_var_map[2];
    real_T c3_b_nargin = 0.0;
    real_T c3_b_nargout = 0.0;
    real_T c3_c_nargin = 0.0;
    real_T c3_c_nargout = 1.0;
    boolean_T c3_b_out;
    real_T c3_d_nargin = 0.0;
    real_T c3_d_nargout = 0.0;
    c3_set_sim_state_side_effects_c3_Engine_Vehicle_CVT_Wit_System1_(chartInstance);
    _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
    _sfTime_ = sf_get_time(chartInstance->S);
    _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c3_sfEvent);
    _SFD_DATA_RANGE_CHECK(*chartInstance->c3_Engine_RPM, 0U);
    _SFD_DATA_RANGE_CHECK(*chartInstance->c3_RPM_Clutch_THLD, 1U);
    _SFD_DATA_RANGE_CHECK(*chartInstance->c3_RPM_Clutch_Hist_THLD, 2U);
    _SFD_DATA_RANGE_CHECK(*chartInstance->c3_ClutchON, 3U);
    chartInstance->c3_sfEvent = CALL_EVENT;
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c3_sfEvent);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 0U, chartInstance->c3_sfEvent);
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 1U, chartInstance->c3_sfEvent);
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 3U, 3U, c3_c_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_out, 2U, c3_sf_marshallOut,
                                         c3_sf_marshallIn);
    c3_out = CV_EML_IF(1, 0, 0, *chartInstance->c3_Engine_RPM <
                       *chartInstance->c3_RPM_Clutch_THLD -
                       *chartInstance->c3_RPM_Clutch_Hist_THLD);
    _SFD_SYMBOL_SCOPE_POP();
    if (c3_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 1U, chartInstance->c3_sfEvent);
        _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 2U, 2U, c3_d_debug_family_names,
                                   c3_b_debug_family_var_map);
        _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_b_nargin, 0U, c3_b_sf_marshallOut,
                                             c3_b_sf_marshallIn);
        _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_b_nargout, 1U, c3_b_sf_marshallOut,
                                             c3_b_sf_marshallIn);
        *chartInstance->c3_ClutchON = 0.0;
        c3_updateDataWrittenToVector(chartInstance, 0U);
        _SFD_DATA_RANGE_CHECK(*chartInstance->c3_ClutchON, 3U);
        _SFD_SYMBOL_SCOPE_POP();
    } else {
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_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_c_nargin, 0U, c3_b_sf_marshallOut,
                                             c3_b_sf_marshallIn);
        _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_c_nargout, 1U, c3_b_sf_marshallOut,
                                             c3_b_sf_marshallIn);
        _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_b_out, 2U, c3_sf_marshallOut,
                                             c3_sf_marshallIn);
        c3_b_out = CV_EML_IF(2, 0, 0, CV_RELATIONAL_EVAL(5U, 2U, 0,
                             *chartInstance->c3_Engine_RPM, *chartInstance->c3_RPM_Clutch_THLD, -1, 4U,
                             *chartInstance->c3_Engine_RPM > *chartInstance->c3_RPM_Clutch_THLD));
        _SFD_SYMBOL_SCOPE_POP();
        if (c3_b_out) {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 2U, chartInstance->c3_sfEvent);
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 3U, chartInstance->c3_sfEvent);
            _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 2U, 2U, c3_b_debug_family_names,
                                       c3_b_debug_family_var_map);
            _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_d_nargin, 0U, c3_b_sf_marshallOut,
                                                 c3_b_sf_marshallIn);
            _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_d_nargout, 1U,
                                                 c3_b_sf_marshallOut, c3_b_sf_marshallIn);
            *chartInstance->c3_ClutchON = 1.0;
            c3_updateDataWrittenToVector(chartInstance, 0U);
            _SFD_DATA_RANGE_CHECK(*chartInstance->c3_ClutchON, 3U);
            _SFD_SYMBOL_SCOPE_POP();
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 4U, chartInstance->c3_sfEvent);
        }
    }

    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c3_sfEvent);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CHECK_FOR_STATE_INCONSISTENCY
    (_Engine_Vehicle_CVT_Wit_System1_trial1MachineNumber_,
     chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #17
0
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);
}
예제 #18
0
static void sf_c1_Pointing_Cntrl_Act(SFc1_Pointing_Cntrl_ActInstanceStruct
  *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_b_hoistedGlobal;
  real_T c1_c_hoistedGlobal;
  real_T c1_u;
  real_T c1_Lmax;
  real_T c1_Lsat;
  uint32_T c1_debug_family_var_map[7];
  real_T c1_Llim;
  real_T c1_nargin = 3.0;
  real_T c1_nargout = 1.0;
  real_T c1_y;
  real_T c1_varargin_1;
  real_T c1_varargin_2;
  real_T c1_b_varargin_2;
  real_T c1_varargin_3;
  real_T c1_x;
  real_T c1_b_y;
  real_T c1_b_x;
  real_T c1_c_y;
  real_T c1_xk;
  real_T c1_yk;
  real_T c1_c_x;
  real_T c1_d_y;
  real_T c1_b_varargin_1;
  real_T c1_c_varargin_2;
  real_T c1_d_varargin_2;
  real_T c1_b_varargin_3;
  real_T c1_d_x;
  real_T c1_e_y;
  real_T c1_e_x;
  real_T c1_f_y;
  real_T c1_b_xk;
  real_T c1_b_yk;
  real_T c1_f_x;
  real_T c1_g_y;
  real_T *c1_b_u;
  real_T *c1_h_y;
  real_T *c1_b_Lmax;
  real_T *c1_b_Lsat;
  c1_b_Lsat = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c1_b_Lmax = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c1_h_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c1_h_y, 1U);
  _SFD_DATA_RANGE_CHECK(*c1_b_Lmax, 2U);
  _SFD_DATA_RANGE_CHECK(*c1_b_Lsat, 3U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_u;
  c1_b_hoistedGlobal = *c1_b_Lmax;
  c1_c_hoistedGlobal = *c1_b_Lsat;
  c1_u = c1_hoistedGlobal;
  c1_Lmax = c1_b_hoistedGlobal;
  c1_Lsat = c1_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 7U, 7U, c1_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_Llim, 0U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 1U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 2U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_u, 3U, c1_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_Lmax, 4U, c1_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_Lsat, 5U, c1_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_y, 6U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 4);
  if (CV_EML_IF(0, 1, 0, c1_u >= 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
    c1_Llim = c1_Lmax - c1_Lsat;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6);
    if (CV_EML_IF(0, 1, 1, c1_Llim < 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
      c1_y = 0.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
      c1_varargin_1 = c1_Llim;
      c1_varargin_2 = c1_u;
      c1_b_varargin_2 = c1_varargin_1;
      c1_varargin_3 = c1_varargin_2;
      c1_x = c1_b_varargin_2;
      c1_b_y = c1_varargin_3;
      c1_b_x = c1_x;
      c1_c_y = c1_b_y;
      c1_eml_scalar_eg(chartInstance);
      c1_xk = c1_b_x;
      c1_yk = c1_c_y;
      c1_c_x = c1_xk;
      c1_d_y = c1_yk;
      c1_eml_scalar_eg(chartInstance);
      c1_y = muDoubleScalarMin(c1_c_x, c1_d_y);
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 12);
    c1_Llim = -c1_Lmax - c1_Lsat;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 13);
    if (CV_EML_IF(0, 1, 2, c1_Llim > 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 14);
      c1_y = 0.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 16);
      c1_b_varargin_1 = c1_Llim;
      c1_c_varargin_2 = c1_u;
      c1_d_varargin_2 = c1_b_varargin_1;
      c1_b_varargin_3 = c1_c_varargin_2;
      c1_d_x = c1_d_varargin_2;
      c1_e_y = c1_b_varargin_3;
      c1_e_x = c1_d_x;
      c1_f_y = c1_e_y;
      c1_eml_scalar_eg(chartInstance);
      c1_b_xk = c1_e_x;
      c1_b_yk = c1_f_y;
      c1_f_x = c1_b_xk;
      c1_g_y = c1_b_yk;
      c1_eml_scalar_eg(chartInstance);
      c1_y = muDoubleScalarMax(c1_f_x, c1_g_y);
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -16);
  _SFD_SYMBOL_SCOPE_POP();
  *c1_h_y = c1_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Pointing_Cntrl_ActMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #19
0
static void sf_c9_CusakisME4901arcs2(SFc9_CusakisME4901arcs2InstanceStruct
  *chartInstance)
{
  int32_T c9_i4;
  int32_T c9_i5;
  int32_T c9_i6;
  int32_T c9_i7;
  int32_T c9_i8;
  real_T c9_Axes[5];
  int32_T c9_i9;
  boolean_T c9_Buttons[10];
  uint32_T c9_debug_family_var_map[7];
  real_T c9_nargin = 2.0;
  real_T c9_nargout = 3.0;
  real_T c9_u[2];
  real_T c9_but[4];
  real_T c9_j;
  int32_T c9_i10;
  int32_T c9_i11;
  int32_T c9_i12;
  int32_T c9_i13;
  int32_T c9_i14;
  int32_T c9_i15;
  static real_T c9_dv2[4] = { 1.0, 0.0, 0.0, 0.0 };

  int32_T c9_i16;
  static real_T c9_dv3[4] = { 0.0, 1.0, 0.0, 0.0 };

  int32_T c9_i17;
  static real_T c9_dv4[4] = { 0.0, 0.0, 1.0, 0.0 };

  int32_T c9_i18;
  static real_T c9_dv5[4] = { 0.0, 0.0, 0.0, 1.0 };

  int32_T c9_i19;
  int32_T c9_i20;
  int32_T c9_i21;
  real_T *c9_b_j;
  real_T (*c9_b_u)[2];
  real_T (*c9_b_but)[4];
  boolean_T (*c9_b_Buttons)[10];
  real_T (*c9_b_Axes)[5];
  c9_b_j = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c9_b_Buttons = (boolean_T (*)[10])ssGetInputPortSignal(chartInstance->S, 1);
  c9_b_Axes = (real_T (*)[5])ssGetInputPortSignal(chartInstance->S, 0);
  c9_b_but = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 2);
  c9_b_u = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  for (c9_i4 = 0; c9_i4 < 2; c9_i4++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_u)[c9_i4], 0U);
  }

  for (c9_i5 = 0; c9_i5 < 4; c9_i5++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_but)[c9_i5], 1U);
  }

  for (c9_i6 = 0; c9_i6 < 5; c9_i6++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_Axes)[c9_i6], 2U);
  }

  for (c9_i7 = 0; c9_i7 < 10; c9_i7++) {
    _SFD_DATA_RANGE_CHECK((real_T)(*c9_b_Buttons)[c9_i7], 3U);
  }

  _SFD_DATA_RANGE_CHECK(*c9_b_j, 4U);
  chartInstance->c9_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  for (c9_i8 = 0; c9_i8 < 5; c9_i8++) {
    c9_Axes[c9_i8] = (*c9_b_Axes)[c9_i8];
  }

  for (c9_i9 = 0; c9_i9 < 10; c9_i9++) {
    c9_Buttons[c9_i9] = (*c9_b_Buttons)[c9_i9];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 7U, 7U, c9_debug_family_names,
    c9_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c9_nargin, 0U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c9_nargout, 1U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c9_Axes, 2U, c9_e_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c9_Buttons, 3U, c9_d_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c9_u, 4U, c9_c_sf_marshallOut,
    c9_c_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c9_but, 5U, c9_b_sf_marshallOut,
    c9_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c9_j, 6U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 9);
  if (CV_EML_IF(0, 1, 0, c9_Axes[1] == -1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 11);
    for (c9_i10 = 0; c9_i10 < 2; c9_i10++) {
      c9_u[c9_i10] = 1.0 - (real_T)c9_i10;
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 12);
    if (CV_EML_IF(0, 1, 1, c9_Axes[1] == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 14);
      for (c9_i11 = 0; c9_i11 < 2; c9_i11++) {
        c9_u[c9_i11] = -1.0 + (real_T)c9_i11;
      }
    } else {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 15);
      if (CV_EML_IF(0, 1, 2, c9_Axes[0] == -1.0)) {
        _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 17);
        for (c9_i12 = 0; c9_i12 < 2; c9_i12++) {
          c9_u[c9_i12] = (real_T)c9_i12;
        }
      } else {
        _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 18);
        if (CV_EML_IF(0, 1, 3, c9_Axes[0] == 1.0)) {
          _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 20);
          for (c9_i13 = 0; c9_i13 < 2; c9_i13++) {
            c9_u[c9_i13] = 0.0 - (real_T)c9_i13;
          }
        } else {
          _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 23);
          for (c9_i14 = 0; c9_i14 < 2; c9_i14++) {
            c9_u[c9_i14] = 0.0;
          }
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 26);
  if (CV_EML_IF(0, 1, 4, (real_T)c9_Buttons[4] == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 27);
    c9_j = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 29);
    if (CV_EML_IF(0, 1, 5, (real_T)c9_Buttons[5] == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 30);
      c9_j = -1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 32);
      c9_j = 0.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 36);
  if (CV_EML_IF(0, 1, 6, (real_T)c9_Buttons[0] == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 38);
    for (c9_i15 = 0; c9_i15 < 4; c9_i15++) {
      c9_but[c9_i15] = c9_dv2[c9_i15];
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 39);
    if (CV_EML_IF(0, 1, 7, (real_T)c9_Buttons[1] == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 41);
      for (c9_i16 = 0; c9_i16 < 4; c9_i16++) {
        c9_but[c9_i16] = c9_dv3[c9_i16];
      }
    } else {
      _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 42);
      if (CV_EML_IF(0, 1, 8, (real_T)c9_Buttons[2] == 1.0)) {
        _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 44);
        for (c9_i17 = 0; c9_i17 < 4; c9_i17++) {
          c9_but[c9_i17] = c9_dv4[c9_i17];
        }
      } else {
        _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 45);
        if (CV_EML_IF(0, 1, 9, (real_T)c9_Buttons[3] == 1.0)) {
          _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 47);
          for (c9_i18 = 0; c9_i18 < 4; c9_i18++) {
            c9_but[c9_i18] = c9_dv5[c9_i18];
          }
        } else {
          _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 50);
          for (c9_i19 = 0; c9_i19 < 4; c9_i19++) {
            c9_but[c9_i19] = 0.0;
          }
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, -50);
  _SFD_SYMBOL_SCOPE_POP();
  for (c9_i20 = 0; c9_i20 < 2; c9_i20++) {
    (*c9_b_u)[c9_i20] = c9_u[c9_i20];
  }

  for (c9_i21 = 0; c9_i21 < 4; c9_i21++) {
    (*c9_b_but)[c9_i21] = c9_but[c9_i21];
  }

  *c9_b_j = c9_j;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CusakisME4901arcs2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #20
0
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_gateway_c14_ARP_02_RPSs_Bdr_GK_BIS5
  (SFc14_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct *chartInstance)
{
  real_T c14_hoistedGlobal;
  real_T c14_interactionState;
  uint32_T c14_debug_family_var_map[4];
  real_T c14_nargin = 1.0;
  real_T c14_nargout = 1.0;
  real_T c14_arousalFlag;
  real_T *c14_b_interactionState;
  real_T *c14_b_arousalFlag;
  c14_b_arousalFlag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c14_b_interactionState = (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, 10U, chartInstance->c14_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c14_b_interactionState, 0U);
  chartInstance->c14_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 10U, chartInstance->c14_sfEvent);
  c14_hoistedGlobal = *c14_b_interactionState;
  c14_interactionState = c14_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c14_debug_family_names,
    c14_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_nargin, 0U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_nargout, 1U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c14_interactionState, 2U, c14_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_arousalFlag, 3U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 13);
  if (CV_EML_IF(0, 1, 0, c14_interactionState == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 14);
    c14_arousalFlag = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 15);
    if (CV_EML_IF(0, 1, 1, c14_interactionState == 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 16);
      c14_arousalFlag = 1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 18);
      if (CV_EML_IF(0, 1, 2, c14_interactionState == 2.0)) {
        _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 19);
        c14_arousalFlag = -1.0;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 20);
        if (CV_EML_IF(0, 1, 3, c14_interactionState == 6.0)) {
          _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 21);
          c14_arousalFlag = -1.0;
        } else {
          _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 22);
          if (CV_EML_IF(0, 1, 4, c14_interactionState == 3.0)) {
            _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 23);
            c14_arousalFlag = -1.0;
          } else {
            _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 26);
            c14_arousalFlag = 0.0;
          }
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, -26);
  _SFD_SYMBOL_SCOPE_POP();
  *c14_b_arousalFlag = c14_arousalFlag;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 10U, chartInstance->c14_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_ARP_02_RPSs_Bdr_GK_BIS5MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c14_b_arousalFlag, 1U);
}
예제 #22
0
static void sf_c25_BuckBoost1(SFc25_BuckBoost1InstanceStruct *chartInstance)
{
  real_T c25_hoistedGlobal;
  real_T c25_b_hoistedGlobal;
  real_T c25_Ts;
  real_T c25_TimeCNT_k1;
  uint32_T c25_debug_family_var_map[7];
  real_T c25_Tsimulation;
  real_T c25_CNT_Ts;
  real_T c25_nargin = 2.0;
  real_T c25_nargout = 1.0;
  real_T c25_TimeCNT_k;
  real_T c25_A;
  real_T c25_x;
  real_T c25_b_x;
  real_T c25_y;
  real_T *c25_b_TimeCNT_k1;
  real_T *c25_b_Ts;
  real_T *c25_b_TimeCNT_k;
  c25_b_TimeCNT_k = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c25_b_TimeCNT_k1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c25_b_Ts = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c25_b_Ts, 0U);
  _SFD_DATA_RANGE_CHECK(*c25_b_TimeCNT_k1, 1U);
  _SFD_DATA_RANGE_CHECK(*c25_b_TimeCNT_k, 2U);
  chartInstance->c25_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  c25_hoistedGlobal = *c25_b_Ts;
  c25_b_hoistedGlobal = *c25_b_TimeCNT_k1;
  c25_Ts = c25_hoistedGlobal;
  c25_TimeCNT_k1 = c25_b_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c25_debug_family_names,
    c25_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c25_Tsimulation, 0U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c25_CNT_Ts, 1U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c25_nargin, 2U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c25_nargout, 3U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c25_Ts, 4U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c25_TimeCNT_k1, 5U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c25_TimeCNT_k, 6U,
    c25_sf_marshallOut, c25_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 3);
  c25_Tsimulation = 1.0E-6;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 4);
  c25_A = c25_Ts;
  c25_x = c25_A;
  c25_b_x = c25_x;
  c25_y = c25_b_x / 1.0E-6;
  c25_CNT_Ts = c25_y - 1.0;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 6);
  if (CV_EML_IF(0, 1, 0, c25_TimeCNT_k1 >= c25_CNT_Ts)) {
    _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 7);
    c25_TimeCNT_k = 0.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 9);
    c25_TimeCNT_k = c25_TimeCNT_k1 + 1.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, -9);
  sf_debug_symbol_scope_pop();
  *c25_b_TimeCNT_k = c25_TimeCNT_k;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  sf_debug_check_for_state_inconsistency(_BuckBoost1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c19_adcs_v15_integral_Power_nom(void)
{
  int32_T c19_previousEvent;
  real_T c19_Latitude;
  real_T c19_Longitude;
  real_T c19_nargout = 4.0;
  real_T c19_nargin = 2.0;
  real_T c19_phi;
  real_T c19_flag_india;
  real_T c19_flag_france;
  real_T c19_flag_downlink;
  real_T c19_Downlink_power;
  real_T c19_a;
  real_T c19_A;
  real_T c19_x;
  real_T c19_b_x;
  real_T c19_c_x;
  real_T c19_d_x;
  real_T c19_b_a;
  real_T c19_e_x;
  real_T c19_b;
  real_T c19_y;
  real_T c19_c_a;
  real_T c19_b_A;
  real_T c19_f_x;
  real_T c19_g_x;
  real_T c19_h_x;
  real_T c19_i_x;
  real_T c19_d_a;
  real_T c19_j_x;
  real_T c19_b_b;
  real_T c19_b_y;
  real_T c19_e_a;
  real_T *c19_b_flag_india;
  real_T *c19_b_flag_france;
  real_T *c19_b_flag_downlink;
  real_T *c19_b_Downlink_power;
  real_T *c19_b_Longitude;
  real_T *c19_b_Latitude;
  c19_b_flag_france = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c19_b_Downlink_power = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c19_b_Latitude = (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
  c19_b_Longitude = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c19_b_flag_india = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c19_b_flag_downlink = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,13);
  _SFD_DATA_RANGE_CHECK(*c19_b_Latitude, 0U);
  _SFD_DATA_RANGE_CHECK(*c19_b_Longitude, 1U);
  _SFD_DATA_RANGE_CHECK(*c19_b_Downlink_power, 2U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_downlink, 3U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_france, 4U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_india, 5U);
  c19_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,13);
  c19_Latitude = *c19_b_Latitude;
  c19_Longitude = *c19_b_Longitude;
  sf_debug_symbol_scope_push(9U, 0U);
  sf_debug_symbol_scope_add("nargout", &c19_nargout, c19_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c19_nargin, c19_sf_marshall);
  sf_debug_symbol_scope_add("phi", &c19_phi, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_india", &c19_flag_india, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_france", &c19_flag_france, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_downlink", &c19_flag_downlink, c19_sf_marshall);
  sf_debug_symbol_scope_add("Downlink_power", &c19_Downlink_power,
    c19_sf_marshall);
  sf_debug_symbol_scope_add("Longitude", &c19_Longitude, c19_sf_marshall);
  sf_debug_symbol_scope_add("Latitude", &c19_Latitude, c19_sf_marshall);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0,3);
  c19_phi = 10.0;
  _SFD_EML_CALL(0,4);
  c19_flag_france = 0.0;
  _SFD_EML_CALL(0,5);
  c19_flag_india = 0.0;
  _SFD_EML_CALL(0,6);
  c19_a = c19_Latitude;
  c19_A = c19_a * 3.1415926535897931E+000;
  c19_x = c19_A;
  c19_b_x = c19_x;
  c19_c_x = c19_b_x;
  c19_d_x = c19_c_x / 180.0;
  c19_b_a = c19_d_x;
  c19_e_x = c19_b_a;
  c19_b_a = c19_e_x;
  c19_b_a = muDoubleScalarCos(c19_b_a);
  c19_b = c19_mpower(c19_Longitude - 82.7666);
  c19_y = c19_b_a * c19_b;
  if (CV_EML_IF(0, 0, c19_mpower(c19_Latitude - 22.5833) + c19_y < c19_mpower
                (25.0))) {
    _SFD_EML_CALL(0,7);
    c19_flag_downlink = 1.0;
    _SFD_EML_CALL(0,8);
    c19_flag_india = 1.0;
  } else {
    _SFD_EML_CALL(0,9);
    c19_c_a = c19_Latitude;
    c19_b_A = c19_c_a * 3.1415926535897931E+000;
    c19_f_x = c19_b_A;
    c19_g_x = c19_f_x;
    c19_h_x = c19_g_x;
    c19_i_x = c19_h_x / 180.0;
    c19_d_a = c19_i_x;
    c19_j_x = c19_d_a;
    c19_d_a = c19_j_x;
    c19_d_a = muDoubleScalarCos(c19_d_a);
    c19_b_b = c19_mpower(c19_Longitude - 2.33);
    c19_b_y = c19_d_a * c19_b_b;
    if (CV_EML_IF(0, 1, c19_mpower(c19_Latitude - 48.8) + c19_b_y < c19_mpower
                  (10.0))) {
      _SFD_EML_CALL(0,10);
      c19_flag_downlink = 1.0;
      _SFD_EML_CALL(0,11);
      c19_flag_france = 1.0;
    } else {
      _SFD_EML_CALL(0,13);
      c19_flag_downlink = 0.0;
    }
  }

  _SFD_EML_CALL(0,16);
  c19_e_a = c19_flag_downlink;
  c19_Downlink_power = c19_e_a * 2.6;

  /* W */
  /*   */
  /*  y = u; */
  _SFD_EML_CALL(0,-16);
  sf_debug_symbol_scope_pop();
  *c19_b_Downlink_power = c19_Downlink_power;
  *c19_b_flag_downlink = c19_flag_downlink;
  *c19_b_flag_france = c19_flag_france;
  *c19_b_flag_india = c19_flag_india;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,13);
  _sfEvent_ = c19_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_nomMachineNumber_, chartInstance.chartNumber,
     chartInstance.
     instanceNumber);
}
예제 #24
0
static void sf_c2_controller1(SFc2_controller1InstanceStruct *chartInstance)
{
  int32_T c2_previousEvent;
  real_T c2_hoistedGlobal;
  real_T c2_u;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_y;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_b_y;
  real_T c2_c_x;
  real_T c2_xk;
  real_T c2_d_x;
  real_T c2_e_x;
  real_T c2_f_x;
  real_T *c2_b_u;
  real_T *c2_c_y;
  c2_c_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1);
  _SFD_DATA_RANGE_CHECK(*c2_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_c_y, 1U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1);
  c2_hoistedGlobal = *c2_b_u;
  c2_u = 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_u, c2_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c2_y, c2_sf_marshall, 3U);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0, 2);
  c2_x = c2_u;
  c2_b_x = c2_x;
  c2_b_y = muDoubleScalarAbs(c2_b_x);
  if (CV_EML_IF(0, 0, c2_b_y > 90.0)) {
    _SFD_EML_CALL(0, 3);
    c2_c_x = c2_u;
    c2_eml_scalar_eg(chartInstance);
    c2_xk = c2_c_x;
    c2_d_x = c2_xk;
    c2_eml_scalar_eg(chartInstance);
    c2_e_x = c2_d_x / 90.0;
    c2_f_x = c2_e_x;
    c2_f_x = muDoubleScalarFloor(c2_f_x);
    c2_u = c2_d_x - c2_f_x * 90.0;
  }

  _SFD_EML_CALL(0, 5);
  c2_y = c2_u;
  _SFD_EML_CALL(0, -5);
  sf_debug_symbol_scope_pop();
  *c2_c_y = c2_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_controller1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
예제 #25
0
static void sf_gateway_c6_Demo_Kinect(SFc6_Demo_KinectInstanceStruct
  *chartInstance)
{
  real_T c6_hoistedGlobal;
  real_T c6_z;
  uint32_T c6_debug_family_var_map[8];
  boolean_T c6_aVarTruthTableCondition_1;
  boolean_T c6_aVarTruthTableCondition_2;
  boolean_T c6_aVarTruthTableCondition_3;
  boolean_T c6_aVarTruthTableCondition_4;
  real_T c6_nargin = 1.0;
  real_T c6_nargout = 1.0;
  real_T c6_y;
  boolean_T c6_b0;
  boolean_T c6_b1;
  real_T *c6_b_z;
  real_T *c6_b_y;
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  c6_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c6_b_z = (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, 4U, chartInstance->c6_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c6_b_z, 0U);
  chartInstance->c6_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 4U, chartInstance->c6_sfEvent);
  c6_hoistedGlobal = *c6_b_z;
  c6_z = c6_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 8U, 8U, c6_debug_family_names,
    c6_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_aVarTruthTableCondition_1, 0U,
    c6_b_sf_marshallOut, c6_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_aVarTruthTableCondition_2, 1U,
    c6_b_sf_marshallOut, c6_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_aVarTruthTableCondition_3, 2U,
    c6_b_sf_marshallOut, c6_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_aVarTruthTableCondition_4, 3U,
    c6_b_sf_marshallOut, c6_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargin, 4U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargout, 5U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_z, 6U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_y, 7U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 3);
  c6_aVarTruthTableCondition_1 = false;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 4);
  c6_aVarTruthTableCondition_2 = false;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 5);
  c6_aVarTruthTableCondition_3 = false;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 6);
  c6_aVarTruthTableCondition_4 = false;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 11);
  c6_aVarTruthTableCondition_1 = (c6_z >= 240.0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 15);
  guard2 = false;
  if (c6_z < 100.0) {
    if (c6_z != 0.0) {
      c6_b0 = true;
    } else {
      guard2 = true;
    }
  } else {
    guard2 = true;
  }

  if (guard2 == true) {
    c6_b0 = false;
  }

  c6_aVarTruthTableCondition_2 = c6_b0;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 19);
  guard1 = false;
  if (c6_z >= 100.0) {
    if (c6_z < 240.0) {
      c6_b1 = true;
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

  if (guard1 == true) {
    c6_b1 = false;
  }

  c6_aVarTruthTableCondition_3 = c6_b1;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 23);
  c6_aVarTruthTableCondition_4 = (c6_z == 0.0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 25);
  if (CV_EML_IF(0, 1, 0, c6_aVarTruthTableCondition_1)) {
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 26);
    CV_EML_FCN(0, 1);
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 41);
    c6_y = 2.0;
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -41);
  } else {
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 27);
    if (CV_EML_IF(0, 1, 1, c6_aVarTruthTableCondition_2)) {
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 28);
      CV_EML_FCN(0, 2);
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 47);
      c6_y = 1.0;
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -47);
    } else {
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 29);
      if (CV_EML_IF(0, 1, 2, c6_aVarTruthTableCondition_3)) {
        _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 30);
        CV_EML_FCN(0, 3);
        _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 53);
        c6_y = 0.0;
        _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -53);
      } else {
        _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 31);
        if (CV_EML_IF(0, 1, 3, c6_aVarTruthTableCondition_4)) {
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 32);
          CV_EML_FCN(0, 4);
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 59);
          c6_y = 3.0;
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -59);
        } else {
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 34);
          CV_EML_FCN(0, 4);
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 59);
          c6_y = 3.0;
          _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -59);
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -34);
  _SFD_SYMBOL_SCOPE_POP();
  *c6_b_y = c6_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 4U, chartInstance->c6_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_KinectMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c6_b_y, 1U);
}
예제 #26
0
static void c12_chartstep_c12_DemoWave_K(SFc12_DemoWave_KInstanceStruct
  *chartInstance)
{
  real_T c12_hoistedGlobal;
  real_T c12_b_hoistedGlobal;
  real_T c12_V;
  real_T c12_A;
  uint32_T c12_debug_family_var_map[13];
  boolean_T c12_aVarTruthTableCondition_1;
  boolean_T c12_aVarTruthTableCondition_2;
  boolean_T c12_aVarTruthTableCondition_3;
  boolean_T c12_aVarTruthTableCondition_4;
  boolean_T c12_aVarTruthTableCondition_5;
  boolean_T c12_aVarTruthTableCondition_6;
  boolean_T c12_aVarTruthTableCondition_7;
  boolean_T c12_aVarTruthTableCondition_8;
  real_T c12_nargin = 2.0;
  real_T c12_nargout = 1.0;
  real_T c12_e;
  boolean_T c12_b0;
  boolean_T c12_b1;
  boolean_T c12_b2;
  boolean_T c12_b3;
  boolean_T c12_b4;
  boolean_T c12_b5;
  boolean_T c12_b6;
  boolean_T c12_b7;
  real_T *c12_b_e;
  real_T *c12_b_V;
  real_T *c12_b_A;
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  boolean_T guard3 = false;
  boolean_T guard4 = false;
  boolean_T guard5 = false;
  boolean_T guard6 = false;
  boolean_T guard7 = false;
  boolean_T guard8 = false;
  boolean_T guard9 = false;
  boolean_T guard10 = false;
  boolean_T guard11 = false;
  boolean_T guard12 = false;
  c12_b_A = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c12_b_e = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c12_b_V = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 9U, chartInstance->c12_sfEvent);
  c12_hoistedGlobal = *c12_b_V;
  c12_b_hoistedGlobal = *c12_b_A;
  c12_V = c12_hoistedGlobal;
  c12_A = c12_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 13U, 13U, c12_debug_family_names,
    c12_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_1, 0U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_2, 1U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_3, 2U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_4, 3U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_5, 4U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_6, 5U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_7, 6U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_aVarTruthTableCondition_8, 7U,
    c12_b_sf_marshallOut, c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_nargin, 8U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_nargout, 9U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c12_V, 10U, c12_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c12_A, 11U, c12_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_e, 12U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 3);
  c12_aVarTruthTableCondition_1 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 4);
  c12_aVarTruthTableCondition_2 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 5);
  c12_aVarTruthTableCondition_3 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 6);
  c12_aVarTruthTableCondition_4 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 7);
  c12_aVarTruthTableCondition_5 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 8);
  c12_aVarTruthTableCondition_6 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 9);
  c12_aVarTruthTableCondition_7 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 10);
  c12_aVarTruthTableCondition_8 = false;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 15);
  guard11 = false;
  guard12 = false;
  if (c12_V > 15.0) {
    if (c12_A < 15.0) {
      if (c12_A > 0.0) {
        c12_b0 = true;
      } else {
        guard11 = true;
      }
    } else {
      guard12 = true;
    }
  } else {
    guard12 = true;
  }

  if (guard12 == true) {
    guard11 = true;
  }

  if (guard11 == true) {
    c12_b0 = false;
  }

  c12_aVarTruthTableCondition_1 = c12_b0;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 19);
  guard10 = false;
  if (c12_V > 0.0) {
    if (c12_A > 15.0) {
      c12_b1 = true;
    } else {
      guard10 = true;
    }
  } else {
    guard10 = true;
  }

  if (guard10 == true) {
    c12_b1 = false;
  }

  c12_aVarTruthTableCondition_2 = c12_b1;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 23);
  guard9 = false;
  if (c12_V < 0.0) {
    if (c12_A > 15.0) {
      c12_b2 = true;
    } else {
      guard9 = true;
    }
  } else {
    guard9 = true;
  }

  if (guard9 == true) {
    c12_b2 = false;
  }

  c12_aVarTruthTableCondition_3 = c12_b2;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 27);
  guard7 = false;
  guard8 = false;
  if (c12_V < -15.0) {
    if (c12_A < 15.0) {
      if (c12_A > 0.0) {
        c12_b3 = true;
      } else {
        guard7 = true;
      }
    } else {
      guard8 = true;
    }
  } else {
    guard8 = true;
  }

  if (guard8 == true) {
    guard7 = true;
  }

  if (guard7 == true) {
    c12_b3 = false;
  }

  c12_aVarTruthTableCondition_4 = c12_b3;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 31);
  guard5 = false;
  guard6 = false;
  if (c12_V > 15.0) {
    if (c12_A < 0.0) {
      if (c12_A > -15.0) {
        c12_b4 = true;
      } else {
        guard5 = true;
      }
    } else {
      guard6 = true;
    }
  } else {
    guard6 = true;
  }

  if (guard6 == true) {
    guard5 = true;
  }

  if (guard5 == true) {
    c12_b4 = false;
  }

  c12_aVarTruthTableCondition_5 = c12_b4;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 35);
  guard4 = false;
  if (c12_V > 0.0) {
    if (c12_A < -15.0) {
      c12_b5 = true;
    } else {
      guard4 = true;
    }
  } else {
    guard4 = true;
  }

  if (guard4 == true) {
    c12_b5 = false;
  }

  c12_aVarTruthTableCondition_6 = c12_b5;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 39);
  guard3 = false;
  if (c12_V < 0.0) {
    if (c12_A < -15.0) {
      c12_b6 = true;
    } else {
      guard3 = true;
    }
  } else {
    guard3 = true;
  }

  if (guard3 == true) {
    c12_b6 = false;
  }

  c12_aVarTruthTableCondition_7 = c12_b6;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 43);
  guard1 = false;
  guard2 = false;
  if (c12_V < -15.0) {
    if (c12_A < 0.0) {
      if (c12_A > -15.0) {
        c12_b7 = true;
      } else {
        guard1 = true;
      }
    } else {
      guard2 = true;
    }
  } else {
    guard2 = true;
  }

  if (guard2 == true) {
    guard1 = true;
  }

  if (guard1 == true) {
    c12_b7 = false;
  }

  c12_aVarTruthTableCondition_8 = c12_b7;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 45);
  if (CV_EML_IF(0, 1, 0, c12_aVarTruthTableCondition_1)) {
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 46);
    CV_EML_FCN(0, 1);
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 69);
    c12_e = 7.0;
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -69);
  } else {
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 47);
    if (CV_EML_IF(0, 1, 1, c12_aVarTruthTableCondition_2)) {
      _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 48);
      CV_EML_FCN(0, 2);
      _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 75);
      c12_e = 8.0;
      _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -75);
    } else {
      _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 49);
      if (CV_EML_IF(0, 1, 2, c12_aVarTruthTableCondition_3)) {
        _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 50);
        CV_EML_FCN(0, 3);
        _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 81);
        c12_e = 4.0;
        _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -81);
      } else {
        _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 51);
        if (CV_EML_IF(0, 1, 3, c12_aVarTruthTableCondition_4)) {
          _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 52);
          CV_EML_FCN(0, 4);
          _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 87);
          c12_e = 3.0;
          _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -87);
        } else {
          _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 53);
          if (CV_EML_IF(0, 1, 4, c12_aVarTruthTableCondition_5)) {
            _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 54);
            CV_EML_FCN(0, 5);
            _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 93);
            c12_e = 6.0;
            _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -93);
          } else {
            _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 55);
            if (CV_EML_IF(0, 1, 5, c12_aVarTruthTableCondition_6)) {
              _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 56);
              CV_EML_FCN(0, 6);
              _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 99);
              c12_e = 5.0;
              _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -99);
            } else {
              _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 57);
              if (CV_EML_IF(0, 1, 6, c12_aVarTruthTableCondition_7)) {
                _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 58);
                CV_EML_FCN(0, 7);
                _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 105);
                c12_e = 1.0;
                _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -105);
              } else {
                _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 59);
                if (CV_EML_IF(0, 1, 7, c12_aVarTruthTableCondition_8)) {
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 60);
                  CV_EML_FCN(0, 8);
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 111);
                  c12_e = 2.0;
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -111);
                } else {
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 62);
                  CV_EML_FCN(0, 5);
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 93);
                  c12_e = 6.0;
                  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -93);
                }
              }
            }
          }
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -62);
  _SFD_SYMBOL_SCOPE_POP();
  *c12_b_e = c12_e;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 9U, chartInstance->c12_sfEvent);
}
예제 #27
0
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);
}
예제 #28
0
static void sf_gateway_c54_Expriment_FacialExpr
(SFc54_Expriment_FacialExprInstanceStruct *chartInstance)
{
    real_T c54_hoistedGlobal;
    real_T c54_v1;
    uint32_T c54_debug_family_var_map[6];
    boolean_T c54_aVarTruthTableCondition_1;
    boolean_T c54_aVarTruthTableCondition_2;
    real_T c54_nargin = 1.0;
    real_T c54_nargout = 1.0;
    real_T c54_v2;
    real_T *c54_b_v2;
    real_T *c54_b_v1;
    c54_b_v1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
    c54_b_v2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
    _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
    _sfTime_ = sf_get_time(chartInstance->S);
    _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 30U, chartInstance->c54_sfEvent);
    chartInstance->c54_sfEvent = CALL_EVENT;
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 30U, chartInstance->c54_sfEvent);
    c54_hoistedGlobal = *c54_b_v1;
    c54_v1 = c54_hoistedGlobal;
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c54_debug_family_names,
                               c54_debug_family_var_map);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c54_aVarTruthTableCondition_1, 0U,
                                         c54_b_sf_marshallOut, c54_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c54_aVarTruthTableCondition_2, 1U,
                                         c54_b_sf_marshallOut, c54_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c54_nargin, 2U, c54_sf_marshallOut,
                                         c54_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c54_nargout, 3U, c54_sf_marshallOut,
                                         c54_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c54_v1, 4U, c54_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c54_v2, 5U, c54_sf_marshallOut,
                                         c54_sf_marshallIn);
    CV_EML_FCN(0, 0);
    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 3);
    c54_aVarTruthTableCondition_1 = false;
    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 4);
    c54_aVarTruthTableCondition_2 = false;
    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 8);
    c54_aVarTruthTableCondition_1 = (c54_v1 > 25.0);
    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 11);
    c54_aVarTruthTableCondition_2 = (c54_v1 < -25.0);
    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 13);
    if (CV_EML_IF(0, 1, 0, c54_aVarTruthTableCondition_1)) {
        _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 14);
        CV_EML_FCN(0, 1);
        _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 24);
        c54_v2 = c54_v1;
        _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, -24);
    } else {
        _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 15);
        if (CV_EML_IF(0, 1, 1, c54_aVarTruthTableCondition_2)) {
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 16);
            CV_EML_FCN(0, 2);
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 29);
            c54_v2 = c54_v1;
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, -29);
        } else {
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 18);
            CV_EML_FCN(0, 3);
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, 34);
            c54_v2 = 0.0;
            _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, -34);
        }
    }

    _SFD_EML_CALL(0U, chartInstance->c54_sfEvent, -18);
    _SFD_SYMBOL_SCOPE_POP();
    *c54_b_v2 = c54_v2;
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 30U, chartInstance->c54_sfEvent);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Expriment_FacialExprMachineNumber_,
                                       chartInstance->chartNumber, chartInstance->instanceNumber);
    _SFD_DATA_RANGE_CHECK(*c54_b_v2, 0U);
    _SFD_DATA_RANGE_CHECK(*c54_b_v1, 1U);
}
예제 #29
0
static void sf_gateway_c6_CSE1_DP(SFc6_CSE1_DPInstanceStruct *chartInstance)
{
  real_T c6_hoistedGlobal;
  real_T c6_u_BT;
  int32_T c6_i0;
  real_T c6_nu[3];
  uint32_T c6_debug_family_var_map[15];
  real_T c6_u;
  real_T c6_a;
  real_T c6_b;
  real_T c6_c;
  real_T c6_d;
  real_T c6_y0;
  real_T c6_a0;
  real_T c6_a1;
  real_T c6_b1;
  real_T c6_c1;
  real_T c6_nargin = 2.0;
  real_T c6_nargout = 1.0;
  real_T c6_F_y;
  real_T c6_x;
  real_T c6_b_x;
  real_T c6_c_x;
  real_T c6_d_x;
  real_T c6_e_x;
  real_T c6_f_x;
  real_T c6_g_x;
  real_T c6_h_x;
  real_T c6_i_x;
  real_T c6_j_x;
  real_T c6_A;
  real_T c6_k_x;
  real_T c6_l_x;
  real_T c6_m_x;
  int32_T c6_i1;
  real_T *c6_b_u_BT;
  real_T *c6_b_F_y;
  real_T (*c6_b_nu)[3];
  c6_b_nu = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c6_b_F_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c6_b_u_BT = (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, 5U, chartInstance->c6_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c6_b_u_BT, 0U);
  chartInstance->c6_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  c6_hoistedGlobal = *c6_b_u_BT;
  c6_u_BT = c6_hoistedGlobal;
  for (c6_i0 = 0; c6_i0 < 3; c6_i0++) {
    c6_nu[c6_i0] = (*c6_b_nu)[c6_i0];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 15U, 15U, c6_debug_family_names,
    c6_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_u, 0U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_a, 1U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_b, 2U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_c, 3U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_d, 4U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_y0, 5U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_a0, 6U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_a1, 7U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_b1, 8U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_c1, 9U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargin, 10U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargout, 11U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_u_BT, 12U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c6_nu, 13U, c6_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_F_y, 14U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 3);
  c6_u = c6_nu[0];
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 5);
  if (CV_EML_IF(0, 1, 0, c6_u_BT > 0.0879)) {
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 6);
    c6_a = 2.515;
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 7);
    c6_b = 0.1174;
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 8);
    c6_c = -2.807;
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 9);
    c6_d = -1.131;
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 10);
    c6_x = 0.1174 * c6_u_BT;
    c6_b_x = c6_x;
    c6_b_x = muDoubleScalarExp(c6_b_x);
    c6_c_x = -1.131 * c6_u_BT;
    c6_d_x = c6_c_x;
    c6_d_x = muDoubleScalarExp(c6_d_x);
    c6_y0 = 2.515 * c6_b_x + -2.807 * c6_d_x;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 11);
    if (CV_EML_IF(0, 1, 1, c6_u_BT < -0.059)) {
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 12);
      c6_a = -548.0;
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 13);
      c6_b = 0.193;
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 14);
      c6_c = 548.2;
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 15);
      c6_d = 0.1992;
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 16);
      c6_e_x = 0.193 * c6_u_BT;
      c6_f_x = c6_e_x;
      c6_f_x = muDoubleScalarExp(c6_f_x);
      c6_g_x = 0.1992 * c6_u_BT;
      c6_h_x = c6_g_x;
      c6_h_x = muDoubleScalarExp(c6_h_x);
      c6_y0 = -548.0 * c6_f_x + 548.2 * c6_h_x;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 18);
      c6_y0 = 0.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 21);
  c6_a0 = 0.7561;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 22);
  c6_a1 = 0.3075;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 23);
  c6_b1 = -10.22;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 24);
  c6_c1 = 2.947;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 25);
  c6_i_x = -10.22 * c6_u + c6_c1;
  c6_j_x = c6_i_x;
  c6_j_x = muDoubleScalarAtan(c6_j_x);
  c6_A = c6_y0 * (c6_a0 + 0.3075 * c6_j_x);
  c6_k_x = c6_A;
  c6_l_x = c6_k_x;
  c6_m_x = c6_l_x;
  c6_F_y = c6_m_x / 1.1385;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -25);
  _SFD_SYMBOL_SCOPE_POP();
  *c6_b_F_y = c6_F_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CSE1_DPMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c6_b_F_y, 1U);
  for (c6_i1 = 0; c6_i1 < 3; c6_i1++) {
    _SFD_DATA_RANGE_CHECK((*c6_b_nu)[c6_i1], 2U);
  }
}
예제 #30
0
static void sf_c3_MPC_framework(void)
{
  uint8_T c3_previousEvent;
  real32_T c3_b_a0;
  real32_T c3_b_a1;
  real32_T c3_b_a2;
  real32_T c3_b_a3;
  real32_T c3_b_a4;
  real32_T c3_b_a5;
  real_T c3_b_t_sim;
  real_T c3_b_t_end;
  real32_T c3_Q[3];
  real_T c3_T[6][3];
  real32_T c3_b_qapp;
  real32_T c3_b_qap;
  real32_T c3_b_qa;
  real_T c3_a;
  real_T c3_b_a;
  real_T c3_b;
  real_T c3_k;
  real_T c3_b_k;
  real_T c3_x;
  real_T c3_xk;
  real_T c3_ak;
  real_T c3_b_x;
  real_T c3_b_xk;
  real_T c3_bk;
  real_T c3_c_x;
  real_T c3_y;
  real_T c3_b_y;
  real_T c3_c;
  real_T c3_A;
  real_T c3_B;
  real_T c3_d_x;
  real_T c3_c_y;
  real_T c3_z;
  real_T c3_d_y;
  real_T c3_b_A;
  real_T c3_b_B;
  real_T c3_e_x;
  real_T c3_e_y;
  real_T c3_b_z;
  real_T c3_f_y;
  real_T c3_c_A;
  real_T c3_c_B;
  real_T c3_f_x;
  real_T c3_g_y;
  real_T c3_c_z;
  real_T c3_h_y;
  real_T c3_d_A;
  real_T c3_d_B;
  real_T c3_g_x;
  real_T c3_i_y;
  real_T c3_d_z;
  real_T c3_j_y;
  real_T c3_e_A;
  real_T c3_e_B;
  real_T c3_h_x;
  real_T c3_k_y;
  real_T c3_e_z;
  real_T c3_l_y;
  real_T c3_f_A;
  real_T c3_f_B;
  real_T c3_i_x;
  real_T c3_m_y;
  real_T c3_f_z;
  real_T c3_n_y;
  real_T c3_g_A;
  real_T c3_g_B;
  real_T c3_j_x;
  real_T c3_o_y;
  real_T c3_g_z;
  real_T c3_p_y;
  real_T c3_q_y[6][1];
  real_T c3_r_y[6][1];
  real_T c3_em_dv0[6][1];
  int32_T c3_em_i0;
  int32_T c3_em_i1;
  int32_T c3_em_i2;
  int32_T c3_em_i3;
  int32_T c3_em_i4;
  real32_T c3_b_T[6][3];
  real32_T c3_c_a0[6];
  int32_T c3_em_i5;
  int32_T c3_em_i6;
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a0(), 3U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a1(), 9U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a2(), 1U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a3(), 8U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a4(), 0U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_a5(), 6U);
  _SFD_DATA_RANGE_CHECK(*c3_t_sim(), 4U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_qa(), 2U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_qap(), 10U);
  _SFD_DATA_RANGE_CHECK((real_T)*c3_qapp(), 7U);
  _SFD_DATA_RANGE_CHECK(*c3_t_end(), 5U);
  c3_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,2);
  c3_b_a0 = *c3_a0();
  c3_b_a1 = *c3_a1();
  c3_b_a2 = *c3_a2();
  c3_b_a3 = *c3_a3();
  c3_b_a4 = *c3_a4();
  c3_b_a5 = *c3_a5();
  c3_b_t_sim = *c3_t_sim();
  c3_b_t_end = *c3_t_end();
  sf_debug_push_symbol_scope(13U, 0U);
  sf_debug_symbol_scope_add_symbol("Q", 1, 1U, 3U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 1, &c3_Q, 0);
  sf_debug_symbol_scope_add_symbol("T", 0, 2U, 3U, 6U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 1, &c3_T, 0);
  sf_debug_symbol_scope_add_symbol("qapp", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U,
   0, 0U, 0, &c3_b_qapp, 0);
  sf_debug_symbol_scope_add_symbol("qap", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_qap, 0);
  sf_debug_symbol_scope_add_symbol("qa", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_qa, 0);
  sf_debug_symbol_scope_add_symbol("t_end", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U,
   0, 0U, 0, &c3_b_t_end, 0);
  sf_debug_symbol_scope_add_symbol("t_sim", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U,
   0, 0U, 0, &c3_b_t_sim, 0);
  sf_debug_symbol_scope_add_symbol("a5", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a5, 0);
  sf_debug_symbol_scope_add_symbol("a4", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a4, 0);
  sf_debug_symbol_scope_add_symbol("a3", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a3, 0);
  sf_debug_symbol_scope_add_symbol("a2", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a2, 0);
  sf_debug_symbol_scope_add_symbol("a1", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a1, 0);
  sf_debug_symbol_scope_add_symbol("a0", 1, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U, 0,
   0U, 0, &c3_b_a0, 0);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,4);
  if(CV_EML_IF(0, 0, c3_b_t_sim >= c3_b_t_end)) {
    /*  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,5);
    c3_b_t_sim = c3_b_t_end;
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,7);
  c3_a = c3_b_t_sim;
  c3_b_a = c3_a;
  c3_b = 5.0;
  c3_k = 1.0;
  c3_b_k = c3_k;
  c3_x = c3_b_a;
  c3_xk = c3_x;
  c3_ak = c3_xk;
  c3_b_x = c3_b;
  c3_b_xk = c3_b_x;
  c3_bk = c3_b_xk;
  if(c3_ak < 0.0) {
    c3_c_x = c3_bk;
    c3_y = floor(c3_c_x);
    if(c3_y != c3_bk) {
      sf_mex_call("error", 0U, 1U, 15,
       "Domain error. To compute complex results, make at least one input complex, e.g. \'power(complex(a),b)\'.");
    }
  }
  _SFD_EML_ARRAY_BOUNDS_CHECK("y", (int32_T)_SFD_INTEGER_CHECK("k", c3_b_k), 1,
   1, 1);
  c3_b_y = pow(c3_ak, c3_bk);
  c3_c = c3_b_y;
  c3_A = c3_c;
  c3_B = 20.0;
  c3_d_x = c3_A;
  c3_c_y = c3_B;
  c3_z = c3_d_x / c3_c_y;
  c3_d_y = c3_z;
  c3_b_A = c3_mpower(c3_b_t_sim);
  c3_b_B = 12.0;
  c3_e_x = c3_b_A;
  c3_e_y = c3_b_B;
  c3_b_z = c3_e_x / c3_e_y;
  c3_f_y = c3_b_z;
  c3_c_A = c3_b_mpower(c3_b_t_sim);
  c3_c_B = 6.0;
  c3_f_x = c3_c_A;
  c3_g_y = c3_c_B;
  c3_c_z = c3_f_x / c3_g_y;
  c3_h_y = c3_c_z;
  c3_d_A = c3_c_mpower(c3_b_t_sim);
  c3_d_B = 2.0;
  c3_g_x = c3_d_A;
  c3_i_y = c3_d_B;
  c3_d_z = c3_g_x / c3_i_y;
  c3_j_y = c3_d_z;
  c3_e_A = c3_mpower(c3_b_t_sim);
  c3_e_B = 4.0;
  c3_h_x = c3_e_A;
  c3_k_y = c3_e_B;
  c3_e_z = c3_h_x / c3_k_y;
  c3_l_y = c3_e_z;
  c3_f_A = c3_b_mpower(c3_b_t_sim);
  c3_f_B = 3.0;
  c3_i_x = c3_f_A;
  c3_m_y = c3_f_B;
  c3_f_z = c3_i_x / c3_m_y;
  c3_n_y = c3_f_z;
  c3_g_A = c3_c_mpower(c3_b_t_sim);
  c3_g_B = 2.0;
  c3_j_x = c3_g_A;
  c3_o_y = c3_g_B;
  c3_g_z = c3_j_x / c3_o_y;
  c3_p_y = c3_g_z;
  c3_q_y[0][0] = c3_d_y;
  c3_q_y[1][0] = c3_f_y;
  c3_q_y[2][0] = c3_h_y;
  c3_q_y[3][0] = c3_j_y;
  c3_q_y[4][0] = c3_b_t_sim;
  c3_q_y[5][0] = 1.0;
  c3_r_y[0][0] = c3_l_y;
  c3_r_y[1][0] = c3_n_y;
  c3_r_y[2][0] = c3_p_y;
  c3_r_y[3][0] = c3_b_t_sim;
  c3_r_y[4][0] = 1.0;
  c3_r_y[5][0] = 0.0;
  c3_em_dv0[0][0] = c3_b_mpower(c3_b_t_sim);
  c3_em_dv0[1][0] = c3_c_mpower(c3_b_t_sim);
  c3_em_dv0[2][0] = c3_b_t_sim;
  c3_em_dv0[3][0] = 1.0;
  c3_em_dv0[4][0] = 0.0;
  c3_em_dv0[5][0] = 0.0;
  for(c3_em_i0 = 0; c3_em_i0 < 6; c3_em_i0 = c3_em_i0 + 1) {
    c3_T[c3_em_i0][0] = c3_q_y[c3_em_i0][0];
  }
  for(c3_em_i1 = 0; c3_em_i1 < 6; c3_em_i1 = c3_em_i1 + 1) {
    c3_T[c3_em_i1][1] = c3_r_y[c3_em_i1][0];
  }
  for(c3_em_i2 = 0; c3_em_i2 < 6; c3_em_i2 = c3_em_i2 + 1) {
    c3_T[c3_em_i2][2] = c3_em_dv0[c3_em_i2][0];
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,10);
  for(c3_em_i3 = 0; c3_em_i3 < 6; c3_em_i3 = c3_em_i3 + 1) {
    for(c3_em_i4 = 0; c3_em_i4 < 3; c3_em_i4 = c3_em_i4 + 1) {
      c3_b_T[c3_em_i3][c3_em_i4] = (real32_T)c3_T[c3_em_i3][c3_em_i4];
    }
  }
  c3_c_a0[0] = c3_b_a0;
  c3_c_a0[1] = c3_b_a1;
  c3_c_a0[2] = c3_b_a2;
  c3_c_a0[3] = c3_b_a3;
  c3_c_a0[4] = c3_b_a4;
  c3_c_a0[5] = c3_b_a5;
  for(c3_em_i5 = 0; c3_em_i5 < 3; c3_em_i5 = c3_em_i5 + 1) {
    c3_Q[c3_em_i5] = 0.0F;
    for(c3_em_i6 = 0; c3_em_i6 < 6; c3_em_i6 = c3_em_i6 + 1) {
      c3_Q[c3_em_i5] = c3_Q[c3_em_i5] + c3_b_T[c3_em_i6][c3_em_i5] *
        c3_c_a0[c3_em_i6];
    }
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,12);
  c3_b_qa = c3_Q[0];
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,13);
  c3_b_qap = c3_Q[1];
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,14);
  c3_b_qapp = c3_Q[2];
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,-14);
  sf_debug_pop_symbol_scope();
  *c3_qa() = c3_b_qa;
  *c3_qap() = c3_b_qap;
  *c3_qapp() = c3_b_qapp;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
  _sfEvent_ = c3_previousEvent;
  sf_debug_check_for_state_inconsistency(_MPC_frameworkMachineNumber_,
   chartInstance.chartNumber, chartInstance.instanceNumber);
}