1 | /* |
2 | * testFoil.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 "testFoil". |
8 | * |
9 | * Model version : 1.3 |
10 | * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 |
11 | * C source code generated on : Wed Nov 23 16:13:03 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 "testFoil.h" |
21 | #include "testFoil_private.h" |
22 | #include "testFoil_dt.h" |
23 | |
24 | /* Block signals (auto storage) */ |
25 | B_testFoil_T testFoil_B; |
26 | |
27 | /* Block states (auto storage) */ |
28 | DW_testFoil_T testFoil_DW; |
29 | |
30 | /* Real-time model */ |
31 | RT_MODEL_testFoil_T testFoil_M_; |
32 | RT_MODEL_testFoil_T *const testFoil_M = &testFoil_M_; |
33 | |
34 | /* Model step function */ |
35 | void testFoil_step(void) |
36 | { |
37 | /* S-Function (sfcn_getFoil): '<Root>/MagMan Foil' */ |
38 | sfcn_getFoil_Outputs_wrapper( &testFoil_B.MagManFoil_o1, |
39 | &testFoil_B.MagManFoil_o2, &testFoil_B.MagManFoil_o3, |
40 | &testFoil_DW.MagManFoil_DSTATE); |
41 | |
42 | /* S-Function "sfcn_getFoil_wrapper" Block: <Root>/MagMan Foil */ |
43 | sfcn_getFoil_Update_wrapper( &testFoil_B.MagManFoil_o1, |
44 | &testFoil_B.MagManFoil_o2, &testFoil_B.MagManFoil_o3, |
45 | &testFoil_DW.MagManFoil_DSTATE); |
46 | |
47 | /* External mode */ |
48 | rtExtModeUploadCheckTrigger(1); |
49 | |
50 | { /* Sample time: [0.01s, 0.0s] */ |
51 | rtExtModeUpload(0, testFoil_M->Timing.taskTime0); |
52 | } |
53 | |
54 | /* signal main to stop simulation */ |
55 | { /* Sample time: [0.01s, 0.0s] */ |
56 | if ((rtmGetTFinal(testFoil_M)!=-1) && |
57 | !((rtmGetTFinal(testFoil_M)-testFoil_M->Timing.taskTime0) > |
58 | testFoil_M->Timing.taskTime0 * (DBL_EPSILON))) { |
59 | rtmSetErrorStatus(testFoil_M, "Simulation finished"); |
60 | } |
61 | |
62 | if (rtmGetStopRequested(testFoil_M)) { |
63 | rtmSetErrorStatus(testFoil_M, "Simulation finished"); |
64 | } |
65 | } |
66 | |
67 | /* Update absolute time for base rate */ |
68 | /* The "clockTick0" counts the number of times the code of this task has |
69 | * been executed. The absolute time is the multiplication of "clockTick0" |
70 | * and "Timing.stepSize0". Size of "clockTick0" ensures timer will not |
71 | * overflow during the application lifespan selected. |
72 | * Timer of this task consists of two 32 bit unsigned integers. |
73 | * The two integers represent the low bits Timing.clockTick0 and the high bits |
74 | * Timing.clockTickH0. When the low bit overflows to 0, the high bits increment. |
75 | */ |
76 | if (!(++testFoil_M->Timing.clockTick0)) { |
77 | ++testFoil_M->Timing.clockTickH0; |
78 | } |
79 | |
80 | testFoil_M->Timing.taskTime0 = testFoil_M->Timing.clockTick0 * |
81 | testFoil_M->Timing.stepSize0 + testFoil_M->Timing.clockTickH0 * |
82 | testFoil_M->Timing.stepSize0 * 4294967296.0; |
83 | } |
84 | |
85 | /* Model initialize function */ |
86 | void testFoil_initialize(void) |
87 | { |
88 | /* Registration code */ |
89 | |
90 | /* initialize real-time model */ |
91 | (void) memset((void *)testFoil_M, 0, |
92 | sizeof(RT_MODEL_testFoil_T)); |
93 | rtmSetTFinal(testFoil_M, -1); |
94 | testFoil_M->Timing.stepSize0 = 0.01; |
95 | |
96 | /* External mode info */ |
97 | testFoil_M->Sizes.checksums[0] = (3359952189U); |
98 | testFoil_M->Sizes.checksums[1] = (3587711270U); |
99 | testFoil_M->Sizes.checksums[2] = (3442953562U); |
100 | testFoil_M->Sizes.checksums[3] = (3986186363U); |
101 | |
102 | { |
103 | static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE; |
104 | static RTWExtModeInfo rt_ExtModeInfo; |
105 | static const sysRanDType *systemRan[1]; |
106 | testFoil_M->extModeInfo = (&rt_ExtModeInfo); |
107 | rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan); |
108 | systemRan[0] = &rtAlwaysEnabled; |
109 | rteiSetModelMappingInfoPtr(testFoil_M->extModeInfo, |
110 | &testFoil_M->SpecialInfo.mappingInfo); |
111 | rteiSetChecksumsPtr(testFoil_M->extModeInfo, testFoil_M->Sizes.checksums); |
112 | rteiSetTPtr(testFoil_M->extModeInfo, rtmGetTPtr(testFoil_M)); |
113 | } |
114 | |
115 | /* block I/O */ |
116 | (void) memset(((void *) &testFoil_B), 0, |
117 | sizeof(B_testFoil_T)); |
118 | |
119 | /* states (dwork) */ |
120 | (void) memset((void *)&testFoil_DW, 0, |
121 | sizeof(DW_testFoil_T)); |
122 | |
123 | /* data type transition information */ |
124 | { |
125 | static DataTypeTransInfo dtInfo; |
126 | (void) memset((char_T *) &dtInfo, 0, |
127 | sizeof(dtInfo)); |
128 | testFoil_M->SpecialInfo.mappingInfo = (&dtInfo); |
129 | dtInfo.numDataTypes = 14; |
130 | dtInfo.dataTypeSizes = &rtDataTypeSizes[0]; |
131 | dtInfo.dataTypeNames = &rtDataTypeNames[0]; |
132 | |
133 | /* Block I/O transition table */ |
134 | dtInfo.BTransTable = &rtBTransTable; |
135 | } |
136 | |
137 | /* S-Function Block: <Root>/MagMan Foil */ |
138 | { |
139 | real_T initVector[1] = { 0 }; |
140 | |
141 | { |
142 | int_T i1; |
143 | for (i1=0; i1 < 1; i1++) { |
144 | testFoil_DW.MagManFoil_DSTATE = initVector[0]; |
145 | } |
146 | } |
147 | } |
148 | } |
149 | |
150 | /* Model terminate function */ |
151 | void testFoil_terminate(void) |
152 | { |
153 | /* (no terminate code required) */ |
154 | } |
155 | |