static void sf_c7_WEC_Sim_Driver(SFc7_WEC_Sim_DriverInstanceStruct
  *chartInstance)
{
  int32_T c7_i2;
  int32_T c7_i3;
  int32_T c7_i4;
  real_T c7_Q[4];
  uint32_T c7_debug_family_var_map[4];
  real_T c7_nargin = 1.0;
  real_T c7_nargout = 1.0;
  real_T c7_E[3];
  int32_T c7_i5;
  real_T c7_a;
  real_T c7_b;
  real_T c7_y;
  real_T c7_b_a;
  real_T c7_b_b;
  real_T c7_b_y;
  real_T c7_c_b;
  real_T c7_c_y;
  real_T c7_d_b;
  real_T c7_d_y;
  real_T c7_A;
  real_T c7_B;
  real_T c7_x;
  real_T c7_e_y;
  real_T c7_b_x;
  real_T c7_f_y;
  real_T c7_g_y;
  real_T c7_c_x;
  real_T c7_d_x;
  real_T c7_c_a;
  real_T c7_e_b;
  real_T c7_h_y;
  real_T c7_d_a;
  real_T c7_f_b;
  real_T c7_i_y;
  real_T c7_g_b;
  real_T c7_j_y;
  real_T c7_e_x;
  real_T c7_f_x;
  real_T c7_e_a;
  real_T c7_h_b;
  real_T c7_k_y;
  real_T c7_f_a;
  real_T c7_i_b;
  real_T c7_l_y;
  real_T c7_j_b;
  real_T c7_m_y;
  real_T c7_k_b;
  real_T c7_n_y;
  real_T c7_b_A;
  real_T c7_b_B;
  real_T c7_g_x;
  real_T c7_o_y;
  real_T c7_h_x;
  real_T c7_p_y;
  real_T c7_q_y;
  real_T c7_i_x;
  real_T c7_j_x;
  int32_T c7_i6;
  real_T (*c7_b_E)[3];
  real_T (*c7_b_Q)[4];
  boolean_T guard1 = FALSE;
  c7_b_E = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c7_b_Q = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3U, chartInstance->c7_sfEvent);
  for (c7_i2 = 0; c7_i2 < 4; c7_i2++) {
    _SFD_DATA_RANGE_CHECK((*c7_b_Q)[c7_i2], 0U);
  }

  for (c7_i3 = 0; c7_i3 < 3; c7_i3++) {
    _SFD_DATA_RANGE_CHECK((*c7_b_E)[c7_i3], 1U);
  }

  chartInstance->c7_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3U, chartInstance->c7_sfEvent);
  for (c7_i4 = 0; c7_i4 < 4; c7_i4++) {
    c7_Q[c7_i4] = (*c7_b_Q)[c7_i4];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c7_debug_family_names,
    c7_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargin, 0U, c7_c_sf_marshallOut,
    c7_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargout, 1U, c7_c_sf_marshallOut,
    c7_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c7_Q, 2U, c7_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c7_E, 3U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 3);
  for (c7_i5 = 0; c7_i5 < 3; c7_i5++) {
    c7_E[c7_i5] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 4);
  c7_a = c7_Q[0];
  c7_b = c7_Q[1];
  c7_y = c7_a * c7_b;
  c7_b_a = c7_Q[2];
  c7_b_b = c7_Q[3];
  c7_b_y = c7_b_a * c7_b_b;
  c7_c_b = c7_y + c7_b_y;
  c7_c_y = 2.0 * c7_c_b;
  c7_d_b = c7_mpower(chartInstance, c7_Q[1]) + c7_mpower(chartInstance, c7_Q[2]);
  c7_d_y = 2.0 * c7_d_b;
  c7_A = c7_c_y;
  c7_B = 1.0 - c7_d_y;
  c7_x = c7_A;
  c7_e_y = c7_B;
  c7_b_x = c7_x;
  c7_f_y = c7_e_y;
  c7_g_y = c7_b_x / c7_f_y;
  c7_c_x = c7_g_y;
  c7_d_x = c7_c_x;
  c7_d_x = muDoubleScalarAtan(c7_d_x);
  c7_E[0] = c7_d_x;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 5);
  c7_c_a = c7_Q[0];
  c7_e_b = c7_Q[2];
  c7_h_y = c7_c_a * c7_e_b;
  c7_d_a = c7_Q[3];
  c7_f_b = c7_Q[1];
  c7_i_y = c7_d_a * c7_f_b;
  c7_g_b = c7_h_y - c7_i_y;
  c7_j_y = 2.0 * c7_g_b;
  c7_e_x = c7_j_y;
  c7_f_x = c7_e_x;
  guard1 = FALSE;
  if (c7_f_x < -1.0) {
    guard1 = TRUE;
  } else {
    if (1.0 < c7_f_x) {
      guard1 = TRUE;
    }
  }

  if (guard1 == TRUE) {
    c7_eml_error(chartInstance);
  }

  c7_f_x = muDoubleScalarAsin(c7_f_x);
  c7_E[1] = c7_f_x;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 6);
  c7_e_a = c7_Q[0];
  c7_h_b = c7_Q[3];
  c7_k_y = c7_e_a * c7_h_b;
  c7_f_a = c7_Q[1];
  c7_i_b = c7_Q[2];
  c7_l_y = c7_f_a * c7_i_b;
  c7_j_b = c7_k_y + c7_l_y;
  c7_m_y = 2.0 * c7_j_b;
  c7_k_b = c7_mpower(chartInstance, c7_Q[2]) + c7_mpower(chartInstance, c7_Q[3]);
  c7_n_y = 2.0 * c7_k_b;
  c7_b_A = c7_m_y;
  c7_b_B = 1.0 - c7_n_y;
  c7_g_x = c7_b_A;
  c7_o_y = c7_b_B;
  c7_h_x = c7_g_x;
  c7_p_y = c7_o_y;
  c7_q_y = c7_h_x / c7_p_y;
  c7_i_x = c7_q_y;
  c7_j_x = c7_i_x;
  c7_j_x = muDoubleScalarAtan(c7_j_x);
  c7_E[2] = c7_j_x;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -6);
  _SFD_SYMBOL_SCOPE_POP();
  for (c7_i6 = 0; c7_i6 < 3; c7_i6++) {
    (*c7_b_E)[c7_i6] = c7_E[c7_i6];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3U, chartInstance->c7_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_WEC_Sim_DriverMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_gateway_c21_DemoGazeFollowWaveIdleRand
  (SFc21_DemoGazeFollowWaveIdleRandInstanceStruct *chartInstance)
{
  real_T c21_hoistedGlobal;
  real_T c21_b_hoistedGlobal;
  real_T c21_R;
  real_T c21_L;
  uint32_T c21_debug_family_var_map[9];
  boolean_T c21_aVarTruthTableCondition_1;
  boolean_T c21_aVarTruthTableCondition_2;
  boolean_T c21_aVarTruthTableCondition_3;
  boolean_T c21_aVarTruthTableCondition_4;
  real_T c21_nargin = 2.0;
  real_T c21_nargout = 1.0;
  real_T c21_y;
  boolean_T c21_b0;
  boolean_T c21_b1;
  boolean_T c21_b2;
  boolean_T c21_b3;
  real_T *c21_b_R;
  real_T *c21_b_L;
  real_T *c21_b_y;
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  boolean_T guard3 = false;
  boolean_T guard4 = false;
  c21_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c21_b_L = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c21_b_R = (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, 14U, chartInstance->c21_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c21_b_R, 0U);
  _SFD_DATA_RANGE_CHECK(*c21_b_L, 1U);
  chartInstance->c21_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 14U, chartInstance->c21_sfEvent);
  c21_hoistedGlobal = *c21_b_R;
  c21_b_hoistedGlobal = *c21_b_L;
  c21_R = c21_hoistedGlobal;
  c21_L = c21_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c21_debug_family_names,
    c21_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_aVarTruthTableCondition_1, 0U,
    c21_b_sf_marshallOut, c21_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_aVarTruthTableCondition_2, 1U,
    c21_b_sf_marshallOut, c21_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_aVarTruthTableCondition_3, 2U,
    c21_b_sf_marshallOut, c21_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_aVarTruthTableCondition_4, 3U,
    c21_b_sf_marshallOut, c21_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_nargin, 4U, c21_sf_marshallOut,
    c21_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_nargout, 5U, c21_sf_marshallOut,
    c21_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c21_R, 6U, c21_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c21_L, 7U, c21_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c21_y, 8U, c21_sf_marshallOut,
    c21_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 3);
  c21_aVarTruthTableCondition_1 = false;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 4);
  c21_aVarTruthTableCondition_2 = false;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 5);
  c21_aVarTruthTableCondition_3 = false;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 6);
  c21_aVarTruthTableCondition_4 = false;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 11);
  guard4 = false;
  if (c21_R == 0.0) {
    if (c21_L == 0.0) {
      c21_b0 = true;
    } else {
      guard4 = true;
    }
  } else {
    guard4 = true;
  }

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

  c21_aVarTruthTableCondition_1 = c21_b0;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 15);
  guard3 = false;
  if (c21_R == 1.0) {
    if (c21_L == 0.0) {
      c21_b1 = true;
    } else {
      guard3 = true;
    }
  } else {
    guard3 = true;
  }

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

  c21_aVarTruthTableCondition_2 = c21_b1;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 19);
  guard2 = false;
  if (c21_R == 0.0) {
    if (c21_L == 1.0) {
      c21_b2 = true;
    } else {
      guard2 = true;
    }
  } else {
    guard2 = true;
  }

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

  c21_aVarTruthTableCondition_3 = c21_b2;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 23);
  guard1 = false;
  if (c21_R == 1.0) {
    if (c21_L == 1.0) {
      c21_b3 = true;
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

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

  c21_aVarTruthTableCondition_4 = c21_b3;
  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 25);
  if (CV_EML_IF(0, 1, 0, c21_aVarTruthTableCondition_1)) {
    _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 26);
    CV_EML_FCN(0, 1);
    _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 41);
    c21_y = 0.0;
    _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -41);
  } else {
    _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 27);
    if (CV_EML_IF(0, 1, 1, c21_aVarTruthTableCondition_2)) {
      _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 28);
      CV_EML_FCN(0, 2);
      _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 47);
      c21_y = 1.0;
      _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -47);
    } else {
      _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 29);
      if (CV_EML_IF(0, 1, 2, c21_aVarTruthTableCondition_3)) {
        _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 30);
        CV_EML_FCN(0, 3);
        _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 53);
        c21_y = 2.0;
        _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -53);
      } else {
        _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 31);
        if (CV_EML_IF(0, 1, 3, c21_aVarTruthTableCondition_4)) {
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 32);
          CV_EML_FCN(0, 4);
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 59);
          c21_y = 3.0;
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -59);
        } else {
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 34);
          CV_EML_FCN(0, 1);
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, 41);
          c21_y = 0.0;
          _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -41);
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c21_sfEvent, -34);
  _SFD_SYMBOL_SCOPE_POP();
  *c21_b_y = c21_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 14U, chartInstance->c21_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_DemoGazeFollowWaveIdleRandMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c21_b_y, 2U);
}
static void sf_c9_Model_justmodel(SFc9_Model_justmodelInstanceStruct
  *chartInstance)
{
  int32_T c9_i2;
  int32_T c9_i3;
  int32_T c9_i4;
  int32_T c9_i5;
  real_T c9_nu_ship[3];
  int32_T c9_i6;
  real_T c9_alpha1[3];
  uint32_T c9_debug_family_var_map[6];
  real_T c9_nu_s[3];
  real_T c9_nargin = 2.0;
  real_T c9_nargout = 1.0;
  real_T c9_z2[3];
  int32_T c9_i7;
  int32_T c9_i8;
  int32_T c9_i9;
  real_T (*c9_b_z2)[3];
  real_T (*c9_b_alpha1)[3];
  real_T (*c9_b_nu_ship)[3];
  c9_b_alpha1 = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c9_b_z2 = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c9_b_nu_ship = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  for (c9_i2 = 0; c9_i2 < 3; c9_i2++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_nu_ship)[c9_i2], 0U);
  }

  for (c9_i3 = 0; c9_i3 < 3; c9_i3++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_z2)[c9_i3], 1U);
  }

  for (c9_i4 = 0; c9_i4 < 3; c9_i4++) {
    _SFD_DATA_RANGE_CHECK((*c9_b_alpha1)[c9_i4], 2U);
  }

  chartInstance->c9_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  for (c9_i5 = 0; c9_i5 < 3; c9_i5++) {
    c9_nu_ship[c9_i5] = (*c9_b_nu_ship)[c9_i5];
  }

  for (c9_i6 = 0; c9_i6 < 3; c9_i6++) {
    c9_alpha1[c9_i6] = (*c9_b_alpha1)[c9_i6];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c9_debug_family_names,
    c9_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c9_nu_s, 0U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c9_nargin, 1U, c9_b_sf_marshallOut,
    c9_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c9_nargout, 2U, c9_b_sf_marshallOut,
    c9_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c9_nu_ship, 3U, c9_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c9_alpha1, 4U, c9_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c9_z2, 5U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 5);
  CV_EML_IF(0, 1, 0, TRUE);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 6);
  for (c9_i7 = 0; c9_i7 < 3; c9_i7++) {
    c9_nu_s[c9_i7] = c9_nu_ship[c9_i7];
  }

  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 11);
  for (c9_i8 = 0; c9_i8 < 3; c9_i8++) {
    c9_z2[c9_i8] = c9_nu_s[c9_i8] - c9_alpha1[c9_i8];
  }

  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, -11);
  _SFD_SYMBOL_SCOPE_POP();
  for (c9_i9 = 0; c9_i9 < 3; c9_i9++) {
    (*c9_b_z2)[c9_i9] = c9_z2[c9_i9];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Model_justmodelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#4
0
static void sf_gateway_c2_Serial(SFc2_SerialInstanceStruct *chartInstance)
{
  uint8_T c2_hoistedGlobal;
  int32_T c2_i2;
  uint8_T c2_dataOut[256];
  uint8_T c2_lengthOut;
  uint32_T c2_debug_family_var_map[6];
  real_T c2_nargin = 2.0;
  real_T c2_nargout = 2.0;
  uint8_T c2_data[256];
  int32_T c2_length;
  int32_T c2_i3;
  int32_T c2_i4;
  int32_T c2_i5;
  int32_T c2_i6;
  int32_T *c2_b_length;
  uint8_T *c2_b_lengthOut;
  uint8_T (*c2_b_data)[256];
  uint8_T (*c2_b_dataOut)[256];
  c2_b_lengthOut = (uint8_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c2_b_dataOut = (uint8_T (*)[256])ssGetInputPortSignal(chartInstance->S, 0);
  c2_b_length = (int32_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c2_b_data = (uint8_T (*)[256])ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  c2_hoistedGlobal = *c2_b_lengthOut;
  for (c2_i2 = 0; c2_i2 < 256; c2_i2++) {
    c2_dataOut[c2_i2] = (*c2_b_dataOut)[c2_i2];
  }

  c2_lengthOut = c2_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c2_debug_family_names,
    c2_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 0U, c2_d_sf_marshallOut,
    c2_c_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 1U, c2_d_sf_marshallOut,
    c2_c_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_dataOut, 2U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_lengthOut, 3U, c2_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c2_data, 4U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_length, 5U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 2);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3);
  for (c2_i3 = 0; c2_i3 < 256; c2_i3++) {
    c2_data[c2_i3] = 0U;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  c2_length = 0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
  CV_EML_COND(0, 1, 0, true);
  CV_EML_MCDC(0, 1, 0, false);
  CV_EML_IF(0, 1, 0, false);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -21);
  _SFD_SYMBOL_SCOPE_POP();
  for (c2_i4 = 0; c2_i4 < 256; c2_i4++) {
    (*c2_b_data)[c2_i4] = c2_data[c2_i4];
  }

  *c2_b_length = c2_length;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_SerialMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c2_i5 = 0; c2_i5 < 256; c2_i5++) {
    _SFD_DATA_RANGE_CHECK((real_T)(*c2_b_data)[c2_i5], 0U);
  }

  _SFD_DATA_RANGE_CHECK((real_T)*c2_b_length, 1U);
  for (c2_i6 = 0; c2_i6 < 256; c2_i6++) {
    _SFD_DATA_RANGE_CHECK((real_T)(*c2_b_dataOut)[c2_i6], 2U);
  }

  _SFD_DATA_RANGE_CHECK((real_T)*c2_b_lengthOut, 3U);
}
static void sf_gateway_c7_aircraft_simplex(SFc7_aircraft_simplexInstanceStruct
  *chartInstance)
{
  real_T c7_hoistedGlobal;
  real_T c7_b_hoistedGlobal;
  real_T c7_c_hoistedGlobal;
  real_T c7_b_phi;
  real_T c7_b_theta;
  real_T c7_b_psi;
  uint32_T c7_debug_family_var_map[6];
  real_T c7_nargin = 3.0;
  real_T c7_nargout = 1.0;
  real_T c7_b_R[9];
  real_T c7_x;
  real_T c7_b_x;
  real_T c7_c_x;
  real_T c7_d_x;
  real_T c7_e_x;
  real_T c7_f_x;
  real_T c7_g_x;
  real_T c7_h_x;
  real_T c7_i_x;
  real_T c7_j_x;
  real_T c7_k_x;
  real_T c7_l_x;
  real_T c7_m_x;
  real_T c7_n_x;
  real_T c7_o_x;
  real_T c7_p_x;
  real_T c7_q_x;
  real_T c7_r_x;
  real_T c7_s_x;
  real_T c7_t_x;
  real_T c7_u_x;
  real_T c7_v_x;
  real_T c7_w_x;
  real_T c7_x_x;
  real_T c7_y_x;
  real_T c7_ab_x;
  real_T c7_bb_x;
  real_T c7_cb_x;
  real_T c7_db_x;
  real_T c7_eb_x;
  real_T c7_fb_x;
  real_T c7_gb_x;
  real_T c7_hb_x;
  real_T c7_ib_x;
  real_T c7_jb_x;
  real_T c7_kb_x;
  real_T c7_lb_x;
  real_T c7_mb_x;
  real_T c7_nb_x;
  real_T c7_ob_x;
  real_T c7_pb_x;
  real_T c7_qb_x;
  real_T c7_rb_x;
  real_T c7_sb_x;
  real_T c7_tb_x;
  real_T c7_ub_x;
  real_T c7_vb_x;
  real_T c7_wb_x;
  real_T c7_xb_x;
  real_T c7_yb_x;
  real_T c7_ac_x;
  real_T c7_bc_x;
  real_T c7_cc_x;
  real_T c7_dc_x;
  real_T c7_ec_x;
  real_T c7_fc_x;
  real_T c7_gc_x;
  real_T c7_hc_x;
  int32_T c7_i2;
  int32_T c7_i3;
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c7_sfEvent);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c7_phi, 0U);
  chartInstance->c7_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c7_sfEvent);
  c7_hoistedGlobal = *chartInstance->c7_phi;
  c7_b_hoistedGlobal = *chartInstance->c7_theta;
  c7_c_hoistedGlobal = *chartInstance->c7_psi;
  c7_b_phi = c7_hoistedGlobal;
  c7_b_theta = c7_b_hoistedGlobal;
  c7_b_psi = c7_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c7_debug_family_names,
    c7_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargin, 0U, c7_b_sf_marshallOut,
    c7_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargout, 1U, c7_b_sf_marshallOut,
    c7_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b_phi, 2U, c7_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b_theta, 3U, c7_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b_psi, 4U, c7_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c7_b_R, 5U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 5);
  c7_x = c7_b_theta;
  c7_b_x = c7_x;
  c7_b_x = muDoubleScalarCos(c7_b_x);
  c7_c_x = c7_b_psi;
  c7_d_x = c7_c_x;
  c7_d_x = muDoubleScalarCos(c7_d_x);
  c7_e_x = c7_b_phi;
  c7_f_x = c7_e_x;
  c7_f_x = muDoubleScalarCos(c7_f_x);
  c7_g_x = c7_b_psi;
  c7_h_x = c7_g_x;
  c7_h_x = muDoubleScalarSin(c7_h_x);
  c7_i_x = c7_b_phi;
  c7_j_x = c7_i_x;
  c7_j_x = muDoubleScalarSin(c7_j_x);
  c7_k_x = c7_b_theta;
  c7_l_x = c7_k_x;
  c7_l_x = muDoubleScalarSin(c7_l_x);
  c7_m_x = c7_b_psi;
  c7_n_x = c7_m_x;
  c7_n_x = muDoubleScalarCos(c7_n_x);
  c7_o_x = c7_b_phi;
  c7_p_x = c7_o_x;
  c7_p_x = muDoubleScalarSin(c7_p_x);
  c7_q_x = c7_b_psi;
  c7_r_x = c7_q_x;
  c7_r_x = muDoubleScalarSin(c7_r_x);
  c7_s_x = c7_b_phi;
  c7_t_x = c7_s_x;
  c7_t_x = muDoubleScalarCos(c7_t_x);
  c7_u_x = c7_b_theta;
  c7_v_x = c7_u_x;
  c7_v_x = muDoubleScalarSin(c7_v_x);
  c7_w_x = c7_b_psi;
  c7_x_x = c7_w_x;
  c7_x_x = muDoubleScalarCos(c7_x_x);
  c7_y_x = c7_b_theta;
  c7_ab_x = c7_y_x;
  c7_ab_x = muDoubleScalarCos(c7_ab_x);
  c7_bb_x = c7_b_psi;
  c7_cb_x = c7_bb_x;
  c7_cb_x = muDoubleScalarSin(c7_cb_x);
  c7_db_x = c7_b_phi;
  c7_eb_x = c7_db_x;
  c7_eb_x = muDoubleScalarCos(c7_eb_x);
  c7_fb_x = c7_b_psi;
  c7_gb_x = c7_fb_x;
  c7_gb_x = muDoubleScalarCos(c7_gb_x);
  c7_hb_x = c7_b_phi;
  c7_ib_x = c7_hb_x;
  c7_ib_x = muDoubleScalarSin(c7_ib_x);
  c7_jb_x = c7_b_theta;
  c7_kb_x = c7_jb_x;
  c7_kb_x = muDoubleScalarSin(c7_kb_x);
  c7_lb_x = c7_b_psi;
  c7_mb_x = c7_lb_x;
  c7_mb_x = muDoubleScalarSin(c7_mb_x);
  c7_nb_x = c7_b_phi;
  c7_ob_x = c7_nb_x;
  c7_ob_x = muDoubleScalarSin(c7_ob_x);
  c7_pb_x = c7_b_psi;
  c7_qb_x = c7_pb_x;
  c7_qb_x = muDoubleScalarCos(c7_qb_x);
  c7_rb_x = c7_b_phi;
  c7_sb_x = c7_rb_x;
  c7_sb_x = muDoubleScalarCos(c7_sb_x);
  c7_tb_x = c7_b_theta;
  c7_ub_x = c7_tb_x;
  c7_ub_x = muDoubleScalarSin(c7_ub_x);
  c7_vb_x = c7_b_psi;
  c7_wb_x = c7_vb_x;
  c7_wb_x = muDoubleScalarSin(c7_wb_x);
  c7_xb_x = c7_b_theta;
  c7_yb_x = c7_xb_x;
  c7_yb_x = muDoubleScalarSin(c7_yb_x);
  c7_ac_x = c7_b_phi;
  c7_bc_x = c7_ac_x;
  c7_bc_x = muDoubleScalarSin(c7_bc_x);
  c7_cc_x = c7_b_theta;
  c7_dc_x = c7_cc_x;
  c7_dc_x = muDoubleScalarCos(c7_dc_x);
  c7_ec_x = c7_b_phi;
  c7_fc_x = c7_ec_x;
  c7_fc_x = muDoubleScalarCos(c7_fc_x);
  c7_gc_x = c7_b_theta;
  c7_hc_x = c7_gc_x;
  c7_hc_x = muDoubleScalarCos(c7_hc_x);
  c7_b_R[0] = c7_b_x * c7_d_x;
  c7_b_R[3] = c7_f_x * c7_h_x + c7_j_x * c7_l_x * c7_n_x;
  c7_b_R[6] = c7_p_x * c7_r_x - c7_t_x * c7_v_x * c7_x_x;
  c7_b_R[1] = -c7_ab_x * c7_cb_x;
  c7_b_R[4] = c7_eb_x * c7_gb_x - c7_ib_x * c7_kb_x * c7_mb_x;
  c7_b_R[7] = c7_ob_x * c7_qb_x + c7_sb_x * c7_ub_x * c7_wb_x;
  c7_b_R[2] = c7_yb_x;
  c7_b_R[5] = -c7_bc_x * c7_dc_x;
  c7_b_R[8] = c7_fc_x * c7_hc_x;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -5);
  _SFD_SYMBOL_SCOPE_POP();
  for (c7_i2 = 0; c7_i2 < 9; c7_i2++) {
    (*chartInstance->c7_R)[c7_i2] = c7_b_R[c7_i2];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c7_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_aircraft_simplexMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c7_i3 = 0; c7_i3 < 9; c7_i3++) {
    _SFD_DATA_RANGE_CHECK((*chartInstance->c7_R)[c7_i3], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*chartInstance->c7_theta, 2U);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c7_psi, 3U);
}
static void sf_gateway_c7_CSE1_DP(SFc7_CSE1_DPInstanceStruct *chartInstance)
{
  real_T c7_hoistedGlobal;
  real_T c7_b_hoistedGlobal;
  real_T c7_alpha;
  real_T c7_u_VST;
  uint32_T c7_debug_family_var_map[24];
  real_T c7_a1;
  real_T c7_b1;
  real_T c7_c1;
  real_T c7_a2;
  real_T c7_b2;
  real_T c7_c2;
  real_T c7_a3;
  real_T c7_b3;
  real_T c7_c3;
  real_T c7_a4;
  real_T c7_b4;
  real_T c7_c4;
  real_T c7_a5;
  real_T c7_b5;
  real_T c7_c5;
  real_T c7_a6;
  real_T c7_b6;
  real_T c7_c6;
  real_T c7_nargin = 2.0;
  real_T c7_nargout = 2.0;
  real_T c7_F_x;
  real_T c7_F_y;
  real_T c7_x;
  real_T c7_b_x;
  real_T c7_c_x;
  real_T c7_d_x;
  real_T c7_e_x;
  real_T c7_f_x;
  real_T c7_g_x;
  real_T c7_h_x;
  real_T c7_i_x;
  real_T c7_j_x;
  real_T c7_k_x;
  real_T c7_l_x;
  real_T c7_m_x;
  real_T c7_n_x;
  real_T c7_o_x;
  real_T c7_p_x;
  real_T c7_q_x;
  real_T c7_r_x;
  real_T c7_s_x;
  real_T c7_t_x;
  real_T c7_u_x;
  real_T c7_v_x;
  real_T c7_w_x;
  real_T c7_x_x;
  real_T *c7_b_alpha;
  real_T *c7_b_F_x;
  real_T *c7_b_u_VST;
  real_T *c7_b_F_y;
  c7_b_F_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c7_b_u_VST = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c7_b_F_x = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c7_b_alpha = (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, 6U, chartInstance->c7_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c7_b_alpha, 0U);
  chartInstance->c7_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  c7_hoistedGlobal = *c7_b_alpha;
  c7_b_hoistedGlobal = *c7_b_u_VST;
  c7_alpha = c7_hoistedGlobal;
  c7_u_VST = c7_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 24U, 24U, c7_debug_family_names,
    c7_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a1, 0U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b1, 1U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c1, 2U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a2, 3U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b2, 4U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c2, 5U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a3, 6U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b3, 7U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c3, 8U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a4, 9U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b4, 10U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c4, 11U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a5, 12U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b5, 13U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c5, 14U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_a6, 15U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_b6, 16U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_c6, 17U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargin, 18U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargout, 19U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_alpha, 20U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c7_u_VST, 21U, c7_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_F_x, 22U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_F_y, 23U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 4);
  c7_a1 = 1.107;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 5);
  c7_b1 = 1.001;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 6);
  c7_c1 = 1.564;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 7);
  c7_a2 = 0.3471;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 8);
  c7_b2 = 0.1397;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 9);
  c7_c2 = -1.599;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 10);
  c7_a3 = 0.1558;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 11);
  c7_b3 = 1.993;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 12);
  c7_c3 = 1.886;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 13);
  c7_a4 = 0.1599;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 14);
  c7_b4 = 0.218;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 15);
  c7_c4 = 1.513;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 16);
  c7_a5 = 0.08237;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 17);
  c7_b5 = 2.986;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 18);
  c7_c5 = -1.601;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 19);
  c7_a6 = 0.04641;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 20);
  c7_b6 = 3.964;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 21);
  c7_c6 = 1.738;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 22);
  c7_x = 1.001 * c7_alpha + c7_c1;
  c7_b_x = c7_x;
  c7_b_x = muDoubleScalarSin(c7_b_x);
  c7_c_x = 0.1397 * c7_alpha + c7_c2;
  c7_d_x = c7_c_x;
  c7_d_x = muDoubleScalarSin(c7_d_x);
  c7_e_x = 1.993 * c7_alpha + c7_c3;
  c7_f_x = c7_e_x;
  c7_f_x = muDoubleScalarSin(c7_f_x);
  c7_g_x = 0.218 * c7_alpha + c7_c4;
  c7_h_x = c7_g_x;
  c7_h_x = muDoubleScalarSin(c7_h_x);
  c7_i_x = 2.986 * c7_alpha + c7_c5;
  c7_j_x = c7_i_x;
  c7_j_x = muDoubleScalarSin(c7_j_x);
  c7_k_x = 3.964 * c7_alpha + c7_c6;
  c7_l_x = c7_k_x;
  c7_l_x = muDoubleScalarSin(c7_l_x);
  c7_F_x = c7_u_VST * (((((1.107 * c7_b_x + 0.3471 * c7_d_x) + 0.1558 * c7_f_x)
    + 0.1599 * c7_h_x) + 0.08237 * c7_j_x) + 0.04641 * c7_l_x);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 29);
  c7_a1 = 0.7936;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 30);
  c7_b1 = 1.001;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 31);
  c7_c1 = 0.01605;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 32);
  c7_a2 = 0.2112;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 33);
  c7_b2 = 1.997;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 34);
  c7_c2 = 0.03229;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 35);
  c7_a3 = 0.07608;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 36);
  c7_b3 = 2.991;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 37);
  c7_c3 = 2.986;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 38);
  c7_a4 = 0.04817;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 39);
  c7_b4 = 3.999;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 40);
  c7_c4 = -0.8668;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 41);
  c7_a5 = 0.01757;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 42);
  c7_b5 = 4.904;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 43);
  c7_c5 = -2.622;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 44);
  c7_a6 = -0.02089;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 45);
  c7_b6 = 5.068;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 46);
  c7_c6 = 0.2548;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 47);
  c7_m_x = 1.001 * c7_alpha + c7_c1;
  c7_n_x = c7_m_x;
  c7_n_x = muDoubleScalarSin(c7_n_x);
  c7_o_x = 1.997 * c7_alpha + c7_c2;
  c7_p_x = c7_o_x;
  c7_p_x = muDoubleScalarSin(c7_p_x);
  c7_q_x = 2.991 * c7_alpha + c7_c3;
  c7_r_x = c7_q_x;
  c7_r_x = muDoubleScalarSin(c7_r_x);
  c7_s_x = 3.999 * c7_alpha + c7_c4;
  c7_t_x = c7_s_x;
  c7_t_x = muDoubleScalarSin(c7_t_x);
  c7_u_x = 4.904 * c7_alpha + c7_c5;
  c7_v_x = c7_u_x;
  c7_v_x = muDoubleScalarSin(c7_v_x);
  c7_w_x = 5.068 * c7_alpha + c7_c6;
  c7_x_x = c7_w_x;
  c7_x_x = muDoubleScalarSin(c7_x_x);
  c7_F_y = c7_u_VST * (((((0.7936 * c7_n_x + 0.2112 * c7_p_x) + 0.07608 * c7_r_x)
    + 0.04817 * c7_t_x) + 0.01757 * c7_v_x) + -0.02089 * c7_x_x);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -47);
  _SFD_SYMBOL_SCOPE_POP();
  *c7_b_F_x = c7_F_x;
  *c7_b_F_y = c7_F_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CSE1_DPMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c7_b_F_x, 1U);
  _SFD_DATA_RANGE_CHECK(*c7_b_u_VST, 2U);
  _SFD_DATA_RANGE_CHECK(*c7_b_F_y, 3U);
}
示例#7
0
static void sf_c25_CusakisME4901(SFc25_CusakisME4901InstanceStruct
  *chartInstance)
{
  int32_T c25_i2;
  int32_T c25_i3;
  real_T c25_hoistedGlobal;
  real_T c25_b_hoistedGlobal;
  real_T c25_c_hoistedGlobal;
  int32_T c25_i4;
  real_T c25_u[3];
  real_T c25_b_mt;
  real_T c25_b_mb;
  real_T c25_b_m;
  uint32_T c25_debug_family_var_map[8];
  real_T c25_r;
  real_T c25_nargin = 4.0;
  real_T c25_nargout = 1.0;
  real_T c25_a[6];
  real_T c25_b;
  real_T c25_y;
  real_T c25_A;
  real_T c25_B;
  real_T c25_x;
  real_T c25_b_y;
  real_T c25_b_x;
  real_T c25_c_y;
  int32_T c25_i5;
  real_T c25_b_a;
  real_T c25_b_b;
  real_T c25_d_y;
  real_T c25_c_a;
  real_T c25_c_b;
  real_T c25_e_y;
  real_T c25_d_a;
  real_T c25_d_b;
  real_T c25_f_y;
  int32_T c25_i6;
  real_T (*c25_e_a)[6];
  real_T (*c25_b_u)[3];
  c25_e_a = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
  c25_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 23U, chartInstance->c25_sfEvent);
  for (c25_i2 = 0; c25_i2 < 3; c25_i2++) {
    _SFD_DATA_RANGE_CHECK((*c25_b_u)[c25_i2], 0U);
  }

  _SFD_DATA_RANGE_CHECK(chartInstance->c25_mt, 1U);
  for (c25_i3 = 0; c25_i3 < 6; c25_i3++) {
    _SFD_DATA_RANGE_CHECK((*c25_e_a)[c25_i3], 2U);
  }

  _SFD_DATA_RANGE_CHECK(chartInstance->c25_mb, 3U);
  _SFD_DATA_RANGE_CHECK(chartInstance->c25_m, 4U);
  chartInstance->c25_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 23U, chartInstance->c25_sfEvent);
  c25_hoistedGlobal = chartInstance->c25_mt;
  c25_b_hoistedGlobal = chartInstance->c25_mb;
  c25_c_hoistedGlobal = chartInstance->c25_m;
  for (c25_i4 = 0; c25_i4 < 3; c25_i4++) {
    c25_u[c25_i4] = (*c25_b_u)[c25_i4];
  }

  c25_b_mt = c25_hoistedGlobal;
  c25_b_mb = c25_b_hoistedGlobal;
  c25_b_m = c25_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 8U, 8U, c25_debug_family_names,
    c25_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_r, 0U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_nargin, 1U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_nargout, 2U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c25_u, 3U, c25_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_b_mt, 4U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_b_mb, 5U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c25_b_m, 6U, c25_b_sf_marshallOut,
    c25_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c25_a, 7U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 7);
  c25_b = c25_b_m;
  c25_y = 3.0 * c25_b;
  c25_A = c25_b_mt;
  c25_B = c25_b_mb + c25_y;
  c25_x = c25_A;
  c25_b_y = c25_B;
  c25_b_x = c25_x;
  c25_c_y = c25_b_y;
  c25_r = c25_b_x / c25_c_y;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 8);
  for (c25_i5 = 0; c25_i5 < 6; c25_i5++) {
    c25_a[c25_i5] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 10);
  c25_b_a = -c25_r;
  c25_b_b = c25_u[0];
  c25_d_y = c25_b_a * c25_b_b;
  c25_a[0] = c25_d_y;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 11);
  c25_c_a = -c25_r;
  c25_c_b = c25_u[1];
  c25_e_y = c25_c_a * c25_c_b;
  c25_a[1] = c25_e_y;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 12);
  c25_d_a = -c25_r;
  c25_d_b = c25_u[2];
  c25_f_y = c25_d_a * c25_d_b;
  c25_a[5] = c25_f_y;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, -12);
  _SFD_SYMBOL_SCOPE_POP();
  for (c25_i6 = 0; c25_i6 < 6; c25_i6++) {
    (*c25_e_a)[c25_i6] = c25_a[c25_i6];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 23U, chartInstance->c25_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CusakisME4901MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c10_HIL_model_overall(SFc10_HIL_model_overallInstanceStruct
  *chartInstance)
{
  int32_T c10_i2;
  int32_T c10_i3;
  int32_T c10_i4;
  real_T c10_eta[3];
  uint32_T c10_debug_family_var_map[7];
  real_T c10_psi;
  real_T c10_c;
  real_T c10_s;
  real_T c10_nargin = 1.0;
  real_T c10_nargout = 1.0;
  real_T c10_R[9];
  real_T c10_x;
  real_T c10_b_x;
  real_T c10_c_x;
  real_T c10_d_x;
  int32_T c10_i5;
  int32_T c10_i6;
  static real_T c10_dv1[3] = { 0.0, 0.0, 1.0 };

  int32_T c10_i7;
  real_T (*c10_b_R)[9];
  real_T (*c10_b_eta)[3];
  c10_b_R = (real_T (*)[9])ssGetOutputPortSignal(chartInstance->S, 1);
  c10_b_eta = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 9U, chartInstance->c10_sfEvent);
  for (c10_i2 = 0; c10_i2 < 3; c10_i2++) {
    _SFD_DATA_RANGE_CHECK((*c10_b_eta)[c10_i2], 0U);
  }

  for (c10_i3 = 0; c10_i3 < 9; c10_i3++) {
    _SFD_DATA_RANGE_CHECK((*c10_b_R)[c10_i3], 1U);
  }

  chartInstance->c10_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 9U, chartInstance->c10_sfEvent);
  for (c10_i4 = 0; c10_i4 < 3; c10_i4++) {
    c10_eta[c10_i4] = (*c10_b_eta)[c10_i4];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 7U, 7U, c10_debug_family_names,
    c10_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_psi, 0U, c10_c_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_c, 1U, c10_c_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_s, 2U, c10_c_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_nargin, 3U, c10_c_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_nargout, 4U, c10_c_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c10_eta, 5U, c10_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c10_R, 6U, c10_sf_marshallOut,
    c10_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 3);
  CV_EML_IF(0, 1, 0, TRUE);
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 4);
  c10_psi = c10_eta[2];
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 9);
  c10_x = c10_psi;
  c10_c = c10_x;
  c10_b_x = c10_c;
  c10_c = c10_b_x;
  c10_c = muDoubleScalarCos(c10_c);
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 10);
  c10_c_x = c10_psi;
  c10_s = c10_c_x;
  c10_d_x = c10_s;
  c10_s = c10_d_x;
  c10_s = muDoubleScalarSin(c10_s);
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 12);
  c10_R[0] = c10_c;
  c10_R[3] = -c10_s;
  c10_R[6] = 0.0;
  c10_R[1] = c10_s;
  c10_R[4] = c10_c;
  c10_R[7] = 0.0;
  c10_i5 = 0;
  for (c10_i6 = 0; c10_i6 < 3; c10_i6++) {
    c10_R[c10_i5 + 2] = c10_dv1[c10_i6];
    c10_i5 += 3;
  }

  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, -12);
  _SFD_SYMBOL_SCOPE_POP();
  for (c10_i7 = 0; c10_i7 < 9; c10_i7++) {
    (*c10_b_R)[c10_i7] = c10_R[c10_i7];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 9U, chartInstance->c10_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_HIL_model_overallMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_gateway_c3_ARP_02_RPSsmile_WirelessGlove
  (SFc3_ARP_02_RPSsmile_WirelessGloveInstanceStruct *chartInstance)
{
  real_T c3_hoistedGlobal;
  real_T c3_u;
  uint32_T c3_debug_family_var_map[4];
  real_T c3_nargin = 1.0;
  real_T c3_nargout = 1.0;
  real_T c3_y;
  real_T *c3_b_u;
  real_T *c3_b_y;
  c3_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c3_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, 2U, chartInstance->c3_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c3_b_u, 0U);
  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *c3_b_u;
  c3_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_u, 2U, c3_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_y, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 6);
  if (CV_EML_IF(0, 1, 0, c3_u == 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 7);
    c3_u = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 8);
    if (CV_EML_IF(0, 1, 1, c3_u == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
      c3_u = 0.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 10);
      if (CV_EML_IF(0, 1, 2, c3_u == 3.0)) {
        _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 11);
        c3_u = 2.0;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 13);
        c3_u = 3.0;
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 15);
  c3_y = c3_u;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -15);
  _SFD_SYMBOL_SCOPE_POP();
  *c3_b_y = c3_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY
    (_ARP_02_RPSsmile_WirelessGloveMachineNumber_, chartInstance->chartNumber,
     chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c3_b_y, 1U);
}
static void sf_c13_Final_Project_v3c(SFc13_Final_Project_v3cInstanceStruct
  *chartInstance)
{
  int32_T c13_i2;
  int32_T c13_i3;
  int32_T c13_i4;
  real_T c13_hoistedGlobal;
  int32_T c13_i5;
  real_T c13_u[3];
  int32_T c13_i6;
  real_T c13_ur[3];
  real_T c13_coll;
  uint32_T c13_debug_family_var_map[6];
  real_T c13_nargin = 3.0;
  real_T c13_nargout = 1.0;
  real_T c13_y[3];
  int32_T c13_i7;
  int32_T c13_i8;
  int32_T c13_i9;
  real_T *c13_b_coll;
  real_T (*c13_b_y)[3];
  real_T (*c13_b_ur)[3];
  real_T (*c13_b_u)[3];
  c13_b_coll = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c13_b_ur = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c13_b_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c13_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  for (c13_i2 = 0; c13_i2 < 3; c13_i2++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_u)[c13_i2], 0U);
  }

  for (c13_i3 = 0; c13_i3 < 3; c13_i3++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_y)[c13_i3], 1U);
  }

  for (c13_i4 = 0; c13_i4 < 3; c13_i4++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_ur)[c13_i4], 2U);
  }

  _SFD_DATA_RANGE_CHECK(*c13_b_coll, 3U);
  chartInstance->c13_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  c13_hoistedGlobal = *c13_b_coll;
  for (c13_i5 = 0; c13_i5 < 3; c13_i5++) {
    c13_u[c13_i5] = (*c13_b_u)[c13_i5];
  }

  for (c13_i6 = 0; c13_i6 < 3; c13_i6++) {
    c13_ur[c13_i6] = (*c13_b_ur)[c13_i6];
  }

  c13_coll = c13_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c13_debug_family_names,
    c13_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargin, 0U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargout, 1U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c13_u, 2U, c13_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c13_ur, 3U, c13_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_coll, 4U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c13_y, 5U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 6);
  if (CV_EML_IF(0, 1, 0, c13_coll == 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 8);
    for (c13_i7 = 0; c13_i7 < 3; c13_i7++) {
      c13_y[c13_i7] = c13_ur[c13_i7];
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 12);
    for (c13_i8 = 0; c13_i8 < 3; c13_i8++) {
      c13_y[c13_i8] = c13_u[c13_i8];
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, -12);
  _SFD_SYMBOL_SCOPE_POP();
  for (c13_i9 = 0; c13_i9 < 3; c13_i9++) {
    (*c13_b_y)[c13_i9] = c13_y[c13_i9];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Final_Project_v3cMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c13_Final_Project_v3b(SFc13_Final_Project_v3bInstanceStruct
  *chartInstance)
{
  int32_T c13_i2;
  int32_T c13_i3;
  real_T c13_hoistedGlobal;
  real_T c13_b_hoistedGlobal;
  real_T c13_c_hoistedGlobal;
  real_T c13_d_hoistedGlobal;
  real_T c13_e_hoistedGlobal;
  real_T c13_f_hoistedGlobal;
  real_T c13_g_hoistedGlobal;
  real_T c13_u1;
  real_T c13_u2;
  real_T c13_u3;
  real_T c13_u4;
  real_T c13_u5;
  real_T c13_u6;
  real_T c13_collision;
  int32_T c13_i4;
  real_T c13_memory[6];
  uint32_T c13_debug_family_var_map[11];
  real_T c13_nargin = 8.0;
  real_T c13_nargout = 1.0;
  real_T c13_y[6];
  int32_T c13_i5;
  real_T *c13_b_u1;
  real_T *c13_b_u2;
  real_T *c13_b_u3;
  real_T *c13_b_u4;
  real_T *c13_b_u5;
  real_T *c13_b_u6;
  real_T *c13_b_collision;
  real_T (*c13_b_y)[6];
  real_T (*c13_b_memory)[6];
  c13_b_memory = (real_T (*)[6])ssGetInputPortSignal(chartInstance->S, 7);
  c13_b_collision = (real_T *)ssGetInputPortSignal(chartInstance->S, 6);
  c13_b_u6 = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
  c13_b_u5 = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
  c13_b_u4 = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c13_b_u3 = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c13_b_u2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c13_b_y = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
  c13_b_u1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c13_b_u1, 0U);
  for (c13_i2 = 0; c13_i2 < 6; c13_i2++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_y)[c13_i2], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c13_b_u2, 2U);
  _SFD_DATA_RANGE_CHECK(*c13_b_u3, 3U);
  _SFD_DATA_RANGE_CHECK(*c13_b_u4, 4U);
  _SFD_DATA_RANGE_CHECK(*c13_b_u5, 5U);
  _SFD_DATA_RANGE_CHECK(*c13_b_u6, 6U);
  _SFD_DATA_RANGE_CHECK(*c13_b_collision, 7U);
  for (c13_i3 = 0; c13_i3 < 6; c13_i3++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_memory)[c13_i3], 8U);
  }

  chartInstance->c13_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  c13_hoistedGlobal = *c13_b_u1;
  c13_b_hoistedGlobal = *c13_b_u2;
  c13_c_hoistedGlobal = *c13_b_u3;
  c13_d_hoistedGlobal = *c13_b_u4;
  c13_e_hoistedGlobal = *c13_b_u5;
  c13_f_hoistedGlobal = *c13_b_u6;
  c13_g_hoistedGlobal = *c13_b_collision;
  c13_u1 = c13_hoistedGlobal;
  c13_u2 = c13_b_hoistedGlobal;
  c13_u3 = c13_c_hoistedGlobal;
  c13_u4 = c13_d_hoistedGlobal;
  c13_u5 = c13_e_hoistedGlobal;
  c13_u6 = c13_f_hoistedGlobal;
  c13_collision = c13_g_hoistedGlobal;
  for (c13_i4 = 0; c13_i4 < 6; c13_i4++) {
    c13_memory[c13_i4] = (*c13_b_memory)[c13_i4];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 11U, 11U, c13_debug_family_names,
    c13_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargin, 0U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargout, 1U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u1, 2U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u2, 3U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u3, 4U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u4, 5U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u5, 6U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_u6, 7U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_collision, 8U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c13_memory, 9U, c13_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c13_y, 10U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 5);
  if (CV_EML_IF(0, 1, 0, c13_collision == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 7);
    c13_y[0] = c13_u1;
    c13_y[1] = c13_u2;
    c13_y[2] = c13_u3;
    c13_y[3] = c13_u4;
    c13_y[4] = c13_u5;
    c13_y[5] = c13_u6;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 11);
    c13_y[0] = c13_u1;
    c13_y[1] = c13_u2;
    c13_y[2] = c13_u3;
    c13_y[3] = c13_memory[3];
    c13_y[4] = c13_memory[4];
    c13_y[5] = c13_memory[5];
  }

  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, -11);
  _SFD_SYMBOL_SCOPE_POP();
  for (c13_i5 = 0; c13_i5 < 6; c13_i5++) {
    (*c13_b_y)[c13_i5] = c13_y[c13_i5];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Final_Project_v3bMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#12
0
static void sf_gateway_c1_MON_sl_after_replacement3
  (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
{
  boolean_T c1_out;
  boolean_T c1_b_out;
  boolean_T c1_c_out;
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  c1_set_sim_state_side_effects_c1_MON_sl_after_replacement3(chartInstance);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_pedal, 1U, 1U, 0U,
                        chartInstance->c1_sfEvent, false);
  _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_mode, 0U, 1U, 0U,
                        chartInstance->c1_sfEvent, false);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 1U, chartInstance->c1_sfEvent);
  c1_out = (CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1U, 0,
              CV_RELATIONAL_EVAL(5U, 1U, 0, (real_T)*chartInstance->c1_mode,
    (real_T)chartInstance->c1_LO, 0, 0U, *chartInstance->c1_mode ==
    chartInstance->c1_LO) != 0U, chartInstance->c1_sfEvent)) != 0);
  guard1 = false;
  guard2 = false;
  if (c1_out) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 3U, chartInstance->c1_sfEvent);
    *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_LO;
    _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 3U,
                          chartInstance->c1_sfEvent, false);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 11U, chartInstance->c1_sfEvent);
    guard2 = true;
  } else {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 4U, chartInstance->c1_sfEvent);
    c1_b_out = (CV_TRANSITION_EVAL(4U, (int32_T)_SFD_CCP_CALL(4U, 0,
      CV_RELATIONAL_EVAL(5U, 4U, 0, (real_T)*chartInstance->c1_mode, (real_T)
                         chartInstance->c1_MED, 0, 0U, *chartInstance->c1_mode ==
                         chartInstance->c1_MED) != 0U, chartInstance->c1_sfEvent))
                != 0);
    if (c1_b_out) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 4U, chartInstance->c1_sfEvent);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 6U, chartInstance->c1_sfEvent);
      *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_MED;
      _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 6U,
                            chartInstance->c1_sfEvent, false);
      guard2 = true;
    } else {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 5U, chartInstance->c1_sfEvent);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 7U,
                   chartInstance->c1_sfEvent);
      c1_c_out = (CV_TRANSITION_EVAL(7U, (int32_T)_SFD_CCP_CALL(7U, 0,
        CV_RELATIONAL_EVAL(5U, 7U, 0, (real_T)*chartInstance->c1_mode, (real_T)
                           chartInstance->c1_MAX, 0, 0U, *chartInstance->c1_mode
                           == chartInstance->c1_MAX) != 0U,
        chartInstance->c1_sfEvent)) != 0);
      if (c1_c_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 7U, chartInstance->c1_sfEvent);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 9U, chartInstance->c1_sfEvent);
        *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_MAX;
        _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 9U,
                              chartInstance->c1_sfEvent, false);
        guard1 = true;
      } else {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 13U, chartInstance->c1_sfEvent);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 8U, chartInstance->c1_sfEvent);
        *chartInstance->c1_r = *chartInstance->c1_pedal;
        _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 8U,
                              chartInstance->c1_sfEvent, false);
      }
    }
  }

  if (guard2 == true) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 10U, chartInstance->c1_sfEvent);
    guard1 = true;
  }

  if (guard1 == true) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 14U, chartInstance->c1_sfEvent);
  }

  _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 12U, chartInstance->c1_sfEvent);
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_MON_sl_after_replacement3MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c14_Model_justmodel(SFc14_Model_justmodelInstanceStruct
  *chartInstance)
{
  int32_T c14_i4;
  int32_T c14_i5;
  int32_T c14_i6;
  int32_T c14_i7;
  real_T c14_eta_s_in[3];
  uint32_T c14_debug_family_var_map[9];
  real_T c14_eta_s[3];
  real_T c14_psi;
  real_T c14_c;
  real_T c14_s;
  real_T c14_nargin = 1.0;
  real_T c14_nargout = 2.0;
  real_T c14_Rs[9];
  real_T c14_Rst[9];
  int32_T c14_i8;
  real_T c14_x;
  real_T c14_b_x;
  real_T c14_c_x;
  real_T c14_d_x;
  int32_T c14_i9;
  int32_T c14_i10;
  static real_T c14_dv2[3] = { 0.0, 0.0, 1.0 };

  int32_T c14_i11;
  int32_T c14_i12;
  int32_T c14_i13;
  int32_T c14_i14;
  int32_T c14_i15;
  int32_T c14_i16;
  real_T (*c14_b_Rs)[9];
  real_T (*c14_b_Rst)[9];
  real_T (*c14_b_eta_s_in)[3];
  c14_b_Rst = (real_T (*)[9])ssGetOutputPortSignal(chartInstance->S, 2);
  c14_b_Rs = (real_T (*)[9])ssGetOutputPortSignal(chartInstance->S, 1);
  c14_b_eta_s_in = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 13U, chartInstance->c14_sfEvent);
  for (c14_i4 = 0; c14_i4 < 3; c14_i4++) {
    _SFD_DATA_RANGE_CHECK((*c14_b_eta_s_in)[c14_i4], 0U);
  }

  for (c14_i5 = 0; c14_i5 < 9; c14_i5++) {
    _SFD_DATA_RANGE_CHECK((*c14_b_Rs)[c14_i5], 1U);
  }

  for (c14_i6 = 0; c14_i6 < 9; c14_i6++) {
    _SFD_DATA_RANGE_CHECK((*c14_b_Rst)[c14_i6], 2U);
  }

  chartInstance->c14_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 13U, chartInstance->c14_sfEvent);
  for (c14_i7 = 0; c14_i7 < 3; c14_i7++) {
    c14_eta_s_in[c14_i7] = (*c14_b_eta_s_in)[c14_i7];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c14_debug_family_names,
    c14_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c14_eta_s, 0U, c14_b_sf_marshallOut,
    c14_c_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_psi, 1U, c14_c_sf_marshallOut,
    c14_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_c, 2U, c14_c_sf_marshallOut,
    c14_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_s, 3U, c14_c_sf_marshallOut,
    c14_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_nargin, 4U, c14_c_sf_marshallOut,
    c14_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c14_nargout, 5U, c14_c_sf_marshallOut,
    c14_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c14_eta_s_in, 6U, c14_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c14_Rs, 7U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c14_Rst, 8U, c14_sf_marshallOut,
    c14_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 3);
  CV_EML_IF(0, 1, 0, TRUE);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 4);
  for (c14_i8 = 0; c14_i8 < 3; c14_i8++) {
    c14_eta_s[c14_i8] = c14_eta_s_in[c14_i8];
  }

  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 9);
  c14_psi = c14_eta_s[2];
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 11);
  c14_x = c14_psi;
  c14_c = c14_x;
  c14_b_x = c14_c;
  c14_c = c14_b_x;
  c14_c = muDoubleScalarCos(c14_c);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 12);
  c14_c_x = c14_psi;
  c14_s = c14_c_x;
  c14_d_x = c14_s;
  c14_s = c14_d_x;
  c14_s = muDoubleScalarSin(c14_s);
  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 14);
  c14_Rs[0] = c14_c;
  c14_Rs[3] = -c14_s;
  c14_Rs[6] = 0.0;
  c14_Rs[1] = c14_s;
  c14_Rs[4] = c14_c;
  c14_Rs[7] = 0.0;
  c14_i9 = 0;
  for (c14_i10 = 0; c14_i10 < 3; c14_i10++) {
    c14_Rs[c14_i9 + 2] = c14_dv2[c14_i10];
    c14_i9 += 3;
  }

  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, 17);
  c14_i11 = 0;
  for (c14_i12 = 0; c14_i12 < 3; c14_i12++) {
    c14_i13 = 0;
    for (c14_i14 = 0; c14_i14 < 3; c14_i14++) {
      c14_Rst[c14_i14 + c14_i11] = c14_Rs[c14_i13 + c14_i12];
      c14_i13 += 3;
    }

    c14_i11 += 3;
  }

  _SFD_EML_CALL(0U, chartInstance->c14_sfEvent, -17);
  _SFD_SYMBOL_SCOPE_POP();
  for (c14_i15 = 0; c14_i15 < 9; c14_i15++) {
    (*c14_b_Rs)[c14_i15] = c14_Rs[c14_i15];
  }

  for (c14_i16 = 0; c14_i16 < 9; c14_i16++) {
    (*c14_b_Rst)[c14_i16] = c14_Rst[c14_i16];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 13U, chartInstance->c14_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Model_justmodelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c1_TTR_RobustMPC_RTmdl(SFc1_TTR_RobustMPC_RTmdlInstanceStruct
  *chartInstance)
{
  int32_T c1_i0;
  real_T c1_hoistedGlobal;
  real_T c1_u_ctrl;
  int32_T c1_i1;
  real_T c1_U_bounds[2];
  uint32_T c1_debug_family_var_map[6];
  real_T c1_i;
  real_T c1_nargin = 2.0;
  real_T c1_nargout = 1.0;
  real_T c1_u_ctrl_out;
  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_y;
  real_T c1_b_x;
  real_T c1_b_y;
  real_T c1_xk;
  real_T c1_yk;
  real_T c1_c_x;
  real_T c1_c_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_d_y;
  real_T c1_e_x;
  real_T c1_e_y;
  real_T c1_b_xk;
  real_T c1_b_yk;
  real_T c1_f_x;
  real_T c1_f_y;
  real_T *c1_b_u_ctrl;
  real_T *c1_b_u_ctrl_out;
  real_T (*c1_b_U_bounds)[2];
  c1_b_U_bounds = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 1);
  c1_b_u_ctrl_out = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_u_ctrl = (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_ctrl, 0U);
  _SFD_DATA_RANGE_CHECK(*c1_b_u_ctrl_out, 1U);
  for (c1_i0 = 0; c1_i0 < 2; c1_i0++) {
    _SFD_DATA_RANGE_CHECK((*c1_b_U_bounds)[c1_i0], 2U);
  }

  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_u_ctrl;
  c1_u_ctrl = c1_hoistedGlobal;
  for (c1_i1 = 0; c1_i1 < 2; c1_i1++) {
    c1_U_bounds[c1_i1] = (*c1_b_U_bounds)[c1_i1];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c1_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_i, 0U, c1_sf_marshallOut);
  _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_ctrl, 3U, c1_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c1_U_bounds, 4U, c1_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_u_ctrl_out, 5U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
  c1_u_ctrl_out = c1_u_ctrl;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 11);
  CV_EML_IF(0, 1, 0, FALSE);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 17);
  c1_i = 1.0;
  CV_EML_FOR(0, 1, 0, 1);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 18);
  c1_varargin_1 = c1_u_ctrl;
  c1_varargin_2 = c1_U_bounds[0];
  c1_b_varargin_2 = c1_varargin_1;
  c1_varargin_3 = c1_varargin_2;
  c1_x = c1_b_varargin_2;
  c1_y = c1_varargin_3;
  c1_b_x = c1_x;
  c1_b_y = c1_y;
  c1_eml_scalar_eg(chartInstance);
  c1_xk = c1_b_x;
  c1_yk = c1_b_y;
  c1_c_x = c1_xk;
  c1_c_y = c1_yk;
  c1_eml_scalar_eg(chartInstance);
  c1_u_ctrl_out = muDoubleScalarMax(c1_c_x, c1_c_y);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 19);
  c1_b_varargin_1 = c1_u_ctrl;
  c1_c_varargin_2 = c1_U_bounds[1];
  c1_d_varargin_2 = c1_b_varargin_1;
  c1_b_varargin_3 = c1_c_varargin_2;
  c1_d_x = c1_d_varargin_2;
  c1_d_y = c1_b_varargin_3;
  c1_e_x = c1_d_x;
  c1_e_y = c1_d_y;
  c1_eml_scalar_eg(chartInstance);
  c1_b_xk = c1_e_x;
  c1_b_yk = c1_e_y;
  c1_f_x = c1_b_xk;
  c1_f_y = c1_b_yk;
  c1_eml_scalar_eg(chartInstance);
  c1_u_ctrl_out = muDoubleScalarMin(c1_f_x, c1_f_y);
  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -19);
  _SFD_SYMBOL_SCOPE_POP();
  *c1_b_u_ctrl_out = c1_u_ctrl_out;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_TTR_RobustMPC_RTmdlMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c19_HIL_model_overall(SFc19_HIL_model_overallInstanceStruct
  *chartInstance)
{
  real_T c19_hoistedGlobal;
  real_T c19_b_hoistedGlobal;
  real_T c19_U_in;
  real_T c19_t;
  uint32_T c19_debug_family_var_map[5];
  real_T c19_nargin = 2.0;
  real_T c19_nargout = 1.0;
  real_T c19_U_ref;
  real_T c19_a;
  real_T c19_b;
  real_T c19_y;
  real_T c19_A;
  real_T c19_x;
  real_T c19_b_x;
  real_T c19_b_y;
  real_T c19_varargin_1;
  real_T c19_varargin_2;
  real_T c19_b_varargin_2;
  real_T c19_varargin_3;
  real_T c19_c_x;
  real_T c19_c_y;
  real_T c19_d_x;
  real_T c19_d_y;
  real_T c19_xk;
  real_T c19_yk;
  real_T c19_e_x;
  real_T c19_e_y;
  real_T *c19_b_t;
  real_T *c19_b_U_in;
  real_T *c19_b_U_ref;
  c19_b_t = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c19_b_U_ref = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c19_b_U_in = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 18U, chartInstance->c19_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c19_b_U_in, 0U);
  _SFD_DATA_RANGE_CHECK(*c19_b_U_ref, 1U);
  _SFD_DATA_RANGE_CHECK(*c19_b_t, 2U);
  chartInstance->c19_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 18U, chartInstance->c19_sfEvent);
  c19_hoistedGlobal = *c19_b_U_in;
  c19_b_hoistedGlobal = *c19_b_t;
  c19_U_in = c19_hoistedGlobal;
  c19_t = c19_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 5U, 5U, 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_U_in, 2U, c19_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c19_t, 3U, c19_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c19_U_ref, 4U, c19_sf_marshallOut,
    c19_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, 5);
  c19_a = c19_U_in;
  c19_b = c19_t;
  c19_y = c19_a * c19_b;
  c19_A = c19_y;
  c19_x = c19_A;
  c19_b_x = c19_x;
  c19_b_y = c19_b_x / 200.0;
  c19_varargin_1 = c19_U_in;
  c19_varargin_2 = c19_b_y;
  c19_b_varargin_2 = c19_varargin_1;
  c19_varargin_3 = c19_varargin_2;
  c19_c_x = c19_b_varargin_2;
  c19_c_y = c19_varargin_3;
  c19_d_x = c19_c_x;
  c19_d_y = c19_c_y;
  c19_eml_scalar_eg(chartInstance);
  c19_xk = c19_d_x;
  c19_yk = c19_d_y;
  c19_e_x = c19_xk;
  c19_e_y = c19_yk;
  c19_eml_scalar_eg(chartInstance);
  c19_U_ref = muDoubleScalarMin(c19_e_x, c19_e_y);
  _SFD_EML_CALL(0U, chartInstance->c19_sfEvent, -5);
  _SFD_SYMBOL_SCOPE_POP();
  *c19_b_U_ref = c19_U_ref;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 18U, chartInstance->c19_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_HIL_model_overallMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#16
0
static void sf_gateway_c55_Expriment_All(SFc55_Expriment_AllInstanceStruct
  *chartInstance)
{
  real_T c55_hoistedGlobal;
  real_T c55_v1;
  uint32_T c55_debug_family_var_map[6];
  boolean_T c55_aVarTruthTableCondition_1;
  boolean_T c55_aVarTruthTableCondition_2;
  real_T c55_nargin = 1.0;
  real_T c55_nargout = 1.0;
  real_T c55_v2;
  real_T *c55_b_v2;
  real_T *c55_b_v1;
  c55_b_v1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c55_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->c55_sfEvent);
  chartInstance->c55_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 30U, chartInstance->c55_sfEvent);
  c55_hoistedGlobal = *c55_b_v1;
  c55_v1 = c55_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c55_debug_family_names,
    c55_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c55_aVarTruthTableCondition_1, 0U,
    c55_b_sf_marshallOut, c55_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c55_aVarTruthTableCondition_2, 1U,
    c55_b_sf_marshallOut, c55_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c55_nargin, 2U, c55_sf_marshallOut,
    c55_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c55_nargout, 3U, c55_sf_marshallOut,
    c55_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c55_v1, 4U, c55_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c55_v2, 5U, c55_sf_marshallOut,
    c55_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 3);
  c55_aVarTruthTableCondition_1 = false;
  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 4);
  c55_aVarTruthTableCondition_2 = false;
  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 8);
  c55_aVarTruthTableCondition_1 = (c55_v1 > 25.0);
  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 11);
  c55_aVarTruthTableCondition_2 = (c55_v1 < -25.0);
  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 13);
  if (CV_EML_IF(0, 1, 0, c55_aVarTruthTableCondition_1)) {
    _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 14);
    CV_EML_FCN(0, 1);
    _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 24);
    c55_v2 = c55_v1;
    _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, -24);
  } else {
    _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 15);
    if (CV_EML_IF(0, 1, 1, c55_aVarTruthTableCondition_2)) {
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 16);
      CV_EML_FCN(0, 2);
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 29);
      c55_v2 = c55_v1;
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, -29);
    } else {
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 18);
      CV_EML_FCN(0, 3);
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, 34);
      c55_v2 = 0.0;
      _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, -34);
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c55_sfEvent, -18);
  _SFD_SYMBOL_SCOPE_POP();
  *c55_b_v2 = c55_v2;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 30U, chartInstance->c55_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Expriment_AllMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c55_b_v2, 0U);
  _SFD_DATA_RANGE_CHECK(*c55_b_v1, 1U);
}
示例#17
0
static void sf_gateway_c40_Demo_Glove(SFc40_Demo_GloveInstanceStruct
  *chartInstance)
{
  real_T c40_hoistedGlobal;
  real_T c40_b_hoistedGlobal;
  real_T c40_c_hoistedGlobal;
  real_T c40_d_hoistedGlobal;
  real_T c40_e_hoistedGlobal;
  real_T c40_f_hoistedGlobal;
  real_T c40_r1;
  real_T c40_r2;
  real_T c40_r3;
  real_T c40_r4;
  real_T c40_r5;
  real_T c40_r6;
  uint32_T c40_debug_family_var_map[9];
  real_T c40_nargin = 6.0;
  real_T c40_nargout = 1.0;
  real_T c40_y[6];
  int32_T c40_i2;
  real_T c40_x;
  real_T c40_b_x;
  real_T c40_c_x;
  real_T c40_d_x;
  real_T c40_e_x;
  real_T c40_f_x;
  real_T c40_g_x;
  real_T c40_h_x;
  real_T c40_i_x;
  real_T c40_j_x;
  real_T c40_k_x;
  real_T c40_l_x;
  int32_T c40_i3;
  int32_T c40_i4;
  real_T *c40_b_r1;
  real_T *c40_b_r2;
  real_T *c40_b_r3;
  real_T *c40_b_r4;
  real_T *c40_b_r5;
  real_T *c40_b_r6;
  real_T (*c40_b_y)[6];
  c40_b_r6 = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
  c40_b_r5 = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
  c40_b_r4 = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c40_b_r3 = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c40_b_r2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c40_b_y = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
  c40_b_r1 = (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, 21U, chartInstance->c40_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c40_b_r1, 0U);
  chartInstance->c40_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 21U, chartInstance->c40_sfEvent);
  c40_hoistedGlobal = *c40_b_r1;
  c40_b_hoistedGlobal = *c40_b_r2;
  c40_c_hoistedGlobal = *c40_b_r3;
  c40_d_hoistedGlobal = *c40_b_r4;
  c40_e_hoistedGlobal = *c40_b_r5;
  c40_f_hoistedGlobal = *c40_b_r6;
  c40_r1 = c40_hoistedGlobal;
  c40_r2 = c40_b_hoistedGlobal;
  c40_r3 = c40_c_hoistedGlobal;
  c40_r4 = c40_d_hoistedGlobal;
  c40_r5 = c40_e_hoistedGlobal;
  c40_r6 = c40_f_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c40_debug_family_names,
    c40_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c40_nargin, 0U, c40_b_sf_marshallOut,
    c40_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c40_nargout, 1U, c40_b_sf_marshallOut,
    c40_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r1, 2U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r2, 3U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r3, 4U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r4, 5U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r5, 6U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c40_r6, 7U, c40_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c40_y, 8U, c40_sf_marshallOut,
    c40_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 3);
  for (c40_i2 = 0; c40_i2 < 6; c40_i2++) {
    c40_y[c40_i2] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 4);
  c40_x = c40_r1;
  c40_b_x = c40_x;
  c40_b_x = muDoubleScalarFloor(c40_b_x);
  c40_y[0] = c40_b_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 5);
  c40_c_x = c40_r2;
  c40_d_x = c40_c_x;
  c40_d_x = muDoubleScalarFloor(c40_d_x);
  c40_y[1] = c40_d_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 6);
  c40_e_x = c40_r3;
  c40_f_x = c40_e_x;
  c40_f_x = muDoubleScalarFloor(c40_f_x);
  c40_y[2] = c40_f_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 7);
  c40_g_x = c40_r4;
  c40_h_x = c40_g_x;
  c40_h_x = muDoubleScalarFloor(c40_h_x);
  c40_y[3] = c40_h_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 8);
  c40_i_x = c40_r5;
  c40_j_x = c40_i_x;
  c40_j_x = muDoubleScalarFloor(c40_j_x);
  c40_y[4] = c40_j_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, 9);
  c40_k_x = c40_r6;
  c40_l_x = c40_k_x;
  c40_l_x = muDoubleScalarFloor(c40_l_x);
  c40_y[5] = c40_l_x;
  _SFD_EML_CALL(0U, chartInstance->c40_sfEvent, -9);
  _SFD_SYMBOL_SCOPE_POP();
  for (c40_i3 = 0; c40_i3 < 6; c40_i3++) {
    (*c40_b_y)[c40_i3] = c40_y[c40_i3];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 21U, chartInstance->c40_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_GloveMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c40_i4 = 0; c40_i4 < 6; c40_i4++) {
    _SFD_DATA_RANGE_CHECK((*c40_b_y)[c40_i4], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c40_b_r2, 2U);
  _SFD_DATA_RANGE_CHECK(*c40_b_r3, 3U);
  _SFD_DATA_RANGE_CHECK(*c40_b_r4, 4U);
  _SFD_DATA_RANGE_CHECK(*c40_b_r5, 5U);
  _SFD_DATA_RANGE_CHECK(*c40_b_r6, 6U);
}
static void sf_gateway_c8_NavigationObserver_2
  (SFc8_NavigationObserver_2InstanceStruct *chartInstance)
{
  int32_T c8_i2;
  int32_T c8_i3;
  real_T c8_b_u[36];
  uint32_T c8_debug_family_var_map[4];
  real_T c8_nargin = 1.0;
  real_T c8_nargout = 1.0;
  real_T c8_b_FT_k_1[36];
  int32_T c8_i4;
  int32_T c8_i5;
  int32_T c8_i6;
  int32_T c8_i7;
  int32_T c8_i8;
  int32_T c8_i9;
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c8_sfEvent);
  for (c8_i2 = 0; c8_i2 < 36; c8_i2++) {
    _SFD_DATA_RANGE_CHECK((*chartInstance->c8_u)[c8_i2], 0U);
  }

  chartInstance->c8_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c8_sfEvent);
  for (c8_i3 = 0; c8_i3 < 36; c8_i3++) {
    c8_b_u[c8_i3] = (*chartInstance->c8_u)[c8_i3];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c8_debug_family_names,
    c8_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c8_nargin, 0U, c8_b_sf_marshallOut,
    c8_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c8_nargout, 1U, c8_b_sf_marshallOut,
    c8_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c8_b_u, 2U, c8_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c8_b_FT_k_1, 3U, c8_sf_marshallOut,
    c8_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, 4);
  c8_i4 = 0;
  for (c8_i5 = 0; c8_i5 < 6; c8_i5++) {
    c8_i6 = 0;
    for (c8_i7 = 0; c8_i7 < 6; c8_i7++) {
      c8_b_FT_k_1[c8_i7 + c8_i4] = c8_b_u[c8_i6 + c8_i5];
      c8_i6 += 6;
    }

    c8_i4 += 6;
  }

  _SFD_EML_CALL(0U, chartInstance->c8_sfEvent, -4);
  _SFD_SYMBOL_SCOPE_POP();
  for (c8_i8 = 0; c8_i8 < 36; c8_i8++) {
    (*chartInstance->c8_FT_k_1)[c8_i8] = c8_b_FT_k_1[c8_i8];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c8_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_NavigationObserver_2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c8_i9 = 0; c8_i9 < 36; c8_i9++) {
    _SFD_DATA_RANGE_CHECK((*chartInstance->c8_FT_k_1)[c8_i9], 1U);
  }
}
static void sf_gateway_c26_CSE1_DP(SFc26_CSE1_DPInstanceStruct *chartInstance)
{
  int32_T c26_i2;
  real_T c26_K_d1[3];
  uint32_T c26_debug_family_var_map[4];
  real_T c26_nargin = 1.0;
  real_T c26_nargout = 1.0;
  real_T c26_K_d[9];
  int32_T c26_i3;
  real_T c26_v[3];
  int32_T c26_i4;
  int32_T c26_j;
  int32_T c26_b_j;
  int32_T c26_i5;
  int32_T c26_i6;
  int32_T c26_i7;
  real_T (*c26_b_K_d)[9];
  real_T (*c26_b_K_d1)[3];
  c26_b_K_d1 = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  c26_b_K_d = (real_T (*)[9])ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 22U, chartInstance->c26_sfEvent);
  chartInstance->c26_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 22U, chartInstance->c26_sfEvent);
  for (c26_i2 = 0; c26_i2 < 3; c26_i2++) {
    c26_K_d1[c26_i2] = (*c26_b_K_d1)[c26_i2];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c26_debug_family_names,
    c26_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c26_nargin, 0U, c26_c_sf_marshallOut,
    c26_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c26_nargout, 1U, c26_c_sf_marshallOut,
    c26_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c26_K_d1, 2U, c26_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c26_K_d, 3U, c26_sf_marshallOut,
    c26_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c26_sfEvent, 4);
  for (c26_i3 = 0; c26_i3 < 3; c26_i3++) {
    c26_v[c26_i3] = c26_K_d1[c26_i3];
  }

  for (c26_i4 = 0; c26_i4 < 9; c26_i4++) {
    c26_K_d[c26_i4] = 0.0;
  }

  for (c26_j = 1; c26_j < 4; c26_j++) {
    c26_b_j = c26_j;
    c26_K_d[(_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
               (real_T)c26_b_j), 1, 3, 1, 0) + 3 * (_SFD_EML_ARRAY_BOUNDS_CHECK(
               "", (int32_T)_SFD_INTEGER_CHECK("", (real_T)c26_b_j), 1, 3, 2, 0)
              - 1)) - 1] = c26_v[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      _SFD_INTEGER_CHECK("", (real_T)c26_b_j), 1, 3, 1, 0) - 1];
  }

  _SFD_EML_CALL(0U, chartInstance->c26_sfEvent, -4);
  _SFD_SYMBOL_SCOPE_POP();
  for (c26_i5 = 0; c26_i5 < 9; c26_i5++) {
    (*c26_b_K_d)[c26_i5] = c26_K_d[c26_i5];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 22U, chartInstance->c26_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CSE1_DPMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c26_i6 = 0; c26_i6 < 9; c26_i6++) {
    _SFD_DATA_RANGE_CHECK((*c26_b_K_d)[c26_i6], 0U);
  }

  for (c26_i7 = 0; c26_i7 < 3; c26_i7++) {
    _SFD_DATA_RANGE_CHECK((*c26_b_K_d1)[c26_i7], 1U);
  }
}
示例#20
0
static void sf_gateway_c14_DemoWalk_K(SFc14_DemoWalk_KInstanceStruct
  *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, 11U, chartInstance->c14_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c14_b_interactionState, 0U);
  chartInstance->c14_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 11U, 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, 11U, chartInstance->c14_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_DemoWalk_KMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c14_b_arousalFlag, 1U);
}
示例#21
0
static void sf_gateway_c7_NMPC_Controller(SFc7_NMPC_ControllerInstanceStruct
  *chartInstance)
{
  int32_T c7_i0;
  int32_T c7_i1;
  real_T c7_b_u[3];
  uint32_T c7_debug_family_var_map[6];
  real_T c7_factor;
  real_T c7_increment;
  real_T c7_nargin = 1.0;
  real_T c7_nargout = 1.0;
  real_T c7_b_y;
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  boolean_T guard3 = false;
  boolean_T guard4 = false;
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  for (c7_i0 = 0; c7_i0 < 3; c7_i0++) {
    _SFD_DATA_RANGE_CHECK((*chartInstance->c7_u)[c7_i0], 0U);
  }

  chartInstance->c7_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  for (c7_i1 = 0; c7_i1 < 3; c7_i1++) {
    c7_b_u[c7_i1] = (*chartInstance->c7_u)[c7_i1];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c7_debug_family_names,
    c7_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_factor, 0U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_increment, 1U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargin, 2U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_nargout, 3U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c7_b_u, 4U, c7_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c7_b_y, 5U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 4);
  c7_factor = 1.0;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 5);
  c7_increment = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 7);
  guard1 = false;
  if (CV_EML_COND(0, 1, 0, CV_RELATIONAL_EVAL(4U, 0U, 0, c7_b_u[1], 0.0, -1, 4U,
        c7_b_u[1] > 0.0))) {
    if (CV_EML_COND(0, 1, 1, CV_RELATIONAL_EVAL(4U, 0U, 1, c7_b_u[2], 0.0, -1,
          4U, c7_b_u[2] > 0.0))) {
      CV_EML_MCDC(0, 1, 0, true);
      CV_EML_IF(0, 1, 0, true);
      _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 8);
      c7_increment = 0.0;
      _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 9);
      c7_factor = 1.0;
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

  if (guard1 == true) {
    CV_EML_MCDC(0, 1, 0, false);
    CV_EML_IF(0, 1, 0, false);
    _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 10);
    guard2 = false;
    if (CV_EML_COND(0, 1, 2, CV_RELATIONAL_EVAL(4U, 0U, 2, c7_b_u[1], 0.0, -1,
          4U, c7_b_u[1] > 0.0))) {
      if (CV_EML_COND(0, 1, 3, CV_RELATIONAL_EVAL(4U, 0U, 3, c7_b_u[2], 0.0, -1,
            2U, c7_b_u[2] < 0.0))) {
        CV_EML_MCDC(0, 1, 1, true);
        CV_EML_IF(0, 1, 1, true);
        _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 11);
        c7_increment = 3.1415926535897931;
        _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 12);
        c7_factor = -1.0;
      } else {
        guard2 = true;
      }
    } else {
      guard2 = true;
    }

    if (guard2 == true) {
      CV_EML_MCDC(0, 1, 1, false);
      CV_EML_IF(0, 1, 1, false);
      _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 13);
      guard3 = false;
      if (CV_EML_COND(0, 1, 4, CV_RELATIONAL_EVAL(4U, 0U, 4, c7_b_u[1], 0.0, -1,
            2U, c7_b_u[1] < 0.0))) {
        if (CV_EML_COND(0, 1, 5, CV_RELATIONAL_EVAL(4U, 0U, 5, c7_b_u[2], 0.0,
              -1, 2U, c7_b_u[2] < 0.0))) {
          CV_EML_MCDC(0, 1, 2, true);
          CV_EML_IF(0, 1, 2, true);
          _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 14);
          c7_increment = -3.1415926535897931;
          _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 15);
          c7_factor = -1.0;
        } else {
          guard3 = true;
        }
      } else {
        guard3 = true;
      }

      if (guard3 == true) {
        CV_EML_MCDC(0, 1, 2, false);
        CV_EML_IF(0, 1, 2, false);
        _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 16);
        guard4 = false;
        if (CV_EML_COND(0, 1, 6, CV_RELATIONAL_EVAL(4U, 0U, 6, c7_b_u[1], 0.0,
              -1, 2U, c7_b_u[1] < 0.0))) {
          if (CV_EML_COND(0, 1, 7, CV_RELATIONAL_EVAL(4U, 0U, 7, c7_b_u[2], 0.0,
                -1, 4U, c7_b_u[2] > 0.0))) {
            CV_EML_MCDC(0, 1, 3, true);
            CV_EML_IF(0, 1, 3, true);
            _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 17);
            c7_increment = 0.0;
            _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 18);
            c7_factor = 1.0;
          } else {
            guard4 = true;
          }
        } else {
          guard4 = true;
        }

        if (guard4 == true) {
          CV_EML_MCDC(0, 1, 3, false);
          CV_EML_IF(0, 1, 3, false);
        }
      }
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 20);
  c7_b_y = c7_b_u[0] * c7_factor + c7_increment;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -20);
  _SFD_SYMBOL_SCOPE_POP();
  *chartInstance->c7_y = c7_b_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_NMPC_ControllerMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c7_y, 1U);
}
static void sf_gateway_c1_Engine_Vehicle_CVT_RS_System2
  (SFc1_Engine_Vehicle_CVT_RS_System2InstanceStruct *chartInstance)
{
  uint32_T c1_debug_family_var_map[3];
  real_T c1_nargin = 0.0;
  real_T c1_nargout = 1.0;
  boolean_T c1_out;
  uint32_T c1_b_debug_family_var_map[2];
  real_T c1_b_nargin = 0.0;
  real_T c1_b_nargout = 0.0;
  real_T c1_c_nargin = 0.0;
  real_T c1_c_nargout = 1.0;
  boolean_T c1_b_out;
  real_T c1_d_nargin = 0.0;
  real_T c1_d_nargout = 0.0;
  c1_set_sim_state_side_effects_c1_Engine_Vehicle_CVT_RS_System2(chartInstance);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c1_Engine_RPM, 0U);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c1_RPM_Clutch_THLD, 1U);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c1_RPM_Clutch_Hist_THLD, 2U);
  _SFD_DATA_RANGE_CHECK(*chartInstance->c1_ClutchON, 3U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 1U, chartInstance->c1_sfEvent);
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 3U, 3U, c1_c_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 0U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 1U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_out, 2U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  c1_out = CV_EML_IF(1, 0, 0, *chartInstance->c1_Engine_RPM <
                     *chartInstance->c1_RPM_Clutch_THLD -
                     *chartInstance->c1_RPM_Clutch_Hist_THLD);
  _SFD_SYMBOL_SCOPE_POP();
  if (c1_out) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 2U, 2U, c1_d_debug_family_names,
      c1_b_debug_family_var_map);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_b_nargin, 0U, c1_b_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_b_nargout, 1U, c1_b_sf_marshallOut,
      c1_b_sf_marshallIn);
    *chartInstance->c1_ClutchON = 0.0;
    c1_updateDataWrittenToVector(chartInstance, 0U);
    _SFD_DATA_RANGE_CHECK(*chartInstance->c1_ClutchON, 3U);
    _SFD_SYMBOL_SCOPE_POP();
  } else {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 2U, chartInstance->c1_sfEvent);
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 3U, 3U, c1_debug_family_names,
      c1_debug_family_var_map);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_c_nargin, 0U, c1_b_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_c_nargout, 1U, c1_b_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_b_out, 2U, c1_sf_marshallOut,
      c1_sf_marshallIn);
    c1_b_out = CV_EML_IF(2, 0, 0, CV_RELATIONAL_EVAL(5U, 2U, 0,
      *chartInstance->c1_Engine_RPM, *chartInstance->c1_RPM_Clutch_THLD, -1, 4U,
      *chartInstance->c1_Engine_RPM > *chartInstance->c1_RPM_Clutch_THLD));
    _SFD_SYMBOL_SCOPE_POP();
    if (c1_b_out) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 3U, chartInstance->c1_sfEvent);
      _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 2U, 2U, c1_b_debug_family_names,
        c1_b_debug_family_var_map);
      _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_d_nargin, 0U, c1_b_sf_marshallOut,
        c1_b_sf_marshallIn);
      _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_d_nargout, 1U,
        c1_b_sf_marshallOut, c1_b_sf_marshallIn);
      *chartInstance->c1_ClutchON = 1.0;
      c1_updateDataWrittenToVector(chartInstance, 0U);
      _SFD_DATA_RANGE_CHECK(*chartInstance->c1_ClutchON, 3U);
      _SFD_SYMBOL_SCOPE_POP();
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 4U, chartInstance->c1_sfEvent);
    }
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY
    (_Engine_Vehicle_CVT_RS_System2MachineNumber_, chartInstance->chartNumber,
     chartInstance->instanceNumber);
}
static void sf_c5_MigrationBGOW_Proto6_MultiSwarm
  (SFc5_MigrationBGOW_Proto6_MultiSwarmInstanceStruct *chartInstance)
{
  real_T c5_hoistedGlobal;
  real_T c5_b_hoistedGlobal;
  real_T c5_x;
  real_T c5_y;
  uint32_T c5_debug_family_var_map[5];
  real_T c5_nargin = 2.0;
  real_T c5_nargout = 1.0;
  real_T c5_z;
  real_T c5_b_x;
  real_T c5_c_x;
  real_T *c5_d_x;
  real_T *c5_b_y;
  real_T *c5_b_z;
  c5_b_z = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c5_b_y = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c5_d_x = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 4U, chartInstance->c5_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c5_d_x, 0U);
  _SFD_DATA_RANGE_CHECK(*c5_b_y, 1U);
  _SFD_DATA_RANGE_CHECK(*c5_b_z, 2U);
  chartInstance->c5_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 4U, chartInstance->c5_sfEvent);
  c5_hoistedGlobal = *c5_d_x;
  c5_b_hoistedGlobal = *c5_b_y;
  c5_x = c5_hoistedGlobal;
  c5_y = c5_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 5U, 5U, c5_debug_family_names,
    c5_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargin, 0U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargout, 1U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_x, 2U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_y, 3U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_z, 4U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 3);
  c5_b_x = (26.4196 - c5_mpower(chartInstance, c5_x - 1.44)) - c5_mpower
    (chartInstance, c5_y - 0.3677);
  c5_z = c5_b_x;
  if (c5_z < 0.0) {
    c5_eml_error(chartInstance);
  }

  c5_c_x = c5_z;
  c5_z = c5_c_x;
  c5_z = muDoubleScalarSqrt(c5_z);
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 4);
  c5_z += 1.6;
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, -4);
  _SFD_SYMBOL_SCOPE_POP();
  *c5_b_z = c5_z;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 4U, chartInstance->c5_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY
    (_MigrationBGOW_Proto6_MultiSwarmMachineNumber_, chartInstance->chartNumber,
     chartInstance->instanceNumber);
}
static void sf_c1_EVdemo_6(SFc1_EVdemo_6InstanceStruct *chartInstance)
{
  boolean_T c1_temp;
  boolean_T c1_b_temp;
  boolean_T c1_out;
  boolean_T c1_b_out;
  boolean_T c1_c_temp;
  boolean_T c1_d_temp;
  boolean_T c1_c_out;
  boolean_T c1_d_out;
  real32_T *c1_spd_err;
  real32_T *c1_spd_ref_rate;
  uint8_T *c1_Mode;
  real32_T *c1_veh_spd;
  boolean_T *c1_BrakeSet;
  c1_spd_ref_rate = (real32_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c1_BrakeSet = (boolean_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_veh_spd = (real32_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c1_spd_err = (real32_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c1_Mode = (uint8_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_set_sim_state_side_effects_c1_EVdemo_6(chartInstance);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  chartInstance->c1_sfEvent = CALL_EVENT;
  if (chartInstance->c1_temporalCounter_i1 < 127U) {
    chartInstance->c1_temporalCounter_i1 = (uint8_T)(int16_T)
      (chartInstance->c1_temporalCounter_i1 + 1);
  }

  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  if (chartInstance->c1_is_active_c1_EVdemo_6 == 0U) {
    _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    chartInstance->c1_is_active_c1_EVdemo_6 = 1U;
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
    chartInstance->c1_is_c1_EVdemo_6 = c1_IN_Stop;
    _SFD_CS_CALL(STATE_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
    chartInstance->c1_tp_Stop = 1U;
  } else {
    switch (chartInstance->c1_is_c1_EVdemo_6) {
     case c1_IN_Accel:
      CV_CHART_EVAL(0, 0, 1);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 4U,
                   chartInstance->c1_sfEvent);
      c1_temp = (_SFD_CCP_CALL(4U, 0, *c1_spd_err < -0.25F != 0U,
                  chartInstance->c1_sfEvent) != 0);
      if (c1_temp) {
        c1_temp = (_SFD_CCP_CALL(4U, 1, *c1_spd_ref_rate < 0.0F != 0U,
                    chartInstance->c1_sfEvent) != 0);
      }

      c1_b_temp = c1_temp;
      if (c1_b_temp) {
        c1_b_temp = (_SFD_CCP_CALL(4U, 2, (int16_T)
          chartInstance->c1_temporalCounter_i1 >= 120 != 0U,
          chartInstance->c1_sfEvent) != 0);
      }

      c1_out = (CV_TRANSITION_EVAL(4U, (int32_T)c1_b_temp) != 0);
      if (c1_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 4U, chartInstance->c1_sfEvent);
        chartInstance->c1_tp_Accel = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
        chartInstance->c1_is_c1_EVdemo_6 = c1_IN_Decel;
        _SFD_CS_CALL(STATE_ACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
        chartInstance->c1_temporalCounter_i1 = 0U;
        chartInstance->c1_tp_Decel = 1U;
      } else {
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG, 0U,
                     chartInstance->c1_sfEvent);
        *c1_Mode = 1U;
      }

      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
      break;

     case c1_IN_Decel:
      CV_CHART_EVAL(0, 0, 2);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 2U,
                   chartInstance->c1_sfEvent);
      c1_b_out = (CV_TRANSITION_EVAL(2U, (int32_T)_SFD_CCP_CALL(2U, 0, (real_T)
        *c1_veh_spd < 0.05 != 0U, chartInstance->c1_sfEvent)) != 0);
      if (c1_b_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
        chartInstance->c1_tp_Decel = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
        chartInstance->c1_is_c1_EVdemo_6 = c1_IN_Stop;
        _SFD_CS_CALL(STATE_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
        chartInstance->c1_tp_Stop = 1U;
      } else {
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 3U,
                     chartInstance->c1_sfEvent);
        c1_c_temp = (_SFD_CCP_CALL(3U, 0, *c1_spd_err > 0.25F != 0U,
          chartInstance->c1_sfEvent) != 0);
        if (c1_c_temp) {
          c1_c_temp = (_SFD_CCP_CALL(3U, 1, *c1_spd_ref_rate > 0.0F != 0U,
            chartInstance->c1_sfEvent) != 0);
        }

        c1_d_temp = c1_c_temp;
        if (c1_d_temp) {
          c1_d_temp = (_SFD_CCP_CALL(3U, 2, (int16_T)
            chartInstance->c1_temporalCounter_i1 >= 120 != 0U,
            chartInstance->c1_sfEvent) != 0);
        }

        c1_c_out = (CV_TRANSITION_EVAL(3U, (int32_T)c1_d_temp) != 0);
        if (c1_c_out) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 3U, chartInstance->c1_sfEvent);
          chartInstance->c1_tp_Decel = 0U;
          _SFD_CS_CALL(STATE_INACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
          chartInstance->c1_is_c1_EVdemo_6 = c1_IN_Accel;
          _SFD_CS_CALL(STATE_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
          chartInstance->c1_temporalCounter_i1 = 0U;
          chartInstance->c1_tp_Accel = 1U;
        } else {
          _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG, 1U,
                       chartInstance->c1_sfEvent);
          *c1_Mode = 2U;
        }
      }

      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c1_sfEvent);
      break;

     case c1_IN_Stop:
      CV_CHART_EVAL(0, 0, 3);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 1U,
                   chartInstance->c1_sfEvent);
      c1_d_out = (CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1U, 0,
        *c1_spd_err > 0.0F != 0U, chartInstance->c1_sfEvent)) != 0);
      if (c1_d_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
        *c1_BrakeSet = FALSE;
        chartInstance->c1_tp_Stop = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
        chartInstance->c1_is_c1_EVdemo_6 = c1_IN_Accel;
        _SFD_CS_CALL(STATE_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
        chartInstance->c1_temporalCounter_i1 = 0U;
        chartInstance->c1_tp_Accel = 1U;
      } else {
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG, 2U,
                     chartInstance->c1_sfEvent);
        *c1_Mode = 0U;
        *c1_BrakeSet = TRUE;
      }

      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c1_sfEvent);
      break;

     default:
      CV_CHART_EVAL(0, 0, 0);
      chartInstance->c1_is_c1_EVdemo_6 = c1_IN_NO_ACTIVE_CHILD;
      _SFD_CS_CALL(STATE_INACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
      break;
    }
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_EVdemo_6MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c24_ManipulatorME4901(SFc24_ManipulatorME4901InstanceStruct
  *chartInstance)
{
  int32_T c24_i0;
  real_T c24_hoistedGlobal;
  int32_T c24_i1;
  real_T c24_but[4];
  real_T c24_bo;
  uint32_T c24_debug_family_var_map[6];
  real_T c24_b;
  real_T c24_nargin = 2.0;
  real_T c24_nargout = 1.0;
  real_T c24_y;
  real_T *c24_b_y;
  real_T *c24_b_bo;
  real_T (*c24_b_but)[4];
  c24_b_bo = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c24_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c24_b_but = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 22U, chartInstance->c24_sfEvent);
  for (c24_i0 = 0; c24_i0 < 4; c24_i0++) {
    _SFD_DATA_RANGE_CHECK((*c24_b_but)[c24_i0], 0U);
  }

  _SFD_DATA_RANGE_CHECK(*c24_b_y, 1U);
  _SFD_DATA_RANGE_CHECK(*c24_b_bo, 2U);
  chartInstance->c24_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 22U, chartInstance->c24_sfEvent);
  c24_hoistedGlobal = *c24_b_bo;
  for (c24_i1 = 0; c24_i1 < 4; c24_i1++) {
    c24_but[c24_i1] = (*c24_b_but)[c24_i1];
  }

  c24_bo = c24_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c24_debug_family_names,
    c24_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_b, 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_but, 3U, c24_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c24_bo, 4U, c24_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c24_y, 5U, c24_sf_marshallOut,
    c24_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 5);
  c24_b = c24_but[3];
  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 7);
  if (CV_EML_IF(0, 1, 0, c24_b == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 8);
    if (CV_EML_IF(0, 1, 1, c24_bo == 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 9);
      c24_y = 1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 11);
      c24_y = 0.0;
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 14);
    if (CV_EML_IF(0, 1, 2, c24_bo == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 15);
      c24_y = 1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, 17);
      c24_y = 0.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c24_sfEvent, -17);
  _SFD_SYMBOL_SCOPE_POP();
  *c24_b_y = c24_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 22U, chartInstance->c24_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_ManipulatorME4901MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c13_BoatLibraryTest02(SFc13_BoatLibraryTest02InstanceStruct
  *chartInstance)
{
  int32_T c13_i2;
  real_T c13_hoistedGlobal;
  real_T c13_b_hoistedGlobal;
  real_T c13_c_hoistedGlobal;
  real_T c13_Fx;
  real_T c13_Fy;
  real_T c13_M;
  uint32_T c13_debug_family_var_map[6];
  real_T c13_nargin = 3.0;
  real_T c13_nargout = 1.0;
  real_T c13_y[3];
  int32_T c13_i3;
  real_T *c13_b_Fx;
  real_T *c13_b_Fy;
  real_T *c13_b_M;
  real_T (*c13_b_y)[3];
  c13_b_M = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c13_b_Fy = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c13_b_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c13_b_Fx = (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, 12U, chartInstance->c13_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c13_b_Fx, 0U);
  for (c13_i2 = 0; c13_i2 < 3; c13_i2++) {
    _SFD_DATA_RANGE_CHECK((*c13_b_y)[c13_i2], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c13_b_Fy, 2U);
  _SFD_DATA_RANGE_CHECK(*c13_b_M, 3U);
  chartInstance->c13_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  c13_hoistedGlobal = *c13_b_Fx;
  c13_b_hoistedGlobal = *c13_b_Fy;
  c13_c_hoistedGlobal = *c13_b_M;
  c13_Fx = c13_hoistedGlobal;
  c13_Fy = c13_b_hoistedGlobal;
  c13_M = c13_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c13_debug_family_names,
    c13_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargin, 0U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c13_nargout, 1U, c13_b_sf_marshallOut,
    c13_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_Fx, 2U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_Fy, 3U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c13_M, 4U, c13_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c13_y, 5U, c13_sf_marshallOut,
    c13_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, 4);
  c13_y[0] = c13_Fx;
  c13_y[1] = c13_Fy;
  c13_y[2] = c13_M;
  _SFD_EML_CALL(0U, chartInstance->c13_sfEvent, -4);
  _SFD_SYMBOL_SCOPE_POP();
  for (c13_i3 = 0; c13_i3 < 3; c13_i3++) {
    (*c13_b_y)[c13_i3] = c13_y[c13_i3];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 12U, chartInstance->c13_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_BoatLibraryTest02MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c27_Model_justmodel(SFc27_Model_justmodelInstanceStruct
  *chartInstance)
{
  int32_T c27_i0;
  real_T c27_hoistedGlobal;
  real_T c27_b_hoistedGlobal;
  real_T c27_U;
  int32_T c27_i1;
  real_T c27_eta_ship[3];
  real_T c27_alpha_LOS;
  uint32_T c27_debug_family_var_map[9];
  real_T c27_psi;
  real_T c27_gamma;
  real_T c27_nargin = 3.0;
  real_T c27_nargout = 2.0;
  real_T c27_surge;
  real_T c27_sway;
  real_T c27_x;
  real_T c27_b_x;
  real_T c27_a;
  real_T c27_b;
  real_T c27_c_x;
  real_T c27_d_x;
  real_T c27_b_a;
  real_T c27_b_b;
  real_T *c27_b_U;
  real_T *c27_b_surge;
  real_T *c27_b_alpha_LOS;
  real_T *c27_b_sway;
  real_T (*c27_b_eta_ship)[3];
  c27_b_sway = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c27_b_alpha_LOS = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c27_b_eta_ship = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c27_b_surge = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c27_b_U = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 17U, chartInstance->c27_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c27_b_U, 0U);
  _SFD_DATA_RANGE_CHECK(*c27_b_surge, 1U);
  for (c27_i0 = 0; c27_i0 < 3; c27_i0++) {
    _SFD_DATA_RANGE_CHECK((*c27_b_eta_ship)[c27_i0], 2U);
  }

  _SFD_DATA_RANGE_CHECK(*c27_b_alpha_LOS, 3U);
  _SFD_DATA_RANGE_CHECK(*c27_b_sway, 4U);
  chartInstance->c27_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 17U, chartInstance->c27_sfEvent);
  c27_hoistedGlobal = *c27_b_U;
  c27_b_hoistedGlobal = *c27_b_alpha_LOS;
  c27_U = c27_hoistedGlobal;
  for (c27_i1 = 0; c27_i1 < 3; c27_i1++) {
    c27_eta_ship[c27_i1] = (*c27_b_eta_ship)[c27_i1];
  }

  c27_alpha_LOS = c27_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c27_debug_family_names,
    c27_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_psi, 0U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_gamma, 1U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_nargin, 2U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_nargout, 3U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c27_U, 4U, c27_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c27_eta_ship, 5U, c27_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c27_alpha_LOS, 6U, c27_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_surge, 7U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c27_sway, 8U, c27_sf_marshallOut,
    c27_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c27_sfEvent, 3);
  c27_psi = c27_eta_ship[2];
  _SFD_EML_CALL(0U, chartInstance->c27_sfEvent, 4);
  c27_gamma = c27_alpha_LOS - c27_psi;
  _SFD_EML_CALL(0U, chartInstance->c27_sfEvent, 6);
  c27_x = c27_gamma;
  c27_b_x = c27_x;
  c27_b_x = muDoubleScalarCos(c27_b_x);
  c27_a = c27_U;
  c27_b = c27_b_x;
  c27_surge = c27_a * c27_b;
  _SFD_EML_CALL(0U, chartInstance->c27_sfEvent, 7);
  c27_c_x = c27_gamma;
  c27_d_x = c27_c_x;
  c27_d_x = muDoubleScalarSin(c27_d_x);
  c27_b_a = c27_U;
  c27_b_b = c27_d_x;
  c27_sway = c27_b_a * c27_b_b;
  _SFD_EML_CALL(0U, chartInstance->c27_sfEvent, -7);
  _SFD_SYMBOL_SCOPE_POP();
  *c27_b_surge = c27_surge;
  *c27_b_sway = c27_sway;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 17U, chartInstance->c27_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Model_justmodelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_gateway_c37_Demo_EP_IdleRandMerg
  (SFc37_Demo_EP_IdleRandMergInstanceStruct *chartInstance)
{
  boolean_T c37_hoistedGlobal;
  boolean_T c37_b_hoistedGlobal;
  boolean_T c37_extrovert;
  boolean_T c37_neurotic;
  uint32_T c37_debug_family_var_map[5];
  real_T c37_nargin = 2.0;
  real_T c37_nargout = 1.0;
  real_T c37_personality;
  boolean_T *c37_b_extrovert;
  real_T *c37_b_personality;
  boolean_T *c37_b_neurotic;
  c37_b_neurotic = (boolean_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c37_b_personality = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c37_b_extrovert = (boolean_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 17U, chartInstance->c37_sfEvent);
  _SFD_DATA_RANGE_CHECK((real_T)*c37_b_extrovert, 0U);
  chartInstance->c37_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 17U, chartInstance->c37_sfEvent);
  c37_hoistedGlobal = *c37_b_extrovert;
  c37_b_hoistedGlobal = *c37_b_neurotic;
  c37_extrovert = c37_hoistedGlobal;
  c37_neurotic = c37_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 5U, 5U, c37_debug_family_names,
    c37_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c37_nargin, 0U, c37_sf_marshallOut,
    c37_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c37_nargout, 1U, c37_sf_marshallOut,
    c37_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c37_extrovert, 2U, c37_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c37_neurotic, 3U, c37_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c37_personality, 4U, c37_sf_marshallOut,
    c37_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 4);
  if (CV_EML_IF(0, 1, 0, (real_T)c37_extrovert == 1.0)) {
    _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 5);
    if (CV_EML_IF(0, 1, 1, (real_T)c37_neurotic == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 6);
      c37_personality = 1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 8);
      c37_personality = 3.0;
    }
  } else {
    _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 11);
    if (CV_EML_IF(0, 1, 2, (real_T)c37_neurotic == 1.0)) {
      _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 12);
      c37_personality = 2.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, 14);
      c37_personality = 4.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c37_sfEvent, -14);
  _SFD_SYMBOL_SCOPE_POP();
  *c37_b_personality = c37_personality;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 17U, chartInstance->c37_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_EP_IdleRandMergMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c37_b_personality, 1U);
  _SFD_DATA_RANGE_CHECK((real_T)*c37_b_neurotic, 2U);
}
示例#29
0
static void sf_gateway_c2_Demo_Glove(SFc2_Demo_GloveInstanceStruct
                                     *chartInstance)
{
    real_T c2_hoistedGlobal;
    real_T c2_b_hoistedGlobal;
    real_T c2_c_hoistedGlobal;
    real_T c2_d_hoistedGlobal;
    real_T c2_e_hoistedGlobal;
    real_T c2_f_hoistedGlobal;
    real_T c2_g_hoistedGlobal;
    real_T c2_gameStatus;
    real_T c2_bradHand;
    real_T c2_userHand;
    real_T c2_win;
    real_T c2_bTotal;
    real_T c2_uTotal;
    real_T c2_gameNum;
    uint32_T c2_debug_family_var_map[9];
    real_T c2_nargin = 7.0;
    real_T c2_nargout = 0.0;
    real_T c2_u;
    const mxArray *c2_y = NULL;
    int32_T c2_i0;
    static char_T c2_cv0[10] = { 'g', 'a', 'm', 'e', 'S', 't', 'a', 't', 'u', 's'
                               };

    char_T c2_b_u[10];
    const mxArray *c2_b_y = NULL;
    real_T c2_c_u;
    const mxArray *c2_c_y = NULL;
    real_T c2_d_u;
    const mxArray *c2_d_y = NULL;
    int32_T c2_i1;
    static char_T c2_cv1[8] = { 'b', 'r', 'a', 'd', 'H', 'a', 'n', 'd' };

    char_T c2_e_u[8];
    const mxArray *c2_e_y = NULL;
    real_T c2_f_u;
    const mxArray *c2_f_y = NULL;
    real_T c2_g_u;
    const mxArray *c2_g_y = NULL;
    int32_T c2_i2;
    static char_T c2_cv2[8] = { 'u', 's', 'e', 'r', 'H', 'a', 'n', 'd' };

    char_T c2_h_u[8];
    const mxArray *c2_h_y = NULL;
    real_T c2_i_u;
    const mxArray *c2_i_y = NULL;
    real_T c2_j_u;
    const mxArray *c2_j_y = NULL;
    int32_T c2_i3;
    static char_T c2_cv3[3] = { 'w', 'i', 'n' };

    char_T c2_k_u[3];
    const mxArray *c2_k_y = NULL;
    real_T c2_l_u;
    const mxArray *c2_l_y = NULL;
    real_T c2_m_u;
    const mxArray *c2_m_y = NULL;
    int32_T c2_i4;
    static char_T c2_cv4[6] = { 'u', 'T', 'o', 't', 'a', 'l' };

    char_T c2_n_u[6];
    const mxArray *c2_n_y = NULL;
    real_T c2_o_u;
    const mxArray *c2_o_y = NULL;
    real_T c2_p_u;
    const mxArray *c2_p_y = NULL;
    int32_T c2_i5;
    static char_T c2_cv5[6] = { 'b', 'T', 'o', 't', 'a', 'l' };

    char_T c2_q_u[6];
    const mxArray *c2_q_y = NULL;
    real_T c2_r_u;
    const mxArray *c2_r_y = NULL;
    real_T c2_s_u;
    const mxArray *c2_s_y = NULL;
    int32_T c2_i6;
    static char_T c2_cv6[7] = { 'g', 'a', 'm', 'e', 'N', 'u', 'm' };

    char_T c2_t_u[7];
    const mxArray *c2_t_y = NULL;
    real_T c2_u_u;
    const mxArray *c2_u_y = NULL;
    real_T *c2_b_gameStatus;
    real_T *c2_b_bradHand;
    real_T *c2_b_userHand;
    real_T *c2_b_win;
    real_T *c2_b_bTotal;
    real_T *c2_b_uTotal;
    real_T *c2_b_gameNum;
    c2_b_gameNum = (real_T *)ssGetInputPortSignal(chartInstance->S, 6);
    c2_b_uTotal = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
    c2_b_bTotal = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
    c2_b_win = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
    c2_b_userHand = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
    c2_b_bradHand = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
    c2_b_gameStatus = (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_gameStatus, 0U);
    _SFD_DATA_RANGE_CHECK(*c2_b_bradHand, 1U);
    _SFD_DATA_RANGE_CHECK(*c2_b_userHand, 2U);
    _SFD_DATA_RANGE_CHECK(*c2_b_win, 3U);
    _SFD_DATA_RANGE_CHECK(*c2_b_bTotal, 4U);
    _SFD_DATA_RANGE_CHECK(*c2_b_uTotal, 5U);
    _SFD_DATA_RANGE_CHECK(*c2_b_gameNum, 6U);
    chartInstance->c2_sfEvent = CALL_EVENT;
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
    c2_hoistedGlobal = *c2_b_gameStatus;
    c2_b_hoistedGlobal = *c2_b_bradHand;
    c2_c_hoistedGlobal = *c2_b_userHand;
    c2_d_hoistedGlobal = *c2_b_win;
    c2_e_hoistedGlobal = *c2_b_bTotal;
    c2_f_hoistedGlobal = *c2_b_uTotal;
    c2_g_hoistedGlobal = *c2_b_gameNum;
    c2_gameStatus = c2_hoistedGlobal;
    c2_bradHand = c2_b_hoistedGlobal;
    c2_userHand = c2_c_hoistedGlobal;
    c2_win = c2_d_hoistedGlobal;
    c2_bTotal = c2_e_hoistedGlobal;
    c2_uTotal = c2_f_hoistedGlobal;
    c2_gameNum = c2_g_hoistedGlobal;
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, 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_gameStatus, 2U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_bradHand, 3U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_userHand, 4U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_win, 5U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_bTotal, 6U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_uTotal, 7U, c2_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c2_gameNum, 8U, c2_sf_marshallOut);
    CV_EML_FCN(0, 0);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3);
    c2_u = 0.0;
    c2_y = NULL;
    sf_mex_assign(&c2_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i0 = 0; c2_i0 < 10; c2_i0++) {
        c2_b_u[c2_i0] = c2_cv0[c2_i0];
    }

    c2_b_y = NULL;
    sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_b_u, 10, 0U, 1U, 0U, 2, 1, 10),
                  false);
    c2_c_u = c2_gameStatus;
    c2_c_y = NULL;
    sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_c_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14, c2_y,
                      14, c2_b_y, 14, c2_c_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
    c2_d_u = 0.0;
    c2_d_y = NULL;
    sf_mex_assign(&c2_d_y, sf_mex_create("y", &c2_d_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i1 = 0; c2_i1 < 8; c2_i1++) {
        c2_e_u[c2_i1] = c2_cv1[c2_i1];
    }

    c2_e_y = NULL;
    sf_mex_assign(&c2_e_y, sf_mex_create("y", c2_e_u, 10, 0U, 1U, 0U, 2, 1, 8),
                  false);
    c2_f_u = c2_bradHand;
    c2_f_y = NULL;
    sf_mex_assign(&c2_f_y, sf_mex_create("y", &c2_f_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_d_y, 14, c2_e_y, 14, c2_f_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
    c2_g_u = 0.0;
    c2_g_y = NULL;
    sf_mex_assign(&c2_g_y, sf_mex_create("y", &c2_g_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i2 = 0; c2_i2 < 8; c2_i2++) {
        c2_h_u[c2_i2] = c2_cv2[c2_i2];
    }

    c2_h_y = NULL;
    sf_mex_assign(&c2_h_y, sf_mex_create("y", c2_h_u, 10, 0U, 1U, 0U, 2, 1, 8),
                  false);
    c2_i_u = c2_userHand;
    c2_i_y = NULL;
    sf_mex_assign(&c2_i_y, sf_mex_create("y", &c2_i_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_g_y, 14, c2_h_y, 14, c2_i_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 6);
    c2_j_u = 0.0;
    c2_j_y = NULL;
    sf_mex_assign(&c2_j_y, sf_mex_create("y", &c2_j_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i3 = 0; c2_i3 < 3; c2_i3++) {
        c2_k_u[c2_i3] = c2_cv3[c2_i3];
    }

    c2_k_y = NULL;
    sf_mex_assign(&c2_k_y, sf_mex_create("y", c2_k_u, 10, 0U, 1U, 0U, 2, 1, 3),
                  false);
    c2_l_u = c2_win;
    c2_l_y = NULL;
    sf_mex_assign(&c2_l_y, sf_mex_create("y", &c2_l_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_j_y, 14, c2_k_y, 14, c2_l_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 7);
    c2_m_u = 0.0;
    c2_m_y = NULL;
    sf_mex_assign(&c2_m_y, sf_mex_create("y", &c2_m_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i4 = 0; c2_i4 < 6; c2_i4++) {
        c2_n_u[c2_i4] = c2_cv4[c2_i4];
    }

    c2_n_y = NULL;
    sf_mex_assign(&c2_n_y, sf_mex_create("y", c2_n_u, 10, 0U, 1U, 0U, 2, 1, 6),
                  false);
    c2_o_u = c2_uTotal;
    c2_o_y = NULL;
    sf_mex_assign(&c2_o_y, sf_mex_create("y", &c2_o_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_m_y, 14, c2_n_y, 14, c2_o_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 8);
    c2_p_u = 0.0;
    c2_p_y = NULL;
    sf_mex_assign(&c2_p_y, sf_mex_create("y", &c2_p_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i5 = 0; c2_i5 < 6; c2_i5++) {
        c2_q_u[c2_i5] = c2_cv5[c2_i5];
    }

    c2_q_y = NULL;
    sf_mex_assign(&c2_q_y, sf_mex_create("y", c2_q_u, 10, 0U, 1U, 0U, 2, 1, 6),
                  false);
    c2_r_u = c2_bTotal;
    c2_r_y = NULL;
    sf_mex_assign(&c2_r_y, sf_mex_create("y", &c2_r_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_p_y, 14, c2_q_y, 14, c2_r_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 9);
    c2_s_u = 0.0;
    c2_s_y = NULL;
    sf_mex_assign(&c2_s_y, sf_mex_create("y", &c2_s_u, 0, 0U, 0U, 0U, 0), false);
    for (c2_i6 = 0; c2_i6 < 7; c2_i6++) {
        c2_t_u[c2_i6] = c2_cv6[c2_i6];
    }

    c2_t_y = NULL;
    sf_mex_assign(&c2_t_y, sf_mex_create("y", c2_t_u, 10, 0U, 1U, 0U, 2, 1, 7),
                  false);
    c2_u_u = c2_gameNum;
    c2_u_y = NULL;
    sf_mex_assign(&c2_u_y, sf_mex_create("y", &c2_u_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "setappdata", 0U, 3U, 14,
                      c2_s_y, 14, c2_t_y, 14, c2_u_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -9);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Demo_GloveMachineNumber_,
                                       chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#30
0
static void sf_gateway_c5_testYarpReadSHORE(SFc5_testYarpReadSHOREInstanceStruct
  *chartInstance)
{
  real_T c5_hoistedGlobal;
  real_T c5_b_hoistedGlobal;
  real_T c5_c_hoistedGlobal;
  real_T c5_nextX;
  real_T c5_currentX;
  real_T c5_oldX;
  uint32_T c5_debug_family_var_map[9];
  real_T c5_nx;
  real_T c5_cx;
  real_T c5_ox;
  real_T c5_nargin = 3.0;
  real_T c5_nargout = 1.0;
  real_T c5_y;
  real_T *c5_b_nextX;
  real_T *c5_b_currentX;
  real_T *c5_b_y;
  real_T *c5_b_oldX;
  boolean_T guard1 = false;
  c5_b_oldX = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c5_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c5_b_currentX = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c5_b_nextX = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c5_b_nextX, 0U);
  _SFD_DATA_RANGE_CHECK(*c5_b_currentX, 1U);
  chartInstance->c5_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  c5_hoistedGlobal = *c5_b_nextX;
  c5_b_hoistedGlobal = *c5_b_currentX;
  c5_c_hoistedGlobal = *c5_b_oldX;
  c5_nextX = c5_hoistedGlobal;
  c5_currentX = c5_b_hoistedGlobal;
  c5_oldX = c5_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c5_debug_family_names,
    c5_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nx, 0U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_cx, 1U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_ox, 2U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargin, 3U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargout, 4U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_nextX, 5U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_currentX, 6U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_oldX, 7U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_y, 8U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 7);
  if (CV_EML_IF(0, 1, 0, c5_nextX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 8);
    c5_nx = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 10);
    c5_nx = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 12);
  if (CV_EML_IF(0, 1, 1, c5_currentX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 13);
    c5_cx = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 15);
    c5_cx = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 17);
  if (CV_EML_IF(0, 1, 2, c5_oldX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 18);
    c5_ox = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 20);
    c5_ox = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 23);
  guard1 = false;
  if (CV_EML_COND(0, 1, 0, c5_nx != c5_cx)) {
    if (CV_EML_COND(0, 1, 1, c5_cx != c5_ox)) {
      CV_EML_MCDC(0, 1, 0, true);
      CV_EML_IF(0, 1, 3, true);
      _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 24);
      c5_currentX = c5_oldX;
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

  if (guard1 == true) {
    CV_EML_MCDC(0, 1, 0, false);
    CV_EML_IF(0, 1, 3, false);
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 26);
  c5_y = c5_currentX;
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, -26);
  _SFD_SYMBOL_SCOPE_POP();
  *c5_b_y = c5_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_testYarpReadSHOREMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c5_b_y, 2U);
  _SFD_DATA_RANGE_CHECK(*c5_b_oldX, 3U);
}