📄 li3_5_sfun_c1.c
字号:
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(0,
2,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(1,2,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0,14};
static unsigned int sEndEntryMap[] = {0,23};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(1,
2,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(2,2,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0,14};
static unsigned int sEndEntryMap[] = {0,23};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(2,
2,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(4,2,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0,13};
static unsigned int sEndEntryMap[] = {0,22};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(4,
2,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(3,1,2,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0};
static unsigned int sEndEntryMap[] = {0};
static unsigned int sStartDuringMap[] = {0,24};
static unsigned int sEndDuringMap[] = {0,32};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(3,
1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
2,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(6,1,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0};
static unsigned int sEndEntryMap[] = {0};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(6,
1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(5,1,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0};
static unsigned int sEndEntryMap[] = {0};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(5,
1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_STATE_COV_WTS(8,1,1,1);
if(chartAlreadyPresent==0)
{
static unsigned int sStartEntryMap[] = {0};
static unsigned int sEndEntryMap[] = {0};
static unsigned int sStartDuringMap[] = {0};
static unsigned int sEndDuringMap[] = {0};
static unsigned int sStartExitMap[] = {0};
static unsigned int sEndExitMap[] = {0};
_SFD_STATE_COV_MAPS(8,
1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
1,&(sStartExitMap[0]),&(sEndExitMap[0]));
}
_SFD_TRANS_COV_WTS(5,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {2};
_SFD_TRANS_COV_MAPS(5,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(10,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {2};
_SFD_TRANS_COV_MAPS(10,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(2,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {2};
_SFD_TRANS_COV_MAPS(2,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(3,0,0,0,0);
if(chartAlreadyPresent==0)
{
_SFD_TRANS_COV_MAPS(3,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(9,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {4};
_SFD_TRANS_COV_MAPS(9,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(7,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {4};
_SFD_TRANS_COV_MAPS(7,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(11,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {0};
static unsigned int sEndGuardMap[] = {4};
_SFD_TRANS_COV_MAPS(11,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(0,0,0,0,0);
if(chartAlreadyPresent==0)
{
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(1,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {1};
static unsigned int sEndGuardMap[] = {14};
_SFD_TRANS_COV_MAPS(1,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(13,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {1};
static unsigned int sEndGuardMap[] = {16};
_SFD_TRANS_COV_MAPS(13,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(6,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {1};
static unsigned int sEndGuardMap[] = {14};
_SFD_TRANS_COV_MAPS(6,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(8,0,1,0,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {1};
static unsigned int sEndGuardMap[] = {16};
_SFD_TRANS_COV_MAPS(8,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(4,0,3,1,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {12,0,19};
static unsigned int sEndGuardMap[] = {16,17,35};
static unsigned int sStartConditionActionMap[] = {38};
static unsigned int sEndConditionActionMap[] = {54};
_SFD_TRANS_COV_MAPS(4,
0,NULL,NULL,
3,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
1,&(sStartConditionActionMap[0]),&(sEndConditionActionMap[0]),
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(12,0,3,1,0);
if(chartAlreadyPresent==0)
{
static unsigned int sStartGuardMap[] = {12,0,19};
static unsigned int sEndGuardMap[] = {16,17,33};
static unsigned int sStartConditionActionMap[] = {36};
static unsigned int sEndConditionActionMap[] = {50};
_SFD_TRANS_COV_MAPS(12,
0,NULL,NULL,
3,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
1,&(sStartConditionActionMap[0]),&(sEndConditionActionMap[0]),
0,NULL,NULL);
}
_SFD_SET_DATA_VALUE_PTR(3,(void *)(&InputData_c1_d1_throttle));
_SFD_SET_DATA_VALUE_PTR(0,(void *)(&InputData_c1_d2_speed));
_SFD_SET_DATA_VALUE_PTR(1,(void *)(&OutputData_c1_d5_gear));
_SFD_SET_DATA_VALUE_PTR(2,(void *)(&c1_d6_TWAIT));
_SFD_SET_DATA_VALUE_PTR(4,(void *)(&InputData_c1_d3_up_th));
_SFD_SET_DATA_VALUE_PTR(5,(void *)(&InputData_c1_d4_down_th));
}
}else{
sf_debug_reset_current_state_configuration(_li3_5MachineNumber_,chartInstance.chartNumber,chartInstance.instanceNumber);
}
}
chartInstance.chartInfo.chartInitialized = 1;
}
void li3_5_sfun_c1_sizes_registry(SimStruct *S)
{
ssSetNumInputPorts((SimStruct *)S, 4);
ssSetInputPortDataType((SimStruct *)S,0,SS_DOUBLE); /* InputData_c1_d1_throttle */
ssSetInputPortWidth((SimStruct *)S,0,1);
ssSetInputPortDirectFeedThrough((SimStruct *)S,0,1);
ssSetInputPortDataType((SimStruct *)S,1,SS_DOUBLE); /* InputData_c1_d2_speed */
ssSetInputPortWidth((SimStruct *)S,1,1);
ssSetInputPortDirectFeedThrough((SimStruct *)S,1,1);
ssSetInputPortDataType((SimStruct *)S,2,SS_DOUBLE); /* InputData_c1_d3_up_th */
ssSetInputPortWidth((SimStruct *)S,2,1);
ssSetInputPortDirectFeedThrough((SimStruct *)S,2,1);
ssSetInputPortDataType((SimStruct *)S,3,SS_DOUBLE); /* InputData_c1_d4_down_th */
ssSetInputPortWidth((SimStruct *)S,3,1);
ssSetInputPortDirectFeedThrough((SimStruct *)S,3,1);
ssSetNumOutputPorts((SimStruct *)S, 2);
ssSetOutputPortDataType((SimStruct *)S,0,SS_DOUBLE);
ssSetOutputPortWidth((SimStruct *)S,0,1);
ssSetOutputPortDataType((SimStruct *)S,1,SS_DOUBLE); /* OutputData_c1_d5_gear */
ssSetOutputPortWidth((SimStruct *)S,1,1);
}
void terminate_li3_5_sfun_c1(SimStruct *S)
{
}
static void mdlRTW_li3_5_sfun_c1(SimStruct *S)
{
if (!ssWriteRTWWorkVect(S, "PWork", 1,"ChartInstance", 1)) {
return;
}
if (!ssWriteRTWStr(S, "ChartWorkspaceData {")) return;
{
int indexArray[1];
const mxArray *mxArrayPtr;
indexArray[0] = 1;
sf_set_error_prefix_string("Stateflow Runtime Error (chart): Error evaluating chart workspace data 'TWAIT' in the chart's parent workspace.\n");
mxArrayPtr =
ml_get_typed_vector("TWAIT",CALLER_WORKSPACE,1,indexArray,SF_UINT8,1,0);
sf_set_error_prefix_string("Stateflow Runtime Error (chart): ");
if (!ssWriteRTWVectParam(S, "TWAIT",(const void
*)(mxGetPr(mxArrayPtr)),sf_get_sl_type_from_ml_type(mxGetClassID(mxArrayPtr)),
1)) return;
}
if (!ssWriteRTWStr(S, "}")) return;
}
void sf_li3_5_sfun_c1( void *);
void li3_5_sfun_c1_registry(SimStruct *S)
{
chartInstance.chartInfo.chartInstance = NULL;
chartInstance.chartInfo.chartInitialized = 0;
chartInstance.chartInfo.sFunctionGateway = sf_li3_5_sfun_c1;
chartInstance.chartInfo.initializeChart = initialize_li3_5_sfun_c1;
chartInstance.chartInfo.terminateChart = terminate_li3_5_sfun_c1;
chartInstance.chartInfo.mdlRTW = mdlRTW_li3_5_sfun_c1;
chartInstance.chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance.chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance.chartInfo.storeCurrentConfiguration = NULL;
chartInstance.chartInfo.sampleTime = ml_eval_scalar("0.04",CALLER_WORKSPACE,1);
if(mxIsNaN(chartInstance.chartInfo.sampleTime)) {
sf_mex_error_message("Error evaluating sample-time expression '0.04' for chart 'li3_5/shift_logic' in the chart's parent workspace.");
}
if(chartInstance.chartInfo.sampleTime==CONTINUOUS_SAMPLE_TIME) {
mexPrintf("Stateflow runtime error in chart li3_5/shift_logic\n");
sf_mex_error_message("Runtime value of chart sample time 0.04 \ncannot be set to 0.0 (continuous). \nPlease change the update method to continuous time for this chart.\n");
}
chartInstance.S = S;
ssSetUserData((SimStruct *)S,(void *)(&(chartInstance.chartInfo))); /* register the chart instance with simstruct */
ssSetSampleTime((SimStruct *)S, 0, chartInstance.chartInfo.sampleTime);
if (chartInstance.chartInfo.sampleTime == INHERITED_SAMPLE_TIME) {
ssSetOffsetTime((SimStruct *)S, 0, FIXED_IN_MINOR_STEP_OFFSET);
} else if (chartInstance.chartInfo.sampleTime == CONTINUOUS_SAMPLE_TIME) {
ssSetOffsetTime((SimStruct *)S, 0, 0.0);
}
ssSetCallSystemOutput((SimStruct *)S,0);
}
void sf_li3_5_sfun_c1( void *chartInstanceVoidPtr)
{
/* Remember current event being processed */
int previousEvent;
previousEvent = _sfEvent_;
/* Update Stateflow time variable */
_sfTime_ = ssGetT(chartInstance.S);
/* Call this chart */
_sfEvent_ = CALL_EVENT;
li3_5_sfun_c1();
_sfEvent_ = previousEvent;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -