1/*
2 * FoilControlRaspberrySentinel.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 "FoilControlRaspberrySentinel".
8 *
9 * Model version : 1.24
10 * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016
11 * C source code generated on : Wed Nov 23 14:06:32 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_FoilControlRaspberrySentinel_h_
21#define RTW_HEADER_FoilControlRaspberrySentinel_h_
22#include <math.h>
23#include <string.h>
24#include <float.h>
25#include <stddef.h>
26#ifndef FoilControlRaspberrySentinel_COMMON_INCLUDES_
27# define FoilControlRaspberrySentinel_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#include "MW_gpio.h"
36#endif /* FoilControlRaspberrySentinel_COMMON_INCLUDES_ */
37
38#include "FoilControlRaspberrySentinel_types.h"
39
40/* Shared type includes */
41#include "multiword_types.h"
42#include "rt_nonfinite.h"
43#include "rtGetInf.h"
44
45/* Macros for accessing real-time model data structure */
46#ifndef rtmGetFinalTime
47# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
48#endif
49
50#ifndef rtmGetRTWExtModeInfo
51# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
52#endif
53
54#ifndef rtmGetErrorStatus
55# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
56#endif
57
58#ifndef rtmSetErrorStatus
59# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
60#endif
61
62#ifndef rtmGetStopRequested
63# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
64#endif
65
66#ifndef rtmSetStopRequested
67# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
68#endif
69
70#ifndef rtmGetStopRequestedPtr
71# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
72#endif
73
74#ifndef rtmGetT
75# define rtmGetT(rtm) ((rtm)->Timing.taskTime0)
76#endif
77
78#ifndef rtmGetTFinal
79# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
80#endif
81
82/* Block signals (auto storage) */
83typedef struct {
84 real_T MagManFoilwitherror_o1; /* '<Root>/MagMan Foil with error' */
85 real_T MagManFoilwitherror_o2; /* '<Root>/MagMan Foil with error' */
86 real_T MagManFoilwitherror_o3; /* '<Root>/MagMan Foil with error' */
87 real_T Saturate[2]; /* '<S5>/Saturate' */
88 real_T MagManlinearization_o1[16]; /* '<S7>/MagMan linearization' */
89 real_T MagManlinearization_o2; /* '<S7>/MagMan linearization' */
90 real_T Switch1[16]; /* '<Root>/Switch1' */
91 real_T pw[16]; /* '<Root>/pwm' */
92 real_T Ao[32]; /* '<S7>/Embedded MATLAB Function' */
93 real_T y[16];
94 real_T i[16]; /* '<Root>/proud' */
95 real_T y_m[4];
96 real_T X; /* '<Root>/ht1' */
97 real_T Y; /* '<Root>/ht1' */
98 real_T lim; /* '<Root>/proud' */
99 int32_T MagManFoilwitherror_o4; /* '<Root>/MagMan Foil with error' */
100} B_FoilControlRaspberrySentine_T;
101
102/* Block states (auto storage) for system '<Root>' */
103typedef struct {
104 real_T MagManFoilwitherror_DSTATE; /* '<Root>/MagMan Foil with error' */
105 real_T Integrator_DSTATE[2]; /* '<S5>/Integrator' */
106 real_T Filter_DSTATE[2]; /* '<S5>/Filter' */
107 real_T MagManCoils_DSTATE; /* '<Root>/MagMan Coils' */
108 struct {
109 void *LoggedData[3];
110 } Scope1_PWORK; /* '<Root>/Scope1' */
111
112 struct {
113 void *LoggedData[2];
114 } Scope2_PWORK; /* '<Root>/Scope2' */
115
116 struct {
117 void *LoggedData[2];
118 } Scope3_PWORK; /* '<Root>/Scope3' */
119
120 void *DigitalWrite_PWORK; /* '<S4>/Digital Write' */
121 codertarget_linux_blocks_Digi_T obj; /* '<S4>/Digital Write' */
122 uint8_T Output_DSTATE; /* '<S3>/Output' */
123 boolean_T objisempty; /* '<S4>/Digital Write' */
124} DW_FoilControlRaspberrySentin_T;
125
126/* Parameters (auto storage) */
127struct P_FoilControlRaspberrySentine_T_ {
128 real_T km4pi[9]; /* Variable: km4pi
129 * Referenced by: '<Root>/Sentinel Calibration matrix'
130 */
131 real_T PIDController2DOF1_D; /* Mask Parameter: PIDController2DOF1_D
132 * Referenced by: '<S5>/Derivative Gain'
133 */
134 real_T PIDController2DOF1_I; /* Mask Parameter: PIDController2DOF1_I
135 * Referenced by: '<S5>/Integral Gain'
136 */
137 real_T PIDController2DOF1_Kb; /* Mask Parameter: PIDController2DOF1_Kb
138 * Referenced by: '<S5>/Kb'
139 */
140 real_T PIDController2DOF1_LowerSaturat;/* Mask Parameter: PIDController2DOF1_LowerSaturat
141 * Referenced by: '<S5>/Saturate'
142 */
143 real_T PIDController2DOF1_N; /* Mask Parameter: PIDController2DOF1_N
144 * Referenced by: '<S5>/Filter Coefficient'
145 */
146 real_T PIDController2DOF1_P; /* Mask Parameter: PIDController2DOF1_P
147 * Referenced by: '<S5>/Proportional Gain'
148 */
149 real_T PIDController2DOF1_UpperSaturat;/* Mask Parameter: PIDController2DOF1_UpperSaturat
150 * Referenced by: '<S5>/Saturate'
151 */
152 real_T PIDController2DOF1_b; /* Mask Parameter: PIDController2DOF1_b
153 * Referenced by: '<S5>/Setpoint Weighting (Proportional)'
154 */
155 real_T PIDController2DOF1_c; /* Mask Parameter: PIDController2DOF1_c
156 * Referenced by: '<S5>/Setpoint Weighting (Derivative)'
157 */
158 uint8_T CounterLimited_uplimit; /* Mask Parameter: CounterLimited_uplimit
159 * Referenced by: '<S11>/FixPt Switch'
160 */
161 real_T Constant2_Value[16]; /* Expression: [0,0,0,0;0,0,0,0;0,0,0,0;0,0,0,0]
162 * Referenced by: '<Root>/Constant2'
163 */
164 real_T Constant_Value; /* Expression: 2.5
165 * Referenced by: '<Root>/Constant'
166 */
167 real_T Constant1_Value; /* Expression: 2.5
168 * Referenced by: '<Root>/Constant1'
169 */
170 real_T Integrator_gainval; /* Computed Parameter: Integrator_gainval
171 * Referenced by: '<S5>/Integrator'
172 */
173 real_T Integrator_IC; /* Expression: InitialConditionForIntegrator
174 * Referenced by: '<S5>/Integrator'
175 */
176 real_T Filter_gainval; /* Computed Parameter: Filter_gainval
177 * Referenced by: '<S5>/Filter'
178 */
179 real_T Filter_IC; /* Expression: InitialConditionForFilter
180 * Referenced by: '<S5>/Filter'
181 */
182 real_T Constant_Value_a; /* Expression: 0
183 * Referenced by: '<S2>/Constant'
184 */
185 uint8_T Constant_Value_h; /* Computed Parameter: Constant_Value_h
186 * Referenced by: '<S11>/Constant'
187 */
188 uint8_T Output_InitialCondition; /* Computed Parameter: Output_InitialCondition
189 * Referenced by: '<S3>/Output'
190 */
191 uint8_T Constant_Value_p; /* Computed Parameter: Constant_Value_p
192 * Referenced by: '<S1>/Constant'
193 */
194 uint8_T FixPtConstant_Value; /* Computed Parameter: FixPtConstant_Value
195 * Referenced by: '<S10>/FixPt Constant'
196 */
197};
198
199/* Real-time Model Data Structure */
200struct tag_RTM_FoilControlRaspberryS_T {
201 const char_T *errorStatus;
202 RTWExtModeInfo *extModeInfo;
203
204 /*
205 * Sizes:
206 * The following substructure contains sizes information
207 * for many of the model attributes such as inputs, outputs,
208 * dwork, sample times, etc.
209 */
210 struct {
211 uint32_T checksums[4];
212 } Sizes;
213
214 /*
215 * SpecialInfo:
216 * The following substructure contains special information
217 * related to other components that are dependent on RTW.
218 */
219 struct {
220 const void *mappingInfo;
221 } SpecialInfo;
222
223 /*
224 * Timing:
225 * The following substructure contains information regarding
226 * the timing information for the model.
227 */
228 struct {
229 time_T taskTime0;
230 uint32_T clockTick0;
231 uint32_T clockTickH0;
232 time_T stepSize0;
233 time_T tFinal;
234 boolean_T stopRequestedFlag;
235 } Timing;
236};
237
238/* Block parameters (auto storage) */
239extern P_FoilControlRaspberrySentine_T FoilControlRaspberrySentinel_P;
240
241/* Block signals (auto storage) */
242extern B_FoilControlRaspberrySentine_T FoilControlRaspberrySentinel_B;
243
244/* Block states (auto storage) */
245extern DW_FoilControlRaspberrySentin_T FoilControlRaspberrySentinel_DW;
246
247/* Model entry point functions */
248extern void FoilControlRaspberrySentinel_initialize(void);
249extern void FoilControlRaspberrySentinel_step(void);
250extern void FoilControlRaspberrySentinel_terminate(void);
251
252/* Real-time Model object */
253extern RT_MODEL_FoilControlRaspberry_T *const FoilControlRaspberrySentinel_M;
254
255/*-
256 * These blocks were eliminated from the model due to optimizations:
257 *
258 * Block '<S3>/Data Type Propagation' : Unused code path elimination
259 * Block '<S10>/FixPt Data Type Duplicate' : Unused code path elimination
260 * Block '<S11>/FixPt Data Type Duplicate1' : Unused code path elimination
261 */
262
263/*-
264 * The generated code includes comments that allow you to trace directly
265 * back to the appropriate location in the model. The basic format
266 * is <system>/block_name, where system is the system number (uniquely
267 * assigned by Simulink) and block_name is the name of the block.
268 *
269 * Use the MATLAB hilite_system command to trace the generated code back
270 * to the model. For example,
271 *
272 * hilite_system('<S3>') - opens system 3
273 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
274 *
275 * Here is the system hierarchy for this model
276 *
277 * '<Root>' : 'FoilControlRaspberrySentinel'
278 * '<S1>' : 'FoilControlRaspberrySentinel/Compare To Zero'
279 * '<S2>' : 'FoilControlRaspberrySentinel/Compare To Zero1'
280 * '<S3>' : 'FoilControlRaspberrySentinel/Counter Limited'
281 * '<S4>' : 'FoilControlRaspberrySentinel/GPIO Write'
282 * '<S5>' : 'FoilControlRaspberrySentinel/PID Controller (2DOF)1'
283 * '<S6>' : 'FoilControlRaspberrySentinel/ht1'
284 * '<S7>' : 'FoilControlRaspberrySentinel/linearization'
285 * '<S8>' : 'FoilControlRaspberrySentinel/proud'
286 * '<S9>' : 'FoilControlRaspberrySentinel/pwm'
287 * '<S10>' : 'FoilControlRaspberrySentinel/Counter Limited/Increment Real World'
288 * '<S11>' : 'FoilControlRaspberrySentinel/Counter Limited/Wrap To Zero'
289 * '<S12>' : 'FoilControlRaspberrySentinel/linearization/Embedded MATLAB Function'
290 */
291#endif /* RTW_HEADER_FoilControlRaspberrySentinel_h_ */
292