Overview
Comment: | Added check for non-finite array elements. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
943995fdc4bdfff84806197fe31893b3 |
User & Date: | geraint@users.sourceforge.net on 2003-03-11 13:46:03 |
Other Links: | branch diff | manifest | tags |
Context
2003-03-11
| ||
23:05:51 | *** empty log message *** check-in: 886942145f user: geraint@users.sourceforge.net tags: origin/master, trunk | |
13:46:03 | Added check for non-finite array elements. check-in: 943995fdc4 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2003-03-10
| ||
12:07:25 |
Tracking Matlab's ever-changing API. Updated to Matlab 6.5: - removed mxSetName - mexGetArray -> mexGetVariable - mexPutArray -> mexPutVariable check-in: b7937ff652 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/lib/rep/sfun_rep/sfun_interface.c.tmpl from [bbdb5fc62d] to [12aacfe503].
︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | { void *p = calloc (n, sizeof (double)); if (! p) { fprintf (stderr, "*** Error: failed to allocate memory\n"); } return (double *) p; } static void check_finite(SimStruct *S, double *array, unsigned int index) { const char *array_name; char warning[128]; if ((array[index] <= 0.0) || (array[index] >= 0.0)) { ; /* no problem */ } else { if (array == mttpar) { array_name = "mttpar"; } else if (array == mttu) { array_name = "mttu"; } else if (array == mttx) { array_name = "mttx"; } else if (array == mtty) { array_name = "mtty"; } else if (array == controller_inputs) { array_name = "controller_inputs"; } else if (array == controller_outputs) { array_name = "controller_outputs"; } else { array_name = "unknown_array"; } sprintf(warning, "(time %f) Non-finite array element: %s[%d]\n", mttt, array_name, index); ssWarning(S, warning); } } static void initialise_arrays (void) { PRINT_ENTER; mttpar = array_of_double (MTTNPAR); |
︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | + + + + | static void update_inputs_from_simulink (SimStruct *S) { PRINT_ENTER; for (i = 0; i < MTTNU; i++) { mttu[i] = *ssGetInputPortRealSignalPtrs (S, 0)[i]; check_finite(S, mttu, i); } for (i = 0; i < MTTNX; i++) { mttx[i] = *ssGetInputPortRealSignalPtrs (S, 1)[i]; check_finite(S, mttx, i); } for (i = 0; i < MTTNY; i++) { mtty[i] = *ssGetInputPortRealSignalPtrs (S, 2)[i]; check_finite(S, mtty, i); } for (i = 0; i < NumberOfControllerOutputs; i++) { controller_outputs[i] = *ssGetInputPortRealSignalPtrs (S, 3)[i]; check_finite(S, controller_outputs, i); } PRINT_LEAVE; } static void update_simtime_from_simulink (SimStruct *S) { |
︙ | |||
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + | update_simtime_from_simulink (S); <mtt_model_name>_process_inputs (S); UNUSED_ARG(tid); /* not used in single tasking mode */ for (i = 0; i < MTTNU; i++) { check_finite(S, mttu, i); ssGetOutputPortRealSignal (S, 0)[i] = mttu[i]; } for (i = 0; i < NumberOfControllerInputs; i++) { check_finite(S, controller_inputs, i); ssGetOutputPortRealSignal (S, 1)[i] = controller_inputs[i]; } PRINT_LEAVE; } #define MDL_DERIVATIVES |
︙ |