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

📄 c1_sim_netcon.c

📁 RFID读卡器与标签之间在AWGN和加入其它读写器干扰下的BER仿真
💻 C
📖 第 1 页 / 共 4 页
字号:
/* Include files */
#include "sim_netcon_sfun.h"
#include "c1_sim_netcon.h"
#define CHARTINSTANCE_CHARTNUMBER       (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER    (chartInstance.instanceNumber)
#include "sim_netcon_sfun_debug_macros.h"

/* Type Definitions */

/* Named Constants */
#define c1_event_event                  (0)
#define c1_IN_NO_ACTIVE_CHILD           (0)
#define c1_IN_S2                        (3)
#define c1_IN_Road                      (1)
#define c1_IN_S1                        (2)
#define c1_IN_S3                        (4)
#define c1_IN_S0                        (1)

/* Variable Declarations */

/* Variable Definitions */
static SFc1_sim_netconInstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c1_sim_netcon(void);
static void enable_c1_sim_netcon(void);
static void disable_c1_sim_netcon(void);
static void finalize_c1_sim_netcon(void);
static void sf_c1_sim_netcon(void);
static void c1_enter_internal_Road(void);
static void c1_exit_internal_Road(void);
static uint8_T c1__u8_s8_(int8_T c1_b);
static uint16_T c1__u16_s32_(int32_T c1_b);
static uint16_T c1__u16_s8_(int8_T c1_b);
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_c1_sim_netcon(void)
{
  chartInstance.c1_is_Road = 0;
  chartInstance.c1_was_Road = 0;
  chartInstance.c1_tp_Road = 0;
  chartInstance.c1_tp_S0 = 0;
  chartInstance.c1_tp_S1 = 0;
  chartInstance.c1_tp_S2 = 0;
  chartInstance.c1_tp_S3 = 0;
  chartInstance.c1_is_active_c1_sim_netcon = 0;
  chartInstance.c1_is_c1_sim_netcon = 0;
  chartInstance.c1_count = 0;
  chartInstance.c1_code = 0;
  {
    int32_T c1_sf_i0;
    for(c1_sf_i0 = 0; c1_sf_i0 <= 1; c1_sf_i0++) {
      chartInstance.c1_convec[c1_sf_i0] = 0;
    }
  }
  chartInstance.c1_i = 0;
}

static void enable_c1_sim_netcon(void)
{
}

static void disable_c1_sim_netcon(void)
{
}

static void finalize_c1_sim_netcon(void)
{
}

static void sf_c1_sim_netcon(void)
{
  int32_T c1_sf_i1;
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_count, 3U);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_code, 1U);
  for(c1_sf_i1 = 0; c1_sf_i1 <= 1; c1_sf_i1++) {
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[c1_sf_i1], 2U);
  }
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
  {
    uint8_T c1_previousEvent;
    c1_previousEvent = _sfEvent_;
    _sfEvent_ = c1_event_event;
    _SFD_CE_CALL(EVENT_ENTER_BROADCAST_FUNCTION_TAG,c1_event_event);
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
    if(chartInstance.c1_is_active_c1_sim_netcon == 0) {
      _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
      chartInstance.c1_is_active_c1_sim_netcon = 1;
      _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,7);
      chartInstance.c1_count = c1__u16_s8_(0);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_count, 3U);
      chartInstance.c1_convec[0] = c1__u8_s8_(0);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[0], 2U);
      chartInstance.c1_convec[1] = c1__u8_s8_(0);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[1], 2U);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,14);
      chartInstance.c1_code = (uint8_T)In1(chartInstance.c1_count);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_code, 1U);
      if(CV_TRANSITION_EVAL(17U, (_SFD_CCP_CALL(17,0,(chartInstance.c1_code ==
           0)) != 0) || (_SFD_CCP_CALL(17,1,(chartInstance.c1_code ==
           1)) != 0)) != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,17);
        chartInstance.c1_is_c1_sim_netcon = (uint8_T)c1_IN_Road;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
        chartInstance.c1_tp_Road = 1;
        c1_enter_internal_Road();
      } else {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
      }
    } else {
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,4);
      switch(chartInstance.c1_is_Road) {
       case c1_IN_S0:
        CV_STATE_EVAL(4,0,1);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
        if(CV_TRANSITION_EVAL(5U, (_SFD_CCP_CALL(5,0,(chartInstance.c1_code ==
             0)) != 0) && (_SFD_CCP_CALL(5,1,(chartInstance.c1_i == 0))
           != 0)) != 0) {
          if(sf_debug_transition_conflict_check_enabled()) {
            unsigned int transitionList[3];
            unsigned int numTransitions=1;
            transitionList[0] = 5;
            sf_debug_transition_conflict_check_begin();
            if(chartInstance.c1_i == 1) {
              transitionList[numTransitions] = 1;
              numTransitions++;
            }
            if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {
              transitionList[numTransitions] = 13;
              numTransitions++;
            }
            sf_debug_transition_conflict_check_end();
            if(numTransitions>1) {
              _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
            }
          }
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,5);
          chartInstance.c1_convec[1] = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[1], 2U);
          chartInstance.c1_convec[0] = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[0], 2U);
          chartInstance.c1_i = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          chartInstance.c1_tp_S0 = 0;
          chartInstance.c1_is_Road = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
          chartInstance.c1_is_Road = (uint8_T)c1_IN_S0;
          chartInstance.c1_was_Road = (uint8_T)c1_IN_S0;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,3);
          chartInstance.c1_tp_S0 = 1;
        } else if(CV_TRANSITION_EVAL(1U,
          (int32_T)_SFD_CCP_CALL(1,0,(chartInstance.c1_i == 1))) != 0) {
          if(sf_debug_transition_conflict_check_enabled()) {
            unsigned int transitionList[2];
            unsigned int numTransitions=1;
            transitionList[0] = 1;
            sf_debug_transition_conflict_check_begin();
            if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {
              transitionList[numTransitions] = 13;
              numTransitions++;
            }
            sf_debug_transition_conflict_check_end();
            if(numTransitions>1) {
              _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
            }
          }
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,16);
          chartInstance.c1_count = c1__u16_s32_(chartInstance.c1_count + 1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_count, 3U);
          output(chartInstance.c1_convec);
          chartInstance.c1_i = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,14);
          chartInstance.c1_code = (uint8_T)In1(chartInstance.c1_count);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_code, 1U);
          if(CV_TRANSITION_EVAL(17U, (_SFD_CCP_CALL(17,0,(chartInstance.c1_code
               == 0)) != 0) || (_SFD_CCP_CALL(17,1,(chartInstance.c1_code ==
               1)) != 0)) != 0) {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,17);
            c1_exit_internal_Road();
            chartInstance.c1_tp_Road = 0;
            chartInstance.c1_is_c1_sim_netcon = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
            _SFD_CS_CALL(STATE_INACTIVE_TAG,4);
            chartInstance.c1_is_c1_sim_netcon = (uint8_T)c1_IN_Road;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
            chartInstance.c1_tp_Road = 1;
            c1_enter_internal_Road();
          } else {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
          }
        } else if(CV_TRANSITION_EVAL(13U,
          (_SFD_CCP_CALL(13,0,(chartInstance.c1_code == 1)) != 0) &&
          (_SFD_CCP_CALL(13,1,(chartInstance.c1_i
             == 0)) != 0)) != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,13);
          chartInstance.c1_convec[1] = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[1], 2U);
          chartInstance.c1_convec[0] = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[0], 2U);
          chartInstance.c1_i = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          chartInstance.c1_tp_S0 = 0;
          chartInstance.c1_is_Road = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
          chartInstance.c1_is_Road = (uint8_T)c1_IN_S1;
          chartInstance.c1_was_Road = (uint8_T)c1_IN_S1;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,2);
          chartInstance.c1_tp_S1 = 1;
        }
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
        break;
       case c1_IN_S1:
        CV_STATE_EVAL(4,0,2);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
        if(CV_TRANSITION_EVAL(8U, (_SFD_CCP_CALL(8,0,(chartInstance.c1_code ==
             0)) != 0) && (_SFD_CCP_CALL(8,1,(chartInstance.c1_i == 0))
           != 0)) != 0) {
          if(sf_debug_transition_conflict_check_enabled()) {
            unsigned int transitionList[3];
            unsigned int numTransitions=1;
            transitionList[0] = 8;
            sf_debug_transition_conflict_check_begin();
            if(chartInstance.c1_i == 1) {
              transitionList[numTransitions] = 11;
              numTransitions++;
            }
            if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {
              transitionList[numTransitions] = 15;
              numTransitions++;
            }
            sf_debug_transition_conflict_check_end();
            if(numTransitions>1) {
              _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
            }
          }
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,8);
          chartInstance.c1_convec[1] = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[1], 2U);
          chartInstance.c1_convec[0] = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[0], 2U);
          chartInstance.c1_i = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          chartInstance.c1_tp_S1 = 0;
          chartInstance.c1_is_Road = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,2);
          chartInstance.c1_is_Road = (uint8_T)c1_IN_S2;
          chartInstance.c1_was_Road = (uint8_T)c1_IN_S2;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,0);
          chartInstance.c1_tp_S2 = 1;
        } else if(CV_TRANSITION_EVAL(11U,
          (int32_T)_SFD_CCP_CALL(11,0,(chartInstance.c1_i == 1))) != 0) {
          if(sf_debug_transition_conflict_check_enabled()) {
            unsigned int transitionList[2];
            unsigned int numTransitions=1;
            transitionList[0] = 11;
            sf_debug_transition_conflict_check_begin();
            if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {
              transitionList[numTransitions] = 15;
              numTransitions++;
            }
            sf_debug_transition_conflict_check_end();
            if(numTransitions>1) {
              _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
            }
          }
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,11);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,16);
          chartInstance.c1_count = c1__u16_s32_(chartInstance.c1_count + 1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_count, 3U);
          output(chartInstance.c1_convec);
          chartInstance.c1_i = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,14);
          chartInstance.c1_code = (uint8_T)In1(chartInstance.c1_count);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_code, 1U);
          if(CV_TRANSITION_EVAL(17U, (_SFD_CCP_CALL(17,0,(chartInstance.c1_code
               == 0)) != 0) || (_SFD_CCP_CALL(17,1,(chartInstance.c1_code ==
               1)) != 0)) != 0) {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,17);
            c1_exit_internal_Road();
            chartInstance.c1_tp_Road = 0;
            chartInstance.c1_is_c1_sim_netcon = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
            _SFD_CS_CALL(STATE_INACTIVE_TAG,4);
            chartInstance.c1_is_c1_sim_netcon = (uint8_T)c1_IN_Road;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
            chartInstance.c1_tp_Road = 1;
            c1_enter_internal_Road();
          } else {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
          }
        } else if(CV_TRANSITION_EVAL(15U,
          (_SFD_CCP_CALL(15,0,(chartInstance.c1_code == 1)) != 0) &&
          (_SFD_CCP_CALL(15,1,(chartInstance.c1_i
             == 0)) != 0)) != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,15);
          chartInstance.c1_convec[1] = c1__u8_s8_(0);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[1], 2U);
          chartInstance.c1_convec[0] = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_convec[0], 2U);
          chartInstance.c1_i = c1__u8_s8_(1);
          _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_i, 0U);
          chartInstance.c1_tp_S1 = 0;
          chartInstance.c1_is_Road = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,2);
          chartInstance.c1_is_Road = (uint8_T)c1_IN_S3;
          chartInstance.c1_was_Road = (uint8_T)c1_IN_S3;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,1);
          chartInstance.c1_tp_S3 = 1;
        }
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
        break;
       case c1_IN_S2:
        CV_STATE_EVAL(4,0,3);

⌨️ 快捷键说明

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