📄 c2_mybldc_mdl2.c
字号:
/* Include files */
#include "mybldc_mdl2_sfun.h"
#include "c2_mybldc_mdl2.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance.instanceNumber)
#include "mybldc_mdl2_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
#define c2_IN_NO_ACTIVE_CHILD (0)
#define c2_IN_B (1)
#define c2_IN_B1 (1)
#define c2_IN_B2 (2)
/* Variable Declarations */
/* Variable Definitions */
static SFc2_mybldc_mdl2InstanceStruct chartInstance;
/* Function Declarations */
static void initialize_c2_mybldc_mdl2(void);
static void initialize_params_c2_mybldc_mdl2(void);
static void enable_c2_mybldc_mdl2(void);
static void disable_c2_mybldc_mdl2(void);
static void finalize_c2_mybldc_mdl2(void);
static void sf_c2_mybldc_mdl2(void);
static void store_current_config(void);
static void restore_last_major_step(void);
static void restore_before_last_major_step(void);
static real_T *c2_IV(void);
static real_T *c2_IVSTAR(void);
static real_T *c2_Q3(void);
static real_T *c2_Q6(void);
static void init_test_point_addr_map(void);
static void **get_test_point_address_map(void);
static rtwCAPI_ModelMappingInfo *get_test_point_mapping_info(void);
/* Function Definitions */
static void initialize_c2_mybldc_mdl2(void)
{
uint8_T c2_previousEvent;
chartInstance.c2_is_B = 0;
chartInstance.c2_tp_B = 0;
chartInstance.c2_tp_B1 = 0;
chartInstance.c2_tp_B2 = 0;
chartInstance.c2_is_active_c2_mybldc_mdl2 = 0;
chartInstance.c2_is_c2_mybldc_mdl2 = 0;
if(!(cdrGetOutputPortReusable(chartInstance.S, 1) != 0)) {
*c2_Q3() = 0.0;
}
if(!(cdrGetOutputPortReusable(chartInstance.S, 2) != 0)) {
*c2_Q6() = 0.0;
}
c2_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
c2_mybldc_mdl2();
_sfEvent_ = c2_previousEvent;
store_current_config();
store_current_config();
}
static void initialize_params_c2_mybldc_mdl2(void)
{
}
static void enable_c2_mybldc_mdl2(void)
{
}
static void disable_c2_mybldc_mdl2(void)
{
}
static void finalize_c2_mybldc_mdl2(void)
{
}
static void sf_c2_mybldc_mdl2(void)
{
uint8_T c2_previousEvent;
_sfTime_ = (real_T)ssGetT(chartInstance.S);
_SFD_DATA_RANGE_CHECK(*c2_IV(), 0U);
_SFD_DATA_RANGE_CHECK(*c2_IVSTAR(), 2U);
_SFD_DATA_RANGE_CHECK(*c2_Q3(), 1U);
_SFD_DATA_RANGE_CHECK(*c2_Q6(), 3U);
c2_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
c2_mybldc_mdl2();
_sfEvent_ = c2_previousEvent;
}
void c2_mybldc_mdl2(void)
{
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1);
if(chartInstance.c2_is_active_c2_mybldc_mdl2 == 0) {
_SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,1);
chartInstance.c2_is_active_c2_mybldc_mdl2 = 1;
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
if(CV_TRANSITION_EVAL(0U, (int32_T)_SFD_CCP_CALL(0,0,(1))) != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
chartInstance.c2_is_c2_mybldc_mdl2 = (uint8_T)c2_IN_B;
_SFD_CS_CALL(STATE_ACTIVE_TAG,2);
chartInstance.c2_tp_B = 1;
if(CV_TRANSITION_EVAL(2U, (int32_T)_SFD_CCP_CALL(2,0,(1))) != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
chartInstance.c2_is_B = (uint8_T)c2_IN_B1;
_SFD_CS_CALL(STATE_ACTIVE_TAG,1);
chartInstance.c2_tp_B1 = 1;
}
}
} else {
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
switch(chartInstance.c2_is_B) {
case c2_IN_B1:
CV_STATE_EVAL(2,0,1);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
if(CV_TRANSITION_EVAL(3U, (int32_T)_SFD_CCP_CALL(3,0,(*c2_IV() >
*c2_IVSTAR()))) != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,3);
chartInstance.c2_tp_B1 = 0;
chartInstance.c2_is_B = (uint8_T)c2_IN_NO_ACTIVE_CHILD;
_SFD_CS_CALL(STATE_INACTIVE_TAG,1);
chartInstance.c2_is_B = (uint8_T)c2_IN_B2;
_SFD_CS_CALL(STATE_ACTIVE_TAG,0);
chartInstance.c2_tp_B2 = 1;
} else {
*c2_Q3() = 1.0;
_SFD_DATA_RANGE_CHECK(*c2_Q3(), 1U);
*c2_Q6() = 0.0;
_SFD_DATA_RANGE_CHECK(*c2_Q6(), 3U);
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
break;
case c2_IN_B2:
CV_STATE_EVAL(2,0,2);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,0);
if(CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1,0,(*c2_IV() <
*c2_IVSTAR()))) != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
chartInstance.c2_tp_B2 = 0;
chartInstance.c2_is_B = (uint8_T)c2_IN_NO_ACTIVE_CHILD;
_SFD_CS_CALL(STATE_INACTIVE_TAG,0);
chartInstance.c2_is_B = (uint8_T)c2_IN_B1;
_SFD_CS_CALL(STATE_ACTIVE_TAG,1);
chartInstance.c2_tp_B1 = 1;
} else {
*c2_Q3() = 0.0;
_SFD_DATA_RANGE_CHECK(*c2_Q3(), 1U);
*c2_Q6() = 1.0;
_SFD_DATA_RANGE_CHECK(*c2_Q6(), 3U);
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
break;
default:
CV_STATE_EVAL(2,0,0);
break;
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
}
static void store_current_config(void)
{
chartInstance.c2_tp_B_shadow2 = chartInstance.c2_tp_B_shadow1;
chartInstance.c2_tp_B_shadow1 = chartInstance.c2_tp_B;
chartInstance.c2_tp_B1_shadow2 = chartInstance.c2_tp_B1_shadow1;
chartInstance.c2_tp_B1_shadow1 = chartInstance.c2_tp_B1;
chartInstance.c2_tp_B2_shadow2 = chartInstance.c2_tp_B2_shadow1;
chartInstance.c2_tp_B2_shadow1 = chartInstance.c2_tp_B2;
chartInstance.c2_is_active_c2_mybldc_mdl2_shadow2 =
chartInstance.c2_is_active_c2_mybldc_mdl2_shadow1;
chartInstance.c2_is_active_c2_mybldc_mdl2_shadow1 =
chartInstance.c2_is_active_c2_mybldc_mdl2;
chartInstance.c2_is_c2_mybldc_mdl2_shadow2 =
chartInstance.c2_is_c2_mybldc_mdl2_shadow1;
chartInstance.c2_is_c2_mybldc_mdl2_shadow1 =
chartInstance.c2_is_c2_mybldc_mdl2;
chartInstance.c2_is_B_shadow2 = chartInstance.c2_is_B_shadow1;
chartInstance.c2_is_B_shadow1 = chartInstance.c2_is_B;
chartInstance.c2_Q3_shadow2 = chartInstance.c2_Q3_shadow1;
chartInstance.c2_Q3_shadow1 = *c2_Q3();
chartInstance.c2_Q6_shadow2 = chartInstance.c2_Q6_shadow1;
chartInstance.c2_Q6_shadow1 = *c2_Q6();
sf_debug_store_current_state_configuration(_mybldc_mdl2MachineNumber_,
chartInstance.chartNumber, chartInstance.instanceNumber);
}
static void restore_last_major_step(void)
{
chartInstance.c2_tp_B = chartInstance.c2_tp_B_shadow1;
chartInstance.c2_tp_B1 = chartInstance.c2_tp_B1_shadow1;
chartInstance.c2_tp_B2 = chartInstance.c2_tp_B2_shadow1;
chartInstance.c2_is_active_c2_mybldc_mdl2 =
chartInstance.c2_is_active_c2_mybldc_mdl2_shadow1;
chartInstance.c2_is_c2_mybldc_mdl2 =
chartInstance.c2_is_c2_mybldc_mdl2_shadow1;
chartInstance.c2_is_B = chartInstance.c2_is_B_shadow1;
*c2_Q3() = chartInstance.c2_Q3_shadow1;
*c2_Q6() = chartInstance.c2_Q6_shadow1;
sf_debug_restore_previous_state_configuration(_mybldc_mdl2MachineNumber_,
chartInstance.chartNumber, chartInstance.instanceNumber);
}
static void restore_before_last_major_step(void)
{
chartInstance.c2_tp_B = chartInstance.c2_tp_B_shadow2;
chartInstance.c2_tp_B1 = chartInstance.c2_tp_B1_shadow2;
chartInstance.c2_tp_B2 = chartInstance.c2_tp_B2_shadow2;
chartInstance.c2_is_active_c2_mybldc_mdl2 =
chartInstance.c2_is_active_c2_mybldc_mdl2_shadow2;
chartInstance.c2_is_c2_mybldc_mdl2 =
chartInstance.c2_is_c2_mybldc_mdl2_shadow2;
chartInstance.c2_is_B = chartInstance.c2_is_B_shadow2;
*c2_Q3() = chartInstance.c2_Q3_shadow2;
*c2_Q6() = chartInstance.c2_Q6_shadow2;
sf_debug_restore_previous_state_configuration2(_mybldc_mdl2MachineNumber_,
chartInstance.chartNumber, chartInstance.instanceNumber);
}
static real_T *c2_IV(void)
{
return (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
}
static real_T *c2_IVSTAR(void)
{
return (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
}
static real_T *c2_Q3(void)
{
return (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
}
static real_T *c2_Q6(void)
{
return (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
}
static void init_test_point_addr_map(void)
{
chartInstance.c2_testPointAddrMap[0] = &chartInstance.c2_tp_B;
chartInstance.c2_testPointAddrMap[1] = &chartInstance.c2_tp_B1;
chartInstance.c2_testPointAddrMap[2] = &chartInstance.c2_tp_B2;
}
static void **get_test_point_address_map(void)
{
return &chartInstance.c2_testPointAddrMap[0];
}
static rtwCAPI_ModelMappingInfo *get_test_point_mapping_info(void)
{
return &chartInstance.c2_testPointMappingInfo;
}
/* SFunction Glue Code */
static void init_test_point_mapping_info(SimStruct *S);
void sf_c2_mybldc_mdl2_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(350711250U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2239766752U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1283151175U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(622461824U);
}
mxArray *sf_c2_mybldc_mdl2_get_autoinheritance_info(void)
{
const char *autoinheritanceInfoStructFieldNames[] =
{"checksum","inputTypes","inputComplexities","parameterTypes","parameterComplexities","outputSizes","outputTypes","outputComplexities"};
mxArray *mxAutoinheritanceInfo = NULL;
mxArray *mxChecksum = NULL;
mxArray *mxInputTypes = NULL;
mxArray *mxInputComplexities = NULL;
mxArray *mxParameterTypes = NULL;
mxArray *mxParameterComplexities = NULL;
mxArray *mxOutputSizes = NULL;
mxArray *mxOutputTypes = NULL;
mxArray *mxOutputComplexities = NULL;
mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,
sizeof(autoinheritanceInfoStructFieldNames)/sizeof(char *),
autoinheritanceInfoStructFieldNames);
mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
((real_T *)mxGetPr((mxChecksum)))[0] = (real_T)(0U);
((real_T *)mxGetPr((mxChecksum)))[1] = (real_T)(0U);
((real_T *)mxGetPr((mxChecksum)))[2] = (real_T)(0U);
((real_T *)mxGetPr((mxChecksum)))[3] = (real_T)(0U);
mxInputTypes = mxCreateDoubleMatrix(1,2,mxREAL);
mxInputComplexities = mxCreateDoubleMatrix(1,2,mxREAL);
((real_T *)mxGetPr((mxInputTypes)))[0] = (real_T)(10U);
((real_T *)mxGetPr((mxInputComplexities)))[0] = (real_T)(0U);
((real_T *)mxGetPr((mxInputTypes)))[1] = (real_T)(10U);
((real_T *)mxGetPr((mxInputComplexities)))[1] = (real_T)(0U);
mxParameterTypes = mxCreateDoubleMatrix(1,0,mxREAL);
mxParameterComplexities = mxCreateDoubleMatrix(1,0,mxREAL);
mxOutputSizes = mxCreateDoubleMatrix(2,2,mxREAL);
mxOutputTypes = mxCreateDoubleMatrix(1,2,mxREAL);
mxOutputComplexities = mxCreateDoubleMatrix(1,2,mxREAL);
((real_T *)mxGetPr((mxOutputSizes)))[0] = (real_T)(1U);
((real_T *)mxGetPr((mxOutputSizes)))[1] = (real_T)(1U);
((real_T *)mxGetPr((mxOutputTypes)))[0] = (real_T)(10U);
((real_T *)mxGetPr((mxOutputComplexities)))[0] = (real_T)(0U);
((real_T *)mxGetPr((mxOutputSizes)))[2] = (real_T)(1U);
((real_T *)mxGetPr((mxOutputSizes)))[3] = (real_T)(1U);
((real_T *)mxGetPr((mxOutputTypes)))[1] = (real_T)(10U);
((real_T *)mxGetPr((mxOutputComplexities)))[1] = (real_T)(0U);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,0,mxChecksum);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,1,mxInputTypes);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,2,mxInputComplexities);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,3,mxParameterTypes);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,4,mxParameterComplexities);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,5,mxOutputSizes);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,6,mxOutputTypes);
mxSetFieldByNumber(mxAutoinheritanceInfo,0,7,mxOutputComplexities);
return(mxAutoinheritanceInfo);
}
static void chart_debug_initialization(SimStruct *S)
{
if(ssIsFirstInitCond(S)) {
/* do this only if simulation is starting */
if(!sim_mode_is_rtw_gen(S)) {
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent =
sf_debug_initialize_chart(_mybldc_mdl2MachineNumber_,
2,
3,
4,
4,
0,
0,
0,
0,
&(chartInstance.chartNumber),
&(chartInstance.instanceNumber),
ssGetPath(S),
(void *)S);
if(chartAlreadyPresent==0) {
/* this is the first instance */
sf_debug_set_chart_disable_implicit_casting(_mybldc_mdl2MachineNumber_,chartInstance.chartNumber,0);
sf_debug_set_chart_event_thresholds(_mybldc_mdl2MachineNumber_,
chartInstance.chartNumber,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -