/* Include files */
#include <stddef.h>
#include "blas.h"
#include "N2PMSM_PI_decomposition_sfun.h"
#include "c17_N2PMSM_PI_decomposition.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "N2PMSM_PI_decomposition_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 real_T _sfTime_;
static const char * c17_debug_family_names[64] = { "pn", "The", "Alpha", "Beta",
"D", "Q", "we", "flux", "Ld", "iq_s", "Lq", "id_s", "speed_in", "Ts",
"speed_out0", "speed_out", "iq_in", "R", "iq_out", "iq_lim", "id_in", "id_out",
"id_lim", "Vq", "Vd", "Ualpha", "Ubeta", "B0", "B1", "B2", "N", "X", "Y", "Z",
"T1", "T2", "Tpwm", "fcn1", "fcn", "fcn2", "Ta", "Tb", "Tc", "Tcm1", "Tcm2",
"Tcm3", "add1", "add2", "add3", "nargin", "nargout", "Te", "The0", "ia", "ib",
"ic", "wm", "n_given", "id_given", "Ts1", "Udc", "In", "pulse", "Nr" };
/* Function Declarations */
static void initialize_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void initialize_params_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void enable_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void disable_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void c17_update_debugger_state_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void set_sim_state_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance, const mxArray
*c17_st);
static void finalize_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void sf_gateway_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void mdl_start_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void c17_chartstep_c17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void initSimStructsc17_N2PMSM_PI_decomposition
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c17_machineNumber, uint32_T
c17_chartNumber, uint32_T c17_instanceNumber);
static const mxArray *c17_sf_marshallOut(void *chartInstanceVoid, void
*c17_inData);
static real_T c17_emlrt_marshallIn(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, const mxArray *c17_b_Nr, const char_T *c17_identifier);
static real_T c17_b_emlrt_marshallIn(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, const mxArray *c17_u, const emlrtMsgIdentifier *c17_parentId);
static void c17_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c17_mxArrayInData, const char_T *c17_varName, void *c17_outData);
static const mxArray *c17_b_sf_marshallOut(void *chartInstanceVoid, void
*c17_inData);
static void c17_c_emlrt_marshallIn(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, const mxArray *c17_b_pulse, const char_T *c17_identifier,
real_T c17_y[6]);
static void c17_d_emlrt_marshallIn(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, const mxArray *c17_u, const emlrtMsgIdentifier *c17_parentId,
real_T c17_y[6]);
static void c17_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c17_mxArrayInData, const char_T *c17_varName, void *c17_outData);
static void c17_info_helper(const mxArray **c17_info);
static const mxArray *c17_emlrt_marshallOut(const char * c17_u);
static const mxArray *c17_b_emlrt_marshallOut(const uint32_T c17_u);
static void c17_eps(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance);
static const mxArray *c17_c_sf_marshallOut(void *chartInstanceVoid, void
*c17_inData);
static int32_T c17_e_emlrt_marshallIn
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance, const mxArray
*c17_u, const emlrtMsgIdentifier *c17_parentId);
static void c17_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c17_mxArrayInData, const char_T *c17_varName, void *c17_outData);
static uint8_T c17_f_emlrt_marshallIn
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance, const mxArray
*c17_b_is_active_c17_N2PMSM_PI_decomposition, const char_T *c17_identifier);
static uint8_T c17_g_emlrt_marshallIn
(SFc17_N2PMSM_PI_decompositionInstanceStruct *chartInstance, const mxArray
*c17_u, const emlrtMsgIdentifier *c17_parentId);
static real_T c17_get_Nr_0(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_Nr_0(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_Nr_0(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_id_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_id_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_id_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_iq_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_iq_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_iq_i(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_pwm1(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_pwm1(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_pwm1(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_pwm2(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_pwm2(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_pwm2(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_pwm3(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_pwm3(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_pwm3(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_pwm4(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_pwm4(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_pwm4(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_rdOnly);
static real_T c17_get_pwm5(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex);
static void c17_set_pwm5(SFc17_N2PMSM_PI_decompositionInstanceStruct
*chartInstance, uint32_T c17_elementIndex, real_T c17_elementValue);
static real_T *c17_access_pwm5(SFc17_N2PMSM_PI_decompositionInstanceStruct