1 | /* |
2 | * RaspberryMagmanControl.h |
3 | * |
4 | * Classroom License -- for classroom instructional use only. Not for |
5 | * government, commercial, academic research, or other organizational use. |
6 | * |
7 | * Code generation for model "RaspberryMagmanControl". |
8 | * |
9 | * Model version : 1.38 |
10 | * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 |
11 | * C source code generated on : Thu Dec 22 16:38:00 2016 |
12 | * |
13 | * Target selection: ert.tlc |
14 | * Note: GRT includes extra infrastructure and instrumentation for prototyping |
15 | * Embedded hardware selection: ARM Compatible->ARM Cortex |
16 | * Code generation objectives: Unspecified |
17 | * Validation result: Not run |
18 | */ |
19 | |
20 | #ifndef RTW_HEADER_RaspberryMagmanControl_h_ |
21 | #define RTW_HEADER_RaspberryMagmanControl_h_ |
22 | #include <math.h> |
23 | #include <string.h> |
24 | #include <float.h> |
25 | #include <stddef.h> |
26 | #ifndef RaspberryMagmanControl_COMMON_INCLUDES_ |
27 | # define RaspberryMagmanControl_COMMON_INCLUDES_ |
28 | #include "rtwtypes.h" |
29 | #include "rtw_extmode.h" |
30 | #include "sysran_types.h" |
31 | #include "rtw_continuous.h" |
32 | #include "rtw_solver.h" |
33 | #include "dt_info.h" |
34 | #include "ext_work.h" |
35 | #endif /* RaspberryMagmanControl_COMMON_INCLUDES_ */ |
36 | |
37 | #include "RaspberryMagmanControl_types.h" |
38 | |
39 | /* Shared type includes */ |
40 | #include "multiword_types.h" |
41 | #include "rt_nonfinite.h" |
42 | #include "rtGetInf.h" |
43 | |
44 | /* Macros for accessing real-time model data structure */ |
45 | #ifndef rtmGetFinalTime |
46 | # define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal) |
47 | #endif |
48 | |
49 | #ifndef rtmGetRTWExtModeInfo |
50 | # define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo) |
51 | #endif |
52 | |
53 | #ifndef rtmGetErrorStatus |
54 | # define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) |
55 | #endif |
56 | |
57 | #ifndef rtmSetErrorStatus |
58 | # define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) |
59 | #endif |
60 | |
61 | #ifndef rtmGetStopRequested |
62 | # define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag) |
63 | #endif |
64 | |
65 | #ifndef rtmSetStopRequested |
66 | # define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val)) |
67 | #endif |
68 | |
69 | #ifndef rtmGetStopRequestedPtr |
70 | # define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag)) |
71 | #endif |
72 | |
73 | #ifndef rtmGetT |
74 | # define rtmGetT(rtm) (rtmGetTPtr((rtm))[0]) |
75 | #endif |
76 | |
77 | #ifndef rtmGetTFinal |
78 | # define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal) |
79 | #endif |
80 | |
81 | /* Block signals for system '<S1>/Position transformation1' */ |
82 | typedef struct { |
83 | real_T X; /* '<S1>/Position transformation1' */ |
84 | real_T Y; /* '<S1>/Position transformation1' */ |
85 | } B_Positiontransformation1_Ras_T; |
86 | |
87 | /* Block signals (auto storage) */ |
88 | typedef struct { |
89 | real_T MagManlinearization1_o1[16]; /* '<S5>/MagMan linearization1' */ |
90 | real_T minval[16]; |
91 | real_T i[16]; /* '<Root>/proud' */ |
92 | real_T y[4]; |
93 | real_T MagManFoilwitherror_o1; /* '<S4>/MagMan Foil with error' */ |
94 | real_T MagManFoilwitherror_o2; /* '<S4>/MagMan Foil with error' */ |
95 | real_T MagManFoilwitherror_o3; /* '<S4>/MagMan Foil with error' */ |
96 | real_T DataTypeConversion1; /* '<S10>/Data Type Conversion1' */ |
97 | real_T DataTypeConversion2; /* '<S10>/Data Type Conversion2' */ |
98 | real_T ManualSwitch[2]; /* '<Root>/Manual Switch' */ |
99 | real_T SineWave; /* '<Root>/Sine Wave' */ |
100 | real_T SineWave1; /* '<Root>/Sine Wave1' */ |
101 | real_T ManualSwitch1[2]; /* '<Root>/Manual Switch1' */ |
102 | real_T Integrator[2]; /* '<S6>/Integrator' */ |
103 | real_T Filter[2]; /* '<S6>/Filter' */ |
104 | real_T FilterCoefficient[2]; /* '<S6>/Filter Coefficient' */ |
105 | real_T Saturate[2]; /* '<S6>/Saturate' */ |
106 | real_T MagManlinearization1_o2; /* '<S5>/MagMan linearization1' */ |
107 | real_T MathFunction[16]; /* '<S5>/Math Function' */ |
108 | real_T Gain[2]; /* '<S2>/Gain' */ |
109 | real_T Switch1[16]; /* '<Root>/Switch1' */ |
110 | real_T SumI1[2]; /* '<S6>/SumI1' */ |
111 | real_T TmpSignalConversionAtsfunxyInpo[2]; |
112 | real_T TmpSignalConversionAtsfunxyIn_i[2]; |
113 | real_T Ao[32]; /* '<S5>/Embedded MATLAB Function' */ |
114 | real_T PWM[16]; /* '<Root>/Currents to PWM' */ |
115 | real_T vy; |
116 | real_T d_a; |
117 | real_T lim; /* '<Root>/proud' */ |
118 | int32_T MagManFoilwitherror_o4; /* '<S4>/MagMan Foil with error' */ |
119 | int32_T Sharedmemorycameraposition_o1;/* '<S10>/Shared memory camera position' */ |
120 | int32_T Sharedmemorycameraposition_o2;/* '<S10>/Shared memory camera position' */ |
121 | B_Positiontransformation1_Ras_T sf_Positiontransformation;/* '<S4>/Position transformation' */ |
122 | B_Positiontransformation1_Ras_T sf_Positiontransformation1;/* '<S1>/Position transformation1' */ |
123 | } B_RaspberryMagmanControl_T; |
124 | |
125 | /* Block states (auto storage) for system '<Root>' */ |
126 | typedef struct { |
127 | real_T MagManFoilwitherror_DSTATE; /* '<S4>/MagMan Foil with error' */ |
128 | real_T Sharedmemorycameraposition_DSTA;/* '<S10>/Shared memory camera position' */ |
129 | real_T Integrator_DSTATE[2]; /* '<S6>/Integrator' */ |
130 | real_T Filter_DSTATE[2]; /* '<S6>/Filter' */ |
131 | real_T MagManCoils_DSTATE; /* '<Root>/MagMan Coils' */ |
132 | struct { |
133 | void *LoggedData[2]; |
134 | } Forcescope_PWORK; /* '<Root>/Force scope' */ |
135 | |
136 | struct { |
137 | void *LoggedData[2]; |
138 | } Forcescope1_PWORK; /* '<Root>/Force scope1' */ |
139 | |
140 | struct { |
141 | void *LoggedData[4]; |
142 | } Storescope_PWORK; /* '<Root>/Store scope' */ |
143 | |
144 | struct { |
145 | void *LoggedData[2]; |
146 | } Nomalizedposition1_PWORK; /* '<S1>/Nomalized position1' */ |
147 | |
148 | struct { |
149 | void *LoggedData[2]; |
150 | } Rawposition_PWORK; /* '<S1>/Raw position' */ |
151 | |
152 | struct { |
153 | void *LoggedData[2]; |
154 | } Nomalizedposition_PWORK; /* '<S4>/Nomalized position' */ |
155 | |
156 | struct { |
157 | void *LoggedData[3]; |
158 | } Scope1_PWORK; /* '<S4>/Scope1' */ |
159 | } DW_RaspberryMagmanControl_T; |
160 | |
161 | /* Parameters (auto storage) */ |
162 | struct P_RaspberryMagmanControl_T_ { |
163 | real_T km4pi[9]; /* Variable: km4pi |
164 | * Referenced by: '<S4>/Sentinel Calibration matrix' |
165 | */ |
166 | real_T km4piCam[9]; /* Variable: km4piCam |
167 | * Referenced by: '<S1>/Sentinel Calibration matrix1' |
168 | */ |
169 | real_T PIDController2DOF_D; /* Mask Parameter: PIDController2DOF_D |
170 | * Referenced by: '<S6>/Derivative Gain' |
171 | */ |
172 | real_T PIDController2DOF_I; /* Mask Parameter: PIDController2DOF_I |
173 | * Referenced by: '<S6>/Integral Gain' |
174 | */ |
175 | real_T PIDController2DOF_Kb; /* Mask Parameter: PIDController2DOF_Kb |
176 | * Referenced by: '<S6>/Kb' |
177 | */ |
178 | real_T PIDController2DOF_LowerSaturati;/* Mask Parameter: PIDController2DOF_LowerSaturati |
179 | * Referenced by: '<S6>/Saturate' |
180 | */ |
181 | real_T PIDController2DOF_N; /* Mask Parameter: PIDController2DOF_N |
182 | * Referenced by: '<S6>/Filter Coefficient' |
183 | */ |
184 | real_T PIDController2DOF_P; /* Mask Parameter: PIDController2DOF_P |
185 | * Referenced by: '<S6>/Proportional Gain' |
186 | */ |
187 | real_T PIDController2DOF_UpperSaturati;/* Mask Parameter: PIDController2DOF_UpperSaturati |
188 | * Referenced by: '<S6>/Saturate' |
189 | */ |
190 | real_T PIDController2DOF_b; /* Mask Parameter: PIDController2DOF_b |
191 | * Referenced by: '<S6>/Setpoint Weighting (Proportional)' |
192 | */ |
193 | real_T PIDController2DOF_c; /* Mask Parameter: PIDController2DOF_c |
194 | * Referenced by: '<S6>/Setpoint Weighting (Derivative)' |
195 | */ |
196 | real_T SineWave_Amp; /* Expression: 1 |
197 | * Referenced by: '<Root>/Sine Wave' |
198 | */ |
199 | real_T SineWave_Bias; /* Expression: 2.5 |
200 | * Referenced by: '<Root>/Sine Wave' |
201 | */ |
202 | real_T SineWave_Freq; /* Expression: 1 |
203 | * Referenced by: '<Root>/Sine Wave' |
204 | */ |
205 | real_T SineWave_Phase; /* Expression: 0 |
206 | * Referenced by: '<Root>/Sine Wave' |
207 | */ |
208 | real_T SineWave1_Amp; /* Expression: 1 |
209 | * Referenced by: '<Root>/Sine Wave1' |
210 | */ |
211 | real_T SineWave1_Bias; /* Expression: 2.5 |
212 | * Referenced by: '<Root>/Sine Wave1' |
213 | */ |
214 | real_T SineWave1_Freq; /* Expression: 2 |
215 | * Referenced by: '<Root>/Sine Wave1' |
216 | */ |
217 | real_T SineWave1_Phase; /* Expression: pi/2 |
218 | * Referenced by: '<Root>/Sine Wave1' |
219 | */ |
220 | real_T Refereceposition_Value[2]; /* Expression: [2.5, 2.5] |
221 | * Referenced by: '<Root>/Referece position' |
222 | */ |
223 | real_T Integrator_gainval; /* Computed Parameter: Integrator_gainval |
224 | * Referenced by: '<S6>/Integrator' |
225 | */ |
226 | real_T Integrator_IC; /* Expression: InitialConditionForIntegrator |
227 | * Referenced by: '<S6>/Integrator' |
228 | */ |
229 | real_T Filter_gainval; /* Computed Parameter: Filter_gainval |
230 | * Referenced by: '<S6>/Filter' |
231 | */ |
232 | real_T Filter_IC; /* Expression: InitialConditionForFilter |
233 | * Referenced by: '<S6>/Filter' |
234 | */ |
235 | real_T Gain_Gain; /* Expression: 1/68 |
236 | * Referenced by: '<S2>/Gain' |
237 | */ |
238 | real_T Constant2_Value[16]; /* Expression: [0,0,0,0;0,0,0,0;0,0,0,0;0,0,0,0] |
239 | * Referenced by: '<Root>/Constant2' |
240 | */ |
241 | uint8_T ManualSwitch_CurrentSetting; /* Computed Parameter: ManualSwitch_CurrentSetting |
242 | * Referenced by: '<Root>/Manual Switch' |
243 | */ |
244 | uint8_T ManualSwitch1_CurrentSetting;/* Computed Parameter: ManualSwitch1_CurrentSetting |
245 | * Referenced by: '<Root>/Manual Switch1' |
246 | */ |
247 | }; |
248 | |
249 | /* Real-time Model Data Structure */ |
250 | struct tag_RTM_RaspberryMagmanControl_T { |
251 | const char_T *errorStatus; |
252 | RTWExtModeInfo *extModeInfo; |
253 | RTWSolverInfo solverInfo; |
254 | |
255 | /* |
256 | * Sizes: |
257 | * The following substructure contains sizes information |
258 | * for many of the model attributes such as inputs, outputs, |
259 | * dwork, sample times, etc. |
260 | */ |
261 | struct { |
262 | uint32_T checksums[4]; |
263 | } Sizes; |
264 | |
265 | /* |
266 | * SpecialInfo: |
267 | * The following substructure contains special information |
268 | * related to other components that are dependent on RTW. |
269 | */ |
270 | struct { |
271 | const void *mappingInfo; |
272 | } SpecialInfo; |
273 | |
274 | /* |
275 | * Timing: |
276 | * The following substructure contains information regarding |
277 | * the timing information for the model. |
278 | */ |
279 | struct { |
280 | uint32_T clockTick0; |
281 | uint32_T clockTickH0; |
282 | time_T stepSize0; |
283 | uint32_T clockTick1; |
284 | uint32_T clockTickH1; |
285 | time_T tFinal; |
286 | SimTimeStep simTimeStep; |
287 | boolean_T stopRequestedFlag; |
288 | time_T *t; |
289 | time_T tArray[2]; |
290 | } Timing; |
291 | }; |
292 | |
293 | /* Block parameters (auto storage) */ |
294 | extern P_RaspberryMagmanControl_T RaspberryMagmanControl_P; |
295 | |
296 | /* Block signals (auto storage) */ |
297 | extern B_RaspberryMagmanControl_T RaspberryMagmanControl_B; |
298 | |
299 | /* Block states (auto storage) */ |
300 | extern DW_RaspberryMagmanControl_T RaspberryMagmanControl_DW; |
301 | |
302 | /* Model entry point functions */ |
303 | extern void RaspberryMagmanControl_initialize(void); |
304 | extern void RaspberryMagmanControl_step(void); |
305 | extern void RaspberryMagmanControl_terminate(void); |
306 | |
307 | /* Real-time Model object */ |
308 | extern RT_MODEL_RaspberryMagmanControl_T *const RaspberryMagmanControl_M; |
309 | |
310 | /*- |
311 | * The generated code includes comments that allow you to trace directly |
312 | * back to the appropriate location in the model. The basic format |
313 | * is <system>/block_name, where system is the system number (uniquely |
314 | * assigned by Simulink) and block_name is the name of the block. |
315 | * |
316 | * Use the MATLAB hilite_system command to trace the generated code back |
317 | * to the model. For example, |
318 | * |
319 | * hilite_system('<S3>') - opens system 3 |
320 | * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3 |
321 | * |
322 | * Here is the system hierarchy for this model |
323 | * |
324 | * '<Root>' : 'RaspberryMagmanControl' |
325 | * '<S1>' : 'RaspberryMagmanControl/Camera position' |
326 | * '<S2>' : 'RaspberryMagmanControl/Currents to Force' |
327 | * '<S3>' : 'RaspberryMagmanControl/Currents to PWM' |
328 | * '<S4>' : 'RaspberryMagmanControl/Foil position' |
329 | * '<S5>' : 'RaspberryMagmanControl/Force to Currents' |
330 | * '<S6>' : 'RaspberryMagmanControl/PID Controller (2DOF)' |
331 | * '<S7>' : 'RaspberryMagmanControl/XY Graph' |
332 | * '<S8>' : 'RaspberryMagmanControl/XY Graph1' |
333 | * '<S9>' : 'RaspberryMagmanControl/proud' |
334 | * '<S10>' : 'RaspberryMagmanControl/Camera position/Camera position from shared memory' |
335 | * '<S11>' : 'RaspberryMagmanControl/Camera position/Position transformation1' |
336 | * '<S12>' : 'RaspberryMagmanControl/Currents to Force/Nonlinearity of magnetic force' |
337 | * '<S13>' : 'RaspberryMagmanControl/Foil position/Position transformation' |
338 | * '<S14>' : 'RaspberryMagmanControl/Force to Currents/Embedded MATLAB Function' |
339 | */ |
340 | #endif /* RTW_HEADER_RaspberryMagmanControl_h_ */ |
341 | |