Chapter 6
Vectorized Code Generation
©
National Instruments Corporation
6-11
}
SUBSYS_PREINIT[1] = FALSE;
return;
}
/***** Output Update. *****/
/* ---------------------------- Time Delay */
/* {VecEx..12} */
if (INIT) {
k = 0;
for (i=1; i<=5; i++) {
X->sensor_delay[k] = R_P[i];
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} */
for (i=1; i<=5; i++) {
Throttle[-1+i] = R_P[5+i]*U->sensor_5[-1+i];
}
/***** State Update. *****/
/* ---------------------------- Time Delay */
/* {VecEx..12} */
k = 0;
for (i=1; i<=5; i++) {
XD->sensor_delay[k] = Throttle[-1+i];
k = k + 1;
}
/***** Swap state pointers. *****/
XTMP = X;
X = XD;
XD = XTMP;
INIT = 0;
}