-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtw_continuous.h
executable file
·131 lines (120 loc) · 4.56 KB
/
rtw_continuous.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* Copyright 1990-2014 The MathWorks, Inc. */
/*
* File: rtw_continuous.h
*
* Abstract:
* Type definitions for continuous-time support.
*
*/
#ifndef RTW_CONTINUOUS_H__
#define RTW_CONTINUOUS_H__
#ifdef MATLAB_MEX_FILE
#include "tmwtypes.h"
#else
#include "rtwtypes.h"
#endif
/* For models registering MassMatrix */
typedef enum {
SS_MATRIX_NONE,
SS_MATRIX_CONSTANT,
SS_MATRIX_TIMEDEP,
SS_MATRIX_STATEDEP
} ssMatrixType;
typedef enum {
SOLVER_MODE_AUTO, /* only occurs in
mdlInitializeSizes/mdlInitializeSampleTimes */
SOLVER_MODE_SINGLETASKING,
SOLVER_MODE_MULTITASKING
} SolverMode;
typedef enum {
MINOR_TIME_STEP,
MAJOR_TIME_STEP
} SimTimeStep;
/* =============================================================================
* Model methods object
* =============================================================================
*/
typedef void (*rtMdlInitializeSizesFcn)(void *rtModel);
typedef void (*rtMdlInitializeSampleTimesFcn)(void *rtModel);
typedef void (*rtMdlStartFcn)(void *rtModel);
typedef void (*rtMdlOutputsFcn)(void *rtModel, int_T tid);
typedef void (*rtMdlUpdateFcn)(void *rtModel, int_T tid);
typedef void (*rtMdlDerivativesFcn)(void *rtModel);
typedef void (*rtMdlProjectionFcn)(void *rtModel);
typedef void (*rtMdlMassMatrixFcn)(void *rtModel);
typedef void (*rtMdlForcingFunctionFcn)(void *rtModel);
typedef void (*rtMdlTerminateFcn)(void *rtModel);
#ifdef RT_MALLOC
typedef real_T (*rtMdlDiscreteEventsFcn)(void *pModel,
int_T rtmNumSampTimes,
void *rtmTimingData,
int_T *rtmSampleHitPtr,
int_T *rtmPerTaskSampleHits);
#endif
typedef struct _RTWRTModelMethodsInfo_tag {
void *rtModelPtr;
rtMdlInitializeSizesFcn rtmInitSizesFcn;
rtMdlInitializeSampleTimesFcn rtmInitSampTimesFcn;
rtMdlStartFcn rtmStartFcn;
rtMdlOutputsFcn rtmOutputsFcn;
rtMdlUpdateFcn rtmUpdateFcn;
rtMdlDerivativesFcn rtmDervisFcn;
rtMdlProjectionFcn rtmProjectionFcn;
rtMdlMassMatrixFcn rtmMassMatrixFcn;
rtMdlForcingFunctionFcn rtmForcingFunctionFcn;
rtMdlTerminateFcn rtmTerminateFcn;
#ifdef RT_MALLOC
rtMdlDiscreteEventsFcn rtmDiscreteEventsFcn;
#endif
} RTWRTModelMethodsInfo;
#define rtmiSetRTModelPtr(M,rtmp) ((M).rtModelPtr = (rtmp))
#define rtmiGetRTModelPtr(M) (M).rtModelPtr
#define rtmiSetInitSizesFcn(M,fp) \
((M).rtmInitSizesFcn = ((rtMdlInitializeSizesFcn)(fp)))
#define rtmiSetInitSampTimesFcn(M,fp) \
((M).rtmInitSampTimesFcn = ((rtMdlInitializeSampleTimesFcn)(fp)))
#define rtmiSetStartFcn(M,fp) \
((M).rtmStartFcn = ((rtMdlStartFcn)(fp)))
#define rtmiSetOutputsFcn(M,fp) \
((M).rtmOutputsFcn = ((rtMdlOutputsFcn)(fp)))
#define rtmiSetUpdateFcn(M,fp) \
((M).rtmUpdateFcn = ((rtMdlUpdateFcn)(fp)))
#define rtmiSetDervisFcn(M,fp) \
((M).rtmDervisFcn = ((rtMdlDerivativesFcn)(fp)))
#define rtmiSetProjectionFcn(M,fp) \
((M).rtmProjectionFcn = ((rtMdlProjectionFcn)(fp)))
#define rtmiSetMassMatrixFcn(M,fp) \
((M).rtmMassMatrixFcn = ((rtMdlMassMatrixFcn)(fp)))
#define rtmiSetForcingFunctionFcn(M,fp) \
((M).rtmForcingFunctionFcn = ((rtMdlForcingFunctionFcn)(fp)))
#define rtmiSetTerminateFcn(M,fp) \
((M).rtmTerminateFcn = ((rtMdlTerminateFcn)(fp)))
#ifdef RT_MALLOC
#define rtmiSetDiscreteEventsFcn(M,fp) \
((M).rtmDiscreteEventsFcn = ((rtMdlDiscreteEventsFcn)(fp)))
#endif
#define rtmiInitializeSizes(M) \
((*(M).rtmInitSizesFcn)((M).rtModelPtr))
#define rtmiInitializeSampleTimes(M) \
((*(M).rtmInitSampTimesFcn)((M).rtModelPtr))
#define rtmiStart(M) \
((*(M).rtmStartFcn)((M).rtModelPtr))
#define rtmiOutputs(M, tid) \
((*(M).rtmOutputsFcn)((M).rtModelPtr,tid))
#define rtmiUpdate(M, tid) \
((*(M).rtmUpdateFcn)((M).rtModelPtr,tid))
#define rtmiDerivatives(M) \
((*(M).rtmDervisFcn)((M).rtModelPtr))
#define rtmiProjection(M) \
((*(M).rtmProjectionFcn)((M).rtModelPtr))
#define rtmiMassMatrix(M) \
((*(M).rtmMassMatrixFcn)((M).rtModelPtr))
#define rtmiForcingFunction(M) \
((*(M).rtmForcingFunctionFcn)((M).rtModelPtr))
#define rtmiTerminate(M) \
((*(M).rtmTerminateFcn)((M).rtModelPtr))
#ifdef RT_MALLOC
#define rtmiDiscreteEvents(M,x1,x2,x3,x4) \
((*(M).rtmDiscreteEventsFcn)((M).rtModelPtr,(x1),(x2),(x3),(x4)))
#endif
#endif /* __RTW_CONTINUOUS_H__ */