www.pudn.com > pi_svpwm.zip > c6_mpc_svpwm.c, change:2014-03-25,size:68282b


/* Include files */ 
 
#include <stddef.h> 
#include "blas.h" 
#include "mpc_svpwm_sfun.h" 
#include "c6_mpc_svpwm.h" 
#include "mwmathutil.h" 
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber) 
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber) 
#include "mpc_svpwm_sfun_debug_macros.h" 
#define _SF_MEX_LISTEN_FOR_CTRL_C(S)   sf_mex_listen_for_ctrl_c(sfGlobalDebugInstanceStruct,S); 
 
/* Type Definitions */ 
 
/* Named Constants */ 
#define CALL_EVENT                     (-1) 
 
/* Variable Declarations */ 
 
/* Variable Definitions */ 
static const char * c6_debug_family_names[33] = { "R", "L", "ts", "v0", "v1", 
  "v2", "v3", "v4", "v5", "v6", "v7", "v", "states", "g_opt", "ik_ref", "ik", 
  "Vk", "x_opt", "i", "v_o1", "ik1", "g", "nargin", "nargout", "I_ref", "I", "V", 
  "Vdc", "Sa", "Sb", "Sc", "x_old", "i_old" }; 
 
/* Function Declarations */ 
static void initialize_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
static void initialize_params_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static void enable_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
static void disable_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
static void c6_update_debugger_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static const mxArray *get_sim_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static void set_sim_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance, const mxArray *c6_st); 
static void finalize_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
static void sf_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
static void c6_chartstep_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static void initSimStructsc6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static void registerMessagesc6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance); 
static void init_script_number_translation(uint32_T c6_machineNumber, uint32_T 
  c6_chartNumber); 
static const mxArray *c6_sf_marshallOut(void *chartInstanceVoid, void *c6_inData); 
static creal_T c6_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_i_old, const char_T *c6_identifier); 
static creal_T c6_b_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void c6_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static const mxArray *c6_b_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static real_T c6_c_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_x_old, const char_T *c6_identifier); 
static real_T c6_d_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void c6_b_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static const mxArray *c6_c_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static real_T c6_e_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_Sc, const char_T *c6_identifier); 
static real_T c6_f_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void c6_c_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static const mxArray *c6_d_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static const mxArray *c6_e_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static creal_T c6_g_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void c6_d_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static const mxArray *c6_f_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static void c6_h_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId, real_T c6_y[24]); 
static void c6_e_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static const mxArray *c6_g_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static void c6_i_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId, creal_T c6_y[8]); 
static void c6_f_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static void c6_info_helper(c6_ResolvedFunctionInfo c6_info[14]); 
static const mxArray *c6_h_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData); 
static int32_T c6_j_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void c6_g_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData); 
static uint8_T c6_k_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_is_active_c6_mpc_svpwm, const char_T *c6_identifier); 
static uint8_T c6_l_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId); 
static void init_dsm_address_info(SFc6_mpc_svpwmInstanceStruct *chartInstance); 
 
/* Function Definitions */ 
static void initialize_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
  chartInstance->c6_sfEvent = CALL_EVENT; 
  _sfTime_ = (real_T)ssGetT(chartInstance->S); 
  chartInstance->c6_x_old_not_empty = FALSE; 
  chartInstance->c6_i_old_not_empty = FALSE; 
  chartInstance->c6_is_active_c6_mpc_svpwm = 0U; 
} 
 
static void initialize_params_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
} 
 
static void enable_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
  _sfTime_ = (real_T)ssGetT(chartInstance->S); 
} 
 
static void disable_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
  _sfTime_ = (real_T)ssGetT(chartInstance->S); 
} 
 
static void c6_update_debugger_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
} 
 
static const mxArray *get_sim_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
  const mxArray *c6_st; 
  const mxArray *c6_y = NULL; 
  real_T c6_hoistedGlobal; 
  real_T c6_u; 
  const mxArray *c6_b_y = NULL; 
  real_T c6_b_hoistedGlobal; 
  real_T c6_b_u; 
  const mxArray *c6_c_y = NULL; 
  real_T c6_c_hoistedGlobal; 
  real_T c6_c_u; 
  const mxArray *c6_d_y = NULL; 
  creal_T c6_d_u; 
  const mxArray *c6_e_y = NULL; 
  real_T c6_d_hoistedGlobal; 
  real_T c6_e_u; 
  const mxArray *c6_f_y = NULL; 
  uint8_T c6_e_hoistedGlobal; 
  uint8_T c6_f_u; 
  const mxArray *c6_g_y = NULL; 
  real_T *c6_Sa; 
  real_T *c6_Sb; 
  real_T *c6_Sc; 
  c6_Sc = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); 
  c6_Sb = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); 
  c6_Sa = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); 
  c6_st = NULL; 
  c6_st = NULL; 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_createcellarray(6), FALSE); 
  c6_hoistedGlobal = *c6_Sa; 
  c6_u = c6_hoistedGlobal; 
  c6_b_y = NULL; 
  sf_mex_assign(&c6_b_y, sf_mex_create("y", &c6_u, 0, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_setcell(c6_y, 0, c6_b_y); 
  c6_b_hoistedGlobal = *c6_Sb; 
  c6_b_u = c6_b_hoistedGlobal; 
  c6_c_y = NULL; 
  sf_mex_assign(&c6_c_y, sf_mex_create("y", &c6_b_u, 0, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_setcell(c6_y, 1, c6_c_y); 
  c6_c_hoistedGlobal = *c6_Sc; 
  c6_c_u = c6_c_hoistedGlobal; 
  c6_d_y = NULL; 
  sf_mex_assign(&c6_d_y, sf_mex_create("y", &c6_c_u, 0, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_setcell(c6_y, 2, c6_d_y); 
  c6_d_u = chartInstance->c6_i_old; 
  c6_e_y = NULL; 
  if (!chartInstance->c6_i_old_not_empty) { 
    sf_mex_assign(&c6_e_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0), 
                  FALSE); 
  } else { 
    sf_mex_assign(&c6_e_y, sf_mex_create("y", &c6_d_u, 0, 1U, 0U, 0U, 0), FALSE); 
  } 
 
  sf_mex_setcell(c6_y, 3, c6_e_y); 
  c6_d_hoistedGlobal = chartInstance->c6_x_old; 
  c6_e_u = c6_d_hoistedGlobal; 
  c6_f_y = NULL; 
  if (!chartInstance->c6_x_old_not_empty) { 
    sf_mex_assign(&c6_f_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0), 
                  FALSE); 
  } else { 
    sf_mex_assign(&c6_f_y, sf_mex_create("y", &c6_e_u, 0, 0U, 0U, 0U, 0), FALSE); 
  } 
 
  sf_mex_setcell(c6_y, 4, c6_f_y); 
  c6_e_hoistedGlobal = chartInstance->c6_is_active_c6_mpc_svpwm; 
  c6_f_u = c6_e_hoistedGlobal; 
  c6_g_y = NULL; 
  sf_mex_assign(&c6_g_y, sf_mex_create("y", &c6_f_u, 3, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_setcell(c6_y, 5, c6_g_y); 
  sf_mex_assign(&c6_st, c6_y, FALSE); 
  return c6_st; 
} 
 
static void set_sim_state_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance, const mxArray *c6_st) 
{ 
  const mxArray *c6_u; 
  real_T *c6_Sa; 
  real_T *c6_Sb; 
  real_T *c6_Sc; 
  c6_Sc = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); 
  c6_Sb = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); 
  c6_Sa = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); 
  chartInstance->c6_doneDoubleBufferReInit = TRUE; 
  c6_u = sf_mex_dup(c6_st); 
  *c6_Sa = c6_e_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c6_u, 
    0)), "Sa"); 
  *c6_Sb = c6_e_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c6_u, 
    1)), "Sb"); 
  *c6_Sc = c6_e_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c6_u, 
    2)), "Sc"); 
  chartInstance->c6_i_old = c6_emlrt_marshallIn(chartInstance, sf_mex_dup 
    (sf_mex_getcell(c6_u, 3)), "i_old"); 
  chartInstance->c6_x_old = c6_c_emlrt_marshallIn(chartInstance, sf_mex_dup 
    (sf_mex_getcell(c6_u, 4)), "x_old"); 
  chartInstance->c6_is_active_c6_mpc_svpwm = c6_k_emlrt_marshallIn(chartInstance, 
    sf_mex_dup(sf_mex_getcell(c6_u, 5)), "is_active_c6_mpc_svpwm"); 
  sf_mex_destroy(&c6_u); 
  c6_update_debugger_state_c6_mpc_svpwm(chartInstance); 
  sf_mex_destroy(&c6_st); 
} 
 
static void finalize_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
} 
 
static void sf_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
  int32_T c6_i0; 
  int32_T c6_i1; 
  int32_T c6_i2; 
  real_T *c6_Sa; 
  real_T *c6_Sb; 
  real_T *c6_Sc; 
  real_T *c6_Vdc; 
  real_T (*c6_V)[2]; 
  real_T (*c6_I)[2]; 
  real_T (*c6_I_ref)[2]; 
  c6_Vdc = (real_T *)ssGetInputPortSignal(chartInstance->S, 3); 
  c6_V = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2); 
  c6_Sc = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); 
  c6_Sb = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); 
  c6_I = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 1); 
  c6_I_ref = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0); 
  c6_Sa = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); 
  _sfTime_ = (real_T)ssGetT(chartInstance->S); 
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c6_sfEvent); 
  _SFD_DATA_RANGE_CHECK(*c6_Sa, 0U); 
  for (c6_i0 = 0; c6_i0 < 2; c6_i0++) { 
    _SFD_DATA_RANGE_CHECK((*c6_I_ref)[c6_i0], 1U); 
  } 
 
  for (c6_i1 = 0; c6_i1 < 2; c6_i1++) { 
    _SFD_DATA_RANGE_CHECK((*c6_I)[c6_i1], 2U); 
  } 
 
  _SFD_DATA_RANGE_CHECK(*c6_Sb, 3U); 
  _SFD_DATA_RANGE_CHECK(*c6_Sc, 4U); 
  for (c6_i2 = 0; c6_i2 < 2; c6_i2++) { 
    _SFD_DATA_RANGE_CHECK((*c6_V)[c6_i2], 5U); 
  } 
 
  _SFD_DATA_RANGE_CHECK(*c6_Vdc, 6U); 
  chartInstance->c6_sfEvent = CALL_EVENT; 
  c6_chartstep_c6_mpc_svpwm(chartInstance); 
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_mpc_svpwmMachineNumber_, 
    chartInstance->chartNumber, chartInstance->instanceNumber); 
} 
 
static void c6_chartstep_c6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
  real_T c6_hoistedGlobal; 
  int32_T c6_i3; 
  real_T c6_I_ref[2]; 
  int32_T c6_i4; 
  real_T c6_I[2]; 
  int32_T c6_i5; 
  real_T c6_V[2]; 
  real_T c6_Vdc; 
  uint32_T c6_debug_family_var_map[33]; 
  real_T c6_R; 
  real_T c6_L; 
  real_T c6_ts; 
  real_T c6_v0; 
  real_T c6_v1; 
  creal_T c6_v2; 
  creal_T c6_v3; 
  real_T c6_v4; 
  creal_T c6_v5; 
  creal_T c6_v6; 
  real_T c6_v7; 
  creal_T c6_v[8]; 
  real_T c6_states[24]; 
  real_T c6_g_opt; 
  creal_T c6_ik_ref; 
  creal_T c6_ik; 
  creal_T c6_Vk; 
  real_T c6_x_opt; 
  real_T c6_i; 
  creal_T c6_v_o1; 
  creal_T c6_ik1; 
  real_T c6_g; 
  real_T c6_nargin = 4.0; 
  real_T c6_nargout = 3.0; 
  real_T c6_Sa; 
  real_T c6_Sb; 
  real_T c6_Sc; 
  real_T c6_b; 
  real_T c6_b_b; 
  real_T c6_y; 
  real_T c6_c_b; 
  static creal_T c6_dc0 = { 0.0, 0.57735026918962573 }; 
 
  creal_T c6_b_y; 
  real_T c6_d_b; 
  real_T c6_c_y; 
  real_T c6_e_b; 
  real_T c6_f_b; 
  real_T c6_g_b; 
  real_T c6_d_y; 
  real_T c6_h_b; 
  real_T c6_i_b; 
  real_T c6_e_y; 
  real_T c6_j_b; 
  int32_T c6_i6; 
  static real_T c6_dv0[24] = { 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 
    1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 }; 
 
  static creal_T c6_dc1 = { 0.0, 0.0 }; 
 
  real_T c6_k_b; 
  static creal_T c6_dc2 = { 0.0, 1.0 }; 
 
  real_T c6_l_b; 
  real_T c6_m_b; 
  int32_T c6_b_i; 
  creal_T c6_n_b; 
  real_T c6_x; 
  real_T c6_b_x; 
  real_T c6_f_y; 
  real_T c6_c_x; 
  real_T c6_d_x; 
  real_T c6_g_y; 
  real_T *c6_b_Vdc; 
  real_T *c6_b_Sa; 
  real_T *c6_b_Sb; 
  real_T *c6_b_Sc; 
  real_T (*c6_b_V)[2]; 
  real_T (*c6_b_I)[2]; 
  real_T (*c6_b_I_ref)[2]; 
  c6_b_Vdc = (real_T *)ssGetInputPortSignal(chartInstance->S, 3); 
  c6_b_V = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2); 
  c6_b_Sc = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); 
  c6_b_Sb = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); 
  c6_b_I = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 1); 
  c6_b_I_ref = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0); 
  c6_b_Sa = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); 
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c6_sfEvent); 
  c6_hoistedGlobal = *c6_b_Vdc; 
  for (c6_i3 = 0; c6_i3 < 2; c6_i3++) { 
    c6_I_ref[c6_i3] = (*c6_b_I_ref)[c6_i3]; 
  } 
 
  for (c6_i4 = 0; c6_i4 < 2; c6_i4++) { 
    c6_I[c6_i4] = (*c6_b_I)[c6_i4]; 
  } 
 
  for (c6_i5 = 0; c6_i5 < 2; c6_i5++) { 
    c6_V[c6_i5] = (*c6_b_V)[c6_i5]; 
  } 
 
  c6_Vdc = c6_hoistedGlobal; 
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 33U, 33U, c6_debug_family_names, 
    c6_debug_family_var_map); 
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_R, 0U, c6_c_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_L, 1U, c6_c_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_ts, 2U, c6_c_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v0, 3U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v1, 4U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v2, 5U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v3, 6U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v4, 7U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v5, 8U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v6, 9U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v7, 10U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c6_v, 11U, c6_g_sf_marshallOut, 
    c6_f_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c6_states, 12U, c6_f_sf_marshallOut, 
    c6_e_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_g_opt, 13U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_ik_ref, 14U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_ik, 15U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_Vk, 16U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_x_opt, 17U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_i, 18U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_v_o1, 19U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_ik1, 20U, c6_e_sf_marshallOut, 
    c6_d_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_g, 21U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargin, 22U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_nargout, 23U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML(c6_I_ref, 24U, c6_d_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML(c6_I, 25U, c6_d_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML(c6_V, 26U, c6_d_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML(&c6_Vdc, 27U, c6_c_sf_marshallOut); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_Sa, 28U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_Sb, 29U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c6_Sc, 30U, c6_c_sf_marshallOut, 
    c6_c_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&chartInstance->c6_x_old, 31U, 
    c6_b_sf_marshallOut, c6_b_sf_marshallIn); 
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&chartInstance->c6_i_old, 32U, 
    c6_sf_marshallOut, c6_sf_marshallIn); 
  CV_EML_FCN(0, 0); 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 3); 
  c6_R = 0.1; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 4); 
  c6_L = 0.015; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 5); 
  c6_ts = 0.0001; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 6); 
  c6_v0 = 0.0; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 7); 
  c6_b = c6_Vdc; 
  c6_v1 = 0.66666666666666663 * c6_b; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 8); 
  c6_b_b = c6_Vdc; 
  c6_y = 0.33333333333333331 * c6_b_b; 
  c6_c_b = c6_Vdc; 
  c6_b_y.re = c6_c_b * c6_dc0.re; 
  c6_b_y.im = c6_c_b * c6_dc0.im; 
  c6_v2.re = c6_y + c6_b_y.re; 
  c6_v2.im = c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 9); 
  c6_d_b = c6_Vdc; 
  c6_c_y = -0.33333333333333331 * c6_d_b; 
  c6_e_b = c6_Vdc; 
  c6_b_y.re = c6_e_b * c6_dc0.re; 
  c6_b_y.im = c6_e_b * c6_dc0.im; 
  c6_v3.re = c6_c_y + c6_b_y.re; 
  c6_v3.im = c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 10); 
  c6_f_b = c6_Vdc; 
  c6_v4 = -0.66666666666666663 * c6_f_b; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 11); 
  c6_g_b = c6_Vdc; 
  c6_d_y = -0.33333333333333331 * c6_g_b; 
  c6_h_b = c6_Vdc; 
  c6_b_y.re = c6_h_b * c6_dc0.re; 
  c6_b_y.im = c6_h_b * c6_dc0.im; 
  c6_v5.re = c6_d_y - c6_b_y.re; 
  c6_v5.im = 0.0 - c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 12); 
  c6_i_b = c6_Vdc; 
  c6_e_y = 0.33333333333333331 * c6_i_b; 
  c6_j_b = c6_Vdc; 
  c6_b_y.re = c6_j_b * c6_dc0.re; 
  c6_b_y.im = c6_j_b * c6_dc0.im; 
  c6_v6.re = c6_e_y - c6_b_y.re; 
  c6_v6.im = 0.0 - c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 13); 
  c6_v7 = 0.0; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 14); 
  c6_v[0].re = c6_v0; 
  c6_v[0].im = 0.0; 
  c6_v[1].re = c6_v1; 
  c6_v[1].im = 0.0; 
  c6_v[2] = c6_v2; 
  c6_v[3] = c6_v3; 
  c6_v[4].re = c6_v4; 
  c6_v[4].im = 0.0; 
  c6_v[5] = c6_v5; 
  c6_v[6] = c6_v6; 
  c6_v[7].re = c6_v7; 
  c6_v[7].im = 0.0; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 15); 
  for (c6_i6 = 0; c6_i6 < 24; c6_i6++) { 
    c6_states[c6_i6] = c6_dv0[c6_i6]; 
  } 
 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 17); 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 18); 
  if (CV_EML_IF(0, 1, 0, !chartInstance->c6_x_old_not_empty)) { 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 18); 
    chartInstance->c6_x_old = 1.0; 
    chartInstance->c6_x_old_not_empty = TRUE; 
  } 
 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 20); 
  if (CV_EML_IF(0, 1, 1, !chartInstance->c6_i_old_not_empty)) { 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 20); 
    chartInstance->c6_i_old = c6_dc1; 
    chartInstance->c6_i_old_not_empty = TRUE; 
  } 
 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 23); 
  c6_g_opt = 1.0E+10; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 25); 
  c6_k_b = c6_I_ref[1]; 
  c6_b_y.re = c6_k_b * c6_dc2.re; 
  c6_b_y.im = c6_k_b * c6_dc2.im; 
  c6_ik_ref.re = c6_I_ref[0] + c6_b_y.re; 
  c6_ik_ref.im = c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 27); 
  c6_l_b = c6_I[1]; 
  c6_b_y.re = c6_l_b * c6_dc2.re; 
  c6_b_y.im = c6_l_b * c6_dc2.im; 
  c6_ik.re = c6_I[0] + c6_b_y.re; 
  c6_ik.im = c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 28); 
  c6_m_b = c6_V[1]; 
  c6_b_y.re = c6_m_b * c6_dc2.re; 
  c6_b_y.im = c6_m_b * c6_dc2.im; 
  c6_Vk.re = c6_V[0] + c6_b_y.re; 
  c6_Vk.im = c6_b_y.im; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 31); 
  chartInstance->c6_i_old = c6_ik; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 32); 
  c6_x_opt = 1.0; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 33); 
  c6_i = 1.0; 
  c6_b_i = 0; 
  while (c6_b_i < 8) { 
    c6_i = 1.0 + (real_T)c6_b_i; 
    CV_EML_FOR(0, 1, 0, 1); 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 35); 
    c6_v_o1 = c6_v[(int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("v", (int32_T) 
      _SFD_INTEGER_CHECK("i", c6_i), 1, 8, 1, 0) - 1]; 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 37); 
    c6_n_b = c6_ik; 
    c6_b_y.re = 0.9993333333333333 * c6_n_b.re; 
    c6_b_y.im = 0.9993333333333333 * c6_n_b.im; 
    c6_n_b.re = c6_Vk.re - c6_v_o1.re; 
    c6_n_b.im = c6_Vk.im - c6_v_o1.im; 
    c6_n_b.re *= 0.0066666666666666671; 
    c6_n_b.im *= 0.0066666666666666671; 
    c6_ik1.re = c6_b_y.re + c6_n_b.re; 
    c6_ik1.im = c6_b_y.im + c6_n_b.im; 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 40); 
    c6_x = c6_ik_ref.re - c6_ik1.re; 
    c6_b_x = c6_x; 
    c6_f_y = muDoubleScalarAbs(c6_b_x); 
    c6_c_x = c6_ik_ref.im - c6_ik1.im; 
    c6_d_x = c6_c_x; 
    c6_g_y = muDoubleScalarAbs(c6_d_x); 
    c6_g = c6_f_y + c6_g_y; 
    _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 42); 
    if (CV_EML_IF(0, 1, 2, c6_g < c6_g_opt)) { 
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 43); 
      c6_g_opt = c6_g; 
      _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 44); 
      c6_x_opt = c6_i; 
    } 
 
    c6_b_i++; 
    _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S); 
  } 
 
  CV_EML_FOR(0, 1, 0, 0); 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 49); 
  chartInstance->c6_x_old = c6_x_opt; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 51); 
  c6_Sa = c6_states[(int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("states", 
    (int32_T)_SFD_INTEGER_CHECK("x_opt", c6_x_opt), 1, 8, 1, 0) - 1]; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 52); 
  c6_Sb = c6_states[(int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("states", 
    (int32_T)_SFD_INTEGER_CHECK("x_opt", c6_x_opt), 1, 8, 1, 0) + 7]; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 53); 
  c6_Sc = c6_states[(int32_T)(real_T)_SFD_EML_ARRAY_BOUNDS_CHECK("states", 
    (int32_T)_SFD_INTEGER_CHECK("x_opt", c6_x_opt), 1, 8, 1, 0) + 15]; 
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -53); 
  _SFD_SYMBOL_SCOPE_POP(); 
  *c6_b_Sa = c6_Sa; 
  *c6_b_Sb = c6_Sb; 
  *c6_b_Sc = c6_Sc; 
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c6_sfEvent); 
} 
 
static void initSimStructsc6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
} 
 
static void registerMessagesc6_mpc_svpwm(SFc6_mpc_svpwmInstanceStruct 
  *chartInstance) 
{ 
} 
 
static void init_script_number_translation(uint32_T c6_machineNumber, uint32_T 
  c6_chartNumber) 
{ 
} 
 
static const mxArray *c6_sf_marshallOut(void *chartInstanceVoid, void *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  creal_T c6_u; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_u = *(creal_T *)c6_inData; 
  c6_y = NULL; 
  if (!chartInstance->c6_i_old_not_empty) { 
    sf_mex_assign(&c6_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0), FALSE); 
  } else { 
    sf_mex_assign(&c6_y, sf_mex_create("y", &c6_u, 0, 1U, 0U, 0U, 0), FALSE); 
  } 
 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static creal_T c6_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_i_old, const char_T *c6_identifier) 
{ 
  creal_T c6_y; 
  emlrtMsgIdentifier c6_thisId; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_b_i_old), &c6_thisId); 
  sf_mex_destroy(&c6_b_i_old); 
  return c6_y; 
} 
 
static creal_T c6_b_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  creal_T c6_y; 
  creal_T c6_dc3; 
  if (mxIsEmpty(c6_u)) { 
    chartInstance->c6_i_old_not_empty = FALSE; 
  } else { 
    chartInstance->c6_i_old_not_empty = TRUE; 
    sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_dc3, 1, 0, 1U, 0, 0U, 0); 
    c6_y = c6_dc3; 
  } 
 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void c6_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_b_i_old; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  creal_T c6_y; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_b_i_old = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_b_i_old), &c6_thisId); 
  sf_mex_destroy(&c6_b_i_old); 
  *(creal_T *)c6_outData = c6_y; 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static const mxArray *c6_b_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  real_T c6_u; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_u = *(real_T *)c6_inData; 
  c6_y = NULL; 
  if (!chartInstance->c6_x_old_not_empty) { 
    sf_mex_assign(&c6_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0), FALSE); 
  } else { 
    sf_mex_assign(&c6_y, sf_mex_create("y", &c6_u, 0, 0U, 0U, 0U, 0), FALSE); 
  } 
 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static real_T c6_c_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_x_old, const char_T *c6_identifier) 
{ 
  real_T c6_y; 
  emlrtMsgIdentifier c6_thisId; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_b_x_old), &c6_thisId); 
  sf_mex_destroy(&c6_b_x_old); 
  return c6_y; 
} 
 
static real_T c6_d_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  real_T c6_y; 
  real_T c6_d0; 
  if (mxIsEmpty(c6_u)) { 
    chartInstance->c6_x_old_not_empty = FALSE; 
  } else { 
    chartInstance->c6_x_old_not_empty = TRUE; 
    sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_d0, 1, 0, 0U, 0, 0U, 0); 
    c6_y = c6_d0; 
  } 
 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void c6_b_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_b_x_old; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  real_T c6_y; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_b_x_old = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_b_x_old), &c6_thisId); 
  sf_mex_destroy(&c6_b_x_old); 
  *(real_T *)c6_outData = c6_y; 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static const mxArray *c6_c_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  real_T c6_u; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_u = *(real_T *)c6_inData; 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", &c6_u, 0, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static real_T c6_e_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_Sc, const char_T *c6_identifier) 
{ 
  real_T c6_y; 
  emlrtMsgIdentifier c6_thisId; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_Sc), &c6_thisId); 
  sf_mex_destroy(&c6_Sc); 
  return c6_y; 
} 
 
static real_T c6_f_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  real_T c6_y; 
  real_T c6_d1; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_d1, 1, 0, 0U, 0, 0U, 0); 
  c6_y = c6_d1; 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void c6_c_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_Sc; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  real_T c6_y; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_Sc = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_Sc), &c6_thisId); 
  sf_mex_destroy(&c6_Sc); 
  *(real_T *)c6_outData = c6_y; 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static const mxArray *c6_d_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  int32_T c6_i7; 
  real_T c6_b_inData[2]; 
  int32_T c6_i8; 
  real_T c6_u[2]; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  for (c6_i7 = 0; c6_i7 < 2; c6_i7++) { 
    c6_b_inData[c6_i7] = (*(real_T (*)[2])c6_inData)[c6_i7]; 
  } 
 
  for (c6_i8 = 0; c6_i8 < 2; c6_i8++) { 
    c6_u[c6_i8] = c6_b_inData[c6_i8]; 
  } 
 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", c6_u, 0, 0U, 1U, 0U, 1, 2), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static const mxArray *c6_e_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  creal_T c6_u; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_u = *(creal_T *)c6_inData; 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", &c6_u, 0, 1U, 0U, 0U, 0), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static creal_T c6_g_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  creal_T c6_y; 
  creal_T c6_dc4; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_dc4, 1, 0, 1U, 0, 0U, 0); 
  c6_y = c6_dc4; 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void c6_d_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_ik1; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  creal_T c6_y; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_ik1 = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_g_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_ik1), &c6_thisId); 
  sf_mex_destroy(&c6_ik1); 
  *(creal_T *)c6_outData = c6_y; 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static const mxArray *c6_f_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  int32_T c6_i9; 
  int32_T c6_i10; 
  int32_T c6_i11; 
  real_T c6_b_inData[24]; 
  int32_T c6_i12; 
  int32_T c6_i13; 
  int32_T c6_i14; 
  real_T c6_u[24]; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_i9 = 0; 
  for (c6_i10 = 0; c6_i10 < 3; c6_i10++) { 
    for (c6_i11 = 0; c6_i11 < 8; c6_i11++) { 
      c6_b_inData[c6_i11 + c6_i9] = (*(real_T (*)[24])c6_inData)[c6_i11 + c6_i9]; 
    } 
 
    c6_i9 += 8; 
  } 
 
  c6_i12 = 0; 
  for (c6_i13 = 0; c6_i13 < 3; c6_i13++) { 
    for (c6_i14 = 0; c6_i14 < 8; c6_i14++) { 
      c6_u[c6_i14 + c6_i12] = c6_b_inData[c6_i14 + c6_i12]; 
    } 
 
    c6_i12 += 8; 
  } 
 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", c6_u, 0, 0U, 1U, 0U, 2, 8, 3), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static void c6_h_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId, real_T c6_y[24]) 
{ 
  real_T c6_dv1[24]; 
  int32_T c6_i15; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), c6_dv1, 1, 0, 0U, 1, 0U, 2, 8, 3); 
  for (c6_i15 = 0; c6_i15 < 24; c6_i15++) { 
    c6_y[c6_i15] = c6_dv1[c6_i15]; 
  } 
 
  sf_mex_destroy(&c6_u); 
} 
 
static void c6_e_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_states; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  real_T c6_y[24]; 
  int32_T c6_i16; 
  int32_T c6_i17; 
  int32_T c6_i18; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_states = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_h_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_states), &c6_thisId, c6_y); 
  sf_mex_destroy(&c6_states); 
  c6_i16 = 0; 
  for (c6_i17 = 0; c6_i17 < 3; c6_i17++) { 
    for (c6_i18 = 0; c6_i18 < 8; c6_i18++) { 
      (*(real_T (*)[24])c6_outData)[c6_i18 + c6_i16] = c6_y[c6_i18 + c6_i16]; 
    } 
 
    c6_i16 += 8; 
  } 
 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static const mxArray *c6_g_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  int32_T c6_i19; 
  creal_T c6_b_inData[8]; 
  int32_T c6_i20; 
  creal_T c6_u[8]; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  for (c6_i19 = 0; c6_i19 < 8; c6_i19++) { 
    c6_b_inData[c6_i19] = (*(creal_T (*)[8])c6_inData)[c6_i19]; 
  } 
 
  for (c6_i20 = 0; c6_i20 < 8; c6_i20++) { 
    c6_u[c6_i20] = c6_b_inData[c6_i20]; 
  } 
 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", c6_u, 0, 1U, 1U, 0U, 2, 1, 8), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static void c6_i_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId, creal_T c6_y[8]) 
{ 
  creal_T c6_dcv0[8]; 
  int32_T c6_i21; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), c6_dcv0, 1, 0, 1U, 1, 0U, 2, 1, 8); 
  for (c6_i21 = 0; c6_i21 < 8; c6_i21++) { 
    c6_y[c6_i21] = c6_dcv0[c6_i21]; 
  } 
 
  sf_mex_destroy(&c6_u); 
} 
 
static void c6_f_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_v; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  creal_T c6_y[8]; 
  int32_T c6_i22; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_v = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_i_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_v), &c6_thisId, c6_y); 
  sf_mex_destroy(&c6_v); 
  for (c6_i22 = 0; c6_i22 < 8; c6_i22++) { 
    (*(creal_T (*)[8])c6_outData)[c6_i22] = c6_y[c6_i22]; 
  } 
 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
const mxArray *sf_c6_mpc_svpwm_get_eml_resolved_functions_info(void) 
{ 
  const mxArray *c6_nameCaptureInfo; 
  c6_ResolvedFunctionInfo c6_info[14]; 
  const mxArray *c6_m0 = NULL; 
  int32_T c6_i23; 
  c6_ResolvedFunctionInfo *c6_r0; 
  c6_nameCaptureInfo = NULL; 
  c6_nameCaptureInfo = NULL; 
  c6_info_helper(c6_info); 
  sf_mex_assign(&c6_m0, sf_mex_createstruct("nameCaptureInfo", 1, 14), FALSE); 
  for (c6_i23 = 0; c6_i23 < 14; c6_i23++) { 
    c6_r0 = &c6_info[c6_i23]; 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", c6_r0->context, 15, 
      0U, 0U, 0U, 2, 1, strlen(c6_r0->context)), "context", "nameCaptureInfo", 
                    c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", c6_r0->name, 15, 0U, 
      0U, 0U, 2, 1, strlen(c6_r0->name)), "name", "nameCaptureInfo", c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", c6_r0->dominantType, 
      15, 0U, 0U, 0U, 2, 1, strlen(c6_r0->dominantType)), "dominantType", 
                    "nameCaptureInfo", c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", c6_r0->resolved, 15, 
      0U, 0U, 0U, 2, 1, strlen(c6_r0->resolved)), "resolved", "nameCaptureInfo", 
                    c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", &c6_r0->fileTimeLo, 
      7, 0U, 0U, 0U, 0), "fileTimeLo", "nameCaptureInfo", c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", &c6_r0->fileTimeHi, 
      7, 0U, 0U, 0U, 0), "fileTimeHi", "nameCaptureInfo", c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", &c6_r0->mFileTimeLo, 
      7, 0U, 0U, 0U, 0), "mFileTimeLo", "nameCaptureInfo", c6_i23); 
    sf_mex_addfield(c6_m0, sf_mex_create("nameCaptureInfo", &c6_r0->mFileTimeHi, 
      7, 0U, 0U, 0U, 0), "mFileTimeHi", "nameCaptureInfo", c6_i23); 
  } 
 
  sf_mex_assign(&c6_nameCaptureInfo, c6_m0, FALSE); 
  sf_mex_emlrtNameCapturePostProcessR2012a(&c6_nameCaptureInfo); 
  return c6_nameCaptureInfo; 
} 
 
static void c6_info_helper(c6_ResolvedFunctionInfo c6_info[14]) 
{ 
  c6_info[0].context = ""; 
  c6_info[0].name = "mrdivide"; 
  c6_info[0].dominantType = "double"; 
  c6_info[0].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p"; 
  c6_info[0].fileTimeLo = 1357926348U; 
  c6_info[0].fileTimeHi = 0U; 
  c6_info[0].mFileTimeLo = 1319708366U; 
  c6_info[0].mFileTimeHi = 0U; 
  c6_info[1].context = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p"; 
  c6_info[1].name = "rdivide"; 
  c6_info[1].dominantType = "double"; 
  c6_info[1].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"; 
  c6_info[1].fileTimeLo = 1346488788U; 
  c6_info[1].fileTimeHi = 0U; 
  c6_info[1].mFileTimeLo = 0U; 
  c6_info[1].mFileTimeHi = 0U; 
  c6_info[2].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"; 
  c6_info[2].name = "eml_scalexp_compatible"; 
  c6_info[2].dominantType = "double"; 
  c6_info[2].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_compatible.m"; 
  c6_info[2].fileTimeLo = 1286797196U; 
  c6_info[2].fileTimeHi = 0U; 
  c6_info[2].mFileTimeLo = 0U; 
  c6_info[2].mFileTimeHi = 0U; 
  c6_info[3].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"; 
  c6_info[3].name = "eml_div"; 
  c6_info[3].dominantType = "double"; 
  c6_info[3].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m"; 
  c6_info[3].fileTimeLo = 1313326210U; 
  c6_info[3].fileTimeHi = 0U; 
  c6_info[3].mFileTimeLo = 0U; 
  c6_info[3].mFileTimeHi = 0U; 
  c6_info[4].context = ""; 
  c6_info[4].name = "mtimes"; 
  c6_info[4].dominantType = "double"; 
  c6_info[4].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m"; 
  c6_info[4].fileTimeLo = 1289494492U; 
  c6_info[4].fileTimeHi = 0U; 
  c6_info[4].mFileTimeLo = 0U; 
  c6_info[4].mFileTimeHi = 0U; 
  c6_info[5].context = ""; 
  c6_info[5].name = "sqrt"; 
  c6_info[5].dominantType = "double"; 
  c6_info[5].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"; 
  c6_info[5].fileTimeLo = 1343808786U; 
  c6_info[5].fileTimeHi = 0U; 
  c6_info[5].mFileTimeLo = 0U; 
  c6_info[5].mFileTimeHi = 0U; 
  c6_info[6].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"; 
  c6_info[6].name = "eml_error"; 
  c6_info[6].dominantType = "char"; 
  c6_info[6].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m"; 
  c6_info[6].fileTimeLo = 1343808758U; 
  c6_info[6].fileTimeHi = 0U; 
  c6_info[6].mFileTimeLo = 0U; 
  c6_info[6].mFileTimeHi = 0U; 
  c6_info[7].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"; 
  c6_info[7].name = "eml_scalar_sqrt"; 
  c6_info[7].dominantType = "double"; 
  c6_info[7].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_sqrt.m"; 
  c6_info[7].fileTimeLo = 1286797138U; 
  c6_info[7].fileTimeHi = 0U; 
  c6_info[7].mFileTimeLo = 0U; 
  c6_info[7].mFileTimeHi = 0U; 
  c6_info[8].context = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m!eml_fldiv"; 
  c6_info[8].name = "eml_scalar_eg"; 
  c6_info[8].dominantType = "double"; 
  c6_info[8].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m"; 
  c6_info[8].fileTimeLo = 1286797196U; 
  c6_info[8].fileTimeHi = 0U; 
  c6_info[8].mFileTimeLo = 0U; 
  c6_info[8].mFileTimeHi = 0U; 
  c6_info[9].context = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m!eml_fldiv"; 
  c6_info[9].name = "eml_scalexp_alloc"; 
  c6_info[9].dominantType = "double"; 
  c6_info[9].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m"; 
  c6_info[9].fileTimeLo = 1352399660U; 
  c6_info[9].fileTimeHi = 0U; 
  c6_info[9].mFileTimeLo = 0U; 
  c6_info[9].mFileTimeHi = 0U; 
  c6_info[10].context = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m!eml_fldiv"; 
  c6_info[10].name = "abs"; 
  c6_info[10].dominantType = "double"; 
  c6_info[10].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"; 
  c6_info[10].fileTimeLo = 1343808766U; 
  c6_info[10].fileTimeHi = 0U; 
  c6_info[10].mFileTimeLo = 0U; 
  c6_info[10].mFileTimeHi = 0U; 
  c6_info[11].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"; 
  c6_info[11].name = "eml_scalar_abs"; 
  c6_info[11].dominantType = "double"; 
  c6_info[11].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m"; 
  c6_info[11].fileTimeLo = 1286797112U; 
  c6_info[11].fileTimeHi = 0U; 
  c6_info[11].mFileTimeLo = 0U; 
  c6_info[11].mFileTimeHi = 0U; 
  c6_info[12].context = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m!eml_fldiv"; 
  c6_info[12].name = "mtimes"; 
  c6_info[12].dominantType = "double"; 
  c6_info[12].resolved = 
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m"; 
  c6_info[12].fileTimeLo = 1289494492U; 
  c6_info[12].fileTimeHi = 0U; 
  c6_info[12].mFileTimeLo = 0U; 
  c6_info[12].mFileTimeHi = 0U; 
  c6_info[13].context = ""; 
  c6_info[13].name = "abs"; 
  c6_info[13].dominantType = "double"; 
  c6_info[13].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"; 
  c6_info[13].fileTimeLo = 1343808766U; 
  c6_info[13].fileTimeHi = 0U; 
  c6_info[13].mFileTimeLo = 0U; 
  c6_info[13].mFileTimeHi = 0U; 
} 
 
static const mxArray *c6_h_sf_marshallOut(void *chartInstanceVoid, void 
  *c6_inData) 
{ 
  const mxArray *c6_mxArrayOutData = NULL; 
  int32_T c6_u; 
  const mxArray *c6_y = NULL; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_mxArrayOutData = NULL; 
  c6_u = *(int32_T *)c6_inData; 
  c6_y = NULL; 
  sf_mex_assign(&c6_y, sf_mex_create("y", &c6_u, 6, 0U, 0U, 0U, 0), FALSE); 
  sf_mex_assign(&c6_mxArrayOutData, c6_y, FALSE); 
  return c6_mxArrayOutData; 
} 
 
static int32_T c6_j_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  int32_T c6_y; 
  int32_T c6_i24; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_i24, 1, 6, 0U, 0, 0U, 0); 
  c6_y = c6_i24; 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void c6_g_sf_marshallIn(void *chartInstanceVoid, const mxArray 
  *c6_mxArrayInData, const char_T *c6_varName, void *c6_outData) 
{ 
  const mxArray *c6_b_sfEvent; 
  const char_T *c6_identifier; 
  emlrtMsgIdentifier c6_thisId; 
  int32_T c6_y; 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)chartInstanceVoid; 
  c6_b_sfEvent = sf_mex_dup(c6_mxArrayInData); 
  c6_identifier = c6_varName; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_j_emlrt_marshallIn(chartInstance, sf_mex_dup(c6_b_sfEvent), 
    &c6_thisId); 
  sf_mex_destroy(&c6_b_sfEvent); 
  *(int32_T *)c6_outData = c6_y; 
  sf_mex_destroy(&c6_mxArrayInData); 
} 
 
static uint8_T c6_k_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_b_is_active_c6_mpc_svpwm, const char_T *c6_identifier) 
{ 
  uint8_T c6_y; 
  emlrtMsgIdentifier c6_thisId; 
  c6_thisId.fIdentifier = c6_identifier; 
  c6_thisId.fParent = NULL; 
  c6_y = c6_l_emlrt_marshallIn(chartInstance, sf_mex_dup 
    (c6_b_is_active_c6_mpc_svpwm), &c6_thisId); 
  sf_mex_destroy(&c6_b_is_active_c6_mpc_svpwm); 
  return c6_y; 
} 
 
static uint8_T c6_l_emlrt_marshallIn(SFc6_mpc_svpwmInstanceStruct *chartInstance, 
  const mxArray *c6_u, const emlrtMsgIdentifier *c6_parentId) 
{ 
  uint8_T c6_y; 
  uint8_T c6_u0; 
  sf_mex_import(c6_parentId, sf_mex_dup(c6_u), &c6_u0, 1, 3, 0U, 0, 0U, 0); 
  c6_y = c6_u0; 
  sf_mex_destroy(&c6_u); 
  return c6_y; 
} 
 
static void init_dsm_address_info(SFc6_mpc_svpwmInstanceStruct *chartInstance) 
{ 
} 
 
/* SFunction Glue Code */ 
#ifdef utFree 
#undef utFree 
#endif 
 
#ifdef utMalloc 
#undef utMalloc 
#endif 
 
#ifdef __cplusplus 
 
extern "C" void *utMalloc(size_t size); 
extern "C" void utFree(void*); 
 
#else 
 
extern void *utMalloc(size_t size); 
extern void utFree(void*); 
 
#endif 
 
void sf_c6_mpc_svpwm_get_check_sum(mxArray *plhs[]) 
{ 
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(4210587739U); 
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3193476931U); 
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1639267418U); 
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1793336513U); 
} 
 
mxArray *sf_c6_mpc_svpwm_get_autoinheritance_info(void) 
{ 
  const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters", 
    "outputs", "locals" }; 
 
  mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,5, 
    autoinheritanceFields); 
 
  { 
    mxArray *mxChecksum = mxCreateString("ee9HBgBfJyjxByIwmytq1D"); 
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum); 
  } 
 
  { 
    const char *dataFields[] = { "size", "type", "complexity" }; 
 
    mxArray *mxData = mxCreateStructMatrix(1,4,3,dataFields); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(2); 
      pr[1] = (double)(1); 
      mxSetField(mxData,0,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,0,"type",mxType); 
    } 
 
    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0)); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(2); 
      pr[1] = (double)(1); 
      mxSetField(mxData,1,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,1,"type",mxType); 
    } 
 
    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0)); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(2); 
      pr[1] = (double)(1); 
      mxSetField(mxData,2,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,2,"type",mxType); 
    } 
 
    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0)); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(1); 
      pr[1] = (double)(1); 
      mxSetField(mxData,3,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,3,"type",mxType); 
    } 
 
    mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0)); 
    mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData); 
  } 
 
  { 
    mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0, 
                mxREAL)); 
  } 
 
  { 
    const char *dataFields[] = { "size", "type", "complexity" }; 
 
    mxArray *mxData = mxCreateStructMatrix(1,3,3,dataFields); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(1); 
      pr[1] = (double)(1); 
      mxSetField(mxData,0,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,0,"type",mxType); 
    } 
 
    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0)); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(1); 
      pr[1] = (double)(1); 
      mxSetField(mxData,1,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,1,"type",mxType); 
    } 
 
    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0)); 
 
    { 
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL); 
      double *pr = mxGetPr(mxSize); 
      pr[0] = (double)(1); 
      pr[1] = (double)(1); 
      mxSetField(mxData,2,"size",mxSize); 
    } 
 
    { 
      const char *typeFields[] = { "base", "fixpt" }; 
 
      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields); 
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10)); 
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL)); 
      mxSetField(mxData,2,"type",mxType); 
    } 
 
    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0)); 
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData); 
  } 
 
  { 
    mxSetField(mxAutoinheritanceInfo,0,"locals",mxCreateDoubleMatrix(0,0,mxREAL)); 
  } 
 
  return(mxAutoinheritanceInfo); 
} 
 
mxArray *sf_c6_mpc_svpwm_third_party_uses_info(void) 
{ 
  mxArray * mxcell3p = mxCreateCellMatrix(1,0); 
  return(mxcell3p); 
} 
 
static const mxArray *sf_get_sim_state_info_c6_mpc_svpwm(void) 
{ 
  const char *infoFields[] = { "chartChecksum", "varInfo" }; 
 
  mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields); 
  const char *infoEncStr[] = { 
    "100 S1x6'type','srcId','name','auxInfo'{{M[1],M[12],T\"Sa\",},{M[1],M[16],T\"Sb\",},{M[1],M[17],T\"Sc\",},{M[4],M[0],T\"i_old\",S'l','i','p'{{M1x2[426 431],M[0],}}},{M[4],M[0],T\"x_old\",S'l','i','p'{{M1x2[419 424],M[0],}}},{M[8],M[0],T\"is_active_c6_mpc_svpwm\",}}" 
  }; 
 
  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 6, 10); 
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL); 
  sf_c6_mpc_svpwm_get_check_sum(&mxChecksum); 
  mxSetField(mxInfo, 0, infoFields[0], mxChecksum); 
  mxSetField(mxInfo, 0, infoFields[1], mxVarInfo); 
  return mxInfo; 
} 
 
static void chart_debug_initialization(SimStruct *S, unsigned int 
  fullDebuggerInitialization) 
{ 
  if (!sim_mode_is_rtw_gen(S)) { 
    SFc6_mpc_svpwmInstanceStruct *chartInstance; 
    chartInstance = (SFc6_mpc_svpwmInstanceStruct *) ((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, 
           _mpc_svpwmMachineNumber_, 
           6, 
           1, 
           1, 
           7, 
           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(_mpc_svpwmMachineNumber_, 
            chartInstance->chartNumber); 
          sf_debug_set_chart_disable_implicit_casting 
            (sfGlobalDebugInstanceStruct,_mpc_svpwmMachineNumber_, 
             chartInstance->chartNumber,1); 
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct, 
            _mpc_svpwmMachineNumber_, 
            chartInstance->chartNumber, 
            0, 
            0, 
            0); 
          _SFD_SET_DATA_PROPS(0,2,0,1,"Sa"); 
          _SFD_SET_DATA_PROPS(1,1,1,0,"I_ref"); 
          _SFD_SET_DATA_PROPS(2,1,1,0,"I"); 
          _SFD_SET_DATA_PROPS(3,2,0,1,"Sb"); 
          _SFD_SET_DATA_PROPS(4,2,0,1,"Sc"); 
          _SFD_SET_DATA_PROPS(5,1,1,0,"V"); 
          _SFD_SET_DATA_PROPS(6,1,1,0,"Vdc"); 
          _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,3,0,0,0,1,0,0,0); 
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,1293); 
        _SFD_CV_INIT_EML_IF(0,1,0,453,470,-1,486); 
        _SFD_CV_INIT_EML_IF(0,1,1,487,504,-1,526); 
        _SFD_CV_INIT_EML_IF(0,1,2,1091,1103,-1,1138); 
        _SFD_CV_INIT_EML_FOR(0,1,0,812,824,1143); 
        _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)c6_c_sf_marshallOut,(MexInFcnForType)c6_c_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)c6_d_sf_marshallOut,(MexInFcnForType)NULL); 
        } 
 
        { 
          unsigned int dimVector[1]; 
          dimVector[0]= 2; 
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0, 
            1.0,0,0,(MexFcnForType)c6_d_sf_marshallOut,(MexInFcnForType)NULL); 
        } 
 
        _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0, 
          (MexFcnForType)c6_c_sf_marshallOut,(MexInFcnForType)c6_c_sf_marshallIn); 
        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0, 
          (MexFcnForType)c6_c_sf_marshallOut,(MexInFcnForType)c6_c_sf_marshallIn); 
 
        { 
          unsigned int dimVector[1]; 
          dimVector[0]= 2; 
          _SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0, 
            1.0,0,0,(MexFcnForType)c6_d_sf_marshallOut,(MexInFcnForType)NULL); 
        } 
 
        _SFD_SET_DATA_COMPILED_PROPS(6,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0, 
          (MexFcnForType)c6_c_sf_marshallOut,(MexInFcnForType)NULL); 
 
        { 
          real_T *c6_Sa; 
          real_T *c6_Sb; 
          real_T *c6_Sc; 
          real_T *c6_Vdc; 
          real_T (*c6_I_ref)[2]; 
          real_T (*c6_I)[2]; 
          real_T (*c6_V)[2]; 
          c6_Vdc = (real_T *)ssGetInputPortSignal(chartInstance->S, 3); 
          c6_V = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2); 
          c6_Sc = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3); 
          c6_Sb = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2); 
          c6_I = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 1); 
          c6_I_ref = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0); 
          c6_Sa = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1); 
          _SFD_SET_DATA_VALUE_PTR(0U, c6_Sa); 
          _SFD_SET_DATA_VALUE_PTR(1U, *c6_I_ref); 
          _SFD_SET_DATA_VALUE_PTR(2U, *c6_I); 
          _SFD_SET_DATA_VALUE_PTR(3U, c6_Sb); 
          _SFD_SET_DATA_VALUE_PTR(4U, c6_Sc); 
          _SFD_SET_DATA_VALUE_PTR(5U, *c6_V); 
          _SFD_SET_DATA_VALUE_PTR(6U, c6_Vdc); 
        } 
      } 
    } else { 
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct, 
        _mpc_svpwmMachineNumber_,chartInstance->chartNumber, 
        chartInstance->instanceNumber); 
    } 
  } 
} 
 
static const char* sf_get_instance_specialization(void) 
{ 
  return "GdF9zr1XRgOBBMLuRJKjsG"; 
} 
 
static void sf_opaque_initialize_c6_mpc_svpwm(void *chartInstanceVar) 
{ 
  chart_debug_initialization(((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar 
    )->S,0); 
  initialize_params_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) 
    chartInstanceVar); 
  initialize_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
} 
 
static void sf_opaque_enable_c6_mpc_svpwm(void *chartInstanceVar) 
{ 
  enable_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
} 
 
static void sf_opaque_disable_c6_mpc_svpwm(void *chartInstanceVar) 
{ 
  disable_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
} 
 
static void sf_opaque_gateway_c6_mpc_svpwm(void *chartInstanceVar) 
{ 
  sf_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
} 
 
extern const mxArray* sf_internal_get_sim_state_c6_mpc_svpwm(SimStruct* S) 
{ 
  ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S); 
  mxArray *plhs[1] = { NULL }; 
 
  mxArray *prhs[4]; 
  int mxError = 0; 
  prhs[0] = mxCreateString("chart_simctx_raw2high"); 
  prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S)); 
  prhs[2] = (mxArray*) get_sim_state_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) 
    chartInfo->chartInstance);         /* raw sim ctx */ 
  prhs[3] = (mxArray*) sf_get_sim_state_info_c6_mpc_svpwm();/* state var info */ 
  mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate"); 
  mxDestroyArray(prhs[0]); 
  mxDestroyArray(prhs[1]); 
  mxDestroyArray(prhs[2]); 
  mxDestroyArray(prhs[3]); 
  if (mxError || plhs[0] == NULL) { 
    sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n"); 
  } 
 
  return plhs[0]; 
} 
 
extern void sf_internal_set_sim_state_c6_mpc_svpwm(SimStruct* S, const mxArray 
  *st) 
{ 
  ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S); 
  mxArray *plhs[1] = { NULL }; 
 
  mxArray *prhs[4]; 
  int mxError = 0; 
  prhs[0] = mxCreateString("chart_simctx_high2raw"); 
  prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S)); 
  prhs[2] = mxDuplicateArray(st);      /* high level simctx */ 
  prhs[3] = (mxArray*) sf_get_sim_state_info_c6_mpc_svpwm();/* state var info */ 
  mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate"); 
  mxDestroyArray(prhs[0]); 
  mxDestroyArray(prhs[1]); 
  mxDestroyArray(prhs[2]); 
  mxDestroyArray(prhs[3]); 
  if (mxError || plhs[0] == NULL) { 
    sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n"); 
  } 
 
  set_sim_state_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) 
    chartInfo->chartInstance, mxDuplicateArray(plhs[0])); 
  mxDestroyArray(plhs[0]); 
} 
 
static const mxArray* sf_opaque_get_sim_state_c6_mpc_svpwm(SimStruct* S) 
{ 
  return sf_internal_get_sim_state_c6_mpc_svpwm(S); 
} 
 
static void sf_opaque_set_sim_state_c6_mpc_svpwm(SimStruct* S, const mxArray *st) 
{ 
  sf_internal_set_sim_state_c6_mpc_svpwm(S, st); 
} 
 
static void sf_opaque_terminate_c6_mpc_svpwm(void *chartInstanceVar) 
{ 
  if (chartInstanceVar!=NULL) { 
    SimStruct *S = ((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar)->S; 
    if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) { 
      sf_clear_rtw_identifier(S); 
      unload_mpc_svpwm_optimization_info(); 
    } 
 
    finalize_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
    utFree((void *)chartInstanceVar); 
    ssSetUserData(S,NULL); 
  } 
} 
 
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar) 
{ 
  initSimStructsc6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) chartInstanceVar); 
} 
 
extern unsigned int sf_machine_global_initializer_called(void); 
static void mdlProcessParameters_c6_mpc_svpwm(SimStruct *S) 
{ 
  int i; 
  for (i=0;i<ssGetNumRunTimeParams(S);i++) { 
    if (ssGetSFcnParamTunable(S,i)) { 
      ssUpdateDlgParamAsRunTimeParam(S,i); 
    } 
  } 
 
  if (sf_machine_global_initializer_called()) { 
    initialize_params_c6_mpc_svpwm((SFc6_mpc_svpwmInstanceStruct*) 
      (((ChartInfoStruct *)ssGetUserData(S))->chartInstance)); 
  } 
} 
 
static void mdlSetWorkWidths_c6_mpc_svpwm(SimStruct *S) 
{ 
  if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) { 
    mxArray *infoStruct = load_mpc_svpwm_optimization_info(); 
    int_T chartIsInlinable = 
      (int_T)sf_is_chart_inlinable(S,sf_get_instance_specialization(),infoStruct, 
      6); 
    ssSetStateflowIsInlinable(S,chartIsInlinable); 
    ssSetRTWCG(S,sf_rtw_info_uint_prop(S,sf_get_instance_specialization(), 
                infoStruct,6,"RTWCG")); 
    ssSetEnableFcnIsTrivial(S,1); 
    ssSetDisableFcnIsTrivial(S,1); 
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S, 
      sf_get_instance_specialization(),infoStruct,6, 
      "gatewayCannotBeInlinedMultipleTimes")); 
    sf_update_buildInfo(S,sf_get_instance_specialization(),infoStruct,6); 
    if (chartIsInlinable) { 
      ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); 
      ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL); 
      ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL); 
      ssSetInputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL); 
      sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(), 
        infoStruct,6,4); 
      sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(), 
        infoStruct,6,3); 
    } 
 
    { 
      unsigned int outPortIdx; 
      for (outPortIdx=1; outPortIdx<=3; ++outPortIdx) { 
        ssSetOutputPortOptimizeInIR(S, outPortIdx, 1U); 
      } 
    } 
 
    { 
      unsigned int inPortIdx; 
      for (inPortIdx=0; inPortIdx < 4; ++inPortIdx) { 
        ssSetInputPortOptimizeInIR(S, inPortIdx, 1U); 
      } 
    } 
 
    sf_set_rtw_dwork_info(S,sf_get_instance_specialization(),infoStruct,6); 
    ssSetHasSubFunctions(S,!(chartIsInlinable)); 
  } else { 
  } 
 
  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE); 
  ssSetChecksum0(S,(2621282172U)); 
  ssSetChecksum1(S,(3158026621U)); 
  ssSetChecksum2(S,(3617401092U)); 
  ssSetChecksum3(S,(3221233129U)); 
  ssSetmdlDerivatives(S, NULL); 
  ssSetExplicitFCSSCtrl(S,1); 
  ssSupportsMultipleExecInstances(S,1); 
} 
 
static void mdlRTW_c6_mpc_svpwm(SimStruct *S) 
{ 
  if (sim_mode_is_rtw_gen(S)) { 
    ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB"); 
  } 
} 
 
static void mdlStart_c6_mpc_svpwm(SimStruct *S) 
{ 
  SFc6_mpc_svpwmInstanceStruct *chartInstance; 
  chartInstance = (SFc6_mpc_svpwmInstanceStruct *)utMalloc(sizeof 
    (SFc6_mpc_svpwmInstanceStruct)); 
  memset(chartInstance, 0, sizeof(SFc6_mpc_svpwmInstanceStruct)); 
  if (chartInstance==NULL) { 
    sf_mex_error_message("Could not allocate memory for chart instance."); 
  } 
 
  chartInstance->chartInfo.chartInstance = chartInstance; 
  chartInstance->chartInfo.isEMLChart = 1; 
  chartInstance->chartInfo.chartInitialized = 0; 
  chartInstance->chartInfo.sFunctionGateway = sf_opaque_gateway_c6_mpc_svpwm; 
  chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c6_mpc_svpwm; 
  chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c6_mpc_svpwm; 
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c6_mpc_svpwm; 
  chartInstance->chartInfo.disableChart = sf_opaque_disable_c6_mpc_svpwm; 
  chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c6_mpc_svpwm; 
  chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c6_mpc_svpwm; 
  chartInstance->chartInfo.getSimStateInfo = sf_get_sim_state_info_c6_mpc_svpwm; 
  chartInstance->chartInfo.zeroCrossings = NULL; 
  chartInstance->chartInfo.outputs = NULL; 
  chartInstance->chartInfo.derivatives = NULL; 
  chartInstance->chartInfo.mdlRTW = mdlRTW_c6_mpc_svpwm; 
  chartInstance->chartInfo.mdlStart = mdlStart_c6_mpc_svpwm; 
  chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c6_mpc_svpwm; 
  chartInstance->chartInfo.extModeExec = NULL; 
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL; 
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL; 
  chartInstance->chartInfo.storeCurrentConfiguration = NULL; 
  chartInstance->S = S; 
  ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */ 
  init_dsm_address_info(chartInstance); 
  if (!sim_mode_is_rtw_gen(S)) { 
  } 
 
  sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance); 
  chart_debug_initialization(S,1); 
} 
 
void c6_mpc_svpwm_method_dispatcher(SimStruct *S, int_T method, void *data) 
{ 
  switch (method) { 
   case SS_CALL_MDL_START: 
    mdlStart_c6_mpc_svpwm(S); 
    break; 
 
   case SS_CALL_MDL_SET_WORK_WIDTHS: 
    mdlSetWorkWidths_c6_mpc_svpwm(S); 
    break; 
 
   case SS_CALL_MDL_PROCESS_PARAMETERS: 
    mdlProcessParameters_c6_mpc_svpwm(S); 
    break; 
 
   default: 
    /* Unhandled method */ 
    sf_mex_error_message("Stateflow Internal Error:\n" 
                         "Error calling c6_mpc_svpwm_method_dispatcher.\n" 
                         "Can't handle method %d.\n", method); 
    break; 
  } 
}