static void set_sim_state_c2_gesamtmodell(SFc2_gesamtmodellInstanceStruct
  *chartInstance, const mxArray *c2_st)
{
  const mxArray *c2_u;
  real_T c2_dv0[3];
  int32_T c2_i1;
  real_T (*c2_y)[3];
  c2_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c2_doneDoubleBufferReInit = TRUE;
  c2_u = sf_mex_dup(c2_st);
  c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)), "y",
                      c2_dv0);
  for (c2_i1 = 0; c2_i1 < 3; c2_i1++) {
    (*c2_y)[c2_i1] = c2_dv0[c2_i1];
  }

  chartInstance->c2_is_active_c2_gesamtmodell = c2_f_emlrt_marshallIn
    (chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 1)),
     "is_active_c2_gesamtmodell");
  sf_mex_destroy(&c2_u);
  c2_update_debugger_state_c2_gesamtmodell(chartInstance);
  sf_mex_destroy(&c2_st);
}
static void set_sim_state_c7_WEC_Sim_Driver(SFc7_WEC_Sim_DriverInstanceStruct
  *chartInstance, const mxArray *c7_st)
{
  const mxArray *c7_u;
  real_T c7_dv0[3];
  int32_T c7_i1;
  real_T (*c7_E)[3];
  c7_E = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c7_doneDoubleBufferReInit = TRUE;
  c7_u = sf_mex_dup(c7_st);
  c7_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c7_u, 0)), "E",
                      c7_dv0);
  for (c7_i1 = 0; c7_i1 < 3; c7_i1++) {
    (*c7_E)[c7_i1] = c7_dv0[c7_i1];
  }

  chartInstance->c7_is_active_c7_WEC_Sim_Driver = c7_e_emlrt_marshallIn
    (chartInstance, sf_mex_dup(sf_mex_getcell(c7_u, 1)),
     "is_active_c7_WEC_Sim_Driver");
  sf_mex_destroy(&c7_u);
  c7_update_debugger_state_c7_WEC_Sim_Driver(chartInstance);
  sf_mex_destroy(&c7_st);
}
static const mxArray *get_sim_state_c2_car_model(SFc2_car_modelInstanceStruct
  *chartInstance)
{
  const mxArray *c2_st = NULL;
  const mxArray *c2_y = NULL;
  int32_T c2_i0;
  real_T c2_hoistedGlobal[4];
  int32_T c2_i1;
  real_T c2_u[4];
  const mxArray *c2_b_y = NULL;
  uint8_T c2_b_hoistedGlobal;
  uint8_T c2_b_u;
  const mxArray *c2_c_y = NULL;
  real_T (*c2_dX)[4];
  c2_dX = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
  c2_st = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_createcellarray(2));
  for (c2_i0 = 0; c2_i0 < 4; c2_i0 = c2_i0 + 1) {
    c2_hoistedGlobal[c2_i0] = (*c2_dX)[c2_i0];
  }

  for (c2_i1 = 0; c2_i1 < 4; c2_i1 = c2_i1 + 1) {
    c2_u[c2_i1] = c2_hoistedGlobal[c2_i1];
  }

  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_u, 0, 0U, 1U, 0U, 1, 4));
  sf_mex_setcell(c2_y, 0, c2_b_y);
  c2_b_hoistedGlobal = chartInstance->c2_is_active_c2_car_model;
  c2_b_u = c2_b_hoistedGlobal;
  c2_c_y = NULL;
  sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_b_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 1, c2_c_y);
  sf_mex_assign(&c2_st, c2_y);
  return c2_st;
}
static const mxArray *get_sim_state_c3_car_model(SFc3_car_modelInstanceStruct
  *chartInstance)
{
  const mxArray *c3_st = NULL;
  const mxArray *c3_y = NULL;
  int32_T c3_i0;
  real_T c3_hoistedGlobal[2];
  int32_T c3_i1;
  real_T c3_u[2];
  const mxArray *c3_b_y = NULL;
  uint8_T c3_b_hoistedGlobal;
  uint8_T c3_b_u;
  const mxArray *c3_c_y = NULL;
  real_T (*c3_s)[2];
  c3_s = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_st = NULL;
  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_createcellarray(2));
  for (c3_i0 = 0; c3_i0 < 2; c3_i0 = c3_i0 + 1) {
    c3_hoistedGlobal[c3_i0] = (*c3_s)[c3_i0];
  }

  for (c3_i1 = 0; c3_i1 < 2; c3_i1 = c3_i1 + 1) {
    c3_u[c3_i1] = c3_hoistedGlobal[c3_i1];
  }

  c3_b_y = NULL;
  sf_mex_assign(&c3_b_y, sf_mex_create("y", &c3_u, 0, 0U, 1U, 0U, 1, 2));
  sf_mex_setcell(c3_y, 0, c3_b_y);
  c3_b_hoistedGlobal = chartInstance->c3_is_active_c3_car_model;
  c3_b_u = c3_b_hoistedGlobal;
  c3_c_y = NULL;
  sf_mex_assign(&c3_c_y, sf_mex_create("y", &c3_b_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c3_y, 1, c3_c_y);
  sf_mex_assign(&c3_st, c3_y);
  return c3_st;
}
static void set_sim_state_c26_HIL_model_experiments2
  (SFc26_HIL_model_experiments2InstanceStruct *chartInstance, const mxArray
   *c26_st)
{
  const mxArray *c26_u;
  real_T c26_dv0[3];
  int32_T c26_i1;
  real_T (*c26_eta_dot_ref)[3];
  c26_eta_dot_ref = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c26_doneDoubleBufferReInit = TRUE;
  c26_u = sf_mex_dup(c26_st);
  c26_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c26_u, 0)),
                       "eta_dot_ref", c26_dv0);
  for (c26_i1 = 0; c26_i1 < 3; c26_i1++) {
    (*c26_eta_dot_ref)[c26_i1] = c26_dv0[c26_i1];
  }

  chartInstance->c26_is_active_c26_HIL_model_experiments2 =
    c26_f_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c26_u, 1)),
    "is_active_c26_HIL_model_experiments2");
  sf_mex_destroy(&c26_u);
  c26_update_debugger_state_c26_HIL_model_experiments2(chartInstance);
  sf_mex_destroy(&c26_st);
}
void features_bta_api(const mxArray *prhs[1], const mxArray *plhs[1])
{
  real_T (*ft)[2];
  emxArray_real_T *tap;
  emlrtStack st = { NULL, NULL, NULL };

  st.tls = emlrtRootTLSGlobal;
  ft = (real_T (*)[2])mxMalloc(sizeof(real_T [2]));
  emlrtHeapReferenceStackEnterFcnR2012b(&st);
  b_emxInit_real_T(&st, &tap, 2, true);
  prhs[0] = emlrtProtectR2012b(prhs[0], 0, false, -1);

  /* Marshall function inputs */
  e_emlrt_marshallIn(&st, emlrtAlias(prhs[0]), "tap", tap);

  /* Invoke the target function */
  features_bta(tap, *ft);

  /* Marshall function outputs */
  plhs[0] = f_emlrt_marshallOut(*ft);
  tap->canFreeData = false;
  emxFree_real_T(&tap);
  emlrtHeapReferenceStackLeaveFcnR2012b(&st);
}
static void sf_gateway_c10_experiment_lib2(SFc10_experiment_lib2InstanceStruct
  *chartInstance)
{
  int32_T c10_i2;
  real_T c10_hoistedGlobal;
  real_T c10_b_hoistedGlobal;
  int32_T c10_i3;
  real_T c10_V[4];
  real_T c10_val;
  real_T c10_b_a;
  uint32_T c10_debug_family_var_map[6];
  real_T c10_nargin = 3.0;
  real_T c10_nargout = 1.0;
  real_T c10_out[4];
  int32_T c10_i4;
  int32_T c10_i5;
  int32_T c10_i6;
  real_T *c10_b_val;
  real_T (*c10_b_out)[4];
  real_T (*c10_b_V)[4];
  c10_b_val = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c10_b_out = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
  c10_b_V = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3U, chartInstance->c10_sfEvent);
  for (c10_i2 = 0; c10_i2 < 4; c10_i2++) {
    _SFD_DATA_RANGE_CHECK((*c10_b_V)[c10_i2], 0U);
  }

  chartInstance->c10_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3U, chartInstance->c10_sfEvent);
  c10_hoistedGlobal = *c10_b_val;
  c10_b_hoistedGlobal = chartInstance->c10_a;
  for (c10_i3 = 0; c10_i3 < 4; c10_i3++) {
    c10_V[c10_i3] = (*c10_b_V)[c10_i3];
  }

  c10_val = c10_hoistedGlobal;
  c10_b_a = c10_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c10_debug_family_names,
    c10_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_nargin, 0U, c10_b_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_nargout, 1U, c10_b_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c10_V, 2U, c10_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c10_val, 3U, c10_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c10_b_a, 4U, c10_b_sf_marshallOut,
    c10_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c10_out, 5U, c10_sf_marshallOut,
    c10_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 2);
  for (c10_i4 = 0; c10_i4 < 4; c10_i4++) {
    c10_out[c10_i4] = c10_V[c10_i4];
  }

  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, 3);
  c10_out[_SFD_EML_ARRAY_BOUNDS_CHECK("out", (int32_T)_SFD_INTEGER_CHECK("a",
    c10_b_a), 1, 4, 1, 0) - 1] = c10_val;
  _SFD_EML_CALL(0U, chartInstance->c10_sfEvent, -3);
  _SFD_SYMBOL_SCOPE_POP();
  for (c10_i5 = 0; c10_i5 < 4; c10_i5++) {
    (*c10_b_out)[c10_i5] = c10_out[c10_i5];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3U, chartInstance->c10_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_experiment_lib2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c10_i6 = 0; c10_i6 < 4; c10_i6++) {
    _SFD_DATA_RANGE_CHECK((*c10_b_out)[c10_i6], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c10_b_val, 2U);
  _SFD_DATA_RANGE_CHECK(chartInstance->c10_a, 3U);
}
/*
 * Arguments    : const mxArray *prhs[15]
 *                const mxArray *plhs[7]
 * Return Type  : void
 */
void clcOptTrj_tmp_api(const mxArray *prhs[15], const mxArray *plhs[7])
{
  emxArray_real_T *engKinNumVec_wayInx;
  emxArray_real_T *engKinMat_engKinInx_wayInx;
  emxArray_real_T *engKinOptVec;
  emxArray_real_T *batEngDltOptVec;
  emxArray_real_T *fulEngDltOptVec;
  emxArray_real_T *staVec;
  emxArray_real_T *psiEngKinOptVec;
  real_T disFlg;
  real_T wayStp;
  real_T wayNum;
  real_T wayInxBeg;
  real_T wayInxEnd;
  real_T staEnd;
  real_T engKinNum;
  real_T engKinEndInxVal;
  real_T staNum;
  real_T (*optPreInxTn3)[52800];
  real_T (*batFrcOptTn3)[52800];
  real_T (*fulEngOptTn3)[52800];
  real_T (*cos2goActMat)[66];
  real_T engKinEndInx;
  real_T fulEngOpt;
  emlrtStack st = { NULL, NULL, NULL };

  st.tls = emlrtRootTLSGlobal;
  emlrtHeapReferenceStackEnterFcnR2012b(&st);
  emxInit_real_T(&st, &engKinNumVec_wayInx, 1, true);
  b_emxInit_real_T(&st, &engKinMat_engKinInx_wayInx, 2, true);
  emxInit_real_T(&st, &engKinOptVec, 1, true);
  emxInit_real_T(&st, &batEngDltOptVec, 1, true);
  emxInit_real_T(&st, &fulEngDltOptVec, 1, true);
  emxInit_real_T(&st, &staVec, 1, true);
  emxInit_real_T(&st, &psiEngKinOptVec, 1, true);
  prhs[9] = emlrtProtectR2012b(prhs[9], 9, false, -1);
  prhs[10] = emlrtProtectR2012b(prhs[10], 10, false, -1);
  prhs[11] = emlrtProtectR2012b(prhs[11], 11, false, -1);
  prhs[12] = emlrtProtectR2012b(prhs[12], 12, false, -1);
  prhs[13] = emlrtProtectR2012b(prhs[13], 13, false, -1);
  prhs[14] = emlrtProtectR2012b(prhs[14], 14, false, -1);

  /* Marshall function inputs */
  disFlg = emlrt_marshallIn(&st, emlrtAliasP(prhs[0]), "disFlg");
  wayStp = emlrt_marshallIn(&st, emlrtAliasP(prhs[1]), "wayStp");
  wayNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[2]), "wayNum");
  wayInxBeg = emlrt_marshallIn(&st, emlrtAliasP(prhs[3]), "wayInxBeg");
  wayInxEnd = emlrt_marshallIn(&st, emlrtAliasP(prhs[4]), "wayInxEnd");
  staEnd = emlrt_marshallIn(&st, emlrtAliasP(prhs[5]), "staEnd");
  engKinNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[6]), "engKinNum");
  engKinEndInxVal = emlrt_marshallIn(&st, emlrtAliasP(prhs[7]),
    "engKinEndInxVal");
  staNum = emlrt_marshallIn(&st, emlrtAliasP(prhs[8]), "staNum");
  c_emlrt_marshallIn(&st, emlrtAlias(prhs[9]), "engKinNumVec_wayInx",
                     engKinNumVec_wayInx);
  e_emlrt_marshallIn(&st, emlrtAlias(prhs[10]), "engKinMat_engKinInx_wayInx",
                     engKinMat_engKinInx_wayInx);
  optPreInxTn3 = g_emlrt_marshallIn(&st, emlrtAlias(prhs[11]), "optPreInxTn3");
  batFrcOptTn3 = g_emlrt_marshallIn(&st, emlrtAlias(prhs[12]), "batFrcOptTn3");
  fulEngOptTn3 = g_emlrt_marshallIn(&st, emlrtAlias(prhs[13]), "fulEngOptTn3");
  cos2goActMat = i_emlrt_marshallIn(&st, emlrtAlias(prhs[14]), "cos2goActMat");

  /* Invoke the target function */
  clcOptTrj_tmp(disFlg, wayStp, wayNum, wayInxBeg, wayInxEnd, staEnd, engKinNum,
                engKinEndInxVal, staNum, engKinNumVec_wayInx,
                engKinMat_engKinInx_wayInx, *optPreInxTn3, *batFrcOptTn3,
                *fulEngOptTn3, *cos2goActMat, engKinOptVec, batEngDltOptVec,
                fulEngDltOptVec, staVec, psiEngKinOptVec, &fulEngOpt,
                &engKinEndInx);

  /* Marshall function outputs */
  plhs[0] = emlrt_marshallOut(engKinOptVec);
  plhs[1] = emlrt_marshallOut(batEngDltOptVec);
  plhs[2] = emlrt_marshallOut(fulEngDltOptVec);
  plhs[3] = emlrt_marshallOut(staVec);
  plhs[4] = emlrt_marshallOut(psiEngKinOptVec);
  plhs[5] = b_emlrt_marshallOut(fulEngOpt);
  plhs[6] = b_emlrt_marshallOut(engKinEndInx);
  psiEngKinOptVec->canFreeData = false;
  emxFree_real_T(&psiEngKinOptVec);
  staVec->canFreeData = false;
  emxFree_real_T(&staVec);
  fulEngDltOptVec->canFreeData = false;
  emxFree_real_T(&fulEngDltOptVec);
  batEngDltOptVec->canFreeData = false;
  emxFree_real_T(&batEngDltOptVec);
  engKinOptVec->canFreeData = false;
  emxFree_real_T(&engKinOptVec);
  engKinMat_engKinInx_wayInx->canFreeData = false;
  emxFree_real_T(&engKinMat_engKinInx_wayInx);
  engKinNumVec_wayInx->canFreeData = false;
  emxFree_real_T(&engKinNumVec_wayInx);
  emlrtHeapReferenceStackLeaveFcnR2012b(&st);
}
static void sf_c1_newtons_cradle(SFc1_newtons_cradleInstanceStruct
  *chartInstance)
{
  boolean_T c1_stateChanged;
  int32_T c1_i;
  int32_T c1_exitg1;
  real_T c1_tmp;
  real_T (*c1_p)[3];
  real_T (*c1_v)[3];
  real_T (*c1_p_out)[3];
  real_T (*c1_v_out)[3];
  c1_v = (real_T (*)[3])(ssGetContStates(chartInstance->S) + 3);
  c1_p = (real_T (*)[3])(ssGetContStates(chartInstance->S) + 0);
  c1_v_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 2);
  c1_p_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c1_set_sim_state_side_effects_c1_newtons_cradle(chartInstance);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  if (ssIsMajorTimeStep(chartInstance->S) != 0) {
    chartInstance->c1_lastMajorTime = _sfTime_;
    c1_stateChanged = (boolean_T)0;
    for (c1_i = 0; c1_i < 3; c1_i++) {
      (*c1_p_out)[c1_i] = 0.0;
      (*c1_v_out)[c1_i] = 0.0;
    }

    c1_i = 0;
    do {
      c1_exitg1 = 0;
      if (c1_i < 2) {
        if ((*c1_p)[c1_i] < (*c1_p)[c1_i + 1]) {
          c1_i = 1;
          c1_exitg1 = 1;
        } else {
          c1_i++;
          _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
        }
      } else {
        c1_i = 0;
        c1_exitg1 = 1;
      }
    } while (c1_exitg1 == 0);

    if (c1_i != 0) {
      for (c1_i = 0; c1_i < 2; c1_i++) {
        if ((*c1_p)[c1_i] < (*c1_p)[c1_i + 1]) {
          c1_tmp = (*c1_p)[c1_i];
          (*c1_p)[c1_i] = (*c1_p)[c1_i + 1];
          (*c1_p)[c1_i + 1] = c1_tmp;
          c1_tmp = (*c1_v)[c1_i];
          (*c1_v)[c1_i] = (*c1_v)[c1_i + 1];
          (*c1_v)[c1_i + 1] = c1_tmp;
        }

        _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
      }

      c1_stateChanged = TRUE;
      chartInstance->c1_is_c1_newtons_cradle = c1_IN_FreeDynamics;
    }

    if (c1_stateChanged) {
      ssSetSolverNeedsReset(chartInstance->S);
    }
  }

  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  for (c1_i = 0; c1_i < 3; c1_i++) {
    (*c1_p_out)[c1_i] = (*c1_p)[c1_i];
    (*c1_v_out)[c1_i] = (*c1_v)[c1_i];
  }
}
Exemple #10
0
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc3_V2A1_2InstanceStruct *chartInstance;
    chartInstance = (SFc3_V2A1_2InstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _V2A1_2MachineNumber_,
           3,
           1,
           1,
           3,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_V2A1_2MachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_V2A1_2MachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _V2A1_2MachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"delta");
          _SFD_SET_DATA_PROPS(1,2,0,1,"x0");
          _SFD_SET_DATA_PROPS(2,1,1,0,"hoehe");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,211);
        _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_b_sf_marshallOut,(MexInFcnForType)NULL);

        {
          unsigned int dimVector[1];
          dimVector[0]= 2;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)
            c3_sf_marshallIn);
        }

        _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_b_sf_marshallOut,(MexInFcnForType)NULL);

        {
          real_T *c3_delta;
          real_T *c3_hoehe;
          real_T (*c3_x0)[2];
          c3_hoehe = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
          c3_x0 = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
          c3_delta = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, c3_delta);
          _SFD_SET_DATA_VALUE_PTR(1U, *c3_x0);
          _SFD_SET_DATA_VALUE_PTR(2U, c3_hoehe);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _V2A1_2MachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
static void sf_c12_CusakisME4901arcs(SFc12_CusakisME4901arcsInstanceStruct
  *chartInstance)
{
  int32_T c12_i2;
  int32_T c12_i3;
  int32_T c12_i4;
  real_T c12_M[16];
  uint32_T c12_debug_family_var_map[11];
  real_T c12_m;
  real_T c12_n;
  real_T c12_a[16];
  real_T c12_MM[16];
  real_T c12_i;
  real_T c12_mm;
  real_T c12_j;
  real_T c12_nargin = 1.0;
  real_T c12_nargout = 1.0;
  real_T c12_DD[16];
  int32_T c12_i5;
  int32_T c12_i6;
  int32_T c12_b_mm;
  int32_T c12_b_j;
  int32_T c12_i7;
  int32_T c12_i8;
  real_T (*c12_b_DD)[16];
  real_T (*c12_b_M)[16];
  c12_b_DD = (real_T (*)[16])ssGetOutputPortSignal(chartInstance->S, 1);
  c12_b_M = (real_T (*)[16])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  for (c12_i2 = 0; c12_i2 < 16; c12_i2++) {
    _SFD_DATA_RANGE_CHECK((*c12_b_M)[c12_i2], 0U);
  }

  for (c12_i3 = 0; c12_i3 < 16; c12_i3++) {
    _SFD_DATA_RANGE_CHECK((*c12_b_DD)[c12_i3], 1U);
  }

  chartInstance->c12_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  for (c12_i4 = 0; c12_i4 < 16; c12_i4++) {
    c12_M[c12_i4] = (*c12_b_M)[c12_i4];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 11U, 11U, c12_debug_family_names,
    c12_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c12_m, 0U, c12_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c12_n, 1U, c12_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c12_a, 2U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c12_MM, 3U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_i, 4U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_mm, 5U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_j, 6U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_nargin, 7U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c12_nargout, 8U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c12_M, 9U, c12_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c12_DD, 10U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 3);
  c12_m = 2.0;
  c12_n = 8.0;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 4);
  for (c12_i5 = 0; c12_i5 < 16; c12_i5++) {
    c12_a[c12_i5] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 5);
  for (c12_i6 = 0; c12_i6 < 16; c12_i6++) {
    c12_MM[c12_i6] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 6);
  c12_i = 1.0;
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 7);
  c12_mm = 0.0;
  c12_b_mm = 0;
  while (c12_b_mm < 8) {
    c12_mm = (real_T)c12_b_mm * 2.0;
    CV_EML_FOR(0, 1, 0, 1);
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 8);
    c12_j = 1.0;
    c12_b_j = 0;
    while (c12_b_j < 2) {
      c12_j = 1.0 + (real_T)c12_b_j;
      CV_EML_FOR(0, 1, 1, 1);
      _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 9);
      c12_a[(int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("a", (int32_T)
        _SFD_INTEGER_CHECK("j+mm", c12_j + c12_mm), 1, 16, 1, 0) - 1] = c12_M
        [((int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("M", (int32_T)
           _SFD_INTEGER_CHECK("j", c12_j), 1, 2, 1, 0) + (((int32_T)(real_T)
            _SFD_EML_ARRAY_BOUNDS_CHECK("M", (int32_T)_SFD_INTEGER_CHECK("i",
              c12_i), 1, 8, 2, 0) - 1) << 1)) - 1];
      c12_b_j++;
      _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
    }

    CV_EML_FOR(0, 1, 1, 0);
    _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 11);
    c12_i++;
    c12_b_mm++;
    _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 13);
  for (c12_i7 = 0; c12_i7 < 16; c12_i7++) {
    c12_DD[c12_i7] = c12_a[c12_i7];
  }

  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -13);
  _SFD_SYMBOL_SCOPE_POP();
  for (c12_i8 = 0; c12_i8 < 16; c12_i8++) {
    (*c12_b_DD)[c12_i8] = c12_DD[c12_i8];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CusakisME4901arcsMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c3_car_model(SFc3_car_modelInstanceStruct *chartInstance)
{
  int32_T c3_i3;
  int32_T c3_i4;
  int32_T c3_i5;
  int32_T c3_previousEvent;
  int32_T c3_i6;
  real_T c3_hoistedGlobal[4];
  int32_T c3_i7;
  real_T c3_b_hoistedGlobal[3];
  int32_T c3_i8;
  real_T c3_X[4];
  int32_T c3_i9;
  real_T c3_u[3];
  uint32_T c3_debug_family_var_map[22];
  real_T c3_l_F;
  real_T c3_l_R;
  real_T c3_Vx;
  real_T c3_Vy;
  real_T c3_r;
  real_T c3_psi;
  real_T c3_f_Fx;
  real_T c3_f_Rx;
  real_T c3_delta;
  real_T c3_beta;
  real_T c3_V;
  real_T c3_s_Fy_num;
  real_T c3_s_Fy_denum;
  real_T c3_s_Fy;
  real_T c3_s_Ry_num;
  real_T c3_s_Ry_denum;
  real_T c3_s_Ry;
  real_T c3_nargin = 2.0;
  real_T c3_nargout = 1.0;
  real_T c3_s[2];
  real_T c3_A;
  real_T c3_B;
  real_T c3_x;
  real_T c3_y;
  real_T c3_b_x;
  real_T c3_b_y;
  real_T c3_c_x;
  real_T c3_c_y;
  real_T c3_d_y;
  real_T c3_d_x;
  real_T c3_e_x;
  real_T c3_f_x;
  real_T c3_g_x;
  real_T c3_h_x;
  real_T c3_i_x;
  real_T c3_j_x;
  real_T c3_a;
  real_T c3_b;
  real_T c3_e_y;
  real_T c3_b_a;
  real_T c3_f_y;
  real_T c3_k_x;
  real_T c3_l_x;
  real_T c3_m_x;
  real_T c3_c_a;
  real_T c3_b_b;
  real_T c3_g_y;
  real_T c3_n_x;
  real_T c3_o_x;
  real_T c3_p_x;
  real_T c3_d_a;
  real_T c3_c_b;
  real_T c3_h_y;
  real_T c3_e_a;
  real_T c3_i_y;
  real_T c3_q_x;
  real_T c3_r_x;
  real_T c3_s_x;
  real_T c3_f_a;
  real_T c3_d_b;
  real_T c3_j_y;
  real_T c3_b_A;
  real_T c3_b_B;
  real_T c3_t_x;
  real_T c3_k_y;
  real_T c3_u_x;
  real_T c3_l_y;
  real_T c3_v_x;
  real_T c3_m_y;
  real_T c3_w_x;
  real_T c3_x_x;
  real_T c3_y_x;
  real_T c3_g_a;
  real_T c3_e_b;
  real_T c3_n_y;
  real_T c3_h_a;
  real_T c3_o_y;
  real_T c3_ab_x;
  real_T c3_bb_x;
  real_T c3_cb_x;
  real_T c3_i_a;
  real_T c3_f_b;
  real_T c3_c_A;
  real_T c3_c_B;
  real_T c3_db_x;
  real_T c3_p_y;
  real_T c3_eb_x;
  real_T c3_q_y;
  real_T c3_fb_x;
  real_T c3_r_y;
  int32_T c3_i10;
  real_T (*c3_b_s)[2];
  real_T (*c3_b_u)[3];
  real_T (*c3_b_X)[4];
  c3_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_s = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_b_X = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,2);
  for (c3_i3 = 0; c3_i3 < 4; c3_i3 = c3_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_X)[c3_i3], 0U);
  }

  for (c3_i4 = 0; c3_i4 < 2; c3_i4 = c3_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_s)[c3_i4], 1U);
  }

  for (c3_i5 = 0; c3_i5 < 3; c3_i5 = c3_i5 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_u)[c3_i5], 2U);
  }

  c3_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,2);
  for (c3_i6 = 0; c3_i6 < 4; c3_i6 = c3_i6 + 1) {
    c3_hoistedGlobal[c3_i6] = (*c3_b_X)[c3_i6];
  }

  for (c3_i7 = 0; c3_i7 < 3; c3_i7 = c3_i7 + 1) {
    c3_b_hoistedGlobal[c3_i7] = (*c3_b_u)[c3_i7];
  }

  for (c3_i8 = 0; c3_i8 < 4; c3_i8 = c3_i8 + 1) {
    c3_X[c3_i8] = c3_hoistedGlobal[c3_i8];
  }

  for (c3_i9 = 0; c3_i9 < 3; c3_i9 = c3_i9 + 1) {
    c3_u[c3_i9] = c3_b_hoistedGlobal[c3_i9];
  }

  sf_debug_symbol_scope_push_eml(0U, 22U, 22U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c3_l_F, c3_d_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c3_l_R, c3_d_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c3_Vx, c3_d_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c3_Vy, c3_d_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c3_r, c3_d_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c3_psi, c3_d_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c3_f_Fx, c3_d_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(&c3_f_Rx, c3_d_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(&c3_delta, c3_d_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(&c3_beta, c3_d_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c3_V, c3_d_sf_marshall, 10U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy_num, c3_d_sf_marshall, 11U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy_denum, c3_d_sf_marshall, 12U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy, c3_d_sf_marshall, 13U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry_num, c3_d_sf_marshall, 14U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry_denum, c3_d_sf_marshall, 15U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry, c3_d_sf_marshall, 16U);
  sf_debug_symbol_scope_add_eml(&c3_nargin, c3_d_sf_marshall, 17U);
  sf_debug_symbol_scope_add_eml(&c3_nargout, c3_d_sf_marshall, 18U);
  sf_debug_symbol_scope_add_eml(&c3_X, c3_c_sf_marshall, 19U);
  sf_debug_symbol_scope_add_eml(&c3_u, c3_b_sf_marshall, 20U);
  sf_debug_symbol_scope_add_eml(&c3_s, c3_sf_marshall, 21U);
  CV_EML_FCN(0, 0);

  /*  l_F = param.l_F; */
  /*  l_R = param.l_R; */
  _SFD_EML_CALL(0,7);
  c3_l_F = 1.1;
  _SFD_EML_CALL(0,8);
  c3_l_R = 1.6;
  _SFD_EML_CALL(0,10);
  c3_Vx = c3_X[0];
  _SFD_EML_CALL(0,11);
  c3_Vy = c3_X[1];
  _SFD_EML_CALL(0,12);
  c3_r = c3_X[2];
  _SFD_EML_CALL(0,13);
  c3_psi = c3_X[3];
  _SFD_EML_CALL(0,15);
  c3_f_Fx = c3_u[0];
  _SFD_EML_CALL(0,16);
  c3_f_Rx = c3_u[1];
  _SFD_EML_CALL(0,17);
  c3_delta = c3_u[2];
  _SFD_EML_CALL(0,20);
  if (CV_EML_COND(0, 0, c3_Vx == 0.0)) {
    if (CV_EML_COND(0, 1, c3_Vy == 0.0)) {
      CV_EML_MCDC(0, 0, TRUE);
      CV_EML_IF(0, 0, TRUE);
      _SFD_EML_CALL(0,21);
      c3_beta = 0.0;
      goto label_1;
    }
  }

  CV_EML_MCDC(0, 0, FALSE);
  CV_EML_IF(0, 0, FALSE);
  _SFD_EML_CALL(0,23);
  c3_A = c3_Vy;
  c3_B = c3_Vx;
  c3_x = c3_A;
  c3_y = c3_B;
  c3_b_x = c3_x;
  c3_b_y = c3_y;
  c3_c_x = c3_b_x;
  c3_c_y = c3_b_y;
  c3_d_y = c3_c_x / c3_c_y;
  c3_d_x = c3_d_y;
  c3_beta = c3_d_x;
  c3_e_x = c3_beta;
  c3_beta = c3_e_x;
  c3_beta = muDoubleScalarAtan(c3_beta);
 label_1:
  ;
  _SFD_EML_CALL(0,26);
  c3_f_x = c3_mpower(chartInstance, c3_Vx) + c3_mpower(chartInstance, c3_Vy);
  c3_V = c3_f_x;
  if (c3_V < 0.0) {
    c3_eml_error(chartInstance);
  }

  c3_g_x = c3_V;
  c3_V = c3_g_x;
  c3_V = muDoubleScalarSqrt(c3_V);
  _SFD_EML_CALL(0,28);
  c3_h_x = c3_beta - c3_delta;
  c3_i_x = c3_h_x;
  c3_j_x = c3_i_x;
  c3_i_x = c3_j_x;
  c3_i_x = muDoubleScalarSin(c3_i_x);
  c3_a = c3_V;
  c3_b = c3_i_x;
  c3_e_y = c3_a * c3_b;
  c3_b_a = c3_r;
  c3_f_y = c3_b_a * 1.1;
  c3_k_x = c3_delta;
  c3_l_x = c3_k_x;
  c3_m_x = c3_l_x;
  c3_l_x = c3_m_x;
  c3_l_x = muDoubleScalarCos(c3_l_x);
  c3_c_a = c3_f_y;
  c3_b_b = c3_l_x;
  c3_g_y = c3_c_a * c3_b_b;
  c3_s_Fy_num = c3_e_y + c3_g_y;
  _SFD_EML_CALL(0,29);
  c3_n_x = c3_beta - c3_delta;
  c3_o_x = c3_n_x;
  c3_p_x = c3_o_x;
  c3_o_x = c3_p_x;
  c3_o_x = muDoubleScalarCos(c3_o_x);
  c3_d_a = c3_V;
  c3_c_b = c3_o_x;
  c3_h_y = c3_d_a * c3_c_b;
  c3_e_a = c3_r;
  c3_i_y = c3_e_a * 1.1;
  c3_q_x = c3_delta;
  c3_r_x = c3_q_x;
  c3_s_x = c3_r_x;
  c3_r_x = c3_s_x;
  c3_r_x = muDoubleScalarSin(c3_r_x);
  c3_f_a = c3_i_y;
  c3_d_b = c3_r_x;
  c3_j_y = c3_f_a * c3_d_b;
  c3_s_Fy_denum = c3_h_y + c3_j_y;
  _SFD_EML_CALL(0,31);
  if (CV_EML_COND(0, 2, c3_s_Fy_num == 0.0)) {
    if (CV_EML_COND(0, 3, c3_s_Fy_denum == 0.0)) {
      CV_EML_MCDC(0, 1, TRUE);
      CV_EML_IF(0, 1, TRUE);
      _SFD_EML_CALL(0,32);
      c3_s_Fy = 0.0;
      goto label_2;
    }
  }

  CV_EML_MCDC(0, 1, FALSE);
  CV_EML_IF(0, 1, FALSE);
  _SFD_EML_CALL(0,34);
  c3_b_A = c3_s_Fy_num;
  c3_b_B = c3_s_Fy_denum;
  c3_t_x = c3_b_A;
  c3_k_y = c3_b_B;
  c3_u_x = c3_t_x;
  c3_l_y = c3_k_y;
  c3_v_x = c3_u_x;
  c3_m_y = c3_l_y;
  c3_s_Fy = c3_v_x / c3_m_y;
 label_2:
  ;
  _SFD_EML_CALL(0,37);
  c3_w_x = c3_beta;
  c3_x_x = c3_w_x;
  c3_y_x = c3_x_x;
  c3_x_x = c3_y_x;
  c3_x_x = muDoubleScalarSin(c3_x_x);
  c3_g_a = c3_V;
  c3_e_b = c3_x_x;
  c3_n_y = c3_g_a * c3_e_b;
  c3_h_a = c3_r;
  c3_o_y = c3_h_a * 1.6;
  c3_s_Ry_num = c3_n_y - c3_o_y;
  _SFD_EML_CALL(0,38);
  c3_ab_x = c3_beta;
  c3_bb_x = c3_ab_x;
  c3_cb_x = c3_bb_x;
  c3_bb_x = c3_cb_x;
  c3_bb_x = muDoubleScalarCos(c3_bb_x);
  c3_i_a = c3_V;
  c3_f_b = c3_bb_x;
  c3_s_Ry_denum = c3_i_a * c3_f_b;
  _SFD_EML_CALL(0,40);
  if (CV_EML_COND(0, 4, c3_s_Ry_num == 0.0)) {
    if (CV_EML_COND(0, 5, c3_s_Ry_denum == 0.0)) {
      CV_EML_MCDC(0, 2, TRUE);
      CV_EML_IF(0, 2, TRUE);
      _SFD_EML_CALL(0,41);
      c3_s_Ry = 0.0;
      goto label_3;
    }
  }

  CV_EML_MCDC(0, 2, FALSE);
  CV_EML_IF(0, 2, FALSE);
  _SFD_EML_CALL(0,43);
  c3_c_A = c3_s_Ry_num;
  c3_c_B = c3_s_Ry_denum;
  c3_db_x = c3_c_A;
  c3_p_y = c3_c_B;
  c3_eb_x = c3_db_x;
  c3_q_y = c3_p_y;
  c3_fb_x = c3_eb_x;
  c3_r_y = c3_q_y;
  c3_s_Ry = c3_fb_x / c3_r_y;
 label_3:
  ;
  _SFD_EML_CALL(0,46);
  c3_s[0] = c3_s_Fy;
  c3_s[1] = c3_s_Ry;
  _SFD_EML_CALL(0,-46);
  sf_debug_symbol_scope_pop();
  for (c3_i10 = 0; c3_i10 < 2; c3_i10 = c3_i10 + 1) {
    (*c3_b_s)[c3_i10] = c3_s[c3_i10];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
  _sfEvent_ = c3_previousEvent;
  sf_debug_check_for_state_inconsistency(_car_modelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (_adcs_v15_integral_PowerMachineNumber_,
           7,
           1,
           1,
           2,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance.chartNumber),
           &(chartInstance.instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_adcs_v15_integral_PowerMachineNumber_,
            chartInstance.chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (_adcs_v15_integral_PowerMachineNumber_,chartInstance.chartNumber,1);
          sf_debug_set_chart_event_thresholds
            (_adcs_v15_integral_PowerMachineNumber_,
             chartInstance.chartNumber,
             0,
             0,
             0);

          {
            unsigned int dimVector[1];
            dimVector[0]= 7;
            _SFD_SET_DATA_PROPS(0,1,1,0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
                                1.0,0,"x",0,(MexFcnForType)c7_sf_marshall);
          }

          {
            unsigned int dimVector[1];
            dimVector[0]= 7;
            _SFD_SET_DATA_PROPS(1,2,0,1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
                                1.0,0,"xN",0,(MexFcnForType)c7_sf_marshall);
          }

          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of EML Model Coverage */
        _SFD_CV_INIT_EML(0,1,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,181);
        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          real_T (*c7_x)[7];
          real_T (*c7_xN)[7];
          c7_xN = (real_T (*)[7])ssGetOutputPortSignal(chartInstance.S, 1);
          c7_x = (real_T (*)[7])ssGetInputPortSignal(chartInstance.S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, c7_x);
          _SFD_SET_DATA_VALUE_PTR(1U, c7_xN);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration
        (_adcs_v15_integral_PowerMachineNumber_,chartInstance.chartNumber,
         chartInstance.instanceNumber);
    }
  }
}
static void sf_gateway_c6_CSE1_DP(SFc6_CSE1_DPInstanceStruct *chartInstance)
{
  real_T c6_hoistedGlobal;
  real_T c6_u_BT;
  int32_T c6_i0;
  real_T c6_nu[3];
  uint32_T c6_debug_family_var_map[15];
  real_T c6_u;
  real_T c6_a;
  real_T c6_b;
  real_T c6_c;
  real_T c6_d;
  real_T c6_y0;
  real_T c6_a0;
  real_T c6_a1;
  real_T c6_b1;
  real_T c6_c1;
  real_T c6_nargin = 2.0;
  real_T c6_nargout = 1.0;
  real_T c6_F_y;
  real_T c6_x;
  real_T c6_b_x;
  real_T c6_c_x;
  real_T c6_d_x;
  real_T c6_e_x;
  real_T c6_f_x;
  real_T c6_g_x;
  real_T c6_h_x;
  real_T c6_i_x;
  real_T c6_j_x;
  real_T c6_A;
  real_T c6_k_x;
  real_T c6_l_x;
  real_T c6_m_x;
  int32_T c6_i1;
  real_T *c6_b_u_BT;
  real_T *c6_b_F_y;
  real_T (*c6_b_nu)[3];
  c6_b_nu = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c6_b_F_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c6_b_u_BT = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c6_b_u_BT, 0U);
  chartInstance->c6_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  c6_hoistedGlobal = *c6_b_u_BT;
  c6_u_BT = c6_hoistedGlobal;
  for (c6_i0 = 0; c6_i0 < 3; c6_i0++) {
    c6_nu[c6_i0] = (*c6_b_nu)[c6_i0];
  }

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

  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 21);
  c6_a0 = 0.7561;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 22);
  c6_a1 = 0.3075;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 23);
  c6_b1 = -10.22;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 24);
  c6_c1 = 2.947;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 25);
  c6_i_x = -10.22 * c6_u + c6_c1;
  c6_j_x = c6_i_x;
  c6_j_x = muDoubleScalarAtan(c6_j_x);
  c6_A = c6_y0 * (c6_a0 + 0.3075 * c6_j_x);
  c6_k_x = c6_A;
  c6_l_x = c6_k_x;
  c6_m_x = c6_l_x;
  c6_F_y = c6_m_x / 1.1385;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -25);
  _SFD_SYMBOL_SCOPE_POP();
  *c6_b_F_y = c6_F_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CSE1_DPMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c6_b_F_y, 1U);
  for (c6_i1 = 0; c6_i1 < 3; c6_i1++) {
    _SFD_DATA_RANGE_CHECK((*c6_b_nu)[c6_i1], 2U);
  }
}
static void sf_c25_CusakisME4901arcs2(SFc25_CusakisME4901arcs2InstanceStruct
  *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(_CusakisME4901arcs2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c1_Model_justmodel2(SFc1_Model_justmodel2InstanceStruct
  *chartInstance)
{
  int32_T c1_i2;
  real_T c1_hoistedGlobal;
  real_T c1_time;
  uint32_T c1_debug_family_var_map[5];
  real_T c1_surge;
  real_T c1_nargin = 1.0;
  real_T c1_nargout = 1.0;
  real_T c1_Force[3];
  int32_T c1_i3;
  real_T c1_b;
  real_T c1_y;
  real_T c1_b_b;
  real_T c1_b_y;
  real_T c1_x;
  real_T c1_b_x;
  real_T c1_c_b;
  real_T c1_c_y;
  real_T c1_d_b;
  real_T c1_d_y;
  real_T c1_c_x;
  real_T c1_d_x;
  real_T c1_e_b;
  real_T c1_e_y;
  real_T c1_e_x;
  real_T c1_f_x;
  real_T c1_f_y;
  real_T c1_varargin_1;
  real_T c1_varargin_2;
  real_T c1_g_x;
  real_T c1_h_x;
  real_T c1_xk;
  real_T c1_i_x;
  int32_T c1_i4;
  real_T *c1_b_time;
  real_T (*c1_b_Force)[3];
  c1_b_Force = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_time = (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_time, 0U);
  for (c1_i2 = 0; c1_i2 < 3; c1_i2++) {
    _SFD_DATA_RANGE_CHECK((*c1_b_Force)[c1_i2], 1U);
  }

  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_time;
  c1_time = c1_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 5U, 5U, c1_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_surge, 0U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 1U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 2U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_time, 3U, c1_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c1_Force, 4U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 3);
  for (c1_i3 = 0; c1_i3 < 3; c1_i3++) {
    c1_Force[c1_i3] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
  c1_b = c1_time;
  c1_y = 0.066666666666666666 * c1_b;
  c1_b_b = c1_time;
  c1_b_y = 0.5 * c1_b_b;
  c1_x = c1_b_y;
  c1_b_x = c1_x;
  c1_b_x = muDoubleScalarCos(c1_b_x);
  c1_c_b = c1_b_x;
  c1_c_y = 10.0 * c1_c_b;
  c1_d_b = c1_time;
  c1_d_y = 0.3 * c1_d_b;
  c1_c_x = c1_d_y + 0.32;
  c1_d_x = c1_c_x;
  c1_d_x = muDoubleScalarSin(c1_d_x);
  c1_e_b = c1_d_x;
  c1_e_y = 14.0 * c1_e_b;
  c1_e_x = c1_c_y + c1_e_y;
  c1_f_x = c1_e_x;
  c1_f_y = muDoubleScalarAbs(c1_f_x);
  c1_varargin_1 = c1_y + c1_f_y;
  c1_varargin_2 = c1_varargin_1;
  c1_g_x = c1_varargin_2;
  c1_h_x = c1_g_x;
  c1_eml_scalar_eg(chartInstance);
  c1_xk = c1_h_x;
  c1_i_x = c1_xk;
  c1_eml_scalar_eg(chartInstance);
  c1_surge = muDoubleScalarMin(c1_i_x, 40.0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
  c1_Force[0] = c1_surge;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -7);
  _SFD_SYMBOL_SCOPE_POP();
  for (c1_i4 = 0; c1_i4 < 3; c1_i4++) {
    (*c1_b_Force)[c1_i4] = c1_Force[c1_i4];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_Model_justmodel2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_gateway_c39_CSE1_Oculus_gesture
  (SFc39_CSE1_Oculus_gestureInstanceStruct *chartInstance)
{
  int32_T c39_i2;
  real_T c39_K_p1[3];
  uint32_T c39_debug_family_var_map[4];
  real_T c39_nargin = 1.0;
  real_T c39_nargout = 1.0;
  real_T c39_K_p[9];
  int32_T c39_i3;
  real_T c39_v[3];
  int32_T c39_i4;
  int32_T c39_j;
  int32_T c39_b_j;
  int32_T c39_i5;
  int32_T c39_i6;
  int32_T c39_i7;
  real_T (*c39_b_K_p)[9];
  real_T (*c39_b_K_p1)[3];
  c39_b_K_p1 = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  c39_b_K_p = (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, 25U, chartInstance->c39_sfEvent);
  chartInstance->c39_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 25U, chartInstance->c39_sfEvent);
  for (c39_i2 = 0; c39_i2 < 3; c39_i2++) {
    c39_K_p1[c39_i2] = (*c39_b_K_p1)[c39_i2];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 4U, 4U, c39_debug_family_names,
    c39_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c39_nargin, 0U, c39_c_sf_marshallOut,
    c39_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c39_nargout, 1U, c39_c_sf_marshallOut,
    c39_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c39_K_p1, 2U, c39_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c39_K_p, 3U, c39_sf_marshallOut,
    c39_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c39_sfEvent, 4);
  for (c39_i3 = 0; c39_i3 < 3; c39_i3++) {
    c39_v[c39_i3] = c39_K_p1[c39_i3];
  }

  for (c39_i4 = 0; c39_i4 < 9; c39_i4++) {
    c39_K_p[c39_i4] = 0.0;
  }

  for (c39_j = 1; c39_j < 4; c39_j++) {
    c39_b_j = c39_j;
    c39_K_p[(_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
               (real_T)c39_b_j), 1, 3, 1, 0) + 3 * (_SFD_EML_ARRAY_BOUNDS_CHECK(
               "", (int32_T)_SFD_INTEGER_CHECK("", (real_T)c39_b_j), 1, 3, 2, 0)
              - 1)) - 1] = c39_v[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      _SFD_INTEGER_CHECK("", (real_T)c39_b_j), 1, 3, 1, 0) - 1];
  }

  _SFD_EML_CALL(0U, chartInstance->c39_sfEvent, -4);
  _SFD_SYMBOL_SCOPE_POP();
  for (c39_i5 = 0; c39_i5 < 9; c39_i5++) {
    (*c39_b_K_p)[c39_i5] = c39_K_p[c39_i5];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 25U, chartInstance->c39_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CSE1_Oculus_gestureMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  for (c39_i6 = 0; c39_i6 < 9; c39_i6++) {
    _SFD_DATA_RANGE_CHECK((*c39_b_K_p)[c39_i6], 0U);
  }

  for (c39_i7 = 0; c39_i7 < 3; c39_i7++) {
    _SFD_DATA_RANGE_CHECK((*c39_b_K_p1)[c39_i7], 1U);
  }
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc9_CusakisME4901arcs2InstanceStruct *chartInstance;
    chartInstance = (SFc9_CusakisME4901arcs2InstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _CusakisME4901arcs2MachineNumber_,
           9,
           1,
           1,
           5,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_CusakisME4901arcs2MachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_CusakisME4901arcs2MachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _CusakisME4901arcs2MachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,2,0,1,"u");
          _SFD_SET_DATA_PROPS(1,2,0,1,"but");
          _SFD_SET_DATA_PROPS(2,1,1,0,"Axes");
          _SFD_SET_DATA_PROPS(3,1,1,0,"Buttons");
          _SFD_SET_DATA_PROPS(4,2,0,1,"j");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,10,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,732);
        _SFD_CV_INIT_EML_IF(0,1,0,176,190,212,391);
        _SFD_CV_INIT_EML_IF(0,1,1,212,229,261,391);
        _SFD_CV_INIT_EML_IF(0,1,2,261,280,304,391);
        _SFD_CV_INIT_EML_IF(0,1,3,304,322,349,391);
        _SFD_CV_INIT_EML_IF(0,1,4,393,409,415,468);
        _SFD_CV_INIT_EML_IF(0,1,5,420,436,447,464);
        _SFD_CV_INIT_EML_IF(0,1,6,470,486,519,728);
        _SFD_CV_INIT_EML_IF(0,1,7,519,539,572,728);
        _SFD_CV_INIT_EML_IF(0,1,8,572,592,625,728);
        _SFD_CV_INIT_EML_IF(0,1,9,625,645,678,728);
        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 2;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c9_c_sf_marshallOut,(MexInFcnForType)
            c9_c_sf_marshallIn);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 4;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c9_b_sf_marshallOut,(MexInFcnForType)
            c9_b_sf_marshallIn);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 5;
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c9_e_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 10;
          _SFD_SET_DATA_COMPILED_PROPS(3,SF_UINT8,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c9_d_sf_marshallOut,(MexInFcnForType)NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c9_sf_marshallOut,(MexInFcnForType)c9_sf_marshallIn);

        {
          real_T *c9_j;
          real_T (*c9_u)[2];
          real_T (*c9_but)[4];
          real_T (*c9_Axes)[5];
          boolean_T (*c9_Buttons)[10];
          c9_j = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
          c9_Buttons = (boolean_T (*)[10])ssGetInputPortSignal(chartInstance->S,
            1);
          c9_Axes = (real_T (*)[5])ssGetInputPortSignal(chartInstance->S, 0);
          c9_but = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 2);
          c9_u = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, *c9_u);
          _SFD_SET_DATA_VALUE_PTR(1U, *c9_but);
          _SFD_SET_DATA_VALUE_PTR(2U, *c9_Axes);
          _SFD_SET_DATA_VALUE_PTR(3U, *c9_Buttons);
          _SFD_SET_DATA_VALUE_PTR(4U, c9_j);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _CusakisME4901arcs2MachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
static void sf_c9_CusakisME4901arcs2(SFc9_CusakisME4901arcs2InstanceStruct
  *chartInstance)
{
  int32_T c9_i4;
  int32_T c9_i5;
  int32_T c9_i6;
  int32_T c9_i7;
  int32_T c9_i8;
  real_T c9_Axes[5];
  int32_T c9_i9;
  boolean_T c9_Buttons[10];
  uint32_T c9_debug_family_var_map[7];
  real_T c9_nargin = 2.0;
  real_T c9_nargout = 3.0;
  real_T c9_u[2];
  real_T c9_but[4];
  real_T c9_j;
  int32_T c9_i10;
  int32_T c9_i11;
  int32_T c9_i12;
  int32_T c9_i13;
  int32_T c9_i14;
  int32_T c9_i15;
  static real_T c9_dv2[4] = { 1.0, 0.0, 0.0, 0.0 };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  *c9_b_j = c9_j;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_CusakisME4901arcs2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c7_adcs_v15_integral_Power(void)
{
  int32_T c7_i3;
  int32_T c7_i4;
  int32_T c7_previousEvent;
  int32_T c7_i5;
  real_T c7_x[7];
  real_T c7_nargout = 1.0;
  real_T c7_nargin = 1.0;
  real_T c7_q[4];
  real_T c7_xN[7];
  int32_T c7_i6;
  int32_T c7_i7;
  real_T c7_A[4];
  int32_T c7_i8;
  real_T c7_a[4];
  int32_T c7_i9;
  real_T c7_b[4];
  int32_T c7_i10;
  real_T c7_b_a[4];
  int32_T c7_i11;
  real_T c7_b_b[4];
  int32_T c7_i12;
  real_T c7_b_x[4];
  int32_T c7_i13;
  real_T c7_y[4];
  int32_T c7_i14;
  real_T c7_c_x[4];
  int32_T c7_i15;
  real_T c7_b_y[4];
  int32_T c7_i16;
  real_T c7_d_x[4];
  int32_T c7_i17;
  real_T c7_c_y[4];
  int32_T c7_i18;
  real_T c7_e_x[4];
  int32_T c7_i19;
  real_T c7_d_y[4];
  real_T c7_f_x;
  real_T c7_B;
  real_T c7_g_x;
  int32_T c7_i20;
  real_T c7_h_x[4];
  real_T c7_e_y;
  int32_T c7_i21;
  real_T c7_i_x[4];
  real_T c7_f_y;
  int32_T c7_i22;
  real_T c7_j_x[4];
  real_T c7_g_y;
  int32_T c7_i23;
  int32_T c7_i24;
  int32_T c7_i25;
  int32_T c7_i26;
  real_T (*c7_b_xN)[7];
  real_T (*c7_k_x)[7];
  c7_b_xN = (real_T (*)[7])ssGetOutputPortSignal(chartInstance.S, 1);
  c7_k_x = (real_T (*)[7])ssGetInputPortSignal(chartInstance.S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,5);
  for (c7_i3 = 0; c7_i3 < 7; c7_i3 = c7_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c7_k_x)[c7_i3], 0U);
  }

  for (c7_i4 = 0; c7_i4 < 7; c7_i4 = c7_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c7_b_xN)[c7_i4], 1U);
  }

  c7_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,5);
  for (c7_i5 = 0; c7_i5 < 7; c7_i5 = c7_i5 + 1) {
    c7_x[c7_i5] = (*c7_k_x)[c7_i5];
  }

  sf_debug_symbol_scope_push(5U, 0U);
  sf_debug_symbol_scope_add("nargout", &c7_nargout, c7_c_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c7_nargin, c7_c_sf_marshall);
  sf_debug_symbol_scope_add("q", &c7_q, c7_b_sf_marshall);
  sf_debug_symbol_scope_add("xN", &c7_xN, c7_sf_marshall);
  sf_debug_symbol_scope_add("x", &c7_x, c7_sf_marshall);
  CV_EML_FCN(0, 0);

  /*  This block gives DCM for converting from ECI to ORBIT frames */
  /*  inputs: state vector in ECI */
  /*  output: DCM */
  _SFD_EML_CALL(0,6);
  for (c7_i6 = 0; c7_i6 < 4; c7_i6 = c7_i6 + 1) {
    c7_q[c7_i6] = c7_x[c7_i6];
  }

  _SFD_EML_CALL(0,7);
  for (c7_i7 = 0; c7_i7 < 4; c7_i7 = c7_i7 + 1) {
    c7_A[c7_i7] = c7_q[c7_i7];
  }

  for (c7_i8 = 0; c7_i8 < 4; c7_i8 = c7_i8 + 1) {
    c7_a[c7_i8] = c7_q[c7_i8];
  }

  for (c7_i9 = 0; c7_i9 < 4; c7_i9 = c7_i9 + 1) {
    c7_b[c7_i9] = c7_q[c7_i9];
  }

  c7_eml_scalar_eg();
  for (c7_i10 = 0; c7_i10 < 4; c7_i10 = c7_i10 + 1) {
    c7_b_a[c7_i10] = c7_a[c7_i10];
  }

  for (c7_i11 = 0; c7_i11 < 4; c7_i11 = c7_i11 + 1) {
    c7_b_b[c7_i11] = c7_b[c7_i11];
  }

  for (c7_i12 = 0; c7_i12 < 4; c7_i12 = c7_i12 + 1) {
    c7_b_x[c7_i12] = c7_b_a[c7_i12];
  }

  for (c7_i13 = 0; c7_i13 < 4; c7_i13 = c7_i13 + 1) {
    c7_y[c7_i13] = c7_b_b[c7_i13];
  }

  for (c7_i14 = 0; c7_i14 < 4; c7_i14 = c7_i14 + 1) {
    c7_c_x[c7_i14] = c7_b_x[c7_i14];
  }

  for (c7_i15 = 0; c7_i15 < 4; c7_i15 = c7_i15 + 1) {
    c7_b_y[c7_i15] = c7_y[c7_i15];
  }

  for (c7_i16 = 0; c7_i16 < 4; c7_i16 = c7_i16 + 1) {
    c7_d_x[c7_i16] = c7_c_x[c7_i16];
  }

  for (c7_i17 = 0; c7_i17 < 4; c7_i17 = c7_i17 + 1) {
    c7_c_y[c7_i17] = c7_b_y[c7_i17];
  }

  for (c7_i18 = 0; c7_i18 < 4; c7_i18 = c7_i18 + 1) {
    c7_e_x[c7_i18] = c7_d_x[c7_i18];
  }

  for (c7_i19 = 0; c7_i19 < 4; c7_i19 = c7_i19 + 1) {
    c7_d_y[c7_i19] = c7_c_y[c7_i19];
  }

  c7_f_x = c7_ceval_xdot(4, c7_e_x, 1, 1, c7_d_y, 1, 1);
  c7_B = c7_f_x;
  if (c7_B < 0.0) {
    c7_eml_error();
  }

  c7_g_x = c7_B;
  c7_B = c7_g_x;
  c7_B = muDoubleScalarSqrt(c7_B);
  for (c7_i20 = 0; c7_i20 < 4; c7_i20 = c7_i20 + 1) {
    c7_h_x[c7_i20] = c7_A[c7_i20];
  }

  c7_e_y = c7_B;
  if (c7_e_y == 0.0) {
    c7_eml_warning();
  }

  for (c7_i21 = 0; c7_i21 < 4; c7_i21 = c7_i21 + 1) {
    c7_i_x[c7_i21] = c7_h_x[c7_i21];
  }

  c7_f_y = c7_e_y;
  for (c7_i22 = 0; c7_i22 < 4; c7_i22 = c7_i22 + 1) {
    c7_j_x[c7_i22] = c7_i_x[c7_i22];
  }

  c7_g_y = c7_f_y;
  for (c7_i23 = 0; c7_i23 < 4; c7_i23 = c7_i23 + 1) {
    c7_q[c7_i23] = c7_j_x[c7_i23] / c7_g_y;
  }

  _SFD_EML_CALL(0,8);
  for (c7_i24 = 0; c7_i24 < 4; c7_i24 = c7_i24 + 1) {
    c7_xN[c7_i24] = c7_q[c7_i24];
  }

  for (c7_i25 = 0; c7_i25 < 3; c7_i25 = c7_i25 + 1) {
    c7_xN[c7_i25 + 4] = c7_x[c7_i25 + 4];
  }

  _SFD_EML_CALL(0,-8);
  sf_debug_symbol_scope_pop();
  for (c7_i26 = 0; c7_i26 < 7; c7_i26 = c7_i26 + 1) {
    (*c7_b_xN)[c7_i26] = c7_xN[c7_i26];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,5);
  _sfEvent_ = c7_previousEvent;
  sf_debug_check_for_state_inconsistency(_adcs_v15_integral_PowerMachineNumber_,
    chartInstance.chartNumber, chartInstance.
    instanceNumber);
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc10_experiment_lib2InstanceStruct *chartInstance;
    ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
    ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
    chartInstance = (SFc10_experiment_lib2InstanceStruct *)
      chartInfo->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _experiment_lib2MachineNumber_,
           10,
           1,
           1,
           0,
           4,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           (void *)S);

        /* Each instance must initialize ist own list of scripts */
        init_script_number_translation(_experiment_lib2MachineNumber_,
          chartInstance->chartNumber,chartInstance->instanceNumber);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_experiment_lib2MachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _experiment_lib2MachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"V");
          _SFD_SET_DATA_PROPS(1,2,0,1,"out");
          _SFD_SET_DATA_PROPS(2,1,1,0,"val");
          _SFD_SET_DATA_PROPS(3,10,0,0,"a");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,50);

        {
          unsigned int dimVector[1];
          dimVector[0]= 4;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c10_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 4;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c10_sf_marshallOut,(MexInFcnForType)
            c10_sf_marshallIn);
        }

        _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c10_b_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c10_b_sf_marshallOut,(MexInFcnForType)
          c10_b_sf_marshallIn);

        {
          real_T *c10_val;
          real_T (*c10_V)[4];
          real_T (*c10_out)[4];
          c10_val = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
          c10_out = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
          c10_V = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, *c10_V);
          _SFD_SET_DATA_VALUE_PTR(1U, *c10_out);
          _SFD_SET_DATA_VALUE_PTR(2U, c10_val);
          _SFD_SET_DATA_VALUE_PTR(3U, &chartInstance->c10_a);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _experiment_lib2MachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc16_HIL_model_overallInstanceStruct *chartInstance;
    chartInstance = (SFc16_HIL_model_overallInstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _HIL_model_overallMachineNumber_,
           16,
           1,
           1,
           5,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_HIL_model_overallMachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_HIL_model_overallMachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _HIL_model_overallMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"WP");
          _SFD_SET_DATA_PROPS(1,2,0,1,"eta_ref");
          _SFD_SET_DATA_PROPS(2,1,1,0,"L_rope");
          _SFD_SET_DATA_PROPS(3,1,1,0,"L_fast");
          _SFD_SET_DATA_PROPS(4,1,1,0,"Offset_direction");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,330);
        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 2;
          dimVector[1]= 2;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c16_c_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 3;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c16_sf_marshallOut,(MexInFcnForType)
            c16_sf_marshallIn);
        }

        _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c16_b_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c16_b_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c16_b_sf_marshallOut,(MexInFcnForType)NULL);

        {
          real_T *c16_L_rope;
          real_T *c16_L_fast;
          real_T *c16_Offset_direction;
          real_T (*c16_WP)[4];
          real_T (*c16_eta_ref)[3];
          c16_Offset_direction = (real_T *)ssGetInputPortSignal(chartInstance->S,
            3);
          c16_L_fast = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
          c16_L_rope = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
          c16_eta_ref = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
          c16_WP = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, *c16_WP);
          _SFD_SET_DATA_VALUE_PTR(1U, *c16_eta_ref);
          _SFD_SET_DATA_VALUE_PTR(2U, c16_L_rope);
          _SFD_SET_DATA_VALUE_PTR(3U, c16_L_fast);
          _SFD_SET_DATA_VALUE_PTR(4U, c16_Offset_direction);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _HIL_model_overallMachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc3_car_modelInstanceStruct *chartInstance;
    chartInstance = (SFc3_car_modelInstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart(_car_modelMachineNumber_,
          3,
          1,
          1,
          3,
          0,
          0,
          0,
          0,
          0,
          &(chartInstance->chartNumber),
          &(chartInstance->instanceNumber),
          ssGetPath(S),
          (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_car_modelMachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting(_car_modelMachineNumber_,
            chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(_car_modelMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);

          {
            unsigned int dimVector[1];
            dimVector[0]= 4;
            _SFD_SET_DATA_PROPS(0,1,1,0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
                                1.0,0,"X",0,(MexFcnForType)c3_c_sf_marshall);
          }

          {
            unsigned int dimVector[1];
            dimVector[0]= 2;
            _SFD_SET_DATA_PROPS(1,2,0,1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
                                1.0,0,"s",0,(MexFcnForType)c3_sf_marshall);
          }

          {
            unsigned int dimVector[1];
            dimVector[0]= 3;
            _SFD_SET_DATA_PROPS(2,1,1,0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
                                1.0,0,"u",0,(MexFcnForType)c3_b_sf_marshall);
          }

          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of EML Model Coverage */
        _SFD_CV_INIT_EML(0,1,3,0,0,0,0,6,3);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,665);
        _SFD_CV_INIT_EML_IF(0,0,197,219,234,266);
        _SFD_CV_INIT_EML_IF(0,1,397,434,449,489);
        _SFD_CV_INIT_EML_IF(0,2,554,591,606,646);

        {
          static int condStart[] = { 201, 212 };

          static int condEnd[] = { 208, 218 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,0,201,218,2,0,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 401, 418 };

          static int condEnd[] = { 414, 433 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,401,433,2,2,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 558, 575 };

          static int condEnd[] = { 571, 590 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,2,558,590,2,4,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          real_T (*c3_X)[4];
          real_T (*c3_s)[2];
          real_T (*c3_u)[3];
          c3_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
          c3_s = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
          c3_X = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, c3_X);
          _SFD_SET_DATA_VALUE_PTR(1U, c3_s);
          _SFD_SET_DATA_VALUE_PTR(2U, c3_u);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_car_modelMachineNumber_,
        chartInstance->chartNumber,chartInstance->instanceNumber);
    }
  }
}
Exemple #24
0
static void sf_c3_V2A1_2(SFc3_V2A1_2InstanceStruct *chartInstance)
{
  int32_T c3_i2;
  real_T c3_hoistedGlobal;
  real_T c3_b_hoistedGlobal;
  real_T c3_delta;
  real_T c3_hoehe;
  uint32_T c3_debug_family_var_map[9];
  real_T c3_er;
  real_T c3_bogen_delta;
  real_T c3_x;
  real_T c3_y;
  real_T c3_nargin = 2.0;
  real_T c3_nargout = 1.0;
  real_T c3_x0[2];
  real_T c3_a;
  real_T c3_b_y;
  real_T c3_A;
  real_T c3_b_x;
  real_T c3_c_x;
  real_T c3_d_x;
  real_T c3_e_x;
  real_T c3_b_a;
  real_T c3_b;
  real_T c3_f_x;
  real_T c3_g_x;
  real_T c3_c_a;
  real_T c3_b_b;
  int32_T c3_i3;
  real_T c3_u[2];
  const mxArray *c3_c_y = NULL;
  int32_T c3_i4;
  real_T *c3_b_hoehe;
  real_T *c3_b_delta;
  real_T (*c3_b_x0)[2];
  c3_b_hoehe = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_x0 = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_b_delta = (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, 2U, chartInstance->c3_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c3_b_delta, 0U);
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    _SFD_DATA_RANGE_CHECK((*c3_b_x0)[c3_i2], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_b_hoehe, 2U);
  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *c3_b_delta;
  c3_b_hoistedGlobal = *c3_b_hoehe;
  c3_delta = c3_hoistedGlobal;
  c3_hoehe = c3_b_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c3_debug_family_names,
    c3_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_er, 0U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_bogen_delta, 1U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_x, 2U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_y, 3U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargin, 4U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c3_nargout, 5U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c3_delta, 6U, c3_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c3_hoehe, 7U, c3_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c3_x0, 8U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 2);
  c3_er = 6.378E+6;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 3);
  c3_a = c3_delta;
  c3_b_y = c3_a * 3.1415926535897931;
  c3_A = c3_b_y;
  c3_b_x = c3_A;
  c3_c_x = c3_b_x;
  c3_bogen_delta = c3_c_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 4);
  c3_d_x = c3_bogen_delta;
  c3_e_x = c3_d_x;
  c3_e_x = muDoubleScalarCos(c3_e_x);
  c3_b_a = c3_e_x;
  c3_b = c3_er + c3_hoehe;
  c3_x = c3_b_a * c3_b;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  c3_f_x = c3_bogen_delta;
  c3_g_x = c3_f_x;
  c3_g_x = muDoubleScalarSin(c3_g_x);
  c3_c_a = c3_g_x;
  c3_b_b = c3_er + c3_hoehe;
  c3_y = c3_c_a * c3_b_b;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 7);
  c3_x0[0] = c3_x;
  c3_x0[1] = c3_y;
  sf_mex_printf("%s =\\n", "x0");
  for (c3_i3 = 0; c3_i3 < 2; c3_i3++) {
    c3_u[c3_i3] = c3_x0[c3_i3];
  }

  c3_c_y = NULL;
  sf_mex_assign(&c3_c_y, sf_mex_create("y", c3_u, 0, 0U, 1U, 0U, 1, 2), FALSE);
  sf_mex_call_debug("disp", 0U, 1U, 14, c3_c_y);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -7);
  _SFD_SYMBOL_SCOPE_POP();
  for (c3_i4 = 0; c3_i4 < 2; c3_i4++) {
    (*c3_b_x0)[c3_i4] = c3_x0[c3_i4];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_V2A1_2MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
Exemple #25
0
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc3_canudas_goal3InstanceStruct *chartInstance;
    chartInstance = (SFc3_canudas_goal3InstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (_canudas_goal3MachineNumber_,
           3,
           1,
           1,
           8,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_canudas_goal3MachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (_canudas_goal3MachineNumber_,chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(_canudas_goal3MachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,2,0,1,"w");
          _SFD_SET_DATA_PROPS(1,1,1,0,"z");
          _SFD_SET_DATA_PROPS(2,1,1,0,"thetad");
          _SFD_SET_DATA_PROPS(3,1,1,0,"r");
          _SFD_SET_DATA_PROPS(4,2,0,1,"v");
          _SFD_SET_DATA_PROPS(5,1,1,0,"qe");
          _SFD_SET_DATA_PROPS(6,1,1,0,"k1");
          _SFD_SET_DATA_PROPS(7,1,1,0,"k2");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,326);
        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)c3_sf_marshallIn);

        {
          unsigned int dimVector[1];
          dimVector[0]= 2;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c3_c_sf_marshallOut,(MexInFcnForType)NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)c3_sf_marshallIn);

        {
          unsigned int dimVector[1];
          dimVector[0]= 3;
          _SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c3_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(6,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(7,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_sf_marshallOut,(MexInFcnForType)NULL);

        {
          real_T *c3_w;
          real_T *c3_thetad;
          real_T *c3_r;
          real_T *c3_v;
          real_T *c3_k1;
          real_T *c3_k2;
          real_T (*c3_z)[2];
          real_T (*c3_qe)[3];
          c3_k2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
          c3_k1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
          c3_qe = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 3);
          c3_v = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
          c3_r = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
          c3_thetad = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
          c3_z = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
          c3_w = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, c3_w);
          _SFD_SET_DATA_VALUE_PTR(1U, *c3_z);
          _SFD_SET_DATA_VALUE_PTR(2U, c3_thetad);
          _SFD_SET_DATA_VALUE_PTR(3U, c3_r);
          _SFD_SET_DATA_VALUE_PTR(4U, c3_v);
          _SFD_SET_DATA_VALUE_PTR(5U, *c3_qe);
          _SFD_SET_DATA_VALUE_PTR(6U, c3_k1);
          _SFD_SET_DATA_VALUE_PTR(7U, c3_k2);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_canudas_goal3MachineNumber_,
        chartInstance->chartNumber,chartInstance->instanceNumber);
    }
  }
}
Exemple #26
0
static void chart_debug_initialization(SimStruct *S, unsigned int fullDebuggerInitialization)
{
   if(!sim_mode_is_rtw_gen(S)) {
        SFc2_tablerot_idInstanceStruct *chartInstance;
        chartInstance = (SFc2_tablerot_idInstanceStruct *) ((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
     if(ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
        /* do this only if simulation is starting */
	{
	unsigned int chartAlreadyPresent;
	chartAlreadyPresent = sf_debug_initialize_chart(_tablerot_idMachineNumber_,
                                                   2,
                                                   1,
                                                   1,
                                                   2,
                                                   0,
                                                   0,
                                                   0,
                                                   0,
                                                   0,
                                                   &(chartInstance->chartNumber),
                                                   &(chartInstance->instanceNumber),
                                                   ssGetPath(S),
                                                   (void *)S);
	if(chartAlreadyPresent==0) {
	/* this is the first instance */
     init_script_number_translation(_tablerot_idMachineNumber_,chartInstance->chartNumber);
 sf_debug_set_chart_disable_implicit_casting(_tablerot_idMachineNumber_,chartInstance->chartNumber,1);
 sf_debug_set_chart_event_thresholds(_tablerot_idMachineNumber_,
                                     chartInstance->chartNumber,
                                     0,
                                     0,
                                     0);
 
		    {
		unsigned int dimVector[1];
			    dimVector[0]= 6;
	_SFD_SET_DATA_PROPS(0,1,1,0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,1.0,0,"u",0,(MexFcnForType)c2_b_sf_marshall);
		    }
		    {
		unsigned int dimVector[1];
			    dimVector[0]= 3;
	_SFD_SET_DATA_PROPS(1,2,0,1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,1.0,0,"y",0,(MexFcnForType)c2_sf_marshall);
		    }
	_SFD_STATE_INFO(0,0,2);
	_SFD_CH_SUBSTATE_COUNT(0);
	_SFD_CH_SUBSTATE_DECOMP(0);
	
	}
 _SFD_CV_INIT_CHART(0,0,0,0);
	{
	    _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
	}

     _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);


 /* Initialization of EML Model Coverage */
 _SFD_CV_INIT_EML(0,1,0,0,0,0,0,0,0);
 _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,38);
	_SFD_TRANS_COV_WTS(0,0,0,1,0);
	if(chartAlreadyPresent==0)
{
		_SFD_TRANS_COV_MAPS(0,
		0,NULL,NULL,
		0,NULL,NULL,
		1,NULL,NULL,
		0,NULL,NULL);
}

{
real_T (*c2_u)[6];
real_T (*c2_y)[3];
c2_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c2_u = (real_T (*)[6])ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, c2_u);
_SFD_SET_DATA_VALUE_PTR(1U, c2_y);
}
}
     } else {
        sf_debug_reset_current_state_configuration(_tablerot_idMachineNumber_,chartInstance->chartNumber,chartInstance->instanceNumber);
     }
   }
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc6_CSE1_DPInstanceStruct *chartInstance;
    ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
    ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
    chartInstance = (SFc6_CSE1_DPInstanceStruct *) chartInfo->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _CSE1_DPMachineNumber_,
           6,
           1,
           1,
           0,
           3,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           (void *)S);

        /* Each instance must initialize ist own list of scripts */
        init_script_number_translation(_CSE1_DPMachineNumber_,
          chartInstance->chartNumber,chartInstance->instanceNumber);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_CSE1_DPMachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _CSE1_DPMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"u_BT");
          _SFD_SET_DATA_PROPS(1,2,0,1,"F_y");
          _SFD_SET_DATA_PROPS(2,1,1,0,"nu");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,2,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,535);
        _SFD_CV_INIT_EML_IF(0,1,0,76,92,217,382);
        _SFD_CV_INIT_EML_IF(0,1,1,217,237,362,382);
        _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c6_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c6_sf_marshallOut,(MexInFcnForType)c6_sf_marshallIn);

        {
          unsigned int dimVector[1];
          dimVector[0]= 3;
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c6_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          real_T *c6_u_BT;
          real_T *c6_F_y;
          real_T (*c6_nu)[3];
          c6_nu = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
          c6_F_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
          c6_u_BT = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, c6_u_BT);
          _SFD_SET_DATA_VALUE_PTR(1U, c6_F_y);
          _SFD_SET_DATA_VALUE_PTR(2U, *c6_nu);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _CSE1_DPMachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
Exemple #28
0
static void sf_c3_canudas_goal3(SFc3_canudas_goal3InstanceStruct *chartInstance)
{
  int32_T c3_i0;
  int32_T c3_i1;
  real_T c3_hoistedGlobal;
  real_T c3_b_hoistedGlobal;
  real_T c3_c_hoistedGlobal;
  real_T c3_d_hoistedGlobal;
  int32_T c3_i2;
  real_T c3_z[2];
  real_T c3_thetad;
  real_T c3_r;
  int32_T c3_i3;
  real_T c3_qe[3];
  real_T c3_k1;
  real_T c3_k2;
  uint32_T c3_debug_family_var_map[13];
  real_T c3_b;
  real_T c3_b1;
  real_T c3_b2;
  real_T c3_nargin = 6.0;
  real_T c3_nargout = 2.0;
  real_T c3_w;
  real_T c3_v;
  real_T c3_A;
  real_T c3_B;
  real_T c3_x;
  real_T c3_y;
  real_T c3_b_x;
  real_T c3_b_y;
  real_T c3_c_x;
  real_T c3_d_x;
  real_T c3_b_A;
  real_T c3_b_B;
  real_T c3_e_x;
  real_T c3_c_y;
  real_T c3_f_x;
  real_T c3_d_y;
  real_T c3_e_y;
  real_T c3_a;
  real_T c3_b_b;
  real_T c3_f_y;
  real_T c3_g_x;
  real_T c3_h_x;
  real_T c3_c_B;
  real_T c3_g_y;
  real_T c3_h_y;
  real_T c3_i_y;
  real_T c3_b_a;
  real_T c3_c_b;
  real_T c3_j_y;
  real_T c3_c_A;
  real_T c3_i_x;
  real_T c3_j_x;
  real_T c3_k_y;
  real_T c3_d_B;
  real_T c3_l_y;
  real_T c3_m_y;
  real_T c3_n_y;
  real_T c3_c_a;
  real_T c3_d_b;
  real_T c3_o_y;
  real_T c3_k_x;
  real_T c3_l_x;
  real_T c3_d_a;
  real_T c3_p_y;
  real_T c3_e_a;
  real_T c3_e_b;
  real_T c3_q_y;
  real_T c3_f_a;
  real_T c3_f_b;
  real_T c3_r_y;
  real_T c3_d_A;
  real_T c3_e_B;
  real_T c3_m_x;
  real_T c3_s_y;
  real_T c3_n_x;
  real_T c3_t_y;
  real_T c3_u_y;
  real_T c3_o_x;
  real_T c3_p_x;
  real_T c3_g_a;
  real_T c3_v_y;
  real_T c3_h_a;
  real_T c3_g_b;
  real_T c3_w_y;
  real_T c3_e_A;
  real_T c3_f_B;
  real_T c3_q_x;
  real_T c3_x_y;
  real_T c3_r_x;
  real_T c3_y_y;
  real_T c3_ab_y;
  real_T c3_i_a;
  real_T c3_h_b;
  real_T c3_bb_y;
  real_T c3_j_a;
  real_T c3_i_b;
  real_T c3_k_a;
  real_T c3_j_b;
  real_T c3_cb_y;
  real_T c3_l_a;
  real_T c3_k_b;
  real_T c3_db_y;
  real_T *c3_b_v;
  real_T *c3_b_w;
  real_T *c3_b_k2;
  real_T *c3_b_k1;
  real_T *c3_b_r;
  real_T *c3_b_thetad;
  real_T (*c3_b_qe)[3];
  real_T (*c3_b_z)[2];
  c3_b_k2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
  c3_b_k1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
  c3_b_qe = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 3);
  c3_b_v = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c3_b_r = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c3_b_thetad = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_z = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  c3_b_w = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c3_b_w, 0U);
  for (c3_i0 = 0; c3_i0 < 2; c3_i0++) {
    _SFD_DATA_RANGE_CHECK((*c3_b_z)[c3_i0], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_b_thetad, 2U);
  _SFD_DATA_RANGE_CHECK(*c3_b_r, 3U);
  _SFD_DATA_RANGE_CHECK(*c3_b_v, 4U);
  for (c3_i1 = 0; c3_i1 < 3; c3_i1++) {
    _SFD_DATA_RANGE_CHECK((*c3_b_qe)[c3_i1], 5U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_b_k1, 6U);
  _SFD_DATA_RANGE_CHECK(*c3_b_k2, 7U);
  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *c3_b_thetad;
  c3_b_hoistedGlobal = *c3_b_r;
  c3_c_hoistedGlobal = *c3_b_k1;
  c3_d_hoistedGlobal = *c3_b_k2;
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    c3_z[c3_i2] = (*c3_b_z)[c3_i2];
  }

  c3_thetad = c3_hoistedGlobal;
  c3_r = c3_b_hoistedGlobal;
  for (c3_i3 = 0; c3_i3 < 3; c3_i3++) {
    c3_qe[c3_i3] = (*c3_b_qe)[c3_i3];
  }

  c3_k1 = c3_c_hoistedGlobal;
  c3_k2 = c3_d_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c3_b, 0U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_b1, 1U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_b2, 2U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargin, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargout, 4U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c3_z, 5U, c3_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_thetad, 6U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_r, 7U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c3_qe, 8U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_k1, 9U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_k2, 10U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c3_w, 11U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_v, 12U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 4);
  c3_A = c3_qe[1];
  c3_B = c3_qe[0];
  c3_x = c3_A;
  c3_y = c3_B;
  c3_b_x = c3_x;
  c3_b_y = c3_y;
  c3_b = c3_b_x / c3_b_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  c3_c_x = c3_qe[2];
  c3_d_x = c3_c_x;
  c3_d_x = muDoubleScalarCos(c3_d_x);
  c3_b_A = c3_thetad;
  c3_b_B = c3_b;
  c3_e_x = c3_b_A;
  c3_c_y = c3_b_B;
  c3_f_x = c3_e_x;
  c3_d_y = c3_c_y;
  c3_e_y = c3_f_x / c3_d_y;
  c3_a = c3_d_x;
  c3_b_b = c3_e_y - 1.0;
  c3_f_y = c3_a * c3_b_b;
  c3_g_x = c3_qe[2];
  c3_h_x = c3_g_x;
  c3_h_x = muDoubleScalarSin(c3_h_x);
  c3_c_B = c3_mpower(chartInstance, c3_b);
  c3_g_y = c3_c_B;
  c3_h_y = c3_g_y;
  c3_i_y = 1.0 / c3_h_y;
  c3_b_a = c3_thetad;
  c3_c_b = 1.0 - c3_i_y;
  c3_j_y = c3_b_a * c3_c_b;
  c3_c_A = c3_j_y;
  c3_i_x = c3_c_A;
  c3_j_x = c3_i_x;
  c3_k_y = c3_j_x / 2.0;
  c3_d_B = c3_b;
  c3_l_y = c3_d_B;
  c3_m_y = c3_l_y;
  c3_n_y = 1.0 / c3_m_y;
  c3_c_a = c3_h_x;
  c3_d_b = c3_k_y + c3_n_y;
  c3_o_y = c3_c_a * c3_d_b;
  c3_b1 = c3_f_y + c3_o_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 6);
  c3_k_x = c3_qe[2];
  c3_l_x = c3_k_x;
  c3_l_x = muDoubleScalarCos(c3_l_x);
  c3_d_a = c3_l_x;
  c3_p_y = c3_d_a * 2.0;
  c3_e_a = c3_p_y;
  c3_e_b = c3_b;
  c3_q_y = c3_e_a * c3_e_b;
  c3_f_a = 1.0 + c3_mpower(chartInstance, c3_b);
  c3_f_b = c3_qe[0];
  c3_r_y = c3_f_a * c3_f_b;
  c3_d_A = c3_q_y;
  c3_e_B = c3_r_y;
  c3_m_x = c3_d_A;
  c3_s_y = c3_e_B;
  c3_n_x = c3_m_x;
  c3_t_y = c3_s_y;
  c3_u_y = c3_n_x / c3_t_y;
  c3_o_x = c3_qe[2];
  c3_p_x = c3_o_x;
  c3_p_x = muDoubleScalarSin(c3_p_x);
  c3_g_a = c3_p_x;
  c3_v_y = c3_g_a * 2.0;
  c3_h_a = 1.0 + c3_mpower(chartInstance, c3_b);
  c3_g_b = c3_qe[0];
  c3_w_y = c3_h_a * c3_g_b;
  c3_e_A = c3_v_y;
  c3_f_B = c3_w_y;
  c3_q_x = c3_e_A;
  c3_x_y = c3_f_B;
  c3_r_x = c3_q_x;
  c3_y_y = c3_x_y;
  c3_ab_y = c3_r_x / c3_y_y;
  c3_b2 = c3_u_y - c3_ab_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 8);
  c3_i_a = -c3_k1;
  c3_h_b = c3_b1;
  c3_bb_y = c3_i_a * c3_h_b;
  c3_j_a = c3_bb_y;
  c3_i_b = c3_z[0];
  c3_v = c3_j_a * c3_i_b;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
  c3_k_a = -c3_b2;
  c3_j_b = c3_v;
  c3_cb_y = c3_k_a * c3_j_b;
  c3_l_a = c3_k2;
  c3_k_b = c3_z[1];
  c3_db_y = c3_l_a * c3_k_b;
  c3_w = c3_cb_y - c3_db_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -9);
  sf_debug_symbol_scope_pop();
  *c3_b_w = c3_w;
  *c3_b_v = c3_v;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  sf_debug_check_for_state_inconsistency(_canudas_goal3MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc25_CusakisME4901arcs2InstanceStruct *chartInstance;
    chartInstance = (SFc25_CusakisME4901arcs2InstanceStruct *) ((ChartInfoStruct
      *)(ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _CusakisME4901arcs2MachineNumber_,
           25,
           1,
           1,
           5,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_CusakisME4901arcs2MachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_CusakisME4901arcs2MachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _CusakisME4901arcs2MachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"u");
          _SFD_SET_DATA_PROPS(1,10,0,0,"mt");
          _SFD_SET_DATA_PROPS(2,2,0,1,"a");
          _SFD_SET_DATA_PROPS(3,10,0,0,"mb");
          _SFD_SET_DATA_PROPS(4,10,0,0,"m");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,162);
        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          unsigned int dimVector[1];
          dimVector[0]= 3;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c25_c_sf_marshallOut,(MexInFcnForType)NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c25_b_sf_marshallOut,(MexInFcnForType)
          c25_b_sf_marshallIn);

        {
          unsigned int dimVector[1];
          dimVector[0]= 6;
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c25_sf_marshallOut,(MexInFcnForType)
            c25_sf_marshallIn);
        }

        _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c25_b_sf_marshallOut,(MexInFcnForType)
          c25_b_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c25_b_sf_marshallOut,(MexInFcnForType)
          c25_b_sf_marshallIn);

        {
          real_T (*c25_u)[3];
          real_T (*c25_a)[6];
          c25_a = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
          c25_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, *c25_u);
          _SFD_SET_DATA_VALUE_PTR(1U, &chartInstance->c25_mt);
          _SFD_SET_DATA_VALUE_PTR(2U, *c25_a);
          _SFD_SET_DATA_VALUE_PTR(3U, &chartInstance->c25_mb);
          _SFD_SET_DATA_VALUE_PTR(4U, &chartInstance->c25_m);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _CusakisME4901arcs2MachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}
Exemple #30
0
static void sf_c3_ErdMond(SFc3_ErdMondInstanceStruct *chartInstance)
{
  int32_T c3_i2;
  int32_T c3_i3;
  int32_T c3_i4;
  real_T c3_xAktuell[2];
  uint32_T c3_debug_family_var_map[16];
  real_T c3_xE[2];
  real_T c3_eSE[2];
  real_T c3_xM[2];
  real_T c3_vSM[2];
  real_T c3_rSM;
  real_T c3_eSM[2];
  real_T c3_r;
  real_T c3_mE;
  real_T c3_mM;
  real_T c3_G;
  real_T c3_F_SE[2];
  real_T c3_F_SM[2];
  real_T c3_nargin = 1.0;
  real_T c3_nargout = 1.0;
  real_T c3_a[2];
  int32_T c3_i5;
  real_T c3_A[2];
  int32_T c3_i6;
  real_T c3_b_xAktuell[2];
  real_T c3_B;
  real_T c3_y;
  real_T c3_b_y;
  int32_T c3_i7;
  int32_T c3_i8;
  int32_T c3_i9;
  int32_T c3_i10;
  int32_T c3_i11;
  int32_T c3_i12;
  real_T c3_b_vSM[2];
  int32_T c3_i13;
  int32_T c3_i14;
  real_T c3_c_vSM[2];
  real_T c3_b_B;
  real_T c3_c_y;
  real_T c3_d_y;
  int32_T c3_i15;
  int32_T c3_i16;
  real_T c3_c_xAktuell[2];
  real_T c3_c_B;
  real_T c3_e_y;
  real_T c3_f_y;
  real_T c3_g_y;
  real_T c3_b_a;
  int32_T c3_i17;
  int32_T c3_i18;
  real_T c3_d_B;
  real_T c3_h_y;
  real_T c3_i_y;
  real_T c3_j_y;
  real_T c3_c_a;
  int32_T c3_i19;
  int32_T c3_i20;
  int32_T c3_i21;
  int32_T c3_i22;
  real_T (*c3_d_a)[2];
  real_T (*c3_d_xAktuell)[2];
  c3_d_a = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_d_xAktuell = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    _SFD_DATA_RANGE_CHECK((*c3_d_xAktuell)[c3_i2], 0U);
  }

  for (c3_i3 = 0; c3_i3 < 2; c3_i3++) {
    _SFD_DATA_RANGE_CHECK((*c3_d_a)[c3_i3], 1U);
  }

  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  for (c3_i4 = 0; c3_i4 < 2; c3_i4++) {
    c3_xAktuell[c3_i4] = (*c3_d_xAktuell)[c3_i4];
  }

  sf_debug_symbol_scope_push_eml(0U, 16U, 16U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c3_xE, 0U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_eSE, 1U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_xM, 2U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_vSM, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_rSM, 4U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_eSM, 5U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_r, 6U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c3_mE, 7U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_mM, 8U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_G, 9U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_F_SE, 10U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_F_SM, 11U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargin, 12U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargout, 13U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c3_xAktuell, 14U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_a, 15U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 4);
  for (c3_i5 = 0; c3_i5 < 2; c3_i5++) {
    c3_A[c3_i5] = c3_xAktuell[c3_i5];
  }

  for (c3_i6 = 0; c3_i6 < 2; c3_i6++) {
    c3_b_xAktuell[c3_i6] = c3_xAktuell[c3_i6];
  }

  c3_B = c3_norm(chartInstance, c3_b_xAktuell);
  c3_y = c3_B;
  c3_b_y = c3_y;
  for (c3_i7 = 0; c3_i7 < 2; c3_i7++) {
    c3_xE[c3_i7] = c3_A[c3_i7] / c3_b_y;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  for (c3_i8 = 0; c3_i8 < 2; c3_i8++) {
    c3_A[c3_i8] = c3_xE[c3_i8];
  }

  for (c3_i9 = 0; c3_i9 < 2; c3_i9++) {
    c3_eSE[c3_i9] = -c3_A[c3_i9];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 7);
  for (c3_i10 = 0; c3_i10 < 2; c3_i10++) {
    c3_xM[c3_i10] = -3.8E+8 * (real_T)c3_i10;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 8);
  for (c3_i11 = 0; c3_i11 < 2; c3_i11++) {
    c3_vSM[c3_i11] = c3_xM[c3_i11] - c3_xAktuell[c3_i11];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
  for (c3_i12 = 0; c3_i12 < 2; c3_i12++) {
    c3_b_vSM[c3_i12] = c3_vSM[c3_i12];
  }

  c3_rSM = c3_norm(chartInstance, c3_b_vSM);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 10);
  for (c3_i13 = 0; c3_i13 < 2; c3_i13++) {
    c3_A[c3_i13] = c3_vSM[c3_i13];
  }

  for (c3_i14 = 0; c3_i14 < 2; c3_i14++) {
    c3_c_vSM[c3_i14] = c3_vSM[c3_i14];
  }

  c3_b_B = c3_norm(chartInstance, c3_c_vSM);
  c3_c_y = c3_b_B;
  c3_d_y = c3_c_y;
  for (c3_i15 = 0; c3_i15 < 2; c3_i15++) {
    c3_eSM[c3_i15] = c3_A[c3_i15] / c3_d_y;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 12);
  for (c3_i16 = 0; c3_i16 < 2; c3_i16++) {
    c3_c_xAktuell[c3_i16] = c3_xAktuell[c3_i16];
  }

  c3_r = c3_norm(chartInstance, c3_c_xAktuell);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 14);
  c3_mE = 5.9736000000000006E+24;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 15);
  c3_mM = 7.348E+22;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 16);
  c3_G = 6.6743E-11;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 18);
  c3_c_B = c3_mpower(chartInstance, c3_r);
  c3_e_y = c3_c_B;
  c3_f_y = c3_e_y;
  c3_g_y = 3.986959848E+14 / c3_f_y;
  c3_b_a = c3_g_y;
  for (c3_i17 = 0; c3_i17 < 2; c3_i17++) {
    c3_A[c3_i17] = c3_eSE[c3_i17];
  }

  for (c3_i18 = 0; c3_i18 < 2; c3_i18++) {
    c3_F_SE[c3_i18] = c3_b_a * c3_A[c3_i18];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 19);
  c3_d_B = c3_mpower(chartInstance, c3_rSM);
  c3_h_y = c3_d_B;
  c3_i_y = c3_h_y;
  c3_j_y = 4.904275639999999E+12 / c3_i_y;
  c3_c_a = c3_j_y;
  for (c3_i19 = 0; c3_i19 < 2; c3_i19++) {
    c3_A[c3_i19] = c3_eSM[c3_i19];
  }

  for (c3_i20 = 0; c3_i20 < 2; c3_i20++) {
    c3_F_SM[c3_i20] = c3_c_a * c3_A[c3_i20];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 21);
  for (c3_i21 = 0; c3_i21 < 2; c3_i21++) {
    c3_a[c3_i21] = c3_F_SE[c3_i21] + c3_F_SM[c3_i21];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -21);
  sf_debug_symbol_scope_pop();
  for (c3_i22 = 0; c3_i22 < 2; c3_i22++) {
    (*c3_d_a)[c3_i22] = c3_a[c3_i22];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  sf_debug_check_for_state_inconsistency(_ErdMondMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}