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

📄 c2_auto_netcon.c

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

/* Type Definitions */

/* Named Constants */
#define c2_event_event                  (0U)
#define c2_IN_NO_ACTIVE_CHILD           (0)
#define c2_IN_ROAD3                     (3)
#define c2_IN_STOP                      (5)
#define c2_IN_ROAD4                     (4)
#define c2_IN_ROAD1                     (1)
#define c2_IN_ROAD2                     (2)
#define c2_IN_start                     (6)

/* Variable Declarations */

/* Variable Definitions */
static SFc2_auto_netconInstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c2_auto_netcon(void);
static void initialize_params_c2_auto_netcon(void);
static void enable_c2_auto_netcon(void);
static void disable_c2_auto_netcon(void);
static void finalize_c2_auto_netcon(void);
static void sf_c2_auto_netcon(void);
static void c2_c2_auto_netcon(void);
static void c2_ROAD1(void);
static void c2_ROAD2(void);
static uint8_T c2__u8_s8_(int8_T c2_b);
static uint16_T c2__u16_s8_(int8_T c2_b);
static uint16_T c2__u16_s32_(int32_T c2_b);
static int8_T c2__s8_s32_(int32_T c2_b);
static uint8_T c2__u8_s32_(int32_T c2_b);
static real_T *c2_outdp(void);
static real_T *c2_indp(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);
static void init_dsm_address_info(void);
static void sf_save_state_c2_auto_netcon(FILE *c2_file);
static void sf_load_state_c2_auto_netcon(FILE *c2_file);

/* Function Definitions */
static void initialize_c2_auto_netcon(void)
{
  int32_T c2_sf_i0;
  chartInstance.c2_tp_ROAD1 = 0U;
  chartInstance.c2_tp_ROAD2 = 0U;
  chartInstance.c2_tp_ROAD3 = 0U;
  chartInstance.c2_tp_ROAD4 = 0U;
  chartInstance.c2_tp_STOP = 0U;
  chartInstance.c2_tp_start = 0U;
  chartInstance.c2_is_active_c2_auto_netcon = 0U;
  chartInstance.c2_is_c2_auto_netcon = 0U;
  chartInstance.c2_code = 0U;
  for(c2_sf_i0 = 0; c2_sf_i0 < 2; c2_sf_i0 = c2_sf_i0 + 1) {
    chartInstance.c2_convec[c2_sf_i0] = 0U;
  }
  chartInstance.c2_i = 0U;
  chartInstance.c2_count = 0U;
  chartInstance.c2_i1 = 0;
  chartInstance.c2_j = 0;
  if(!(cdrGetOutputPortReusable(chartInstance.S, 1) != 0)) {
    *c2_outdp() = 0.0;
  }
}

static void initialize_params_c2_auto_netcon(void)
{
}

static void enable_c2_auto_netcon(void)
{
}

static void disable_c2_auto_netcon(void)
{
}

static void finalize_c2_auto_netcon(void)
{
}

static void sf_c2_auto_netcon(void)
{
  int32_T c2_sf_i1;
  uint8_T c2_previousEvent;
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_code, 4U);
  for(c2_sf_i1 = 0; c2_sf_i1 < 2; c2_sf_i1 = c2_sf_i1 + 1) {
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[c2_sf_i1], 7U);
  }
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_i, 0U);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_count, 1U);
  _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_i1, 2U);
  _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
  _SFD_DATA_RANGE_CHECK(*c2_indp(), 6U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = c2_event_event;
  _SFD_CE_CALL(EVENT_BEFORE_BROADCAST_TAG,c2_event_event);
  c2_c2_auto_netcon();
  _SFD_CE_CALL(EVENT_AFTER_BROADCAST_TAG,c2_event_event);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency();
}

static void c2_c2_auto_netcon(void)
{
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
  if(chartInstance.c2_is_active_c2_auto_netcon == 0) {
    _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
    chartInstance.c2_is_active_c2_auto_netcon = 1U;
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,11);
    chartInstance.c2_count = c2__u16_s8_(0);
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_count, 1U);
    chartInstance.c2_convec[0] = c2__u8_s8_(0);
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
    chartInstance.c2_convec[1] = c2__u8_s8_(0);
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
    chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_start;
    _SFD_CS_CALL(STATE_ACTIVE_TAG,2);
    chartInstance.c2_tp_start = 1U;
  } else {
    switch(chartInstance.c2_is_c2_auto_netcon) {
     case c2_IN_ROAD1:
      CV_CHART_EVAL(0,0,1);
      c2_ROAD1();
      break;
     case c2_IN_ROAD2:
      CV_CHART_EVAL(0,0,2);
      c2_ROAD2();
      break;
     case c2_IN_ROAD3:
      CV_CHART_EVAL(0,0,3);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
      if(CV_TRANSITION_EVAL(3U, (int32_T)_SFD_CCP_CALL(3,0,((chartInstance.c2_j
           == 2)!=0))) != 0) {
        if(sf_debug_transition_conflict_check_enabled()) {
          unsigned int transitionList[2];
          unsigned int numTransitions=1;
          transitionList[0] = 3;
          sf_debug_transition_conflict_check_begin();
          if(chartInstance.c2_j < 2) {
            transitionList[numTransitions] = 4;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,3);
        chartInstance.c2_count = c2__u16_s32_(chartInstance.c2_count + 1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_count, 1U);
        chartInstance.c2_convec[1] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
        chartInstance.c2_convec[0] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
        output(chartInstance.c2_convec);
        *c2_outdp() = 0.0;
        _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
        chartInstance.c2_tp_ROAD3 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,1);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,1);
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_start;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,2);
        chartInstance.c2_tp_start = 1U;
      } else if(CV_TRANSITION_EVAL(4U,
        (int32_T)_SFD_CCP_CALL(4,0,((chartInstance.c2_j < 2)!=0))) != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,4);
        chartInstance.c2_convec[1] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
        chartInstance.c2_convec[0] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
        output(chartInstance.c2_convec);
        *c2_outdp() = 0.0;
        _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
        chartInstance.c2_tp_ROAD3 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,1);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,1);
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_ROAD3;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,1);
        chartInstance.c2_tp_ROAD3 = 1U;
        chartInstance.c2_j = c2__s8_s32_(chartInstance.c2_j + 1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
      }
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
      break;
     case c2_IN_ROAD4:
      CV_CHART_EVAL(0,0,4);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,0);
      if(CV_TRANSITION_EVAL(7U, (int32_T)_SFD_CCP_CALL(7,0,((chartInstance.c2_j
           == 2)!=0))) != 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.c2_j < 2) {
            transitionList[numTransitions] = 12;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,7);
        chartInstance.c2_count = c2__u16_s32_(chartInstance.c2_count + 1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_count, 1U);
        chartInstance.c2_convec[1] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
        chartInstance.c2_convec[0] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
        output(chartInstance.c2_convec);
        *c2_outdp() = 0.0;
        _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
        chartInstance.c2_tp_ROAD4 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,0);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,0);
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_start;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,2);
        chartInstance.c2_tp_start = 1U;
      } else if(CV_TRANSITION_EVAL(12U,
        (int32_T)_SFD_CCP_CALL(12,0,((chartInstance.c2_j < 2)!=0))) != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,12);
        chartInstance.c2_convec[1] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
        chartInstance.c2_convec[0] = c2__u8_s8_(0);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
        output(chartInstance.c2_convec);
        *c2_outdp() = 0.0;
        _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
        chartInstance.c2_tp_ROAD4 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,0);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,0);
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_ROAD4;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,0);
        chartInstance.c2_tp_ROAD4 = 1U;
        chartInstance.c2_j = c2__s8_s32_(chartInstance.c2_j + 1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
      }
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
      break;
     case c2_IN_STOP:
      CV_CHART_EVAL(0,0,5);
      break;
     case c2_IN_start:
      CV_CHART_EVAL(0,0,6);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,9);
      chartInstance.c2_code = (uint8_T)In1(chartInstance.c2_count);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_code, 4U);
      chartInstance.c2_i = c2__u8_s8_(0);
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_i, 0U);
      chartInstance.c2_j = 0;
      _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
      if(CV_TRANSITION_EVAL(8U,
        (int32_T)_SFD_CCP_CALL(8,0,((chartInstance.c2_code == 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.c2_code == 1) {
            transitionList[numTransitions] = 2;
            numTransitions++;
          }
          if(chartInstance.c2_code == 2) {
            transitionList[numTransitions] = 6;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,8);
        chartInstance.c2_convec[1] = c2__u8_s8_(1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[1], 7U);
        chartInstance.c2_convec[0] = c2__u8_s8_(1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_convec[0], 7U);
        output(chartInstance.c2_convec);
        *c2_outdp() = 1.0;
        _SFD_DATA_RANGE_CHECK(*c2_outdp(), 5U);
        chartInstance.c2_tp_start = 0U;
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_NO_ACTIVE_CHILD;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,2);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,2);
        chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_ROAD1;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,5);
        chartInstance.c2_tp_ROAD1 = 1U;
        chartInstance.c2_i = c2__u8_s32_(chartInstance.c2_i + 1);
        _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_i, 0U);
      } else if(CV_TRANSITION_EVAL(2U,
        (int32_T)_SFD_CCP_CALL(2,0,((chartInstance.c2_code == 1)!=0))) != 0) {
        if(sf_debug_transition_conflict_check_enabled()) {
          unsigned int transitionList[2];
          unsigned int numTransitions=1;
          transitionList[0] = 2;
          sf_debug_transition_conflict_check_begin();
          if(chartInstance.c2_code == 2) {
            transitionList[numTransitions] = 6;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
        chartInstance.c2_convec[1] = c2__u8_s8_(1);

⌨️ 快捷键说明

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