Chapter 6
Vectorized Code Generation
6-14
ni.com
k = k + 1;
}
}
k = 1;
for (i=1; i<=5; i++) {
Y->delayed_pulse[-1+i] = X->sensor_delay[-1+k];
k = k + 1;
}
/* ---------------------------- Gain Block */
/* {VecEx..2} */
Throttle = -8.7*U->sensor_5;
Pedal = -7.6*U->sensor_11;
Brake = -6.5*U->sensor_12;
Gear = -5.4*U->sensor_4;
Clutch = -4.3*U->sensor_1;
/***** State Update. *****/
/* ---------------------------- Time Delay */
/* {VecEx..12} */
k = 0;
XD->sensor_delay[k] = Throttle;
k = k + 1;
XD->sensor_delay[k] = Pedal;
k = k + 1;
XD->sensor_delay[k] = Brake;
k = k + 1;
XD->sensor_delay[k] = Gear;
k = k + 1;
XD->sensor_delay[k] = Clutch;
k = k + 1;
/***** Swap state pointers. *****/
XTMP = X;
X = XD;
XD = XTMP;
INIT = 0;
Vectorization Features
This section describes features of the vectorized code. You do not have to
enable these features explicitly. These features are the natural result of
introducing arrays into the generated code. In other words, to support
vectorization for any model, these features must be present.