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

📄 c2_auto_netcon.c

📁 RFID读卡器与标签之间在AWGN和加入其它读写器干扰下的BER仿真
💻 C
📖 第 1 页 / 共 4 页
字号:
        _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;
        _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_ROAD2;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,3);
        chartInstance.c2_tp_ROAD2 = 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(6U,
        (int32_T)_SFD_CCP_CALL(6,0,((chartInstance.c2_code == 2)!=0))) != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,6);
        chartInstance.c2_tp_start = 0U;
        _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_STOP;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
        chartInstance.c2_tp_STOP = 1U;
      }
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
      break;
     default:
      CV_CHART_EVAL(0,0,0);
      break;
    }
  }
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
}

static void c2_ROAD1(void)
{
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,5);
  if(CV_TRANSITION_EVAL(10U, (int32_T)_SFD_CCP_CALL(10,0,((chartInstance.c2_i ==
       1)!=0))) != 0) {
    if(sf_debug_transition_conflict_check_enabled()) {
      unsigned int transitionList[2];
      unsigned int numTransitions=1;
      transitionList[0] = 10;
      sf_debug_transition_conflict_check_begin();
      if(chartInstance.c2_i < 1) {
        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,10);
    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_j = 0;
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
    chartInstance.c2_tp_ROAD1 = 0U;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,5);
    _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,5);
    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);
  } else if(CV_TRANSITION_EVAL(1U,
    (int32_T)_SFD_CCP_CALL(1,0,((chartInstance.c2_i < 1)!=0))) != 0) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
    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_ROAD1 = 0U;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,5);
    _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,5);
    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);
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,5);
}

static void c2_ROAD2(void)
{
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
  if(CV_TRANSITION_EVAL(0U, (int32_T)_SFD_CCP_CALL(0,0,((chartInstance.c2_i ==
       5)!=0))) != 0) {
    if(sf_debug_transition_conflict_check_enabled()) {
      unsigned int transitionList[2];
      unsigned int numTransitions=1;
      transitionList[0] = 0;
      sf_debug_transition_conflict_check_begin();
      if(chartInstance.c2_i < 5) {
        transitionList[numTransitions] = 5;
        numTransitions++;
      }
      sf_debug_transition_conflict_check_end();
      if(numTransitions>1) {
        _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
      }
    }
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
    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_j = 0;
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_j, 3U);
    chartInstance.c2_tp_ROAD2 = 0U;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
    _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
    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);
  } else if(CV_TRANSITION_EVAL(5U,
    (int32_T)_SFD_CCP_CALL(5,0,((chartInstance.c2_i < 5)!=0))) != 0) {
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,5);
    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_ROAD2 = 0U;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
    _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
    chartInstance.c2_is_c2_auto_netcon = (uint8_T)c2_IN_ROAD2;
    _SFD_CS_CALL(STATE_ACTIVE_TAG,3);
    chartInstance.c2_tp_ROAD2 = 1U;
    chartInstance.c2_i = c2__u8_s32_(chartInstance.c2_i + 1);
    _SFD_DATA_RANGE_CHECK((real_T)chartInstance.c2_i, 0U);
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
}

static uint8_T c2__u8_s8_(int8_T c2_b)
{
  uint8_T c2_a;
  c2_a = (uint8_T)c2_b;
  if(c2_b < 0) {
    sf_debug_overflow_detection(0);
  }
  return c2_a;
}

static uint16_T c2__u16_s8_(int8_T c2_b)
{
  uint16_T c2_a;
  c2_a = (uint16_T)c2_b;
  if(c2_b < 0) {
    sf_debug_overflow_detection(0);
  }
  return c2_a;
}

static uint16_T c2__u16_s32_(int32_T c2_b)
{
  uint16_T c2_a;
  c2_a = (uint16_T)c2_b;
  if(c2_a != c2_b) {
    sf_debug_overflow_detection(0);
  }
  return c2_a;
}

static int8_T c2__s8_s32_(int32_T c2_b)
{
  int8_T c2_a;
  c2_a = (int8_T)c2_b;
  if(c2_a != c2_b) {
    sf_debug_overflow_detection(0);
  }
  return c2_a;
}

static uint8_T c2__u8_s32_(int32_T c2_b)
{
  uint8_T c2_a;
  c2_a = (uint8_T)c2_b;
  if(c2_a != c2_b) {
    sf_debug_overflow_detection(0);
  }
  return c2_a;
}

static real_T *c2_outdp(void)
{
  return (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
}

static real_T *c2_indp(void)
{
  return (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
}

static void init_test_point_addr_map(void)
{
  chartInstance.c2_testPointAddrMap[0] = &chartInstance.c2_code;
  chartInstance.c2_testPointAddrMap[1] = &chartInstance.c2_convec;
  chartInstance.c2_testPointAddrMap[2] = &chartInstance.c2_i;
  chartInstance.c2_testPointAddrMap[3] = &chartInstance.c2_count;
  chartInstance.c2_testPointAddrMap[4] = &chartInstance.c2_i1;
  chartInstance.c2_testPointAddrMap[5] = &chartInstance.c2_j;
  chartInstance.c2_testPointAddrMap[6] = &chartInstance.c2_tp_ROAD1;
  chartInstance.c2_testPointAddrMap[7] = &chartInstance.c2_tp_ROAD2;
  chartInstance.c2_testPointAddrMap[8] = &chartInstance.c2_tp_ROAD3;
  chartInstance.c2_testPointAddrMap[9] = &chartInstance.c2_tp_ROAD4;
  chartInstance.c2_testPointAddrMap[10] = &chartInstance.c2_tp_STOP;
  chartInstance.c2_testPointAddrMap[11] = &chartInstance.c2_tp_start;
}

static void **get_test_point_address_map(void)
{
  return &chartInstance.c2_testPointAddrMap[0];
}

static rtwCAPI_ModelMappingInfo *get_test_point_mapping_info(void)
{
  return &chartInstance.c2_testPointMappingInfo;
}

static void init_dsm_address_info(void)
{
}

static void sf_save_state_c2_auto_netcon(FILE *c2_file)
{
  fwrite(&chartInstance.c2_tp_ROAD3, 1, sizeof(chartInstance.c2_tp_ROAD3),
   c2_file);
  fwrite(&chartInstance.c2_tp_STOP, 1, sizeof(chartInstance.c2_tp_STOP),
   c2_file);
  fwrite(&chartInstance.c2_tp_ROAD4, 1, sizeof(chartInstance.c2_tp_ROAD4),
   c2_file);
  fwrite(&chartInstance.c2_tp_ROAD1, 1, sizeof(chartInstance.c2_tp_ROAD1),
   c2_file);
  fwrite(&chartInstance.c2_tp_ROAD2, 1, sizeof(chartInstance.c2_tp_ROAD2),
   c2_file);
  fwrite(&chartInstance.c2_tp_start, 1, sizeof(chartInstance.c2_tp_start),
   c2_file);
  fwrite(&chartInstance.c2_is_active_c2_auto_netcon, 1,
   sizeof(chartInstance.c2_is_active_c2_auto_netcon), c2_file);
  fwrite(&chartInstance.c2_is_c2_auto_netcon, 1,
   sizeof(chartInstance.c2_is_c2_auto_netcon), c2_file);
  fwrite(&chartInstance.c2_code, 1, sizeof(chartInstance.c2_code), c2_file);
  fwrite(&chartInstance.c2_convec, 1, sizeof(chartInstance.c2_convec), c2_file);
  fwrite(&chartInstance.c2_i, 1, sizeof(chartInstance.c2_i), c2_file);
  fwrite(&chartInstance.c2_count, 1, sizeof(chartInstance.c2_count), c2_file);
  fwrite(&chartInstance.c2_i1, 1, sizeof(chartInstance.c2_i1), c2_file);
  fwrite(&chartInstance.c2_j, 1, sizeof(chartInstance.c2_j), c2_file);
}

static void sf_load_state_c2_auto_netcon(FILE *c2_file)
{
  fread(&chartInstance.c2_tp_ROAD3, 1, sizeof(chartInstance.c2_tp_ROAD3),
   c2_file);
  fread(&chartInstance.c2_tp_STOP, 1, sizeof(chartInstance.c2_tp_STOP), c2_file);
  fread(&chartInstance.c2_tp_ROAD4, 1, sizeof(chartInstance.c2_tp_ROAD4),
   c2_file);
  fread(&chartInstance.c2_tp_ROAD1, 1, sizeof(chartInstance.c2_tp_ROAD1),
   c2_file);
  fread(&chartInstance.c2_tp_ROAD2, 1, sizeof(chartInstance.c2_tp_ROAD2),
   c2_file);
  fread(&chartInstance.c2_tp_start, 1, sizeof(chartInstance.c2_tp_start),
   c2_file);
  fread(&chartInstance.c2_is_active_c2_auto_netcon, 1,
   sizeof(chartInstance.c2_is_active_c2_auto_netcon), c2_file);
  fread(&chartInstance.c2_is_c2_auto_netcon, 1,
   sizeof(chartInstance.c2_is_c2_auto_netcon), c2_file);
  fread(&chartInstance.c2_code, 1, sizeof(chartInstance.c2_code), c2_file);
  fread(&chartInstance.c2_convec, 1, sizeof(chartInstance.c2_convec), c2_file);
  fread(&chartInstance.c2_i, 1, sizeof(chartInstance.c2_i), c2_file);
  fread(&chartInstance.c2_count, 1, sizeof(chartInstance.c2_count), c2_file);
  fread(&chartInstance.c2_i1, 1, sizeof(chartInstance.c2_i1), c2_file);
  fread(&chartInstance.c2_j, 1, sizeof(chartInstance.c2_j), c2_file);
}

/* SFunction Glue Code */
static void init_test_point_mapping_info(SimStruct *S);
void sf_c2_auto_netcon_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(391293651U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1351365001U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(3383138287U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(4222560106U);
}

mxArray *sf_c2_auto_netcon_get_autoinheritance_info(void)
{
  const char *autoinheritanceFields[] =
  {"checksum","inputs","parameters","outputs"};
  mxArray *mxAutoinheritanceInfo =
  mxCreateStructMatrix(1,1,4,autoinheritanceFields);
  {
    mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
    double *pr = mxGetPr(mxChecksum);
    pr[0] = (double)(1657689418U);
    pr[1] = (double)(1466544482U);
    pr[2] = (double)(1993133936U);
    pr[3] = (double)(3129600440U);
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }
  {
    const char *dataFields[] = {"size","type","complexity"};

⌨️ 快捷键说明

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