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

📄 c1_netcon.c

📁 RFID读卡器与标签之间在AWGN和加入其它读写器干扰下的BER仿真
💻 C
📖 第 1 页 / 共 4 页
字号:
/* Include files */
#include "netcon_sfun.h"
#include "c1_netcon.h"
#define CHARTINSTANCE_CHARTNUMBER       (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER    (chartInstance.instanceNumber)
#include "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                      (2)
#define c1_IN_S1                        (2)
#define c1_IN_S3                        (4)
#define c1_IN_S0                        (1)
#define c1_IN_STATE                     (3)
#define c1_IN_IN                        (1)
#define c1_IN_STOP                      (4)

/* Variable Declarations */

/* Variable Definitions */
static SFc1_netconInstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c1_netcon(void);
static void enable_c1_netcon(void);
static void disable_c1_netcon(void);
static void finalize_c1_netcon(void);
static void sf_c1_netcon(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 uint8_T *c1_indp(void);
static uint8_T *c1_outdp1(void);
static uint8_T *c1_outdp2(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_c1_netcon(void)
{
  chartInstance.c1_tp_IN = 0;
  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_tp_STATE = 0;
  chartInstance.c1_tp_STOP = 0;
  chartInstance.c1_is_active_c1_netcon = 0;
  chartInstance.c1_is_c1_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;
  if(!(cdrGetOutputPortReusable(chartInstance.S, 1) != 0)) {
    *c1_indp() = 0;
  }
  if(!(cdrGetOutputPortReusable(chartInstance.S, 2) != 0)) {
    *c1_outdp1() = 0;
  }
  if(!(cdrGetOutputPortReusable(chartInstance.S, 3) != 0)) {
    *c1_outdp2() = 0;
  }
}

static void enable_c1_netcon(void)
{
}

static void disable_c1_netcon(void)
{
}

static void finalize_c1_netcon(void)
{
}

static void sf_c1_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);
  _SFD_DATA_RANGE_CHECK((real_T)*c1_indp(), 5U);
  _SFD_DATA_RANGE_CHECK((real_T)*c1_outdp1(), 6U);
  _SFD_DATA_RANGE_CHECK((real_T)*c1_outdp2(), 4U);
  {
    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_netcon == 0) {
      _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
      chartInstance.c1_is_active_c1_netcon = 1;
      _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
      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);
      chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_STATE;
      _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
      chartInstance.c1_tp_STATE = 1;
    } else {
      switch(chartInstance.c1_is_c1_netcon) {
       case c1_IN_IN:
        CV_CHART_EVAL(0,0,1);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
        if(CV_TRANSITION_EVAL(8U, (_SFD_CCP_CALL(8,0,(chartInstance.c1_code ==
             0)) != 0) || (_SFD_CCP_CALL(8,1,(chartInstance.c1_code == 1))
           != 0)) != 0) {
          if(sf_debug_transition_conflict_check_enabled()) {
            unsigned int transitionList[2];
            unsigned int numTransitions=1;
            transitionList[0] = 8;
            sf_debug_transition_conflict_check_begin();
            if(chartInstance.c1_code == 2) {
              transitionList[numTransitions] = 1;
              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_tp_IN = 0;
          chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,1);
          chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_Road;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,5);
          chartInstance.c1_tp_Road = 1;
          switch(chartInstance.c1_was_Road) {
           case c1_IN_S0:
            CV_STATE_EVAL(5,2,1);
            chartInstance.c1_is_Road = (uint8_T)c1_IN_S0;
            chartInstance.c1_was_Road = (uint8_T)c1_IN_S0;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,6);
            chartInstance.c1_tp_S0 = 1;
            break;
           case c1_IN_S1:
            CV_STATE_EVAL(5,2,2);
            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;
            break;
           case c1_IN_S2:
            CV_STATE_EVAL(5,2,3);
            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;
            break;
           case c1_IN_S3:
            CV_STATE_EVAL(5,2,4);
            chartInstance.c1_is_Road = (uint8_T)c1_IN_S3;
            chartInstance.c1_was_Road = (uint8_T)c1_IN_S3;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,3);
            chartInstance.c1_tp_S3 = 1;
            break;
           default:
            CV_STATE_EVAL(5,2,0);
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,9);
            chartInstance.c1_is_Road = (uint8_T)c1_IN_S0;
            chartInstance.c1_was_Road = (uint8_T)c1_IN_S0;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,6);
            chartInstance.c1_tp_S0 = 1;
            break;
          }
        } else if(CV_TRANSITION_EVAL(1U,
          (int32_T)_SFD_CCP_CALL(1,0,(chartInstance.c1_code == 2))) != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
          chartInstance.c1_tp_IN = 0;
          chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,1);
          chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_STOP;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,7);
          chartInstance.c1_tp_STOP = 1;
        }
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
        break;
       case c1_IN_Road:
        CV_CHART_EVAL(0,0,2);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,5);
        switch(chartInstance.c1_is_Road) {
         case c1_IN_S0:
          CV_STATE_EVAL(5,0,1);
          _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,6);
          if(CV_TRANSITION_EVAL(15U, (_SFD_CCP_CALL(15,0,(chartInstance.c1_code
               == 0)) != 0) && (_SFD_CCP_CALL(15,1,(chartInstance.c1_i == 0))
             != 0)) != 0) {
            if(sf_debug_transition_conflict_check_enabled()) {
              unsigned int transitionList[3];
              unsigned int numTransitions=1;
              transitionList[0] = 15;
              sf_debug_transition_conflict_check_begin();
              if(chartInstance.c1_i == 1) {
                transitionList[numTransitions] = 14;
                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,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_(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,6);
            chartInstance.c1_is_Road = (uint8_T)c1_IN_S0;
            chartInstance.c1_was_Road = (uint8_T)c1_IN_S0;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,6);
            chartInstance.c1_tp_S0 = 1;
          } else if(CV_TRANSITION_EVAL(14U,
            (int32_T)_SFD_CCP_CALL(14,0,(chartInstance.c1_i == 1))) != 0) {
            if(sf_debug_transition_conflict_check_enabled()) {
              unsigned int transitionList[2];
              unsigned int numTransitions=1;
              transitionList[0] = 14;
              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,14);
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,6);
            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);
            *c1_outdp1() = chartInstance.c1_convec[1];
            _SFD_DATA_RANGE_CHECK((real_T)*c1_outdp1(), 6U);
            *c1_outdp2() = chartInstance.c1_convec[0];
            _SFD_DATA_RANGE_CHECK((real_T)*c1_outdp2(), 4U);
            c1_exit_internal_Road();
            chartInstance.c1_tp_Road = 0;
            chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
            _SFD_CS_CALL(STATE_INACTIVE_TAG,5);
            chartInstance.c1_is_c1_netcon = (uint8_T)c1_IN_STATE;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
            chartInstance.c1_tp_STATE = 1;
          } 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,6);
            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,6);
          break;
         case c1_IN_S1:
          CV_STATE_EVAL(5,0,2);
          _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
          if(CV_TRANSITION_EVAL(16U, (_SFD_CCP_CALL(16,0,(chartInstance.c1_code
               == 0)) != 0) && (_SFD_CCP_CALL(16,1,(chartInstance.c1_i == 0))
             != 0)) != 0) {
            if(sf_debug_transition_conflict_check_enabled()) {
              unsigned int transitionList[3];
              unsigned int numTransitions=1;
              transitionList[0] = 16;
              sf_debug_transition_conflict_check_begin();
              if(chartInstance.c1_i == 1) {
                transitionList[numTransitions] = 7;
                numTransitions++;
              }
              if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {
                transitionList[numTransitions] = 10;
                numTransitions++;
              }
              sf_debug_transition_conflict_check_end();
              if(numTransitions>1) {
                _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
              }
            }
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,16);
            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(7U,
            (int32_T)_SFD_CCP_CALL(7,0,(chartInstance.c1_i == 1))) != 0) {
            if(sf_debug_transition_conflict_check_enabled()) {
              unsigned int transitionList[2];
              unsigned int numTransitions=1;
              transitionList[0] = 7;
              sf_debug_transition_conflict_check_begin();
              if((chartInstance.c1_code == 1) && (chartInstance.c1_i == 0)) {

⌨️ 快捷键说明

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