Chapter 7 Code Optimization
AutoCode Reference 7-6 ni.com
static const RT_FLOAT _R_P[8] = {-1.0, 1.0, 1.5, 2.0, -1.0, 1.0,
1.25,1.4};
/***** Local Block Outputs. *****/
RT_FLOAT proc_2_1;
RT_FLOAT proc_14_1;
RT_FLOAT proc_12_1;
/***** Algorithmic Local Variables. *****/
RT_INTEGER ilower;
RT_INTEGER iupper;
RT_FLOAT uval;
RT_INTEGER k;
RT_FLOAT alpha;
/******* Initialization. *******/
if (SUBSYS_PREINIT[1]) {
iinfo[0] = 0;
iinfo[1] = 1;
iinfo[2] = 1;
iinfo[3] = 1;
INIT = 1;
X = &ss_1_states[0];
XD = &ss_1_states[1];
X->proc_12_S1 = 0;
X->proc_4_S1 = 0.0;
XD->proc_12_S1 = 0.0;
XD->proc_4_S1 = 0.0;
for ( cnt=0;cnt<8;cnt++ ) {
R_P[cnt] = _R_P[cnt];
}
SUBSYS_PREINIT[1] = FALSE;
return;
}
..
..
Example 7-3 shows excerpts of generated code relevant to the restart capability. The buffer _R_P stores the initial parameter values, and during initialization time this data is copied to the R_P buffer, which might undergo modification. The initialization section also contains code that explicitly initializes states, state derivatives, and info structures. Example 7-4 shows the generated code without the restart capability. Here,