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

📄 simulink_rtdefs.h

📁 simlink应用实例
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * Copyright (c) 1990-2000 The MathWorks, Inc.
 *
 * File: simulink_rtdefs.h     $Revision: 1.5 $
 *
 * Abstract:
 *   Contains typedefs and macros needed both internally and by the
 *   generated code
 *
 */
#ifndef __SIMULINK_RTDEFS_H__
#define __SIMULINK_RTDEFS_H__

/*===========================================================================*
 * BEGIN SECTION
 * LIST OF KEY DEFINES CONTROLLING CONDITIONAL COMPILATION
 *
 * Simulink properties such as definitions, access methods, etc.
 * are conditionally compiled depending on "who" is using the simulink
 * and in what mode.
 *
 * This section list all the key #define macros controlling the inclusion/
 * exclusion of features, defintions, etc.
 *
 * Typically, this section only assigns a default value (such as false).
 * The final value is adjusted in a subsequent section.
 *===========================================================================*/

/*=======================================================*
 * MODE: SINGLE-TASKING OR MULTI-TASKING
 */
#define SS_MULTITASKING (0)

/*=======================================================*
 * MODE: SIMULATION OR GENERATED CODE
 *
 * The following #defines determine whether the simulink is used in "normal"
 * Simulink simulation or in Real Time Workshop generated code.
 *
 * This is designed to be a mutually exclusive set.
 * One and only one should be defined to be true.
 */
#define SS_SIM (0)
#define SS_RTW (0)

/*=======================================================*
 * MODE: WHO IS USING THE SIMULINK RTDEFS
 *
 * The following #defines determine "who" is using the simulink rtdefs.
 *
 * This is designed to be a mutually exclusive set.
 * One and only one should be defined to be true.
 */
#define SS_SFCN_LEVEL_1         (0)
#define SS_SFCN_NORMAL          (0)
#define SS_GENERATED_S_FUNCTION (0)
#define SS_SL_INTERNAL          (0)
#define SS_RTW_INTERNAL         (0)
#define SS_SHARED_MODULE        (0)

/*=======================================================*
 * MODE: GENERATED CODE IS REAL-TIME OR NON-REAL-TIME
 *
 * Both can be false, but both can't be true
 */
#define SS_RT  (0)
#define SS_NRT (0)

/*=======================================================*
 * MODE: ENFORCE NDEBUG
 */
#define SS_NDEBUG (0)

/*=======================================================*
 * MODE: ENVIRONMENT HAS STANDARD IO AVAILABLE
 */
#define SS_HAVESTDIO (0)

/*=======================================================*
 * MODE: TID_EQUALS_SAMPLE_TIME_INDEX -
 *     The model will function correctly if this define is false, however if
 *     this define is true the model's performance may be increased depending
 *     upon whether or not the model has fast to slow rate transitions.
 */
#define TID_EQUALS_SAMPLE_TIME_INDEX (0)

/*=======================================================*
 * MODE: TID01EQ == 1
 */
#define SS_TID01EQ_EQUAL_ONE (0)

/*===========================================================================*
 * END SECTION
 * LIST OF KEY DEFINES CONTROLLING CONDITIONAL COMPILATION
 *===========================================================================*/

#include <limits.h>
#include "tmwtypes.h"
#include "simstruc_types.h"

/*===========================================================================*
 * BEGIN SECTION
 * DETERMINE FINAL VALUES OF KEY DEFINES CONTROLLING CONDITIONAL COMPILATION
 *===========================================================================*/

/*====================================*
 * Determine => MODE: SINGLE-TASKING OR MULTI-TASKING
 *
 * This must come after the inclusion of simstruc_types.h
 */
#if defined(MULTITASKING)
# undef  SS_MULTITASKING
# define SS_MULTITASKING     (1)
#endif

/*====================================*
 * Determine => MODE: SIMULATION OR GENERATED CODE
 */
#if defined(MATLAB_MEX_FILE) || defined(MathWorks_h) || defined(FIPXT_SHARED_MODULE)
# undef  SS_SIM
# define SS_SIM (1)
#else
# undef  SS_RTW
# define SS_RTW (1)
#endif

/*====================================*
 * Determine => MODE: WHO IS USING THIS DATA STRUCTURE
 */
#if !defined(S_FUNCTION_LEVEL)
# if defined(S_FUNCTION_NAME)
#   define S_FUNCTION_LEVEL 1  /* Backwards compatibility old S-functions */
# else
#   define S_FUNCTION_LEVEL 2
# endif
#endif

#if S_FUNCTION_LEVEL != 1 && S_FUNCTION_LEVEL != 2
#  error Invalid S_FUNCTION_LEVEL
#endif

#if defined(RTW_GENERATED_S_FUNCTION)
  /*
   * Used by RTW Generated S Function, ex  s-fcn target.
   * This flag is independent of how the
   * s-function is built (i.e., it is a #define in the code, not a build
   * flag).  It is true when building the s-function for use with simulink and
   * when building the s-function for use with RTW.
   */
# undef  SS_GENERATED_S_FUNCTION
# define SS_GENERATED_S_FUNCTION (1)

#elif S_FUNCTION_LEVEL == 1
  /*
   * Used with any LEVEL 1 s-function (user written) including:
   *  o build for use with a normal simulation (via mex command)
   *  o build for use with rtw (grt)
   */
# undef  SS_SFCN_LEVEL_1
# define SS_SFCN_LEVEL_1   (1)

#elif defined(S_FUNCTION_NAME)
  /*
   * Used with any s-function (user written) including:
   *  o build for use with a normal simulation (via mex command)
   *  o build for use with rtw (grt)
   */
# undef  SS_SFCN_NORMAL
# define SS_SFCN_NORMAL    (1)

#elif defined(MathWorks_h) || defined(RSIM_WITH_SL_SOLVER)
  /*
   * Used internally by Simulink (simulink.dll).
   */
# undef  SS_SL_INTERNAL
# define SS_SL_INTERNAL    (1)

#elif defined(RT) || defined(NRT)
  /*
   * Used in "root" model of generated code, but not in
   * non-inlined, s-functions being compiled for use with the
   * generated code (i.e., rt_main and model.c have access, but
   * sfunc.c does not).
   */
# undef  SS_RTW_INTERNAL
# define SS_RTW_INTERNAL   (1)

#elif defined(FIPXT_SHARED_MODULE)
  /*
   * Used in shared module (such as a dll) that needs to be able to
   * use some feature of the simstruc.
   */
/*
 * Currently, shared module will be treated as if they are
 * normal sfunctions.
 *
# undef  SS_SHARED_MODULE
# define SS_SHARED_MODULE  (1)
*/
# undef  SS_SFCN_NORMAL
# define SS_SFCN_NORMAL    (1)

#elif defined(MATLAB_MEX_FILE)
  /*  Used in mex function that is NOT an S-Function mex
   */
/*
 * Currently, plain mex functions will be treated as if they are
 * normal sfunctions.
 *
# undef  SS_MEX
# define SS_MEX  (1)
*/
# undef  SS_SFCN_NORMAL
# define SS_SFCN_NORMAL    (1)

#else
# error Unrecognized use.
#endif

/*=======================================================*
 * Determine => MODE: GENERATED CODE IS REAL-TIME OR NON-REAL-TIME
 */
#if defined(RT)
# undef  SS_RT
# define SS_RT     (1)
#endif
#if defined(NRT)
# undef  SS_NRT
# define SS_NRT    (1)
#endif

/*=======================================================*
 * Determine => MODE: ENFORCE NDEBUG
 */
#if defined(NDEBUG)
# undef  SS_NDEBUG
# define SS_NDEBUG (1)
#endif

/*=======================================================*
 * Determine => MODE: ENVIRONMENT HAS STANDARD IO AVAILABLE
 */
#if defined(HAVESTDIO)
# undef  SS_HAVESTDIO
# define SS_HAVESTDIO (1)
#endif

/*=======================================================*
 * Determine => MODE: TID_EQUALS_SAMPLE_TIME_INDEX -
 */
#if SS_SL_INTERNAL
# undef  TID_EQUALS_SAMPLE_TIME_INDEX
# define TID_EQUALS_SAMPLE_TIME_INDEX (1)
#else
# if defined(NUMST) && defined(NSAMPLE_TIMES)
#  if NUMST < NSAMPLE_TIMES
#    error NUMST specified incorrectly
#  elif NUMST == NSAMPLE_TIMES
#    undef  TID_EQUALS_SAMPLE_TIME_INDEX
#    define TID_EQUALS_SAMPLE_TIME_INDEX    (1)
#  endif
# endif
#endif

/*=======================================================*
 * Determine => MODE: TID01EQ == 1
 */
#if defined(TID01EQ)
# if TID01EQ == 1
#  undef  SS_TID01EQ_EQUAL_ONE
#  define SS_TID01EQ_EQUAL_ONE (1)
# endif
#endif

/*===========================================================================*
 * END SECTION
 * DETERMINE FINAL VALUES OF KEY DEFINES CONTROLLING CONDITIONAL COMPILATION
 *===========================================================================*/


/*===========================================================================*
 * BEGIN SECTION
 * CHECK PROPER USAGE
 *
 * Issue errors if incompatible modes have been selected
 *===========================================================================*/

#if (defined(RT) + defined(NRT) + defined(MATLAB_MEX_FILE) + defined(MathWorks_h) + defined(RSIM_WITH_SL_SOLVER) + defined(FIPXT_SHARED_MODULE) != 1)
# error Must define one of RT, NRT, MATLAB_MEX_FILE, MathWorks_h, or FIPXT_SHARED_MODULE
# if defined(RT)
#  error defined(RT)
# endif
# if defined(NRT)
#  error defined(NRT)
# endif
# if defined(MATLAB_MEX_FILE)
#  error defined(MATLAB_MEX_FILE)
# endif
# if defined(MathWorks_h)
#  error defined(MathWorks_h)
# endif
# if defined(FIPXT_SHARED_MODULE)
#  error defined(FIPXT_SHARED_MODULE)
# endif
#endif

#if (defined(NRT) && SS_MULTITASKING)
# error NRT does not support MULTITASKING
#endif

⌨️ 快捷键说明

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