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

📄 c1_firststateflowmodel.c

📁 m files for SIAM book, Numerical Computing with MATLAB
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Include files */
#include "FirstStateflowModel_sfun.h"
#include "c1_FirstStateflowModel.h"
#define CHARTINSTANCE_CHARTNUMBER       (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER    (chartInstance.instanceNumber)
#include "FirstStateflowModel_sfun_debug_macros.h"

/* Type Definitions */

/* Named Constants */
#define c1_event_Switch                 (0U)
#define c1_IN_NO_ACTIVE_CHILD           (0)
#define c1_IN_Off                       (1)
#define c1_IN_On                        (2)

/* Variable Declarations */

/* Variable Definitions */
static SFc1_FirstStateflowModelInstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c1_FirstStateflowModel(void);
static void initialize_params_c1_FirstStateflowModel(void);
static void enable_c1_FirstStateflowModel(void);
static void disable_c1_FirstStateflowModel(void);
static void finalize_c1_FirstStateflowModel(void);
static void sf_c1_FirstStateflowModel(void);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
 c1_chartNumber);
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);

/* Function Definitions */
static void initialize_c1_FirstStateflowModel(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  chartInstance.c1_tp_Off = 0U;
  chartInstance.c1_tp_On = 0U;
  chartInstance.c1_is_active_c1_FirstStateflowModel = 0U;
  chartInstance.c1_is_c1_FirstStateflowModel = 0U;
}

static void initialize_params_c1_FirstStateflowModel(void)
{
}

static void enable_c1_FirstStateflowModel(void)
{
}

static void disable_c1_FirstStateflowModel(void)
{
}

static void finalize_c1_FirstStateflowModel(void)
{
}

static void sf_c1_FirstStateflowModel(void)
{
  uint8_T c1_previousEvent;
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  c1_previousEvent = _sfEvent_;
  _sfEvent_ = c1_event_Switch;
  _SFD_CE_CALL(EVENT_BEFORE_BROADCAST_TAG,c1_event_Switch);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
  if(chartInstance.c1_is_active_c1_FirstStateflowModel == 0) {
    _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
    chartInstance.c1_is_active_c1_FirstStateflowModel = 1U;
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,0);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
    chartInstance.c1_is_c1_FirstStateflowModel = (uint8_T)c1_IN_Off;
    _SFD_CS_CALL(STATE_ACTIVE_TAG,0);
    chartInstance.c1_tp_Off = 1U;
  } else {
    switch(chartInstance.c1_is_c1_FirstStateflowModel) {
     case c1_IN_Off:
      CV_CHART_EVAL(0,0,1);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,0);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,1);
      if(CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1,0,((_sfEvent_ ==
           c1_event_Switch)!=0))) != 0U != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,0);
        chartInstance.c1_tp_Off = 0U;
        chartInstance.c1_is_c1_FirstStateflowModel =
          (uint8_T)c1_IN_NO_ACTIVE_CHILD;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,0);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
        chartInstance.c1_is_c1_FirstStateflowModel = (uint8_T)c1_IN_On;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,1);
        chartInstance.c1_tp_On = 1U;
      }
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
      break;
     case c1_IN_On:
      CV_CHART_EVAL(0,0,2);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,2);
      if(CV_TRANSITION_EVAL(2U, (int32_T)_SFD_CCP_CALL(2,0,((_sfEvent_ ==
           c1_event_Switch)!=0))) != 0U != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,1);
        chartInstance.c1_tp_On = 0U;
        chartInstance.c1_is_c1_FirstStateflowModel =
          (uint8_T)c1_IN_NO_ACTIVE_CHILD;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,1);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
        chartInstance.c1_is_c1_FirstStateflowModel = (uint8_T)c1_IN_Off;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,0);
        chartInstance.c1_tp_Off = 1U;
      }
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
      break;
     default:
      CV_CHART_EVAL(0,0,0);
      chartInstance.c1_is_c1_FirstStateflowModel =
        (uint8_T)c1_IN_NO_ACTIVE_CHILD;
      _SFD_CS_CALL(STATE_INACTIVE_TAG,0);
      break;
    }
  }
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
  _SFD_CE_CALL(EVENT_AFTER_BROADCAST_TAG,c1_event_Switch);
  _sfEvent_ = c1_previousEvent;
  sf_debug_check_for_state_inconsistency(_FirstStateflowModelMachineNumber_,
   chartInstance.chartNumber, chartInstance.instanceNumber);
}

static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
 c1_chartNumber)
{
}

const mxArray *sf_c1_FirstStateflowModel_get_eml_resolved_functions_info(void)
{
  const mxArray *c1_nameCaptureInfo = NULL;
  c1_nameCaptureInfo = NULL;
  sf_mex_assign(&c1_nameCaptureInfo, sf_mex_create(NULL, "nameCaptureInfo", 0,
    0U, 1U, 2, 0, 1));
  return c1_nameCaptureInfo;
}

static void init_test_point_addr_map(void)
{
  chartInstance.c1_testPointAddrMap[0] = &chartInstance.c1_tp_Off;
  chartInstance.c1_testPointAddrMap[1] = &chartInstance.c1_tp_On;
}

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

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

static void init_dsm_address_info(void)
{
}

/* SFunction Glue Code */
static void init_test_point_mapping_info(SimStruct *S);
void sf_c1_FirstStateflowModel_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(4215187609U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(599871141U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(792561457U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1879324600U);
}

mxArray *sf_c1_FirstStateflowModel_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)(2280108486U);
    pr[1] = (double)(1748007906U);
    pr[2] = (double)(1875100286U);
    pr[3] = (double)(180867929U);
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }
  {
    mxSetField(mxAutoinheritanceInfo,0,"inputs",mxCreateDoubleMatrix(0,0,mxREAL));
  }
  {
    mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,mxREAL));
  }
  {
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxCreateDoubleMatrix(0,0,mxREAL));
  }
  return(mxAutoinheritanceInfo);
}

static void chart_debug_initialization(SimStruct *S, unsigned int
 fullDebuggerInitialization)
{
  if(ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
    /* do this only if simulation is starting */
    if(!sim_mode_is_rtw_gen(S)) {
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent =
          sf_debug_initialize_chart(_FirstStateflowModelMachineNumber_,
         1,
         2,
         3,
         0,
         1,
         0,
         0,
         0,
         0,
         &(chartInstance.chartNumber),
         &(chartInstance.instanceNumber),
         ssGetPath(S),
         (void *)S);
        if(chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_FirstStateflowModelMachineNumber_,chartInstance.chartNumber);
          sf_debug_set_chart_disable_implicit_casting(_FirstStateflowModelMachineNumber_,chartInstance.chartNumber,1);
          sf_debug_set_chart_event_thresholds(_FirstStateflowModelMachineNumber_,
           chartInstance.chartNumber,
           1,
           1,
           1);

          _SFD_EVENT_SCOPE(0,1);
          _SFD_STATE_INFO(0,0,0);
          _SFD_STATE_INFO(1,0,0);
          _SFD_CH_SUBSTATE_COUNT(2);
          _SFD_CH_SUBSTATE_DECOMP(0);
          _SFD_CH_SUBSTATE_INDEX(0,0);
          _SFD_CH_SUBSTATE_INDEX(1,1);
          _SFD_ST_SUBSTATE_COUNT(0,0);
          _SFD_ST_SUBSTATE_COUNT(1,0);
        }
        _SFD_CV_INIT_CHART(2,1,0,0);
        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }
        {
          _SFD_CV_INIT_STATE(1,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        {
          static unsigned int sStartGuardMap[] = {0};
          static unsigned int sEndGuardMap[] = {6};
          static int sPostFixPredicateTree[] = {0};
          _SFD_CV_INIT_TRANS(2,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,&(sPostFixPredicateTree[0]));
        }
        {

⌨️ 快捷键说明

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