/* Include files */
#include "blascompat32.h"
#include "b1021_sfun.h"
#include "c2_b1021.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "b1021_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
#define CALL_EVENT (-1)
/* Variable Declarations */
/* Variable Definitions */
static const char * c2_debug_family_names[6] = { "nargin", "nargout", "ua", "ub",
"uc", "y" };
/* Function Declarations */
static void initialize_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void initialize_params_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void enable_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void disable_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_b1021(SFc2_b1021InstanceStruct
*chartInstance);
static const mxArray *get_sim_state_c2_b1021(SFc2_b1021InstanceStruct
*chartInstance);
static void set_sim_state_c2_b1021(SFc2_b1021InstanceStruct *chartInstance,
const mxArray *c2_st);
static void finalize_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void sf_c2_b1021(SFc2_b1021InstanceStruct *chartInstance);
static void initSimStructsc2_b1021(SFc2_b1021InstanceStruct *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 void c2_emlrt_marshallIn(SFc2_b1021InstanceStruct *chartInstance, const
mxArray *c2_y, const char_T *c2_identifier, real_T c2_b_y[6]);
static void c2_b_emlrt_marshallIn(SFc2_b1021InstanceStruct *chartInstance, const
mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId, real_T c2_y[6]);
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 real_T c2_c_emlrt_marshallIn(SFc2_b1021InstanceStruct *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 const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
*c2_inData);
static int32_T c2_d_emlrt_marshallIn(SFc2_b1021InstanceStruct *chartInstance,
const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static uint8_T c2_e_emlrt_marshallIn(SFc2_b1021InstanceStruct *chartInstance,
const mxArray *c2_b_is_active_c2_b1021, const char_T *c2_identifier);
static uint8_T c2_f_emlrt_marshallIn(SFc2_b1021InstanceStruct *chartInstance,
const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void init_dsm_address_info(SFc2_b1021InstanceStruct *chartInstance);
/* Function Definitions */
static void initialize_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
chartInstance->c2_sfEvent = CALL_EVENT;
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c2_is_active_c2_b1021 = 0U;
}
static void initialize_params_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
}
static void enable_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c2_update_debugger_state_c2_b1021(SFc2_b1021InstanceStruct
*chartInstance)
{
}
static const mxArray *get_sim_state_c2_b1021(SFc2_b1021InstanceStruct
*chartInstance)
{
const mxArray *c2_st;
const mxArray *c2_y = NULL;
int32_T c2_i0;
real_T c2_u[6];
const mxArray *c2_b_y = NULL;
uint8_T c2_hoistedGlobal;
uint8_T c2_b_u;
const mxArray *c2_c_y = NULL;
real_T (*c2_d_y)[6];
c2_d_y = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
c2_st = NULL;
c2_st = NULL;
c2_y = NULL;
sf_mex_assign(&c2_y, sf_mex_createcellarray(2), FALSE);
for (c2_i0 = 0; c2_i0 < 6; c2_i0++) {
c2_u[c2_i0] = (*c2_d_y)[c2_i0];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 2, 1, 6), FALSE);
sf_mex_setcell(c2_y, 0, c2_b_y);
c2_hoistedGlobal = chartInstance->c2_is_active_c2_b1021;
c2_b_u = c2_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_b1021(SFc2_b1021InstanceStruct *chartInstance,
const mxArray *c2_st)
{
const mxArray *c2_u;
real_T c2_dv0[6];
int32_T c2_i1;
real_T (*c2_y)[6];
c2_y = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c2_doneDoubleBufferReInit = TRUE;
c2_u = sf_mex_dup(c2_st);
c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)), "y",
c2_dv0);
for (c2_i1 = 0; c2_i1 < 6; c2_i1++) {
(*c2_y)[c2_i1] = c2_dv0[c2_i1];
}
chartInstance->c2_is_active_c2_b1021 = c2_e_emlrt_marshallIn(chartInstance,
sf_mex_dup(sf_mex_getcell(c2_u, 1)), "is_active_c2_b1021");
sf_mex_destroy(&c2_u);
c2_update_debugger_state_c2_b1021(chartInstance);
sf_mex_destroy(&c2_st);
}
static void finalize_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
}
static void sf_c2_b1021(SFc2_b1021InstanceStruct *chartInstance)
{
int32_T c2_i2;
real_T c2_hoistedGlobal;
real_T c2_b_hoistedGlobal;
real_T c2_c_hoistedGlobal;
real_T c2_ua;
real_T c2_ub;
real_T c2_uc;
uint32_T c2_debug_family_var_map[6];
real_T c2_nargin = 3.0;
real_T c2_nargout = 1.0;
real_T c2_y[6];
int32_T c2_i3;
int32_T c2_i4;
static real_T c2_dv1[6] = { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 };
int32_T c2_i5;
static real_T c2_dv2[6] = { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0 };
int32_T c2_i6;
static real_T c2_dv3[6] = { 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
int32_T c2_i7;
static real_T c2_dv4[6] = { 0.0, 1.0, 0.0, 0.0, 1.0, 0.0 };
int32_T c2_i8;
static real_T c2_dv5[6] = { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 };
int32_T c2_i9;
static real_T c2_dv6[6] = { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 };
int32_T c2_i10;
int32_T c2_i11;
int32_T c2_i12;
real_T *c2_b_ua;
real_T *c2_b_ub;
real_T *c2_b_uc;
real_T (*c2_b_y)[6];
boolean_T guard1 = FALSE;
boolean_T guard2 = FALSE;
boolean_T guard3 = FALSE;
boolean_T guard4 = FALSE;
boolean_T guard5 = FALSE;
boolean_T guard6 = FALSE;
boolean_T guard7 = FALSE;
boolean_T guard8 = FALSE;
boolean_T guard9 = FALSE;
boolean_T guard10 = FALSE;
boolean_T guard11 = FALSE;
boolean_T guard12 = FALSE;
boolean_T guard13 = FALSE;
boolean_T guard14 = FALSE;
boolean_T guard15 = FALSE;
boolean_T guard16 = FALSE;
c2_b_uc = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
c2_b_ub = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c2_b_y = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 1);
c2_b_ua = (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_ua, 0U);
for (c2_i2 = 0; c2_i2 < 6; c2_i2++) {
_SFD_DATA_RANGE_CHECK((*c2_b_y)[c2_i2], 1U);
}
_SFD_DATA_RANGE_CHECK(*c2_b_ub, 2U);
_SFD_DATA_RANGE_CHECK(*c2_b_uc, 3U);
chartInstance->c2_sfEvent = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
c2_hoistedGlobal = *c2_b_ua;
c2_b_hoistedGlobal = *c2_b_ub;
c2_c_hoistedGlobal = *c2_b_uc;
c2_ua = c2_hoistedGlo