📄 parc_sfun_c1.c
字号:
/*
*
* Stateflow code generation for chart:
* parc/Mobile/Mobile Controller
*
* Target Name : sfun
* Model Version : 1.188
* Stateflow Version : 5.0.0.13.00.1.000001
* Date of code generation : 25-May-2007 15:31:02
*
*/
#include "parc_sfun.h"
#include "parc_sfun_c1.h"
#define mexPrintf sf_mex_printf
#ifdef printf
#undef printf
#endif
#define printf sf_mex_printf
#define CHARTINSTANCE_CHARTNUMBER (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance.instanceNumber)
#include "parc_sfun_debug_macros.h"
#define IN_NO_ACTIVE_CHILD (0)
#define IN_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4 1
#define IN_m0_c1_s12_Mobile_Station_Idle_State_6_6_2 2
#define IN_m0_c1_s13_System_Access_6_6_3 3
#define IN_m0_c1_s2_Clear 1
#define IN_m0_c1_s3_Conversation_6_6_4_3_1 2
#define IN_m0_c1_s4_N0 3
#define IN_m0_c1_s5_N1 4
#define IN_m0_c1_s6_P1 5
#define IN_m0_c1_s7_P2 6
#define IN_m0_c1_s8_Rate0 7
#define IN_m0_c1_s9_Rate1 8
#define IN_m0_c1_s10_RateControl 9
#define IN_m0_c1_s11_Wait1 10
#define IN_m0_c1_s14_Access_Probe 1
#define IN_m0_c1_s15_Wait 2
#define event_m0_c1_e18_Start_Chart 3
#define event_m0_c1_e19_Start_Access 5
#define event_m0_c1_e20_BS_Response 1
#define event_m0_c1_e21_PCG_Clock 4
#define event_m0_c1_e22_End_Call 0
#define event_m0_c1_e23_MS_Clock 2
static SFparc_sfun_c1InstanceStruct chartInstance;
#define InputData_m0_c1_d12_Power_Bit (((real_T *)(ssGetInputPortSignal(chartInstance.S,0)))[0])
#define InputData_m0_c1_d13_Current_Input_Power (((real_T *)(ssGetInputPortSignal(chartInstance.S,1)))[0])
#define m0_c1_e18_Start_Chart (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[0]))
#define m0_c1_e19_Start_Access (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[1]))
#define m0_c1_e20_BS_Response (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[2]))
#define m0_c1_e21_PCG_Clock (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[3]))
#define m0_c1_e22_End_Call (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[4]))
#define m0_c1_e23_MS_Clock (*(real_T *)(ssGetInputPortSignalPtrs(chartInstance.S,2)[5]))
#define OutputData_m0_c1_d14_Traffic_Tx_Enable (((real_T *)(ssGetOutputPortSignal(chartInstance.S,1)))[0])
#define OutputData_m0_c1_d15_Access_Tx_Enable (((real_T *)(ssGetOutputPortSignal(chartInstance.S,2)))[0])
#define OutputData_m0_c1_d16_Tx_Power (((real_T *)(ssGetOutputPortSignal(chartInstance.S,3)))[0])
#define OutputData_m0_c1_d17_Tx_Rate (((real_T *)(ssGetOutputPortSignal(chartInstance.S,4)))[0])
static void
enter_atomic_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4(void);
static void
exit_atomic_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4(void);
static void
exit_internal_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4(void);
static void enter_atomic_m0_c1_s2_Clear(void);
static void exit_atomic_m0_c1_s2_Clear(void);
static void enter_atomic_m0_c1_s3_Conversation_6_6_4_3_1(void);
static void exit_atomic_m0_c1_s3_Conversation_6_6_4_3_1(void);
static void exit_atomic_m0_c1_s4_N0(void);
static void exit_atomic_m0_c1_s5_N1(void);
static void exit_atomic_m0_c1_s6_P1(void);
static void exit_atomic_m0_c1_s8_Rate0(void);
static void exit_atomic_m0_c1_s9_Rate1(void);
static void exit_atomic_m0_c1_s10_RateControl(void);
static void exit_atomic_m0_c1_s11_Wait1(void);
static void enter_atomic_m0_c1_s12_Mobile_Station_Idle_State_6_6_2(void);
static void exit_atomic_m0_c1_s12_Mobile_Station_Idle_State_6_6_2(void);
static void exit_atomic_m0_c1_s13_System_Access_6_6_3(void);
static void exit_internal_m0_c1_s13_System_Access_6_6_3(void);
static void enter_atomic_m0_c1_s14_Access_Probe(void);
static void exit_atomic_m0_c1_s14_Access_Probe(void);
static void exit_atomic_m0_c1_s15_Wait(void);
static void broadcast_m0_c1_e18_Start_Chart(void);
static void broadcast_m0_c1_e19_Start_Access(void);
static void broadcast_m0_c1_e20_BS_Response(void);
static void broadcast_m0_c1_e21_PCG_Clock(void);
static void broadcast_m0_c1_e22_End_Call(void);
static void broadcast_m0_c1_e23_MS_Clock(void);
void parc_sfun_c1(void)
{
real_T __sfTemp1;
real_T __sfTemp2;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
if((_sfEvent_ == event_m0_c1_e23_MS_Clock) && (chartInstance.Counters.i2 < 7))
{
chartInstance.Counters.i2++;
}
if((_sfEvent_ == event_m0_c1_e21_PCG_Clock) && (chartInstance.Counters.i1 <
7)) {
chartInstance.Counters.i1++;
}
if(chartInstance.State.is_active_parc_sfun_c1 == 0) {
_SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
chartInstance.State.is_active_parc_sfun_c1 = 1;
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,18);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,18);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,18);
enter_atomic_m0_c1_s12_Mobile_Station_Idle_State_6_6_2();
} else {
switch(chartInstance.State.is_parc_sfun_c1) {
case IN_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4:
CV_CHART_EVAL(0,0,1);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,8);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,8,0);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,27);
if(CV_TRANSITION_EVAL(27, _SFD_CCP_CALL(27,0,(_sfEvent_ ==
event_m0_c1_e22_End_Call)))) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,27);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,27);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,27);
exit_internal_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4();
exit_atomic_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4();
enter_atomic_m0_c1_s12_Mobile_Station_Idle_State_6_6_2();
} else {
switch(chartInstance.State.is_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4)
{
case IN_m0_c1_s2_Clear:
CV_STATE_EVAL(8,0,1);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,1,0);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,10);
if(CV_TRANSITION_EVAL(10, _SFD_CCP_CALL(10,0,(_sfEvent_ ==
event_m0_c1_e21_PCG_Clock)))) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,10);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,10);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,10);
exit_atomic_m0_c1_s2_Clear();
enter_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
break;
case IN_m0_c1_s3_Conversation_6_6_4_3_1:
CV_STATE_EVAL(8,0,2);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,2,0);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,4);
if(CV_TRANSITION_EVAL(4, _SFD_CCP_CALL(4,0,(_sfEvent_ ==
event_m0_c1_e21_PCG_Clock)))) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,4);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,4);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,4);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,3);
if(CV_TRANSITION_EVAL(3,
_SFD_CCP_CALL(3,0,(InputData_m0_c1_d12_Power_Bit != 0.0 == 0)) &&
_SFD_CCP_CALL(3,1,(
chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 < 14.0)))) {
if(sf_debug_transition_conflict_check_enabled()) {
unsigned int transitionList[3];
unsigned int numTransitions=1;
transitionList[0] = 3;
sf_debug_transition_conflict_check_begin();
if(chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 == 14.0) {
transitionList[numTransitions] = 21;
numTransitions++;
}
if((InputData_m0_c1_d12_Power_Bit != 0.0 == 1) &&
(chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 < 14.0)) {
transitionList[numTransitions] = 2;
numTransitions++;
}
sf_debug_transition_conflict_check_end();
if(numTransitions>1) {
_SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
}
}
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,3);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,3);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,3);
exit_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
_SFD_CT_CALL(TRANSITION_BEFORE_TRANS_ACTION_TAG,3);
chartInstance.LocalData.m0_c1_d11_Sum_Power_Bit_Corrections += 1.0;
_SFD_CCT_CALL(TRANSITION_TRANSITION_ACTION_COVERAGE_TAG,3,0);
_SFD_CT_CALL(TRANSITION_AFTER_TRANS_ACTION_TAG,3);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,3);
_SFD_CS_CALL(STATE_ENTER_ENTRY_FUNCTION_TAG,3);
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,3,0);
chartInstance.State.is_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4
= IN_m0_c1_s4_N0;
_SFD_CS_CALL(STATE_ACTIVE_TAG,3);
_SFD_CS_CALL(STATE_BEFORE_ENTRY_ACTION_TAG,3);
chartInstance.LocalData.m0_c1_d4_Num0 += 1.0;
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,3,1);
_SFD_CS_CALL(STATE_AFTER_ENTRY_ACTION_TAG,3);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
} else {
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,21);
if(CV_TRANSITION_EVAL(21,
_SFD_CCP_CALL(21,0,(chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 == 14.0)))) {
if(sf_debug_transition_conflict_check_enabled()) {
unsigned int transitionList[2];
unsigned int numTransitions=1;
transitionList[0] = 21;
sf_debug_transition_conflict_check_begin();
if((InputData_m0_c1_d12_Power_Bit != 0.0 == 1) &&
(chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 < 14.0)) {
transitionList[numTransitions] = 2;
numTransitions++;
}
sf_debug_transition_conflict_check_end();
if(numTransitions>1) {
_SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
}
}
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,21);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,21);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,21);
exit_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
_SFD_CS_CALL(STATE_ENTER_ENTRY_FUNCTION_TAG,14);
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,14,0);
chartInstance.State.is_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4
= IN_m0_c1_s10_RateControl;
_SFD_CS_CALL(STATE_ACTIVE_TAG,14);
_SFD_CS_CALL(STATE_BEFORE_ENTRY_ACTION_TAG,14);
OutputData_m0_c1_d17_Tx_Rate =
chartInstance.LocalData.m0_c1_d9_Rate_Case;
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,14,1);
_SFD_CS_CALL(STATE_AFTER_ENTRY_ACTION_TAG,14);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,14);
} else {
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,2);
if(CV_TRANSITION_EVAL(2,
_SFD_CCP_CALL(2,0,(InputData_m0_c1_d12_Power_Bit != 0.0 == 1))
&& _SFD_CCP_CALL(2,1,(
chartInstance.LocalData.m0_c1_d4_Num0 +
chartInstance.LocalData.m0_c1_d5_Num1 < 14.0)))) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,2);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,2);
exit_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
_SFD_CT_CALL(TRANSITION_BEFORE_TRANS_ACTION_TAG,2);
chartInstance.LocalData.m0_c1_d11_Sum_Power_Bit_Corrections -=
1.0;
_SFD_CCT_CALL(TRANSITION_TRANSITION_ACTION_COVERAGE_TAG,2,0);
_SFD_CT_CALL(TRANSITION_AFTER_TRANS_ACTION_TAG,2);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,2);
_SFD_CS_CALL(STATE_ENTER_ENTRY_FUNCTION_TAG,11);
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,11,0);
chartInstance.State.is_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4
= IN_m0_c1_s5_N1;
_SFD_CS_CALL(STATE_ACTIVE_TAG,11);
_SFD_CS_CALL(STATE_BEFORE_ENTRY_ACTION_TAG,11);
chartInstance.LocalData.m0_c1_d5_Num1 += 1.0;
_SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,11,1);
_SFD_CS_CALL(STATE_AFTER_ENTRY_ACTION_TAG,11);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
}
}
}
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
break;
case IN_m0_c1_s4_N0:
CV_STATE_EVAL(8,0,3);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,3,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,26);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,26);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,26);
exit_atomic_m0_c1_s4_N0();
enter_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
break;
case IN_m0_c1_s5_N1:
CV_STATE_EVAL(8,0,4);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,11);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,11,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,13);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,13);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,13);
exit_atomic_m0_c1_s5_N1();
enter_atomic_m0_c1_s3_Conversation_6_6_4_3_1();
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
break;
case IN_m0_c1_s6_P1:
CV_STATE_EVAL(8,0,5);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,7);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,7,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,11);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,11);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,11);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,29);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,29);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,29);
exit_atomic_m0_c1_s6_P1();
enter_atomic_m0_c1_s2_Clear();
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,7);
break;
case IN_m0_c1_s7_P2:
CV_STATE_EVAL(8,0,6);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,5);
_SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,5,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,9);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,9);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,9);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,29);
_SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,29);
_SFD_CT_CALL(TRANSITION_INACTIVE_TAG,29);
exit_internal_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4();
exit_atomic_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4();
enter_atomic_m0_c1_s1_Mobile_Station_Control_on_the_Traffic_Channel_6_6_4();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -