30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
-
+
-
+
|
/* Start EDIT */
/* Edit this block to define the number of controller inputs, outputs and parameters */
const int NumberOfControllerInputs = 1; /* inputs TO controller */
const int NumberOfControllerOutputs = 1; /* outputs FROM controller */
/* End EDIT */
static void
<mtt_model_name>_process_inputs (void)
<mtt_model_name>_process_inputs (SimStruct *S)
{
/* insert <mtt_model_name>_struc.c */
/* Start EDIT */
/* Edit this block to process the model inputs and outputs */
/* Remove the following line */
fprintf (stderr, "*** Error: <mtt_model_name>_sfun_interface.c has not been customised!\n"); return;
ssSetErrorStatus (S, "<mtt_model_name>_sfun_interface.c has not been customised!\n");
/* simple example follows */
/* Get total of all outputs and input to controller */
controller_inputs[0] = 0.0;
for (i = 0; i < MTTNY; i++) {
controller_inputs[0] += mtty[i];
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
-
+
|
static void mdlOutputs(SimStruct *S, int_T tid)
{
PRINT_ENTER;
update_inputs_from_simulink (S);
update_simtime_from_simulink (S);
<mtt_model_name>_process_inputs ();
<mtt_model_name>_process_inputs (S);
UNUSED_ARG(tid); /* not used in single tasking mode */
for (i = 0; i < MTTNU; i++) {
ssGetOutputPortRealSignal (S, 0)[i] = mttu[i];
}
|