1/*
2 * RaspberrySmithPredictor.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 "RaspberrySmithPredictor".
8 *
9 * Model version : 1.1
10 * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016
11 * C source code generated on : Tue Dec 20 14:52:06 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_RaspberrySmithPredictor_h_
21#define RTW_HEADER_RaspberrySmithPredictor_h_
22#include <math.h>
23#include <string.h>
24#include <float.h>
25#include <stddef.h>
26#ifndef RaspberrySmithPredictor_COMMON_INCLUDES_
27# define RaspberrySmithPredictor_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 /* RaspberrySmithPredictor_COMMON_INCLUDES_ */
36
37#include "RaspberrySmithPredictor_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 rtmGetBlkStateChangeFlag
46# define rtmGetBlkStateChangeFlag(rtm) ((rtm)->blkStateChange)
47#endif
48
49#ifndef rtmSetBlkStateChangeFlag
50# define rtmSetBlkStateChangeFlag(rtm, val) ((rtm)->blkStateChange = (val))
51#endif
52
53#ifndef rtmGetContStateDisabled
54# define rtmGetContStateDisabled(rtm) ((rtm)->contStateDisabled)
55#endif
56
57#ifndef rtmSetContStateDisabled
58# define rtmSetContStateDisabled(rtm, val) ((rtm)->contStateDisabled = (val))
59#endif
60
61#ifndef rtmGetContStates
62# define rtmGetContStates(rtm) ((rtm)->contStates)
63#endif
64
65#ifndef rtmSetContStates
66# define rtmSetContStates(rtm, val) ((rtm)->contStates = (val))
67#endif
68
69#ifndef rtmGetDerivCacheNeedsReset
70# define rtmGetDerivCacheNeedsReset(rtm) ((rtm)->derivCacheNeedsReset)
71#endif
72
73#ifndef rtmSetDerivCacheNeedsReset
74# define rtmSetDerivCacheNeedsReset(rtm, val) ((rtm)->derivCacheNeedsReset = (val))
75#endif
76
77#ifndef rtmGetFinalTime
78# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
79#endif
80
81#ifndef rtmGetIntgData
82# define rtmGetIntgData(rtm) ((rtm)->intgData)
83#endif
84
85#ifndef rtmSetIntgData
86# define rtmSetIntgData(rtm, val) ((rtm)->intgData = (val))
87#endif
88
89#ifndef rtmGetOdeF
90# define rtmGetOdeF(rtm) ((rtm)->odeF)
91#endif
92
93#ifndef rtmSetOdeF
94# define rtmSetOdeF(rtm, val) ((rtm)->odeF = (val))
95#endif
96
97#ifndef rtmGetPeriodicContStateIndices
98# define rtmGetPeriodicContStateIndices(rtm) ((rtm)->periodicContStateIndices)
99#endif
100
101#ifndef rtmSetPeriodicContStateIndices
102# define rtmSetPeriodicContStateIndices(rtm, val) ((rtm)->periodicContStateIndices = (val))
103#endif
104
105#ifndef rtmGetPeriodicContStateRanges
106# define rtmGetPeriodicContStateRanges(rtm) ((rtm)->periodicContStateRanges)
107#endif
108
109#ifndef rtmSetPeriodicContStateRanges
110# define rtmSetPeriodicContStateRanges(rtm, val) ((rtm)->periodicContStateRanges = (val))
111#endif
112
113#ifndef rtmGetRTWExtModeInfo
114# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
115#endif
116
117#ifndef rtmGetZCCacheNeedsReset
118# define rtmGetZCCacheNeedsReset(rtm) ((rtm)->zCCacheNeedsReset)
119#endif
120
121#ifndef rtmSetZCCacheNeedsReset
122# define rtmSetZCCacheNeedsReset(rtm, val) ((rtm)->zCCacheNeedsReset = (val))
123#endif
124
125#ifndef rtmGetdX
126# define rtmGetdX(rtm) ((rtm)->derivs)
127#endif
128
129#ifndef rtmSetdX
130# define rtmSetdX(rtm, val) ((rtm)->derivs = (val))
131#endif
132
133#ifndef rtmGetErrorStatus
134# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
135#endif
136
137#ifndef rtmSetErrorStatus
138# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
139#endif
140
141#ifndef rtmGetStopRequested
142# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
143#endif
144
145#ifndef rtmSetStopRequested
146# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
147#endif
148
149#ifndef rtmGetStopRequestedPtr
150# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
151#endif
152
153#ifndef rtmGetT
154# define rtmGetT(rtm) (rtmGetTPtr((rtm))[0])
155#endif
156
157#ifndef rtmGetTFinal
158# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
159#endif
160
161/* Block signals for system '<S1>/Position transformation1' */
162typedef struct {
163 real_T X; /* '<S1>/Position transformation1' */
164 real_T Y; /* '<S1>/Position transformation1' */
165} B_Positiontransformation1_Ras_T;
166
167/* Block signals (auto storage) */
168typedef struct {
169 real_T MagManFoilwitherror_o1; /* '<S3>/MagMan Foil with error' */
170 real_T MagManFoilwitherror_o2; /* '<S3>/MagMan Foil with error' */
171 real_T MagManFoilwitherror_o3; /* '<S3>/MagMan Foil with error' */
172 real_T SetpointWeightingProportional[2];/* '<S5>/Setpoint Weighting (Proportional)' */
173 real_T DataTypeConversion1; /* '<S6>/Data Type Conversion1' */
174 real_T DataTypeConversion2; /* '<S6>/Data Type Conversion2' */
175 real_T Integrator[2]; /* '<S5>/Integrator' */
176 real_T SetpointWeightingDerivative[2];/* '<S5>/Setpoint Weighting (Derivative)' */
177 real_T Filter[2]; /* '<S5>/Filter' */
178 real_T FilterCoefficient[2]; /* '<S5>/Filter Coefficient' */
179 real_T Delay[2]; /* '<Root>/Delay' */
180 real_T Sum1[2]; /* '<Root>/Sum1' */
181 real_T MagManlinearization1_o1[16]; /* '<S4>/MagMan linearization1' */
182 real_T MagManlinearization1_o2; /* '<S4>/MagMan linearization1' */
183 real_T Linearmodeloftherollingball2ind[2];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)1' */
184 real_T SumI1[2]; /* '<S5>/SumI1' */
185 real_T Ao[32]; /* '<S4>/Embedded MATLAB Function' */
186 real_T PWM[16]; /* '<Root>/Currents to PWM' */
187 real_T MathFunction[16]; /* '<S4>/Math Function' */
188 int32_T MagManFoilwitherror_o4; /* '<S3>/MagMan Foil with error' */
189 int32_T Sharedmemorycameraposition_o1;/* '<S6>/Shared memory camera position' */
190 int32_T Sharedmemorycameraposition_o2;/* '<S6>/Shared memory camera position' */
191 B_Positiontransformation1_Ras_T sf_Positiontransformation;/* '<S3>/Position transformation' */
192 B_Positiontransformation1_Ras_T sf_Positiontransformation1;/* '<S1>/Position transformation1' */
193} B_RaspberrySmithPredictor_T;
194
195/* Block states (auto storage) for system '<Root>' */
196typedef struct {
197 real_T MagManFoilwitherror_DSTATE; /* '<S3>/MagMan Foil with error' */
198 real_T Sharedmemorycameraposition_DSTA;/* '<S6>/Shared memory camera position' */
199 real_T Integrator_DSTATE[2]; /* '<S5>/Integrator' */
200 real_T Filter_DSTATE[2]; /* '<S5>/Filter' */
201 real_T Delay_DSTATE[4]; /* '<Root>/Delay' */
202 real_T MagManCoils_DSTATE; /* '<Root>/MagMan Coils' */
203 struct {
204 void *LoggedData[2];
205 } Nomalizedposition1_PWORK; /* '<S1>/Nomalized position1' */
206
207 struct {
208 void *LoggedData[2];
209 } Rawposition_PWORK; /* '<S1>/Raw position' */
210
211 struct {
212 void *LoggedData[2];
213 } Nomalizedposition_PWORK; /* '<S3>/Nomalized position' */
214
215 struct {
216 void *LoggedData[3];
217 } Scope1_PWORK; /* '<S3>/Scope1' */
218} DW_RaspberrySmithPredictor_T;
219
220/* Continuous states (auto storage) */
221typedef struct {
222 real_T Linearmodeloftherollingball2ind[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)' */
223 real_T Linearmodeloftherollingball2i_n[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)1' */
224} X_RaspberrySmithPredictor_T;
225
226/* State derivatives (auto storage) */
227typedef struct {
228 real_T Linearmodeloftherollingball2ind[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)' */
229 real_T Linearmodeloftherollingball2i_n[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)1' */
230} XDot_RaspberrySmithPredictor_T;
231
232/* State disabled */
233typedef struct {
234 boolean_T Linearmodeloftherollingball2ind[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)' */
235 boolean_T Linearmodeloftherollingball2i_n[4];/* '<Root>/Linear model of the rolling ball (2 independent double integrators)1' */
236} XDis_RaspberrySmithPredictor_T;
237
238#ifndef ODE1_INTG
239#define ODE1_INTG
240
241/* ODE1 Integration Data */
242typedef struct {
243 real_T *f[1]; /* derivatives */
244} ODE1_IntgData;
245
246#endif
247
248/* Parameters (auto storage) */
249struct P_RaspberrySmithPredictor_T_ {
250 real_T km4pi[9]; /* Variable: km4pi
251 * Referenced by: '<S3>/Sentinel Calibration matrix'
252 */
253 real_T km4piCam[9]; /* Variable: km4piCam
254 * Referenced by: '<S1>/Sentinel Calibration matrix1'
255 */
256 real_T PIDController2DOF_D; /* Mask Parameter: PIDController2DOF_D
257 * Referenced by: '<S5>/Derivative Gain'
258 */
259 real_T PIDController2DOF_I; /* Mask Parameter: PIDController2DOF_I
260 * Referenced by: '<S5>/Integral Gain'
261 */
262 real_T PIDController2DOF_Kb; /* Mask Parameter: PIDController2DOF_Kb
263 * Referenced by: '<S5>/Kb'
264 */
265 real_T PIDController2DOF_LowerSaturati;/* Mask Parameter: PIDController2DOF_LowerSaturati
266 * Referenced by: '<S5>/Saturate'
267 */
268 real_T PIDController2DOF_N; /* Mask Parameter: PIDController2DOF_N
269 * Referenced by: '<S5>/Filter Coefficient'
270 */
271 real_T PIDController2DOF_P; /* Mask Parameter: PIDController2DOF_P
272 * Referenced by: '<S5>/Proportional Gain'
273 */
274 real_T PIDController2DOF_UpperSaturati;/* Mask Parameter: PIDController2DOF_UpperSaturati
275 * Referenced by: '<S5>/Saturate'
276 */
277 real_T PIDController2DOF_b; /* Mask Parameter: PIDController2DOF_b
278 * Referenced by: '<S5>/Setpoint Weighting (Proportional)'
279 */
280 real_T PIDController2DOF_c; /* Mask Parameter: PIDController2DOF_c
281 * Referenced by: '<S5>/Setpoint Weighting (Derivative)'
282 */
283 real_T Refereceposition_Value[2]; /* Expression: [2.5, 2.5]
284 * Referenced by: '<Root>/Referece position'
285 */
286 real_T Integrator_gainval; /* Computed Parameter: Integrator_gainval
287 * Referenced by: '<S5>/Integrator'
288 */
289 real_T Integrator_IC; /* Expression: InitialConditionForIntegrator
290 * Referenced by: '<S5>/Integrator'
291 */
292 real_T Filter_gainval; /* Computed Parameter: Filter_gainval
293 * Referenced by: '<S5>/Filter'
294 */
295 real_T Filter_IC; /* Expression: InitialConditionForFilter
296 * Referenced by: '<S5>/Filter'
297 */
298 real_T Linearmodeloftherollingball2ind[2];/* Computed Parameter: Linearmodeloftherollingball2ind
299 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)'
300 */
301 real_T Linearmodeloftherollingball2i_c[2];/* Computed Parameter: Linearmodeloftherollingball2i_c
302 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)'
303 */
304 real_T Linearmodeloftherollingball2i_d[2];/* Computed Parameter: Linearmodeloftherollingball2i_d
305 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)'
306 */
307 real_T Linearmodeloftherollingball2i_l[4];/* Expression: [0,2.5,0,2.5]
308 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)'
309 */
310 real_T Delay_InitialCondition; /* Expression: 0
311 * Referenced by: '<Root>/Delay'
312 */
313 real_T Linearmodeloftherollingball2i_o[2];/* Computed Parameter: Linearmodeloftherollingball2i_o
314 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)1'
315 */
316 real_T Linearmodeloftherollingball2i_g[2];/* Computed Parameter: Linearmodeloftherollingball2i_g
317 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)1'
318 */
319 real_T Linearmodeloftherollingball2i_k[2];/* Computed Parameter: Linearmodeloftherollingball2i_k
320 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)1'
321 */
322 real_T Linearmodeloftherollingball2i_a[4];/* Expression: [0,2.5,0,2.5]
323 * Referenced by: '<Root>/Linear model of the rolling ball (2 independent double integrators)1'
324 */
325 uint32_T Delay_DelayLength; /* Computed Parameter: Delay_DelayLength
326 * Referenced by: '<Root>/Delay'
327 */
328};
329
330/* Real-time Model Data Structure */
331struct tag_RTM_RaspberrySmithPredict_T {
332 const char_T *errorStatus;
333 RTWExtModeInfo *extModeInfo;
334 RTWSolverInfo solverInfo;
335 X_RaspberrySmithPredictor_T *contStates;
336 int_T *periodicContStateIndices;
337 real_T *periodicContStateRanges;
338 real_T *derivs;
339 boolean_T *contStateDisabled;
340 boolean_T zCCacheNeedsReset;
341 boolean_T derivCacheNeedsReset;
342 boolean_T blkStateChange;
343 real_T odeF[1][8];
344 ODE1_IntgData intgData;
345
346 /*
347 * Sizes:
348 * The following substructure contains sizes information
349 * for many of the model attributes such as inputs, outputs,
350 * dwork, sample times, etc.
351 */
352 struct {
353 uint32_T checksums[4];
354 int_T numContStates;
355 int_T numPeriodicContStates;
356 int_T numSampTimes;
357 } Sizes;
358
359 /*
360 * SpecialInfo:
361 * The following substructure contains special information
362 * related to other components that are dependent on RTW.
363 */
364 struct {
365 const void *mappingInfo;
366 } SpecialInfo;
367
368 /*
369 * Timing:
370 * The following substructure contains information regarding
371 * the timing information for the model.
372 */
373 struct {
374 uint32_T clockTick0;
375 uint32_T clockTickH0;
376 time_T stepSize0;
377 uint32_T clockTick1;
378 uint32_T clockTickH1;
379 time_T tFinal;
380 SimTimeStep simTimeStep;
381 boolean_T stopRequestedFlag;
382 time_T *t;
383 time_T tArray[2];
384 } Timing;
385};
386
387/* Block parameters (auto storage) */
388extern P_RaspberrySmithPredictor_T RaspberrySmithPredictor_P;
389
390/* Block signals (auto storage) */
391extern B_RaspberrySmithPredictor_T RaspberrySmithPredictor_B;
392
393/* Continuous states (auto storage) */
394extern X_RaspberrySmithPredictor_T RaspberrySmithPredictor_X;
395
396/* Block states (auto storage) */
397extern DW_RaspberrySmithPredictor_T RaspberrySmithPredictor_DW;
398
399/* Model entry point functions */
400extern void RaspberrySmithPredictor_initialize(void);
401extern void RaspberrySmithPredictor_step(void);
402extern void RaspberrySmithPredictor_terminate(void);
403
404/* Real-time Model object */
405extern RT_MODEL_RaspberrySmithPredic_T *const RaspberrySmithPredictor_M;
406
407/*-
408 * The generated code includes comments that allow you to trace directly
409 * back to the appropriate location in the model. The basic format
410 * is <system>/block_name, where system is the system number (uniquely
411 * assigned by Simulink) and block_name is the name of the block.
412 *
413 * Use the MATLAB hilite_system command to trace the generated code back
414 * to the model. For example,
415 *
416 * hilite_system('<S3>') - opens system 3
417 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
418 *
419 * Here is the system hierarchy for this model
420 *
421 * '<Root>' : 'RaspberrySmithPredictor'
422 * '<S1>' : 'RaspberrySmithPredictor/Camera position'
423 * '<S2>' : 'RaspberrySmithPredictor/Currents to PWM'
424 * '<S3>' : 'RaspberrySmithPredictor/Foil position'
425 * '<S4>' : 'RaspberrySmithPredictor/Force to Currents'
426 * '<S5>' : 'RaspberrySmithPredictor/PID Controller (2DOF)'
427 * '<S6>' : 'RaspberrySmithPredictor/Camera position/Camera position from shared memory'
428 * '<S7>' : 'RaspberrySmithPredictor/Camera position/Position transformation1'
429 * '<S8>' : 'RaspberrySmithPredictor/Foil position/Position transformation'
430 * '<S9>' : 'RaspberrySmithPredictor/Force to Currents/Embedded MATLAB Function'
431 */
432#endif /* RTW_HEADER_RaspberrySmithPredictor_h_ */
433