예제 #1
0
static void c9_chartstep_c9_Array(SFc9_ArrayInstanceStruct *chartInstance)
{
  real_T c9_hoistedGlobal;
  real_T c9_b_hoistedGlobal;
  real_T c9_c_hoistedGlobal;
  real_T c9_V;
  real_T c9_Radiacion;
  real_T c9_Temp;
  uint32_T c9_debug_family_var_map[23];
  real_T c9_q;
  real_T c9_K;
  real_T c9_n;
  real_T c9_T;
  real_T c9_Rs;
  real_T c9_Rp;
  real_T c9_Vt;
  real_T c9_Ns;
  real_T c9_Vc;
  real_T c9_Isc;
  real_T c9_Alfa;
  real_T c9_Iph;
  real_T c9_Voc_ref;
  real_T c9_Beta;
  real_T c9_Voc;
  real_T c9_Io;
  real_T c9_Ir;
  real_T c9_nargin = 3.0;
  real_T c9_nargout = 1.0;
  real_T c9_I;
  real_T c9_b;
  real_T c9_y;
  real_T c9_A;
  real_T c9_x;
  real_T c9_b_x;
  real_T c9_c_x;
  real_T c9_d_x;
  real_T c9_b_b;
  real_T c9_b_y;
  real_T c9_b_A;
  real_T c9_e_x;
  real_T c9_f_x;
  real_T c9_c_y;
  real_T c9_c_b;
  real_T c9_d_y;
  real_T c9_a;
  real_T c9_d_b;
  real_T c9_e_b;
  real_T c9_e_y;
  real_T c9_f_b;
  real_T c9_c_A;
  real_T c9_B;
  real_T c9_g_x;
  real_T c9_f_y;
  real_T c9_h_x;
  real_T c9_g_y;
  real_T c9_h_y;
  real_T c9_i_x;
  real_T c9_j_x;
  real_T c9_b_B;
  real_T c9_i_y;
  real_T c9_j_y;
  int32_T c9_i;
  real_T c9_k_x;
  real_T c9_k_y;
  real_T c9_l_x;
  real_T c9_l_y;
  real_T c9_z;
  real_T c9_m_x;
  real_T c9_n_x;
  real_T c9_d_A;
  real_T c9_o_x;
  real_T c9_p_x;
  real_T c9_m_y;
  real_T c9_n_y;
  real_T c9_o_y;
  real_T c9_b_z;
  real_T c9_b_a;
  real_T c9_g_b;
  real_T c9_p_y;
  real_T c9_q_x;
  real_T c9_q_y;
  real_T c9_r_x;
  real_T c9_r_y;
  real_T c9_c_z;
  real_T c9_s_x;
  real_T c9_t_x;
  real_T c9_u_x;
  real_T c9_s_y;
  real_T c9_v_x;
  real_T c9_t_y;
  real_T c9_d_z;
  real_T *c9_b_Temp;
  real_T *c9_b_Radiacion;
  real_T *c9_b_V;
  real_T *c9_b_I;
  c9_b_Temp = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c9_b_Radiacion = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c9_b_I = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c9_b_V = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  c9_hoistedGlobal = *c9_b_V;
  c9_b_hoistedGlobal = *c9_b_Radiacion;
  c9_c_hoistedGlobal = *c9_b_Temp;
  c9_V = c9_hoistedGlobal;
  c9_Radiacion = c9_b_hoistedGlobal;
  c9_Temp = c9_c_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 23U, 23U, c9_debug_family_names,
    c9_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c9_q, 0U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_K, 1U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_n, 2U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_T, 3U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Rs, 4U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Rp, 5U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Vt, 6U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Ns, 7U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Vc, 8U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Isc, 9U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Alfa, 10U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Iph, 11U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Voc_ref, 12U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Beta, 13U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Voc, 14U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_Io, 15U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_Ir, 16U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_nargin, 17U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_nargout, 18U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_V, 19U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Radiacion, 20U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Temp, 21U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_I, 22U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 3);
  c9_q = 1.602176E-19;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 5);
  c9_K = 1.3806488E-23;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 7);
  c9_n = 1.3;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 9);
  c9_T = 273.15 + c9_Temp;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 11);
  c9_Rs = 0.015;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 13);
  c9_Rp = 100.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 15);
  c9_b = c9_T;
  c9_y = 1.79484344E-23 * c9_b;
  c9_A = c9_y;
  c9_x = c9_A;
  c9_b_x = c9_x;
  c9_Vt = c9_b_x / 1.602176E-19;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 16);
  c9_Ns = 36.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 17);
  c9_c_x = c9_V;
  c9_d_x = c9_c_x;
  c9_Vc = c9_d_x / 36.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 19);
  c9_Isc = 5.433;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 20);
  c9_Alfa = 0.00037;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 22);
  c9_b_b = c9_Radiacion;
  c9_b_y = 5.433 * c9_b_b;
  c9_b_A = c9_b_y;
  c9_e_x = c9_b_A;
  c9_f_x = c9_e_x;
  c9_c_y = c9_f_x / 1000.0;
  c9_c_b = c9_Temp - 25.0;
  c9_d_y = 0.00037 * c9_c_b;
  c9_a = c9_c_y;
  c9_d_b = 1.0 + c9_d_y;
  c9_Iph = c9_a * c9_d_b;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 24);
  c9_Voc_ref = 0.6166666666666667;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 25);
  c9_Beta = -0.0034000000000000002;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 26);
  c9_e_b = c9_Temp - 25.0;
  c9_e_y = -0.0034000000000000002 * c9_e_b;
  c9_f_b = 1.0 + c9_e_y;
  c9_Voc = 0.6166666666666667 * c9_f_b;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 32);
  c9_c_A = c9_Voc;
  c9_B = c9_Vt;
  c9_g_x = c9_c_A;
  c9_f_y = c9_B;
  c9_h_x = c9_g_x;
  c9_g_y = c9_f_y;
  c9_h_y = c9_h_x / c9_g_y;
  c9_i_x = c9_h_y;
  c9_j_x = c9_i_x;
  c9_j_x = muDoubleScalarExp(c9_j_x);
  c9_b_B = c9_j_x - 1.0;
  c9_i_y = c9_b_B;
  c9_j_y = c9_i_y;
  c9_Io = 5.433 / c9_j_y;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 33);
  c9_Ir = c9_Io;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 36);
  c9_I = 0.0;
  c9_i = 0;
  while (c9_i < 50) {
    CV_EML_FOR(0, 1, 0, 1);
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 38);
    c9_k_x = c9_Vc + c9_I * c9_Rs;
    c9_k_y = c9_Vt;
    c9_l_x = c9_k_x;
    c9_l_y = c9_k_y;
    c9_z = c9_l_x / c9_l_y;
    c9_m_x = c9_z;
    c9_n_x = c9_m_x;
    c9_n_x = muDoubleScalarExp(c9_n_x);
    c9_d_A = c9_Vc + c9_I * c9_Rs;
    c9_o_x = c9_d_A;
    c9_p_x = c9_o_x;
    c9_m_y = c9_p_x / 100.0;
    c9_n_y = c9_Vt;
    c9_o_y = c9_n_y;
    c9_b_z = 0.015 / c9_o_y;
    c9_b_a = c9_Ir;
    c9_g_b = c9_b_z;
    c9_p_y = c9_b_a * c9_g_b;
    c9_q_x = c9_Vc + c9_I * c9_Rs;
    c9_q_y = c9_Vt;
    c9_r_x = c9_q_x;
    c9_r_y = c9_q_y;
    c9_c_z = c9_r_x / c9_r_y;
    c9_s_x = c9_c_z;
    c9_t_x = c9_s_x;
    c9_t_x = muDoubleScalarExp(c9_t_x);
    c9_u_x = ((c9_Iph - c9_I) - c9_Ir * (c9_n_x - 1.0)) + c9_m_y;
    c9_s_y = (-1.0 - c9_p_y * c9_t_x) - 0.00015;
    c9_v_x = c9_u_x;
    c9_t_y = c9_s_y;
    c9_d_z = c9_v_x / c9_t_y;
    c9_I -= c9_d_z;
    c9_i++;
    sf_mex_listen_for_ctrl_c(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, -38);
  sf_debug_symbol_scope_pop();
  *c9_b_I = c9_I;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
}
예제 #2
0
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);
}
예제 #3
0
static void sf_c6_TTR_mdl(SFc6_TTR_mdlInstanceStruct *chartInstance)
{
  int32_T c6_i0;
  real_T c6_hoistedGlobal;
  real_T c6_u_ctrl;
  int32_T c6_i1;
  real_T c6_U_bounds[2];
  uint32_T c6_debug_family_var_map[6];
  real_T c6_i;
  real_T c6_nargin = 2.0;
  real_T c6_nargout = 1.0;
  real_T c6_u_ctrl_out;
  real_T c6_varargin_1;
  real_T c6_varargin_2;
  real_T c6_b_varargin_2;
  real_T c6_varargin_3;
  real_T c6_x;
  real_T c6_y;
  real_T c6_b_x;
  real_T c6_b_y;
  real_T c6_xk;
  real_T c6_yk;
  real_T c6_c_x;
  real_T c6_c_y;
  real_T c6_b_varargin_1;
  real_T c6_c_varargin_2;
  real_T c6_d_varargin_2;
  real_T c6_b_varargin_3;
  real_T c6_d_x;
  real_T c6_d_y;
  real_T c6_e_x;
  real_T c6_e_y;
  real_T c6_b_xk;
  real_T c6_b_yk;
  real_T c6_f_x;
  real_T c6_f_y;
  real_T *c6_b_u_ctrl;
  real_T *c6_b_u_ctrl_out;
  real_T (*c6_b_U_bounds)[2];
  c6_b_U_bounds = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 1);
  c6_b_u_ctrl_out = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c6_b_u_ctrl = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c6_b_u_ctrl, 0U);
  _SFD_DATA_RANGE_CHECK(*c6_b_u_ctrl_out, 1U);
  for (c6_i0 = 0; c6_i0 < 2; c6_i0++) {
    _SFD_DATA_RANGE_CHECK((*c6_b_U_bounds)[c6_i0], 2U);
  }

  chartInstance->c6_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  c6_hoistedGlobal = *c6_b_u_ctrl;
  c6_u_ctrl = c6_hoistedGlobal;
  for (c6_i1 = 0; c6_i1 < 2; c6_i1++) {
    c6_U_bounds[c6_i1] = (*c6_b_U_bounds)[c6_i1];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 6U, 6U, c6_debug_family_names,
    c6_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_i, 0U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargin, 1U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargout, 2U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_u_ctrl, 3U, c6_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c6_U_bounds, 4U, c6_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_u_ctrl_out, 5U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 9);
  c6_u_ctrl_out = c6_u_ctrl;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 11);
  CV_EML_IF(0, 1, 0, FALSE);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 17);
  c6_i = 1.0;
  CV_EML_FOR(0, 1, 0, 1);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 18);
  c6_varargin_1 = c6_u_ctrl;
  c6_varargin_2 = c6_U_bounds[0];
  c6_b_varargin_2 = c6_varargin_1;
  c6_varargin_3 = c6_varargin_2;
  c6_x = c6_b_varargin_2;
  c6_y = c6_varargin_3;
  c6_b_x = c6_x;
  c6_b_y = c6_y;
  c6_eml_scalar_eg(chartInstance);
  c6_xk = c6_b_x;
  c6_yk = c6_b_y;
  c6_c_x = c6_xk;
  c6_c_y = c6_yk;
  c6_eml_scalar_eg(chartInstance);
  c6_u_ctrl_out = muDoubleScalarMax(c6_c_x, c6_c_y);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 19);
  c6_b_varargin_1 = c6_u_ctrl;
  c6_c_varargin_2 = c6_U_bounds[1];
  c6_d_varargin_2 = c6_b_varargin_1;
  c6_b_varargin_3 = c6_c_varargin_2;
  c6_d_x = c6_d_varargin_2;
  c6_d_y = c6_b_varargin_3;
  c6_e_x = c6_d_x;
  c6_e_y = c6_d_y;
  c6_eml_scalar_eg(chartInstance);
  c6_b_xk = c6_e_x;
  c6_b_yk = c6_e_y;
  c6_f_x = c6_b_xk;
  c6_f_y = c6_b_yk;
  c6_eml_scalar_eg(chartInstance);
  c6_u_ctrl_out = muDoubleScalarMin(c6_f_x, c6_f_y);
  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -19);
  _SFD_SYMBOL_SCOPE_POP();
  *c6_b_u_ctrl_out = c6_u_ctrl_out;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_TTR_mdlMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void c1_chartstep_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
  *chartInstance)
{
  int32_T c1_i3;
  real_T c1_b_u[320];
  uint32_T c1_debug_family_var_map[10];
  real_T c1_pixelsFold;
  real_T c1_remainder;
  real_T c1_sideThreshold;
  real_T c1_nextFold;
  real_T c1_i;
  real_T c1_endFold;
  real_T c1_nargin = 1.0;
  real_T c1_nargout = 1.0;
  real_T c1_b_y[128];
  int32_T c1_i4;
  int32_T c1_b_i;
  const mxArray *c1_c_y = NULL;
  static char_T c1_c_u[30] = { 'C', 'o', 'd', 'e', 'r', ':', 'b', 'u', 'i', 'l',
    't', 'i', 'n', 's', ':', 'A', 's', 's', 'e', 'r', 't', 'i', 'o', 'n', 'F',
    'a', 'i', 'l', 'e', 'd' };

  const mxArray *c1_d_y = NULL;
  boolean_T c1_b0;
  boolean_T c1_b1;
  boolean_T c1_b2;
  int32_T c1_i5;
  int32_T c1_i6;
  int32_T c1_u_sizes;
  int32_T c1_loop_ub;
  int32_T c1_i7;
  real_T c1_u_data[320];
  int32_T c1_c_i;
  const mxArray *c1_e_y = NULL;
  const mxArray *c1_f_y = NULL;
  boolean_T c1_b3;
  boolean_T c1_b4;
  boolean_T c1_b5;
  int32_T c1_i8;
  int32_T c1_i9;
  int32_T c1_b_u_sizes;
  int32_T c1_b_loop_ub;
  int32_T c1_i10;
  real_T c1_b_u_data[320];
  int32_T c1_d_i;
  const mxArray *c1_g_y = NULL;
  const mxArray *c1_h_y = NULL;
  boolean_T c1_b6;
  boolean_T c1_b7;
  boolean_T c1_b8;
  int32_T c1_i11;
  int32_T c1_i12;
  int32_T c1_c_u_sizes;
  int32_T c1_c_loop_ub;
  int32_T c1_i13;
  real_T c1_c_u_data[320];
  int32_T c1_i14;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  for (c1_i3 = 0; c1_i3 < 320; c1_i3++) {
    c1_b_u[c1_i3] = (*chartInstance->c1_u)[c1_i3];
  }

  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 10U, 10U, c1_debug_family_names,
    c1_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_pixelsFold, 0U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_remainder, 1U, c1_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c1_sideThreshold, 2U, c1_c_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nextFold, 3U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_i, 4U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_endFold, 5U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 6U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 7U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c1_b_u, 8U, c1_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c1_b_y, 9U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
  c1_pixelsFold = 2.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
  c1_remainder = 64.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 15);
  for (c1_i4 = 0; c1_i4 < 128; c1_i4++) {
    c1_b_y[c1_i4] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 16);
  c1_sideThreshold = 32.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 18);
  c1_nextFold = 1.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 19);
  c1_i = 1.0;
  c1_b_i = 0;
  while (c1_b_i < 32) {
    c1_i = 1.0 + (real_T)c1_b_i;
    CV_EML_FOR(0, 1, 0, 1);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 20);
    c1_endFold = c1_nextFold + 2.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 21);
    if (c1_nextFold <= 500.0) {
    } else {
      c1_c_y = NULL;
      sf_mex_assign(&c1_c_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_c_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 22);
    if (c1_endFold <= 500.0) {
    } else {
      c1_d_y = NULL;
      sf_mex_assign(&c1_d_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_d_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 23);
    c1_b0 = (c1_nextFold > c1_endFold);
    c1_b1 = c1_b0;
    c1_b2 = c1_b1;
    if (c1_b2) {
      c1_i5 = 1;
      c1_i6 = 0;
    } else {
      c1_i5 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 822, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
        320);
      c1_i6 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 822, 19, MAX_uint32_T, (int32_T)c1_endFold, 1, 320);
    }

    c1_u_sizes = (c1_i6 - c1_i5) + 1;
    c1_loop_ub = c1_i6 - c1_i5;
    for (c1_i7 = 0; c1_i7 <= c1_loop_ub; c1_i7++) {
      c1_u_data[c1_i7] = c1_b_u[(c1_i5 + c1_i7) - 1];
    }

    c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_u_data, c1_u_sizes);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 24);
    c1_nextFold = c1_endFold + 1.0;
    c1_b_i++;
    _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 27);
  c1_i = 33.0;
  c1_c_i = 0;
  while (c1_c_i < 64) {
    c1_i = 33.0 + (real_T)c1_c_i;
    CV_EML_FOR(0, 1, 1, 1);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 28);
    c1_endFold = (c1_nextFold + 2.0) - 1.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 29);
    if (c1_nextFold <= 500.0) {
    } else {
      c1_e_y = NULL;
      sf_mex_assign(&c1_e_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_e_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 30);
    if (c1_endFold <= 500.0) {
    } else {
      c1_f_y = NULL;
      sf_mex_assign(&c1_f_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_f_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 31);
    c1_b3 = (c1_nextFold > c1_endFold);
    c1_b4 = c1_b3;
    c1_b5 = c1_b4;
    if (c1_b5) {
      c1_i8 = 1;
      c1_i9 = 0;
    } else {
      c1_i8 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 1021, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
        320);
      c1_i9 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 1021, 19, MAX_uint32_T, (int32_T)c1_endFold, 1,
        320);
    }

    c1_b_u_sizes = (c1_i9 - c1_i8) + 1;
    c1_b_loop_ub = c1_i9 - c1_i8;
    for (c1_i10 = 0; c1_i10 <= c1_b_loop_ub; c1_i10++) {
      c1_b_u_data[c1_i10] = c1_b_u[(c1_i8 + c1_i10) - 1];
    }

    c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_b_u_data, c1_b_u_sizes);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 32);
    c1_nextFold = c1_endFold + 1.0;
    c1_c_i++;
    _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 1, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 35);
  c1_i = 97.0;
  c1_d_i = 0;
  while (c1_d_i < 32) {
    c1_i = 97.0 + (real_T)c1_d_i;
    CV_EML_FOR(0, 1, 2, 1);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 36);
    c1_endFold = c1_nextFold + 2.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 37);
    if (c1_nextFold <= 500.0) {
    } else {
      c1_g_y = NULL;
      sf_mex_assign(&c1_g_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_g_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 38);
    if (c1_endFold <= 500.0) {
    } else {
      c1_h_y = NULL;
      sf_mex_assign(&c1_h_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_h_y));
    }

    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 39);
    c1_b6 = (c1_nextFold > c1_endFold);
    c1_b7 = c1_b6;
    c1_b8 = c1_b7;
    if (c1_b8) {
      c1_i11 = 1;
      c1_i12 = 0;
    } else {
      c1_i11 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 1208, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
        320);
      c1_i12 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
        chartInstance->S, 1U, 1208, 19, MAX_uint32_T, (int32_T)c1_endFold, 1,
        320);
    }

    c1_c_u_sizes = (c1_i12 - c1_i11) + 1;
    c1_c_loop_ub = c1_i12 - c1_i11;
    for (c1_i13 = 0; c1_i13 <= c1_c_loop_ub; c1_i13++) {
      c1_c_u_data[c1_i13] = c1_b_u[(c1_i11 + c1_i13) - 1];
    }

    c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_c_u_data, c1_c_u_sizes);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 40);
    c1_nextFold = c1_endFold + 1.0;
    c1_d_i++;
    _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 2, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -40);
  _SFD_SYMBOL_SCOPE_POP();
  for (c1_i14 = 0; c1_i14 < 128; c1_i14++) {
    (*chartInstance->c1_y)[c1_i14] = c1_b_y[c1_i14];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
}
예제 #5
0
파일: c2_Leda.c 프로젝트: ingenieriaam/Leda
static void sf_c2_Leda(SFc2_LedaInstanceStruct *chartInstance)
{
  real_T c2_hoistedGlobal;
  real_T c2_nota;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 0.0;
  int32_T c2_i2;
  int32_T c2_i;
  real_T c2_b_i;
  real_T c2_u;
  const mxArray *c2_y = NULL;
  int32_T c2_i3;
  static char_T c2_cv0[4] = { '.', 'j', 'p', 'g' };

  char_T c2_b_u[4];
  const mxArray *c2_b_y = NULL;
  static real_T c2_dv1[435483];
  int32_T c2_c_i;
  int32_T c2_i4;
  int32_T c2_i5;
  int32_T c2_i6;
  int32_T c2_i7;
  static real_T c2_b_hoistedGlobal[33096708];
  int32_T c2_b_nota;
  int32_T c2_i8;
  int32_T c2_i9;
  int32_T c2_i10;
  static real_T c2_c_u[435483];
  const mxArray *c2_c_y = NULL;
  real_T *c2_c_nota;
  c2_c_nota = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c2_c_nota, 0U);
  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  c2_hoistedGlobal = *c2_c_nota;
  c2_nota = c2_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargin, 0U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargout, 1U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c2_nota, 2U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(chartInstance->c2_pent, 3U,
    c2_sf_marshallOut, c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 9);
  if (CV_EML_IF(0, 1, 0, !chartInstance->c2_pent_not_empty)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 10);
    for (c2_i2 = 0; c2_i2 < 33096708; c2_i2++) {
      chartInstance->c2_pent[c2_i2] = 0.0;
    }

    chartInstance->c2_pent_not_empty = TRUE;
    c2_i = 0;
    while (c2_i < 73) {
      c2_b_i = 4.0 + (real_T)c2_i;
      CV_EML_FOR(0, 1, 0, 1);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 13);
      c2_u = c2_b_i;
      c2_y = NULL;
      sf_mex_assign(&c2_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), FALSE);
      for (c2_i3 = 0; c2_i3 < 4; c2_i3++) {
        c2_b_u[c2_i3] = c2_cv0[c2_i3];
      }

      c2_b_y = NULL;
      sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_b_u, 10, 0U, 1U, 0U, 2, 1, 4),
                    FALSE);
      c2_d_emlrt_marshallIn(chartInstance, sf_mex_call_debug("imread", 1U, 1U,
        14, sf_mex_call_debug("horzcat", 1U, 2U, 14, sf_mex_call_debug("num2str",
        1U, 1U, 14, c2_y), 14, c2_b_y)), "imread", c2_dv1);
      c2_c_i = _SFD_EML_ARRAY_BOUNDS_CHECK("pent", (int32_T)_SFD_INTEGER_CHECK(
        "i", c2_b_i), 1, 76, 4, 0) - 1;
      for (c2_i4 = 0; c2_i4 < 3; c2_i4++) {
        for (c2_i5 = 0; c2_i5 < 381; c2_i5++) {
          for (c2_i6 = 0; c2_i6 < 381; c2_i6++) {
            chartInstance->c2_pent[((c2_i6 + 381 * c2_i5) + 145161 * c2_i4) +
              435483 * c2_c_i] = c2_dv1[(c2_i6 + 381 * c2_i5) + 145161 * c2_i4];
          }
        }
      }

      c2_i++;
      sf_mex_listen_for_ctrl_c(chartInstance->S);
    }

    CV_EML_FOR(0, 1, 0, 0);
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 19);
  if (CV_EML_IF(0, 1, 1, c2_nota < 4.0)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 20);
    c2_nota = 4.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 22);
  if (CV_EML_IF(0, 1, 2, c2_nota > 76.0)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 23);
    c2_nota = 76.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 26);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 32);
  for (c2_i7 = 0; c2_i7 < 33096708; c2_i7++) {
    c2_b_hoistedGlobal[c2_i7] = chartInstance->c2_pent[c2_i7];
  }

  c2_b_nota = _SFD_EML_ARRAY_BOUNDS_CHECK("pent", (int32_T)_SFD_INTEGER_CHECK(
    "nota", c2_nota), 1, 76, 4, 0) - 1;
  for (c2_i8 = 0; c2_i8 < 3; c2_i8++) {
    for (c2_i9 = 0; c2_i9 < 381; c2_i9++) {
      for (c2_i10 = 0; c2_i10 < 381; c2_i10++) {
        c2_c_u[(c2_i10 + 381 * c2_i9) + 145161 * c2_i8] = c2_b_hoistedGlobal
          [((c2_i10 + 381 * c2_i9) + 145161 * c2_i8) + 435483 * c2_b_nota];
      }
    }
  }

  c2_c_y = NULL;
  sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 3, 381, 381,
    3), FALSE);
  sf_mex_call_debug("imshow", 0U, 1U, 14, c2_c_y);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -32);
  sf_debug_symbol_scope_pop();
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  sf_debug_check_for_state_inconsistency(_LedaMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}