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

📄 model16to02_sfun.c

📁 《MATLAB7.0_Simulink6.0建模仿真开发与高级工程应用》书中程序
💻 C
字号:
/* Include files */
#define IN_SF_MACHINE_SOURCE            1
#include "model16to02_sfun.h"
#include "c1_model16to02.h"

/* Type Definitions */

/* Named Constants */

/* Variable Declarations */

/* Variable Definitions */
uint8_T _sfEvent_;
uint32_T _model16to02MachineNumber_;
real_T _sfTime_;
SFmodel16to02LocalData smodel16to02LocalData;

/* Function Declarations */

/* Function Definitions */
void model16to02_initializer(void)
{
  real_T m_sf_d0;
  _sfEvent_ = CALL_EVENT;
  sf_debug_set_machine_data_value_ptr(_model16to02MachineNumber_, 0U,
   &smodel16to02LocalData.m_Fstatic);
  sf_set_error_prefix_string("Stateflow Runtime Error (machine): Error evaluating machine workspace data 'Fstatic' in MATLAB base workspace.\n");
  sf_mex_import(sf_mex_get_ml_var("Fstatic", 0), "unnamed temp", &m_sf_d0, 0,
   0U, 0, 0);
  smodel16to02LocalData.m_Fstatic = m_sf_d0;
  sf_set_error_prefix_string("Stateflow Runtime Error (chart): ");
}

void model16to02_terminator(void)
{
}

/* SFunction Glue Code */
unsigned int sf_model16to02_method_dispatcher(SimStruct *simstructPtr, const
 char *chartName, int_T method, void *data)
{
  if(!strcmp_ignore_ws(chartName,"model16to02/state_logic/ SFunction ")) {
    c1_model16to02_method_dispatcher(simstructPtr, method, data);
    return 1;
  }
  return 0;
}
unsigned int sf_model16to02_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)(3749257488U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2755173278U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2826788754U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(244810778U);
    }else if(!strcmp(commandName,"exportedFcn")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0U);
    }else if(!strcmp(commandName,"makefile")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2703224572U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3542450069U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(4094587722U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(524858718U);
    }else if(nrhs==3 && !strcmp(commandName,"chart")) {
      unsigned int chartFileNumber;
      chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
      switch(chartFileNumber) {
       case 1:
        {
          extern void sf_c1_model16to02_get_check_sum(mxArray *plhs[]);
          sf_c1_model16to02_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)(1099933135U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3099773274U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1123725778U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3891239738U);
    }else {
      return 0;
    }
  } else{
    ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2237525652U);
    ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3772863879U);
    ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2770619518U);
    ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3169899492U);
  }
  return 1;
#else
  return 0;
#endif
}

unsigned int sf_model16to02_autoinheritance_info( int nlhs, mxArray * plhs[],
 int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
  char commandName[32];
  if (nrhs<2 || !mxIsChar(prhs[0]) ) return 0;
  /* Possible call to get the autoinheritance_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if(strcmp(commandName,"get_autoinheritance_info")) return 0;
  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch(chartFileNumber) {
     case 1:
      {
        extern mxArray *sf_c1_model16to02_get_autoinheritance_info(void);
        plhs[0] = sf_c1_model16to02_get_autoinheritance_info();
        break;
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }
  return 1;
#else
  return 0;
#endif
}
void model16to02_debug_initialize(void)
{
  _model16to02MachineNumber_ =
  sf_debug_initialize_machine("model16to02","sfun",0,1,1,0,0);
  sf_debug_set_machine_event_thresholds(_model16to02MachineNumber_,0,0);
  sf_debug_set_machine_data_thresholds(_model16to02MachineNumber_,1);
  sf_debug_set_machine_data_scope(_model16to02MachineNumber_,0,10);
  sf_debug_set_machine_data_name(_model16to02MachineNumber_,0,"Fstatic");
  sf_debug_set_machine_data_type(_model16to02MachineNumber_,0,SF_DOUBLE,0,0,0.0,1.0,0);
  sf_debug_set_machine_data_size(_model16to02MachineNumber_,0,0,NULL);
  sf_debug_set_machine_data_value_ptr(_model16to02MachineNumber_,0,NULL);
}

⌨️ 快捷键说明

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