/* Include files */
#include <stddef.h>
#include "blas.h"
#include "PMSM_SMVC_sfun.h"
#include "c2_PMSM_SMVC.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "PMSM_SMVC_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 * c2_debug_family_names[19] = { "L", "R", "phin", "J", "B",
"pn", "c", "s", "sigemu", "k", "A", "iq", "nargin", "nargout", "x1", "x2",
"tl", "w", "y" };
/* Function Declarations */
static void initialize_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
static void initialize_params_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance);
static void enable_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
static void disable_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance);
static const mxArray *get_sim_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance);
static void set_sim_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance, const mxArray *c2_st);
static void finalize_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
static void sf_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
static void initSimStructsc2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance);
static void registerMessagesc2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber);
static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void *c2_inData);
static real_T c2_emlrt_marshallIn(SFc2_PMSM_SMVCInstanceStruct *chartInstance,
const mxArray *c2_y, const char_T *c2_identifier);
static real_T c2_b_emlrt_marshallIn(SFc2_PMSM_SMVCInstanceStruct *chartInstance,
const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
*c2_inData);
static int32_T c2_c_emlrt_marshallIn(SFc2_PMSM_SMVCInstanceStruct *chartInstance,
const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static uint8_T c2_d_emlrt_marshallIn(SFc2_PMSM_SMVCInstanceStruct *chartInstance,
const mxArray *c2_b_is_active_c2_PMSM_SMVC, const char_T *c2_identifier);
static uint8_T c2_e_emlrt_marshallIn(SFc2_PMSM_SMVCInstanceStruct *chartInstance,
const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void init_dsm_address_info(SFc2_PMSM_SMVCInstanceStruct *chartInstance);
/* Function Definitions */
static void initialize_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance)
{
chartInstance->c2_sfEvent = CALL_EVENT;
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c2_is_active_c2_PMSM_SMVC = 0U;
}
static void initialize_params_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance)
{
}
static void enable_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c2_update_debugger_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance)
{
}
static const mxArray *get_sim_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance)
{
const mxArray *c2_st;
const mxArray *c2_y = NULL;
real_T c2_hoistedGlobal;
real_T c2_u;
const mxArray *c2_b_y = NULL;
uint8_T c2_b_hoistedGlobal;
uint8_T c2_b_u;
const mxArray *c2_c_y = NULL;
real_T *c2_d_y;
c2_d_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c2_st = NULL;
c2_st = NULL;
c2_y = NULL;
sf_mex_assign(&c2_y, sf_mex_createcellarray(2), FALSE);
c2_hoistedGlobal = *c2_d_y;
c2_u = c2_hoistedGlobal;
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), FALSE);
sf_mex_setcell(c2_y, 0, c2_b_y);
c2_b_hoistedGlobal = chartInstance->c2_is_active_c2_PMSM_SMVC;
c2_b_u = c2_b_hoistedGlobal;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_b_u, 3, 0U, 0U, 0U, 0), FALSE);
sf_mex_setcell(c2_y, 1, c2_c_y);
sf_mex_assign(&c2_st, c2_y, FALSE);
return c2_st;
}
static void set_sim_state_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct
*chartInstance, const mxArray *c2_st)
{
const mxArray *c2_u;
real_T *c2_y;
c2_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c2_doneDoubleBufferReInit = TRUE;
c2_u = sf_mex_dup(c2_st);
*c2_y = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)),
"y");
chartInstance->c2_is_active_c2_PMSM_SMVC = c2_d_emlrt_marshallIn(chartInstance,
sf_mex_dup(sf_mex_getcell(c2_u, 1)), "is_active_c2_PMSM_SMVC");
sf_mex_destroy(&c2_u);
c2_update_debugger_state_c2_PMSM_SMVC(chartInstance);
sf_mex_destroy(&c2_st);
}
static void finalize_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance)
{
}
static void sf_c2_PMSM_SMVC(SFc2_PMSM_SMVCInstanceStruct *chartInstance)
{
real_T c2_hoistedGlobal;
real_T c2_b_hoistedGlobal;
real_T c2_c_hoistedGlobal;
real_T c2_d_hoistedGlobal;
real_T c2_x1;
real_T c2_x2;
real_T c2_tl;
real_T c2_w;
uint32_T c2_debug_family_var_map[19];
real_T c2_L;
real_T c2_R;
real_T c2_phin;
real_T c2_J;
real_T c2_B;
real_T c2_pn;
real_T c2_c;
real_T c2_s;
real_T c2_sigemu;
real_T c2_k;
real_T c2_A;
real_T c2_iq;
real_T c2_nargin = 4.0;
real_T c2_nargout = 1.0;
real_T c2_y;
real_T c2_b;
real_T c2_b_y;
real_T c2_b_A;
real_T c2_x;
real_T c2_b_x;
real_T c2_c_y;
real_T c2_b_b;
real_T c2_d_y;
real_T c2_c_b;
real_T c2_e_y;
real_T c2_c_x;
real_T c2_d_x;
real_T c2_d_b;
real_T c2_f_y;
real_T c2_e_b;
real_T c2_g_y;
real_T c2_f_b;
real_T *c2_b_w;
real_T *c2_b_tl;
real_T *c2_b_x2;
real_T *c2_b_x1;
real_T *c2_h_y;
c2_b_w = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
c2_b_tl = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
c2_h_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c2_b_x2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c2_b_x1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
_SFD_DATA_RANGE_CHECK(*c2_b_x1, 0U);
_SFD_DATA_RANGE_CHECK(*c2_b_x2, 1U);
_SFD_DATA_RANGE_CHECK(*c2_h_y, 2U);
_SFD_DATA_RANGE_CHECK(*c2_b_tl, 3U);
_SFD_DATA_RANGE_CHECK(*c2_b_w, 4U);
chartInstance->c2_sfEvent = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
c2_hoistedGlobal = *c2_b_x1;
c2_b_hoistedGlobal = *c2_b_x2;
c2_c_hoistedGlobal = *c2_b_tl;
c2_d_hoistedGlobal = *c2_b_w;
c2_x1 = c2_hoistedGlobal;
c2_x2 = c2_b_hoistedGlobal;
c2_tl = c2_c_hoistedGlobal;
c2_w = c2_d_hoistedGlobal;
_SFD_SYMBOL_SCOPE_PUSH_EML(0U, 19U, 19U, c2_debug_family_names,
c2_debug_family_var_map);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_L, 0U, c2_sf_marshallOut,
c2_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_R, 1U, c2_sf_marshallOut,
c2_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML(&c2_phin, 2U, c2_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML(&c2_J
评论9