Chapter 7
Code Optimization
©
National Instruments Corporation
7-9
/* ---------------------------- Time Delay */
/* {proc..22} */
if (INIT) {
X->proc_22_S1 = 0.0;
}
proc_22_1 = X->proc_22_S1;
/* ---------------------------- Time Delay */
/* {proc..24} */
if (INIT) {
X->proc_24_S1 = 0.0;
}
proc_24_1 = X->proc_24_S1;
/* ---------------------------- Sum of Vectors */
/* {proc..14} */
proc_14_1 = U->proc_1 - proc_22_1;
/* ---------------------------- Gain Block */
/* {proc..12} */
proc_12_1 = 2.0*proc_14_1;
/* ---------------------------- Sum of Vectors */
/* {proc..5} */
proc_5_1 = proc_12_1 - proc_24_1;
/* ---------------------------- Gain Block */
/* {proc..4} */
Y->proc_4_1 = 2.0*proc_5_1;
/***** State Update. *****/
/* ---------------------------- Time Delay */
/* {proc..22} */
XD->proc_22_S1 = proc_12_1;
/* ---------------------------- Time Delay */
/* {proc..24} */
XD->proc_24_S1 = Y->proc_4_1;
..
..
Example 7-6
Sample Code Segment Generated with Merging of INITs (-Oinitmerge) Option
if (SUBSYS_PREINIT[1]) {
iinfo[0] = 0;
iinfo[1] = 1;
iinfo[2] = 1;
iinfo[3] = 1;
X = &ss_1_states[0];
XD = &ss_1_states[1];