1 | /* |
2 | * RaspberryForceTest.c |
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 "RaspberryForceTest". |
8 | * |
9 | * Model version : 1.4 |
10 | * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 |
11 | * C source code generated on : Tue Dec 20 10:51: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 | #include "RaspberryForceTest.h" |
21 | #include "RaspberryForceTest_private.h" |
22 | #include "RaspberryForceTest_dt.h" |
23 | |
24 | /* Block signals (auto storage) */ |
25 | B_RaspberryForceTest_T RaspberryForceTest_B; |
26 | |
27 | /* Block states (auto storage) */ |
28 | DW_RaspberryForceTest_T RaspberryForceTest_DW; |
29 | |
30 | /* Real-time model */ |
31 | RT_MODEL_RaspberryForceTest_T RaspberryForceTest_M_; |
32 | RT_MODEL_RaspberryForceTest_T *const RaspberryForceTest_M = |
33 | &RaspberryForceTest_M_; |
34 | real_T rt_powd_snf(real_T u0, real_T u1) |
35 | { |
36 | real_T y; |
37 | real_T tmp; |
38 | real_T tmp_0; |
39 | if (rtIsNaN(u0) || rtIsNaN(u1)) { |
40 | y = (rtNaN); |
41 | } else { |
42 | tmp = fabs(u0); |
43 | tmp_0 = fabs(u1); |
44 | if (rtIsInf(u1)) { |
45 | if (tmp == 1.0) { |
46 | y = (rtNaN); |
47 | } else if (tmp > 1.0) { |
48 | if (u1 > 0.0) { |
49 | y = (rtInf); |
50 | } else { |
51 | y = 0.0; |
52 | } |
53 | } else if (u1 > 0.0) { |
54 | y = 0.0; |
55 | } else { |
56 | y = (rtInf); |
57 | } |
58 | } else if (tmp_0 == 0.0) { |
59 | y = 1.0; |
60 | } else if (tmp_0 == 1.0) { |
61 | if (u1 > 0.0) { |
62 | y = u0; |
63 | } else { |
64 | y = 1.0 / u0; |
65 | } |
66 | } else if (u1 == 2.0) { |
67 | y = u0 * u0; |
68 | } else if ((u1 == 0.5) && (u0 >= 0.0)) { |
69 | y = sqrt(u0); |
70 | } else if ((u0 < 0.0) && (u1 > floor(u1))) { |
71 | y = (rtNaN); |
72 | } else { |
73 | y = pow(u0, u1); |
74 | } |
75 | } |
76 | |
77 | return y; |
78 | } |
79 | |
80 | /* Model step function */ |
81 | void RaspberryForceTest_step(void) |
82 | { |
83 | int32_T iy; |
84 | real_T vy; |
85 | int32_T cnt2; |
86 | real_T d_a; |
87 | real_T out_idx_1; |
88 | real_T rtb_F_idx_0; |
89 | real_T rtb_F_idx_1; |
90 | |
91 | /* Constant: '<Root>/Constant' */ |
92 | RaspberryForceTest_B.Constant[0] = RaspberryForceTest_P.Constant_Value[0]; |
93 | RaspberryForceTest_B.Constant[1] = RaspberryForceTest_P.Constant_Value[1]; |
94 | |
95 | /* S-Function (sfcn_getFoilCheck): '<S1>/MagMan Foil with error' */ |
96 | sfcn_getFoilCheck_Outputs_wrapper |
97 | ( &RaspberryForceTest_B.MagManFoilwitherror_o1, |
98 | &RaspberryForceTest_B.MagManFoilwitherror_o2, |
99 | &RaspberryForceTest_B.MagManFoilwitherror_o3, |
100 | &RaspberryForceTest_B.MagManFoilwitherror_o4, |
101 | &RaspberryForceTest_DW.MagManFoilwitherror_DSTATE); |
102 | |
103 | /* MATLAB Function: '<S1>/Position transformation' incorporates: |
104 | * Constant: '<S1>/Sentinel Calibration matrix' |
105 | */ |
106 | /* MATLAB Function 'Foil position /Position transformation': '<S8>:1' */ |
107 | /* out=km2*[x;y;x^2;y^2;x*y;1]; */ |
108 | /* '<S8>:1:4' xa = [x,y]; */ |
109 | /* '<S8>:1:5' H = km4(:); */ |
110 | /* '<S8>:1:6' xa = [xa,ones(size(xa,1),1)]; */ |
111 | /* homogeneous coordinates */ |
112 | /* '<S8>:1:7' out = [ (xa*H(1:3))./(xa*H(7:9)), (xa*H(4:6))./(xa*H(7:9)) ]; */ |
113 | /* '<S8>:1:9' X=out(1); */ |
114 | RaspberryForceTest_B.X = ((RaspberryForceTest_B.MagManFoilwitherror_o1 * |
115 | RaspberryForceTest_P.km4pi[0] + RaspberryForceTest_B.MagManFoilwitherror_o2 * |
116 | RaspberryForceTest_P.km4pi[1]) + RaspberryForceTest_P.km4pi[2]) / |
117 | ((RaspberryForceTest_B.MagManFoilwitherror_o1 * RaspberryForceTest_P.km4pi[6] |
118 | + RaspberryForceTest_B.MagManFoilwitherror_o2 * |
119 | RaspberryForceTest_P.km4pi[7]) + RaspberryForceTest_P.km4pi[8]); |
120 | |
121 | /* '<S8>:1:10' Y=out(2); */ |
122 | RaspberryForceTest_B.Y = ((RaspberryForceTest_B.MagManFoilwitherror_o1 * |
123 | RaspberryForceTest_P.km4pi[3] + RaspberryForceTest_B.MagManFoilwitherror_o2 * |
124 | RaspberryForceTest_P.km4pi[4]) + RaspberryForceTest_P.km4pi[5]) / |
125 | ((RaspberryForceTest_B.MagManFoilwitherror_o1 * RaspberryForceTest_P.km4pi[6] |
126 | + RaspberryForceTest_B.MagManFoilwitherror_o2 * |
127 | RaspberryForceTest_P.km4pi[7]) + RaspberryForceTest_P.km4pi[8]); |
128 | |
129 | /* MATLAB Function: '<S6>/Embedded MATLAB Function' */ |
130 | /* MATLAB Function 'linearization/Embedded MATLAB Function': '<S9>:1' */ |
131 | /* '<S9>:1:2' Ao=zeros(2,16); */ |
132 | memset(&RaspberryForceTest_B.Ao[0], 0, sizeof(real_T) << 5U); |
133 | |
134 | /* '<S9>:1:4' for iy=1:4 */ |
135 | for (iy = 0; iy < 4; iy++) { |
136 | /* '<S9>:1:5' for ix=1:4 */ |
137 | for (cnt2 = 0; cnt2 < 4; cnt2++) { |
138 | /* '<S9>:1:6' [cFx, cFy] = fForce(x, y, ix, iy); */ |
139 | /* '<S9>:1:14' d=dist(x,y, ix, iy); */ |
140 | /* '<S9>:1:28' d=sqrt((x-ix).^2+(y-iy).^2); */ |
141 | RaspberryForceTest_B.d = RaspberryForceTest_B.X - (1.0 + (real_T)cnt2); |
142 | out_idx_1 = RaspberryForceTest_B.Y - (1.0 + (real_T)iy); |
143 | RaspberryForceTest_B.d = sqrt(RaspberryForceTest_B.d * |
144 | RaspberryForceTest_B.d + out_idx_1 * out_idx_1); |
145 | |
146 | /* '<S9>:1:15' if d~=0 */ |
147 | if (RaspberryForceTest_B.d != 0.0) { |
148 | /* '<S9>:1:16' F=gForce(d); */ |
149 | /* '<S9>:1:43' a = 622.06; */ |
150 | /* '<S9>:1:44' b = 9.5032; */ |
151 | /* '<S9>:1:45' c = 3.1884; */ |
152 | /* '<S9>:1:46' F = x.*a./(b.*x.^2+ c).^3; */ |
153 | RaspberryForceTest_B.d = RaspberryForceTest_B.d * 622.06 / rt_powd_snf |
154 | (RaspberryForceTest_B.d * RaspberryForceTest_B.d * 9.5032 + 3.1884, |
155 | 3.0); |
156 | |
157 | /* '<S9>:1:17' Fv=F*vector(x,y,ix,iy); */ |
158 | /* '<S9>:1:32' vx=ix-x; */ |
159 | out_idx_1 = (1.0 + (real_T)cnt2) - RaspberryForceTest_B.X; |
160 | |
161 | /* '<S9>:1:33' vy=iy-y; */ |
162 | vy = (1.0 + (real_T)iy) - RaspberryForceTest_B.Y; |
163 | |
164 | /* '<S9>:1:35' if(vx==0 && vy ==0) */ |
165 | if ((out_idx_1 == 0.0) && (vy == 0.0)) { |
166 | /* '<S9>:1:36' v=[0 0]; */ |
167 | rtb_F_idx_0 = 0.0; |
168 | out_idx_1 = 0.0; |
169 | } else { |
170 | /* '<S9>:1:37' else */ |
171 | /* '<S9>:1:38' v = [vx vy]/dist(vx, vy, 0 ,0); */ |
172 | /* '<S9>:1:28' d=sqrt((x-ix).^2+(y-iy).^2); */ |
173 | d_a = sqrt(out_idx_1 * out_idx_1 + vy * vy); |
174 | rtb_F_idx_0 = out_idx_1 / d_a; |
175 | out_idx_1 = vy / d_a; |
176 | } |
177 | |
178 | rtb_F_idx_0 *= RaspberryForceTest_B.d; |
179 | out_idx_1 *= RaspberryForceTest_B.d; |
180 | |
181 | /* '<S9>:1:18' Fx=Fv(1); */ |
182 | RaspberryForceTest_B.d = rtb_F_idx_0; |
183 | |
184 | /* '<S9>:1:19' Fy=Fv(2); */ |
185 | } else { |
186 | /* '<S9>:1:20' else */ |
187 | /* '<S9>:1:21' Fx=0; */ |
188 | RaspberryForceTest_B.d = 0.0; |
189 | |
190 | /* '<S9>:1:22' Fy=0; */ |
191 | out_idx_1 = 0.0; |
192 | } |
193 | |
194 | /* '<S9>:1:7' Ao(1,(iy-1)*4+ix) = cFx; */ |
195 | RaspberryForceTest_B.Ao[((iy << 2) + cnt2) << 1] = RaspberryForceTest_B.d; |
196 | |
197 | /* '<S9>:1:8' Ao(2,(iy-1)*4+ix) = cFy; */ |
198 | RaspberryForceTest_B.Ao[1 + (((iy << 2) + cnt2) << 1)] = out_idx_1; |
199 | } |
200 | } |
201 | |
202 | /* End of MATLAB Function: '<S6>/Embedded MATLAB Function' */ |
203 | |
204 | /* S-Function (cvxfasd): '<S6>/MagMan linearization' */ |
205 | cvxfasd_Outputs_wrapper(&RaspberryForceTest_B.Ao[0], |
206 | &RaspberryForceTest_B.Constant[0], &RaspberryForceTest_B.Constant[1], |
207 | &RaspberryForceTest_B.MagManlinearization_o1[0], |
208 | &RaspberryForceTest_B.MagManlinearization_o2 ); |
209 | |
210 | /* MATLAB Function: '<Root>/MATLAB Function' */ |
211 | /* MATLAB Function 'MATLAB Function': '<S2>:1' */ |
212 | /* '<S2>:1:3' y =u'; */ |
213 | for (iy = 0; iy < 4; iy++) { |
214 | RaspberryForceTest_B.y[iy << 2] = |
215 | RaspberryForceTest_B.MagManlinearization_o1[iy]; |
216 | RaspberryForceTest_B.y[1 + (iy << 2)] = |
217 | RaspberryForceTest_B.MagManlinearization_o1[iy + 4]; |
218 | RaspberryForceTest_B.y[2 + (iy << 2)] = |
219 | RaspberryForceTest_B.MagManlinearization_o1[iy + 8]; |
220 | RaspberryForceTest_B.y[3 + (iy << 2)] = |
221 | RaspberryForceTest_B.MagManlinearization_o1[iy + 12]; |
222 | } |
223 | |
224 | /* End of MATLAB Function: '<Root>/MATLAB Function' */ |
225 | |
226 | /* MATLAB Function: '<Root>/Nonlinearity of magnetic force' incorporates: |
227 | * SignalConversion: '<S3>/TmpSignal ConversionAt SFunction Inport2' |
228 | */ |
229 | /* MATLAB Function 'Nonlinearity of magnetic force': '<S3>:1' */ |
230 | /* function F = fcn(u,xmes) */ |
231 | /* Computes vector of magnetic force exerted on the ball in x- and */ |
232 | /* y-direction. Input arguments are excitation factors of coils and measured */ |
233 | /* position of the ball. Contributions of the coils are superposed to get */ |
234 | /* the overall force. */ |
235 | /* Note, that this function only models nonlinearity of the magnetic force, */ |
236 | /* it is not any kind of feedback control. */ |
237 | /* '<S3>:1:10' umin = 1; */ |
238 | /* index of the 1st actuator in one dim */ |
239 | /* '<S3>:1:11' umax = 4; */ |
240 | /* index of tohe last actuator in one dim */ |
241 | /* '<S3>:1:13' F = [0;0]; */ |
242 | rtb_F_idx_0 = 0.0; |
243 | rtb_F_idx_1 = 0.0; |
244 | |
245 | /* '<S3>:1:15' u = abs(u); */ |
246 | for (iy = 0; iy < 16; iy++) { |
247 | RaspberryForceTest_B.u[iy] = fabs(RaspberryForceTest_B.y[iy]); |
248 | } |
249 | |
250 | /* '<S3>:1:16' for cnt = umin:umax */ |
251 | for (iy = 0; iy < 4; iy++) { |
252 | /* '<S3>:1:17' for cnt2 = umin:umax */ |
253 | for (cnt2 = 0; cnt2 < 4; cnt2++) { |
254 | /* '<S3>:1:18' F = F + [dxfce(cnt,cnt2,xmes(1),xmes(2));... */ |
255 | /* '<S3>:1:19' dyfce(cnt,cnt2,xmes(1),xmes(2))] * u(cnt2-umin+1,cnt-umin+1); */ |
256 | /* Compute x-component of force from coil [m,n] exerted on the ball at */ |
257 | /* position [x,y] */ |
258 | /* '<S3>:1:27' out = -48.282*(x-m)./( (x-m).^2 + (y-n).^2 + 0.3303).^3; */ |
259 | RaspberryForceTest_B.d = RaspberryForceTest_B.X - (1.0 + (real_T)iy); |
260 | out_idx_1 = RaspberryForceTest_B.Y - (1.0 + (real_T)cnt2); |
261 | |
262 | /* Compute y-component of force from coil [m,n] exerted on the ball at */ |
263 | /* position [x,y] */ |
264 | /* '<S3>:1:33' out = -48.282*(y-n)./( (x-m).^2 + (y-n).^2 + 0.3303).^3; */ |
265 | vy = RaspberryForceTest_B.X - (1.0 + (real_T)iy); |
266 | d_a = RaspberryForceTest_B.Y - (1.0 + (real_T)cnt2); |
267 | rtb_F_idx_0 += (RaspberryForceTest_B.X - (1.0 + (real_T)iy)) * -48.282 / |
268 | rt_powd_snf((RaspberryForceTest_B.d * RaspberryForceTest_B.d + out_idx_1 |
269 | * out_idx_1) + 0.3303, 3.0) * RaspberryForceTest_B.u[(iy << |
270 | 2) + cnt2]; |
271 | rtb_F_idx_1 += (RaspberryForceTest_B.Y - (1.0 + (real_T)cnt2)) * -48.282 / |
272 | rt_powd_snf((vy * vy + d_a * d_a) + 0.3303, 3.0) * |
273 | RaspberryForceTest_B.u[(iy << 2) + cnt2]; |
274 | } |
275 | } |
276 | |
277 | /* End of MATLAB Function: '<Root>/Nonlinearity of magnetic force' */ |
278 | |
279 | /* Gain: '<Root>/Gain' */ |
280 | RaspberryForceTest_B.Gain[0] = RaspberryForceTest_P.Gain_Gain * rtb_F_idx_0; |
281 | RaspberryForceTest_B.Gain[1] = RaspberryForceTest_P.Gain_Gain * rtb_F_idx_1; |
282 | |
283 | /* MATLAB Function: '<Root>/pwm' */ |
284 | /* MATLAB Function 'pwm': '<S7>:1' */ |
285 | /* conversion from scaling factor to duty cycle of PWM */ |
286 | /* '<S7>:1:3' x = max(0, min(1,x) ); */ |
287 | /* limits */ |
288 | /* '<S7>:1:4' i = 0.18515*x + 0.069587*x.^3 + 0.19285*x.^(1/3); */ |
289 | /* ratio to current conversion */ |
290 | /* '<S7>:1:5' pw = i/0.455/2; */ |
291 | /* '<S7>:1:6' pw(pw>0.05) = pw(pw>0.05) + 0.5; */ |
292 | /* '<S7>:1:7' pw(pw<0.5) = 0; */ |
293 | for (iy = 0; iy < 16; iy++) { |
294 | if ((1.0 <= RaspberryForceTest_B.MagManlinearization_o1[iy]) || rtIsNaN |
295 | (RaspberryForceTest_B.MagManlinearization_o1[iy])) { |
296 | RaspberryForceTest_B.d = 1.0; |
297 | } else { |
298 | RaspberryForceTest_B.d = RaspberryForceTest_B.MagManlinearization_o1[iy]; |
299 | } |
300 | |
301 | if ((0.0 >= RaspberryForceTest_B.d) || rtIsNaN(RaspberryForceTest_B.d)) { |
302 | RaspberryForceTest_B.pw[iy] = 0.0; |
303 | } else { |
304 | RaspberryForceTest_B.pw[iy] = RaspberryForceTest_B.d; |
305 | } |
306 | |
307 | RaspberryForceTest_B.pw[iy] = ((0.18515 * RaspberryForceTest_B.pw[iy] + |
308 | 0.069587 * rt_powd_snf(RaspberryForceTest_B.pw[iy], 3.0)) + 0.19285 * |
309 | rt_powd_snf(RaspberryForceTest_B.pw[iy], 0.33333333333333331)) / 0.455 / |
310 | 2.0; |
311 | if (RaspberryForceTest_B.pw[iy] > 0.05) { |
312 | RaspberryForceTest_B.pw[iy] += 0.5; |
313 | } |
314 | |
315 | if (RaspberryForceTest_B.pw[iy] < 0.5) { |
316 | RaspberryForceTest_B.pw[iy] = 0.0; |
317 | } |
318 | } |
319 | |
320 | /* '<S7>:1:8' pw=pw'; */ |
321 | for (iy = 0; iy < 4; iy++) { |
322 | RaspberryForceTest_B.y[iy << 2] = RaspberryForceTest_B.pw[iy]; |
323 | RaspberryForceTest_B.y[1 + (iy << 2)] = RaspberryForceTest_B.pw[iy + 4]; |
324 | RaspberryForceTest_B.y[2 + (iy << 2)] = RaspberryForceTest_B.pw[iy + 8]; |
325 | RaspberryForceTest_B.y[3 + (iy << 2)] = RaspberryForceTest_B.pw[iy + 12]; |
326 | } |
327 | |
328 | for (iy = 0; iy < 4; iy++) { |
329 | RaspberryForceTest_B.pw[iy << 2] = RaspberryForceTest_B.y[iy << 2]; |
330 | RaspberryForceTest_B.pw[1 + (iy << 2)] = RaspberryForceTest_B.y[(iy << 2) + |
331 | 1]; |
332 | RaspberryForceTest_B.pw[2 + (iy << 2)] = RaspberryForceTest_B.y[(iy << 2) + |
333 | 2]; |
334 | RaspberryForceTest_B.pw[3 + (iy << 2)] = RaspberryForceTest_B.y[(iy << 2) + |
335 | 3]; |
336 | } |
337 | |
338 | /* End of MATLAB Function: '<Root>/pwm' */ |
339 | |
340 | /* S-Function (sfcn_setPlatform): '<Root>/MagMan Coils' */ |
341 | sfcn_setPlatform_Outputs_wrapper(&RaspberryForceTest_B.pw[0], |
342 | &RaspberryForceTest_DW.MagManCoils_DSTATE); |
343 | |
344 | /* S-Function "sfcn_getFoilCheck_wrapper" Block: <S1>/MagMan Foil with error */ |
345 | sfcn_getFoilCheck_Update_wrapper( &RaspberryForceTest_B.MagManFoilwitherror_o1, |
346 | &RaspberryForceTest_B.MagManFoilwitherror_o2, |
347 | &RaspberryForceTest_B.MagManFoilwitherror_o3, |
348 | &RaspberryForceTest_B.MagManFoilwitherror_o4, |
349 | &RaspberryForceTest_DW.MagManFoilwitherror_DSTATE); |
350 | |
351 | /* S-Function "sfcn_setPlatform_wrapper" Block: <Root>/MagMan Coils */ |
352 | sfcn_setPlatform_Update_wrapper(&RaspberryForceTest_B.pw[0], |
353 | &RaspberryForceTest_DW.MagManCoils_DSTATE); |
354 | |
355 | /* External mode */ |
356 | rtExtModeUploadCheckTrigger(1); |
357 | |
358 | { /* Sample time: [0.02s, 0.0s] */ |
359 | rtExtModeUpload(0, RaspberryForceTest_M->Timing.taskTime0); |
360 | } |
361 | |
362 | /* signal main to stop simulation */ |
363 | { /* Sample time: [0.02s, 0.0s] */ |
364 | if ((rtmGetTFinal(RaspberryForceTest_M)!=-1) && |
365 | !((rtmGetTFinal(RaspberryForceTest_M)- |
366 | RaspberryForceTest_M->Timing.taskTime0) > |
367 | RaspberryForceTest_M->Timing.taskTime0 * (DBL_EPSILON))) { |
368 | rtmSetErrorStatus(RaspberryForceTest_M, "Simulation finished"); |
369 | } |
370 | |
371 | if (rtmGetStopRequested(RaspberryForceTest_M)) { |
372 | rtmSetErrorStatus(RaspberryForceTest_M, "Simulation finished"); |
373 | } |
374 | } |
375 | |
376 | /* Update absolute time for base rate */ |
377 | /* The "clockTick0" counts the number of times the code of this task has |
378 | * been executed. The absolute time is the multiplication of "clockTick0" |
379 | * and "Timing.stepSize0". Size of "clockTick0" ensures timer will not |
380 | * overflow during the application lifespan selected. |
381 | * Timer of this task consists of two 32 bit unsigned integers. |
382 | * The two integers represent the low bits Timing.clockTick0 and the high bits |
383 | * Timing.clockTickH0. When the low bit overflows to 0, the high bits increment. |
384 | */ |
385 | if (!(++RaspberryForceTest_M->Timing.clockTick0)) { |
386 | ++RaspberryForceTest_M->Timing.clockTickH0; |
387 | } |
388 | |
389 | RaspberryForceTest_M->Timing.taskTime0 = |
390 | RaspberryForceTest_M->Timing.clockTick0 * |
391 | RaspberryForceTest_M->Timing.stepSize0 + |
392 | RaspberryForceTest_M->Timing.clockTickH0 * |
393 | RaspberryForceTest_M->Timing.stepSize0 * 4294967296.0; |
394 | } |
395 | |
396 | /* Model initialize function */ |
397 | void RaspberryForceTest_initialize(void) |
398 | { |
399 | /* Registration code */ |
400 | |
401 | /* initialize non-finites */ |
402 | rt_InitInfAndNaN(sizeof(real_T)); |
403 | |
404 | /* initialize real-time model */ |
405 | (void) memset((void *)RaspberryForceTest_M, 0, |
406 | sizeof(RT_MODEL_RaspberryForceTest_T)); |
407 | rtmSetTFinal(RaspberryForceTest_M, -1); |
408 | RaspberryForceTest_M->Timing.stepSize0 = 0.02; |
409 | |
410 | /* External mode info */ |
411 | RaspberryForceTest_M->Sizes.checksums[0] = (2020466224U); |
412 | RaspberryForceTest_M->Sizes.checksums[1] = (796819949U); |
413 | RaspberryForceTest_M->Sizes.checksums[2] = (1719685129U); |
414 | RaspberryForceTest_M->Sizes.checksums[3] = (2706746111U); |
415 | |
416 | { |
417 | static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE; |
418 | static RTWExtModeInfo rt_ExtModeInfo; |
419 | static const sysRanDType *systemRan[8]; |
420 | RaspberryForceTest_M->extModeInfo = (&rt_ExtModeInfo); |
421 | rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan); |
422 | systemRan[0] = &rtAlwaysEnabled; |
423 | systemRan[1] = &rtAlwaysEnabled; |
424 | systemRan[2] = &rtAlwaysEnabled; |
425 | systemRan[3] = &rtAlwaysEnabled; |
426 | systemRan[4] = &rtAlwaysEnabled; |
427 | systemRan[5] = &rtAlwaysEnabled; |
428 | systemRan[6] = &rtAlwaysEnabled; |
429 | systemRan[7] = &rtAlwaysEnabled; |
430 | rteiSetModelMappingInfoPtr(RaspberryForceTest_M->extModeInfo, |
431 | &RaspberryForceTest_M->SpecialInfo.mappingInfo); |
432 | rteiSetChecksumsPtr(RaspberryForceTest_M->extModeInfo, |
433 | RaspberryForceTest_M->Sizes.checksums); |
434 | rteiSetTPtr(RaspberryForceTest_M->extModeInfo, rtmGetTPtr |
435 | (RaspberryForceTest_M)); |
436 | } |
437 | |
438 | /* block I/O */ |
439 | (void) memset(((void *) &RaspberryForceTest_B), 0, |
440 | sizeof(B_RaspberryForceTest_T)); |
441 | |
442 | /* states (dwork) */ |
443 | (void) memset((void *)&RaspberryForceTest_DW, 0, |
444 | sizeof(DW_RaspberryForceTest_T)); |
445 | |
446 | /* data type transition information */ |
447 | { |
448 | static DataTypeTransInfo dtInfo; |
449 | (void) memset((char_T *) &dtInfo, 0, |
450 | sizeof(dtInfo)); |
451 | RaspberryForceTest_M->SpecialInfo.mappingInfo = (&dtInfo); |
452 | dtInfo.numDataTypes = 14; |
453 | dtInfo.dataTypeSizes = &rtDataTypeSizes[0]; |
454 | dtInfo.dataTypeNames = &rtDataTypeNames[0]; |
455 | |
456 | /* Block I/O transition table */ |
457 | dtInfo.BTransTable = &rtBTransTable; |
458 | |
459 | /* Parameters transition table */ |
460 | dtInfo.PTransTable = &rtPTransTable; |
461 | } |
462 | |
463 | /* Start for Constant: '<Root>/Constant' */ |
464 | RaspberryForceTest_B.Constant[0] = RaspberryForceTest_P.Constant_Value[0]; |
465 | RaspberryForceTest_B.Constant[1] = RaspberryForceTest_P.Constant_Value[1]; |
466 | |
467 | /* S-Function Block: <S1>/MagMan Foil with error */ |
468 | { |
469 | real_T initVector[1] = { 0 }; |
470 | |
471 | { |
472 | int_T i1; |
473 | for (i1=0; i1 < 1; i1++) { |
474 | RaspberryForceTest_DW.MagManFoilwitherror_DSTATE = initVector[0]; |
475 | } |
476 | } |
477 | } |
478 | |
479 | /* S-Function Block: <Root>/MagMan Coils */ |
480 | { |
481 | real_T initVector[1] = { 0 }; |
482 | |
483 | { |
484 | int_T i1; |
485 | for (i1=0; i1 < 1; i1++) { |
486 | RaspberryForceTest_DW.MagManCoils_DSTATE = initVector[0]; |
487 | } |
488 | } |
489 | } |
490 | } |
491 | |
492 | /* Model terminate function */ |
493 | void RaspberryForceTest_terminate(void) |
494 | { |
495 | /* (no terminate code required) */ |
496 | } |
497 | |