⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tpc9_sfun_c2.c

📁 CDMA移动通信系统功率控制算法的MATLAB仿真实现
💻 C
📖 第 1 页 / 共 2 页
字号:
             0.0,
             1.0,
             0);
            _SFD_SET_DATA_PROPS(2,
             2,
             0,
             1,
             SF_DOUBLE,
             0,
             NULL,
             0,
             0.0,
             1.0,
             0);
            _SFD_SET_DATA_PROPS(0,
             1,
             1,
             0,
             SF_DOUBLE,
             0,
             NULL,
             0,
             0.0,
             1.0,
             0);
            _SFD_EVENT_SCOPE(1,1);
            _SFD_EVENT_SCOPE(5,1);
            _SFD_EVENT_SCOPE(3,2);
            _SFD_EVENT_SCOPE(0,1);
            _SFD_EVENT_SCOPE(2,2);
            _SFD_EVENT_SCOPE(4,1);
            _SFD_STATE_INFO(0,0,0);
            _SFD_STATE_INFO(1,0,0);
            _SFD_CH_SUBSTATE_COUNT(2);
            _SFD_CH_SUBSTATE_DECOMP(0);
            _SFD_CH_SUBSTATE_INDEX(0,0);
            _SFD_CH_SUBSTATE_INDEX(1,1);
            _SFD_ST_SUBSTATE_COUNT(0,0);
            _SFD_ST_SUBSTATE_COUNT(1,0);
          }
          _SFD_CV_INIT_CHART(2,1,0,0);
          {
            _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
          }
          {
            _SFD_CV_INIT_STATE(1,0,0,0,0,0,NULL,NULL);
          }

          _SFD_CV_INIT_TRANS(4,0,NULL,NULL,0,NULL);

          {
            static unsigned int sStartGuardMap[] = {0};
            static unsigned int sEndGuardMap[] = {13};
            static int sPostFixPredicateTree[] = {0};
            _SFD_CV_INIT_TRANS(2,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,&(sPostFixPredicateTree[0]));
          }
          {
            static unsigned int sStartGuardMap[] = {1};
            static unsigned int sEndGuardMap[] = {17};
            static int sPostFixPredicateTree[] = {0};
            _SFD_CV_INIT_TRANS(3,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,&(sPostFixPredicateTree[0]));
          }
          {
            static unsigned int sStartGuardMap[] = {0};
            static unsigned int sEndGuardMap[] = {9};
            static int sPostFixPredicateTree[] = {0};
            _SFD_CV_INIT_TRANS(1,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,&(sPostFixPredicateTree[0]));
          }
          {
            static unsigned int sStartGuardMap[] = {1};
            static unsigned int sEndGuardMap[] = {18};
            static int sPostFixPredicateTree[] = {0};
            _SFD_CV_INIT_TRANS(0,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,&(sPostFixPredicateTree[0]));
          }
          _SFD_STATE_COV_WTS(0,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(0,
             1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
             1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
             1,&(sStartExitMap[0]),&(sEndExitMap[0]));
          }
          _SFD_STATE_COV_WTS(1,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(1,
             1,&(sStartEntryMap[0]),&(sEndEntryMap[0]),
             1,&(sStartDuringMap[0]),&(sEndDuringMap[0]),
             1,&(sStartExitMap[0]),&(sEndExitMap[0]));
          }
          _SFD_TRANS_COV_WTS(4,0,0,0,0);
          if(chartAlreadyPresent==0)
          {
            _SFD_TRANS_COV_MAPS(4,
             0,NULL,NULL,
             0,NULL,NULL,
             0,NULL,NULL,
             0,NULL,NULL);
          }
          _SFD_TRANS_COV_WTS(2,0,1,0,1);
          if(chartAlreadyPresent==0)
          {
            static unsigned int sStartGuardMap[] = {0};
            static unsigned int sEndGuardMap[] = {13};
            static unsigned int sStartTransitionActionMap[] = {14};
            static unsigned int sEndTransitionActionMap[] = {19};
            _SFD_TRANS_COV_MAPS(2,
             0,NULL,NULL,
             1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
             0,NULL,NULL,
             1,&(sStartTransitionActionMap[0]),&(sEndTransitionActionMap[0]));
          }
          _SFD_TRANS_COV_WTS(3,0,1,0,1);
          if(chartAlreadyPresent==0)
          {
            static unsigned int sStartGuardMap[] = {1};
            static unsigned int sEndGuardMap[] = {17};
            static unsigned int sStartTransitionActionMap[] = {19};
            static unsigned int sEndTransitionActionMap[] = {31};
            _SFD_TRANS_COV_MAPS(3,
             0,NULL,NULL,
             1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
             0,NULL,NULL,
             1,&(sStartTransitionActionMap[0]),&(sEndTransitionActionMap[0]));
          }
          _SFD_TRANS_COV_WTS(1,0,1,0,0);
          if(chartAlreadyPresent==0)
          {
            static unsigned int sStartGuardMap[] = {0};
            static unsigned int sEndGuardMap[] = {9};
            _SFD_TRANS_COV_MAPS(1,
             0,NULL,NULL,
             1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
             0,NULL,NULL,
             0,NULL,NULL);
          }
          _SFD_TRANS_COV_WTS(0,0,1,0,1);
          if(chartAlreadyPresent==0)
          {
            static unsigned int sStartGuardMap[] = {1};
            static unsigned int sEndGuardMap[] = {18};
            static unsigned int sStartTransitionActionMap[] = {20};
            static unsigned int sEndTransitionActionMap[] = {32};
            _SFD_TRANS_COV_MAPS(0,
             0,NULL,NULL,
             1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
             0,NULL,NULL,
             1,&(sStartTransitionActionMap[0]),&(sEndTransitionActionMap[0]));
          }
          _SFD_SET_DATA_VALUE_PTR(1,(void *)(&InputData_m0_c2_d1_EbNo));
          _SFD_SET_DATA_VALUE_PTR(2,(void *)(&OutputData_m0_c2_d3_Power_Bit));
          _SFD_SET_DATA_VALUE_PTR(0,(void *)(&InputData_m0_c2_d2_Target_EbNo));
        }
      }
    }else{
      sf_debug_reset_current_state_configuration(_tpc9MachineNumber_,chartInstance.chartNumber,chartInstance.instanceNumber);
    }
  }
  chartInstance.chartInfo.chartInitialized = 1;
}

void tpc9_sfun_c2_sizes_registry(SimStruct *S)
{
  ssSetNumInputPorts((SimStruct *)S, 3);
  ssSetInputPortDataType((SimStruct *)S,0,SS_DOUBLE); /* InputData_m0_c2_d1_EbNo */
  ssSetInputPortRequiredContiguous(S,0,1);
  ssSetInputPortWidth((SimStruct *)S,0,1);
  ssSetInputPortDirectFeedThrough((SimStruct *)S,0,1);
  ssSetInputPortDataType((SimStruct *)S,1,SS_DOUBLE); /* InputData_m0_c2_d2_Target_EbNo */
  ssSetInputPortRequiredContiguous(S,1,1);
  ssSetInputPortWidth((SimStruct *)S,1,1);
  ssSetInputPortDirectFeedThrough((SimStruct *)S,1,1);
  ssSetInputPortDataType((SimStruct *)S,2,SS_DOUBLE);
  ssSetInputPortWidth((SimStruct *)S,2,4);
  ssSetInputPortDirectFeedThrough((SimStruct *)S,2,1);
  ssSetNumOutputPorts((SimStruct *)S, 4);
  ssSetOutputPortDataType((SimStruct *)S,0,SS_DOUBLE);
  ssSetOutputPortWidth((SimStruct *)S,0,1);
  ssSetOutputPortDataType((SimStruct *)S,1,SS_DOUBLE); /* OutputData_m0_c2_d3_Power_Bit */
  ssSetOutputPortWidth((SimStruct *)S,1,1);
  ssSetOutputPortDataType((SimStruct *)S,2,SS_DOUBLE); /* Start_BS_Timer */
  ssSetOutputPortWidth((SimStruct *)S,2,1);
  ssSetOutputPortDataType((SimStruct *)S,3,SS_DOUBLE); /* Page */
  ssSetOutputPortWidth((SimStruct *)S,3,1);
  if(sim_mode_is_rtw_gen(S)) {
    int_T chartIsInlinable =
      (int_T)sf_is_chart_inlinable("tpc9",2);
    ssSetStateflowIsInlinable((SimStruct *)S,chartIsInlinable);
    if(chartIsInlinable) {
      ssSetInputPortReusable((SimStruct *)S,0,1);
      ssSetInputPortReusable((SimStruct *)S,1,1);
      ssSetInputPortReusable((SimStruct *)S,2,1);
      sf_mark_chart_expressionable_inputs((SimStruct *)S,"tpc9",2,2);
      sf_mark_chart_reusable_outputs((SimStruct *)S,"tpc9",2,1);
    }
    {
      int dtId;
      char *chartInstanceTypedefName =
        sf_chart_instance_typedef_name("tpc9",2);
      dtId = ssRegisterDataType(S, chartInstanceTypedefName);
      if (dtId == INVALID_DTYPE_ID ) return;
      /* Register the size of the udt */
      if (!ssSetDataTypeSize(S, dtId, 8)) return;
      if(!ssSetNumDWork(S,1)) return;
      ssSetDWorkDataType(S, 0, dtId);
      ssSetDWorkWidth(S, 0, 1);
      ssSetDWorkName(S, 0, "ChartInstance"); /*optional name, less than 16 chars*/
    }
  }
  ssSetChecksum0(S,(409336012U));
  ssSetChecksum1(S,(3452808985U));
  ssSetChecksum2(S,(2185658609U));
  ssSetChecksum3(S,(4253493883U));
}

void terminate_tpc9_sfun_c2(SimStruct *S)
{
}
static void mdlRTW_tpc9_sfun_c2(SimStruct *S)
{
}

void sf_tpc9_sfun_c2( void *);
void tpc9_sfun_c2_registry(SimStruct *S)
{
  chartInstance.chartInfo.chartInstance = NULL;
  chartInstance.chartInfo.chartInitialized = 0;
  chartInstance.chartInfo.sFunctionGateway = sf_tpc9_sfun_c2;
  chartInstance.chartInfo.initializeChart = initialize_tpc9_sfun_c2;
  chartInstance.chartInfo.terminateChart = terminate_tpc9_sfun_c2;
  chartInstance.chartInfo.mdlRTW = mdlRTW_tpc9_sfun_c2;
  chartInstance.chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance.chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance.chartInfo.storeCurrentConfiguration = NULL;
  chartInstance.chartInfo.sampleTime = INHERITED_SAMPLE_TIME;
  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_tpc9_sfun_c2(void *chartInstanceVoidPtr)
{
  /* Save current event being processed */
  uint8_T previousEvent;
  previousEvent = _sfEvent_;

  /* Update Stateflow time variable */
  _sfTime_ = ssGetT(chartInstance.S);

  /* Broadcast of input event(s) */

  if (m0_c2_e4_Start_Chart==1.0) {      /* rising edge event */
    broadcast_m0_c2_e4_Start_Chart();
  }
  if (m0_c2_e5_Access_Detect==1.0) {    /* rising edge event */
    broadcast_m0_c2_e5_Access_Detect();
  }
  if (m0_c2_e6_BS_Timed_Out!=0.0) {     /* either edge event */
    broadcast_m0_c2_e6_BS_Timed_Out();
  }
  if (m0_c2_e7_PCG_Clock!=0.0) {        /* either edge event */
    broadcast_m0_c2_e7_PCG_Clock();
  }

  if (chartInstance.m0_c2_e8_Start_BS_TimerEventCounter>0) {
    chartInstance.m0_c2_e8_Start_BS_TimerEventData ^= 1U; /* toggle between 0 and 1 */
    m0_c2_e8_Start_BS_Timer =
      (real_T)(chartInstance.m0_c2_e8_Start_BS_TimerEventData);
    (chartInstance.m0_c2_e8_Start_BS_TimerEventCounter)--;
  }
  if (chartInstance.m0_c2_e9_PageEventCounter>0) {
    chartInstance.m0_c2_e9_PageEventData ^= 1U; /* toggle between 0 and 1 */
    m0_c2_e9_Page = (real_T)(chartInstance.m0_c2_e9_PageEventData);
    (chartInstance.m0_c2_e9_PageEventCounter)--;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -