/* Include files */
#include <stddef.h>
#include "blas.h"
#include "ThreeLevelSVPWM1_sfun.h"
#include "c1_ThreeLevelSVPWM1.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "ThreeLevelSVPWM1_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 * c1_debug_family_names[7] = { "nargin", "nargout", "Udc",
"Re", "Im", "theta", "n" };
/* Function Declarations */
static void initialize_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void initialize_params_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance);
static void enable_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void disable_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void c1_update_debugger_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance);
static const mxArray *get_sim_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance);
static void set_sim_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance, const mxArray *c1_st);
static void finalize_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void sf_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void c1_chartstep_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
static void initSimStructsc1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber);
static const mxArray *c1_sf_marshallOut(void *chartInstanceVoid, void *c1_inData);
static real_T c1_emlrt_marshallIn(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance, const mxArray *c1_n, const char_T *c1_identifier);
static real_T c1_b_emlrt_marshallIn(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance, const mxArray *c1_u, const emlrtMsgIdentifier *c1_parentId);
static void c1_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c1_mxArrayInData, const char_T *c1_varName, void *c1_outData);
static void c1_info_helper(const mxArray **c1_info);
static const mxArray *c1_emlrt_marshallOut(char * c1_u);
static const mxArray *c1_b_emlrt_marshallOut(uint32_T c1_u);
static const mxArray *c1_b_sf_marshallOut(void *chartInstanceVoid, void
*c1_inData);
static int32_T c1_c_emlrt_marshallIn(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance, const mxArray *c1_u, const emlrtMsgIdentifier *c1_parentId);
static void c1_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c1_mxArrayInData, const char_T *c1_varName, void *c1_outData);
static uint8_T c1_d_emlrt_marshallIn(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance, const mxArray *c1_b_is_active_c1_ThreeLevelSVPWM1, const
char_T *c1_identifier);
static uint8_T c1_e_emlrt_marshallIn(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance, const mxArray *c1_u, const emlrtMsgIdentifier *c1_parentId);
static void init_dsm_address_info(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
chartInstance->c1_sfEvent = CALL_EVENT;
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c1_is_active_c1_ThreeLevelSVPWM1 = 0U;
}
static void initialize_params_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance)
{
}
static void enable_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c1_update_debugger_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance)
{
const mxArray *c1_st;
const mxArray *c1_y = NULL;
real_T c1_hoistedGlobal;
real_T c1_u;
const mxArray *c1_b_y = NULL;
uint8_T c1_b_hoistedGlobal;
uint8_T c1_b_u;
const mxArray *c1_c_y = NULL;
real_T *c1_n;
c1_n = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c1_st = NULL;
c1_st = NULL;
c1_y = NULL;
sf_mex_assign(&c1_y, sf_mex_createcellarray(2), FALSE);
c1_hoistedGlobal = *c1_n;
c1_u = c1_hoistedGlobal;
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_u, 0, 0U, 0U, 0U, 0), FALSE);
sf_mex_setcell(c1_y, 0, c1_b_y);
c1_b_hoistedGlobal = chartInstance->c1_is_active_c1_ThreeLevelSVPWM1;
c1_b_u = c1_b_hoistedGlobal;
c1_c_y = NULL;
sf_mex_assign(&c1_c_y, sf_mex_create("y", &c1_b_u, 3, 0U, 0U, 0U, 0), FALSE);
sf_mex_setcell(c1_y, 1, c1_c_y);
sf_mex_assign(&c1_st, c1_y, FALSE);
return c1_st;
}
static void set_sim_state_c1_ThreeLevelSVPWM1
(SFc1_ThreeLevelSVPWM1InstanceStruct *chartInstance, const mxArray *c1_st)
{
const mxArray *c1_u;
real_T *c1_n;
c1_n = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c1_doneDoubleBufferReInit = TRUE;
c1_u = sf_mex_dup(c1_st);
*c1_n = c1_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 0)),
"n");
chartInstance->c1_is_active_c1_ThreeLevelSVPWM1 = c1_d_emlrt_marshallIn
(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 1)),
"is_active_c1_ThreeLevelSVPWM1");
sf_mex_destroy(&c1_u);
c1_update_debugger_state_c1_ThreeLevelSVPWM1(chartInstance);
sf_mex_destroy(&c1_st);
}
static void finalize_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
}
static void sf_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
real_T *c1_n;
real_T *c1_Udc;
real_T *c1_Re;
real_T *c1_Im;
real_T *c1_theta;
c1_theta = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
c1_Im = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
c1_Re = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c1_Udc = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
c1_n = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
_SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
_SFD_DATA_RANGE_CHECK(*c1_n, 0U);
_SFD_DATA_RANGE_CHECK(*c1_Udc, 1U);
_SFD_DATA_RANGE_CHECK(*c1_Re, 2U);
_SFD_DATA_RANGE_CHECK(*c1_Im, 3U);
_SFD_DATA_RANGE_CHECK(*c1_theta, 4U);
chartInstance->c1_sfEvent = CALL_EVENT;
c1_chartstep_c1_ThreeLevelSVPWM1(chartInstance);
_SFD_SYMBOL_SCOPE_POP();
_SFD_CHECK_FOR_STATE_INCONSISTENCY(_ThreeLevelSVPWM1MachineNumber_,
chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void c1_chartstep_c1_ThreeLevelSVPWM1(SFc1_ThreeLevelSVPWM1InstanceStruct
*chartInstance)
{
real_T c1_hoistedGlobal;
real_T c1_b_hoistedGlobal;
real_T c1_c_hoistedGlobal;
real_T c1_d_hoistedGlobal;
real_T c1_Udc;
real_T c1_Re;
real_T c1_Im;
real_T c1_theta;
uint32_T c1_debug_family_var_map[7];
real_T c1_nargin = 4.0;
real_T c1_nargout = 1.0;
real_T c1_n;
real_T c1_b;
real_T c1_y;
real_T c1_a;
real_T c1_b_y;
real_T c1_A;
real_T c1_x;
real_T c1_b_x;
real_T c1_c_y;
real_T c1_b_b;
real_T c1_d_y;
real_T c1_b_a;
real_T c1_e_y;
real_T c1_b_A;
real_T c1_c_x;
real_T c1_d_x;
real_T c1_f_y;
boolean_T c1_b0;
boolean_T c1_u;
const mxArray *c1_g_y = NULL;
real_T c1_c_