-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodifiedPMSM_Model.h
More file actions
276 lines (240 loc) · 8.84 KB
/
modifiedPMSM_Model.h
File metadata and controls
276 lines (240 loc) · 8.84 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* File: modifiedPMSM_Model.h
*
* Code generated for Simulink model 'modifiedPMSM_Model'.
*
* Model version : 2.24
* Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
* C/C++ source code generated on : Wed Mar 6 10:13:18 2024
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef RTW_HEADER_modifiedPMSM_Model_h_
#define RTW_HEADER_modifiedPMSM_Model_h_
#ifndef modifiedPMSM_Model_COMMON_INCLUDES_
#define modifiedPMSM_Model_COMMON_INCLUDES_
#include "rtwtypes.h"
#include "rtw_continuous.h"
#include "rtw_solver.h"
#endif /* modifiedPMSM_Model_COMMON_INCLUDES_ */
#include "modifiedPMSM_Model_types.h"
#include <string.h>
#include <math.h>
/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
#endif
#ifndef rtmGetStopRequested
#define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
#endif
#ifndef rtmSetStopRequested
#define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
#endif
#ifndef rtmGetStopRequestedPtr
#define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
#endif
#ifndef rtmGetT
#define rtmGetT(rtm) (rtmGetTPtr((rtm))[0])
#endif
#ifndef rtmGetTPtr
#define rtmGetTPtr(rtm) ((rtm)->Timing.t)
#endif
/* Block signals (default storage) */
typedef struct {
real_T dPsid; /* '<S1>/dq-PMSM' */
real_T dPsiq; /* '<S1>/dq-PMSM' */
real_T dOmega; /* '<S1>/dq-PMSM' */
real_T dTheta; /* '<S1>/dq-PMSM' */
} B_modifiedPMSM_Model_T;
/* Continuous states (default storage) */
typedef struct {
real_T Integrator_CSTATE; /* '<S1>/Integrator' */
real_T Integrator3_CSTATE; /* '<S1>/Integrator3' */
real_T Integrator1_CSTATE; /* '<S1>/Integrator1' */
real_T Integrator2_CSTATE; /* '<S1>/Integrator2' */
} X_modifiedPMSM_Model_T;
/* Periodic continuous state vector (global) */
typedef int_T PeriodicIndX_modifiedPMSM_Mod_T[1];
typedef real_T PeriodicRngX_modifiedPMSM_Mod_T[2];
/* State derivatives (default storage) */
typedef struct {
real_T Integrator_CSTATE; /* '<S1>/Integrator' */
real_T Integrator3_CSTATE; /* '<S1>/Integrator3' */
real_T Integrator1_CSTATE; /* '<S1>/Integrator1' */
real_T Integrator2_CSTATE; /* '<S1>/Integrator2' */
} XDot_modifiedPMSM_Model_T;
/* State disabled */
typedef struct {
boolean_T Integrator_CSTATE; /* '<S1>/Integrator' */
boolean_T Integrator3_CSTATE; /* '<S1>/Integrator3' */
boolean_T Integrator1_CSTATE; /* '<S1>/Integrator1' */
boolean_T Integrator2_CSTATE; /* '<S1>/Integrator2' */
} XDis_modifiedPMSM_Model_T;
#ifndef ODE4_INTG
#define ODE4_INTG
/* ODE4 Integration Data */
typedef struct {
real_T *y; /* output */
real_T *f[4]; /* derivatives */
} ODE4_IntgData;
#endif
/* Constant parameters (default storage) */
typedef struct {
/* Expression: C32
* Referenced by: '<S6>/Gain1'
*/
real_T Gain1_Gain_p[6];
/* Pooled Parameter (Expression: [1;0;1;0.5;0;0;1;0.5])
* Referenced by:
* '<S13>/Leg'
* '<S14>/Leg'
* '<S15>/Leg'
*/
real_T pooled2[8];
/* Expression: C33
* Referenced by: '<S1>/Gain1'
*/
real_T Gain1_Gain_b[9];
/* Expression: C32inv
* Referenced by: '<S5>/Gain3'
*/
real_T Gain3_Gain[6];
} ConstP_modifiedPMSM_Model_T;
/* External inputs (root inport signals with default storage) */
typedef struct {
real_T DutyCycles[3]; /* '<Root>/Duty Cycles' */
} ExtU_modifiedPMSM_Model_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
real_T ThetaOutput; /* '<Root>/Output' */
real_T labcOutput[3]; /* '<Root>/labcOutput' */
real_T OmegaOutput; /* '<Root>/OmegaOutput' */
real_T TmOutput; /* '<Root>/TmOutput' */
real_T WmOutput; /* '<Root>/WmOutput' */
} ExtY_modifiedPMSM_Model_T;
/* Real-time Model Data Structure */
struct tag_RTM_modifiedPMSM_Model_T {
const char_T *errorStatus;
RTWSolverInfo solverInfo;
X_modifiedPMSM_Model_T *contStates;
int_T *periodicContStateIndices;
real_T *periodicContStateRanges;
real_T *derivs;
XDis_modifiedPMSM_Model_T *contStateDisabled;
boolean_T zCCacheNeedsReset;
boolean_T derivCacheNeedsReset;
boolean_T CTOutputIncnstWithState;
real_T odeY[4];
real_T odeF[4][4];
ODE4_IntgData intgData;
/*
* Sizes:
* The following substructure contains sizes information
* for many of the model attributes such as inputs, outputs,
* dwork, sample times, etc.
*/
struct {
int_T numContStates;
int_T numPeriodicContStates;
int_T numSampTimes;
} Sizes;
/*
* Timing:
* The following substructure contains information regarding
* the timing information for the model.
*/
struct {
uint32_T clockTick0;
uint32_T clockTickH0;
time_T stepSize0;
uint32_T clockTick1;
uint32_T clockTickH1;
SimTimeStep simTimeStep;
boolean_T stopRequestedFlag;
time_T *t;
time_T tArray[2];
} Timing;
};
/* Block signals (default storage) */
extern B_modifiedPMSM_Model_T modifiedPMSM_Model_B;
/* Continuous states (default storage) */
extern X_modifiedPMSM_Model_T modifiedPMSM_Model_X;
/* External inputs (root inport signals with default storage) */
extern ExtU_modifiedPMSM_Model_T modifiedPMSM_Model_U;
/* External outputs (root outports fed by signals with default storage) */
extern ExtY_modifiedPMSM_Model_T modifiedPMSM_Model_Y;
/* Constant parameters (default storage) */
extern const ConstP_modifiedPMSM_Model_T modifiedPMSM_Model_ConstP;
/* Model entry point functions */
extern void modifiedPMSM_Model_initialize(void);
extern void modifiedPMSM_Model_step(void);
extern void modifiedPMSM_Model_terminate(void);
/* Real-time Model object */
extern RT_MODEL_modifiedPMSM_Model_T *const modifiedPMSM_Model_M;
/*-
* These blocks were eliminated from the model due to optimizations:
*
* Block '<Root>/Iabc' : Unused code path elimination
* Block '<Root>/Omega(rpm)' : Unused code path elimination
* Block '<Root>/Position' : Unused code path elimination
* Block '<Root>/Pulse Generator' : Unused code path elimination
* Block '<Root>/Scope2' : Unused code path elimination
* Block '<S3>/Sum' : Unused code path elimination
* Block '<S13>/Data Type Conversion' : Unused code path elimination
* Block '<S13>/Product2' : Unused code path elimination
* Block '<S14>/Data Type Conversion' : Unused code path elimination
* Block '<S14>/Product2' : Unused code path elimination
* Block '<S15>/Data Type Conversion' : Unused code path elimination
* Block '<S15>/Product2' : Unused code path elimination
* Block '<S2>/Data Type Conversion' : Eliminate redundant data type conversion
*/
/*-
* The generated code includes comments that allow you to trace directly
* back to the appropriate location in the model. The basic format
* is <system>/block_name, where system is the system number (uniquely
* assigned by Simulink) and block_name is the name of the block.
*
* Use the MATLAB hilite_system command to trace the generated code back
* to the model. For example,
*
* hilite_system('<S3>') - opens system 3
* hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
*
* Here is the system hierarchy for this model
*
* '<Root>' : 'modifiedPMSM_Model'
* '<S1>' : 'modifiedPMSM_Model/PMSM'
* '<S2>' : 'modifiedPMSM_Model/SPWM'
* '<S3>' : 'modifiedPMSM_Model/VSI'
* '<S4>' : 'modifiedPMSM_Model/PMSM/MagCircuit'
* '<S5>' : 'modifiedPMSM_Model/PMSM/abc to dq'
* '<S6>' : 'modifiedPMSM_Model/PMSM/dq to abc'
* '<S7>' : 'modifiedPMSM_Model/PMSM/dq-PMSM'
* '<S8>' : 'modifiedPMSM_Model/PMSM/sin_cos'
* '<S9>' : 'modifiedPMSM_Model/SPWM/S1'
* '<S10>' : 'modifiedPMSM_Model/SPWM/S2'
* '<S11>' : 'modifiedPMSM_Model/SPWM/S3'
* '<S12>' : 'modifiedPMSM_Model/SPWM/carrier'
* '<S13>' : 'modifiedPMSM_Model/VSI/V1'
* '<S14>' : 'modifiedPMSM_Model/VSI/V2'
* '<S15>' : 'modifiedPMSM_Model/VSI/V3'
* '<S16>' : 'modifiedPMSM_Model/VSI/V1/Compare To Zero'
* '<S17>' : 'modifiedPMSM_Model/VSI/V2/Compare To Zero'
* '<S18>' : 'modifiedPMSM_Model/VSI/V3/Compare To Zero'
*/
#endif /* RTW_HEADER_modifiedPMSM_Model_h_ */
/*
* File trailer for generated code.
*
* [EOF]
*/