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

📄 example5_sfun.c

📁 《MATLAB仿真技术与应用》配套光盘,本书附送的光盘包含书中的所有例子的源程序、仿真模型、MATLAB常用函数和各种工具箱函数以及本书的电子版内容。
💻 C
字号:
/*
 *
 * Stateflow code generation for machine:
 *    example5
 * 
 * Target Name                          : sfun
 * Model Version                        : 1.188
 * Stateflow Version                    : 4.1.0.12.10.1.000000
 * Date of code generation              : 14-Jan-2003 20:39:17
 *
 */

#define IN_SF_MACHINE_SOURCE            1
#include "example5_sfun.h"
#include "example5_sfun_c1.h"

int8_T _sfEvent_=CALL_EVENT;
#include "example5_sfun_debug_macros.h"
unsigned int _example5MachineNumber_=UNREASONABLE_NUMBER;
unsigned int sf_example5_process_check_sum_call( int nlhs, mxArray * plhs[], int
 nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
  char commandName[20];
  if (nrhs<1 || !mxIsChar(prhs[0]) ) return 0;
  /* Possible call to get the checksum */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if(strcmp(commandName,"sf_get_check_sum")) return 0;
  plhs[0] = mxCreateDoubleMatrix( 1,4,mxREAL);
  if(nrhs>1 && mxIsChar(prhs[1])) {
    mxGetString(prhs[1], commandName,sizeof(commandName)/sizeof(char));
    commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
    if(!strcmp(commandName,"machine")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(12471285U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(4122240591U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(105549709U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2360725243U);
    }else if(!strcmp(commandName,"makefile")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3087993494U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2887303689U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(819845447U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3662704063U);
    }else if(nrhs==3 && !strcmp(commandName,"chart")) {
      unsigned int chartFileNumber;
      chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
      switch(chartFileNumber) {
       case 1:
        {
          extern void sf_example5_sfun_c1_get_check_sum(mxArray *plhs[]);
          sf_example5_sfun_c1_get_check_sum(plhs);
          break;
        }

       default:
        ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0.0);
      }
    }else if(!strcmp(commandName,"target")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1490673026U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3094088544U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1699186973U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(977413857U);
    }else {
      return 0;
    }
  } else{
    ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3364522130U);
    ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1935230683U);
    ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1088371793U);
    ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2578228661U);
  }
  return 1;
#else
  return 0;
#endif
}
/* Stateflow time variable */
real_T _sfTime_;

void example5_initializer( void )
{
  /* Initialize machine's broadcast event variable */
  _sfEvent_ = CALL_EVENT;

  _example5MachineNumber_ =
    sf_debug_initialize_machine("example5","sfun",0,1,0,0,0);
  sf_debug_set_machine_event_thresholds(_example5MachineNumber_,0,0);
  sf_debug_set_machine_data_thresholds(_example5MachineNumber_,0);
}

unsigned int example5_registry(SimStruct *simstructPtr,char *chartName, int
 initializeFlag)
{
  if(!strcmp_ignore_ws(chartName,"example5/shift_logic/ SFunction ")) {
    example5_sfun_c1_registry(simstructPtr);
    return 1;
  }
  return 0;
}
unsigned int example5_sizes_registry(SimStruct *simstructPtr,char *chartName)
{
  if(!strcmp_ignore_ws(chartName,"example5/shift_logic/ SFunction ")) {
    example5_sfun_c1_sizes_registry(simstructPtr);
    return 1;
  }
  return 0;
}
void example5_terminator(void)
{
}

⌨️ 快捷键说明

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