Chapter 7 Code Optimization
© National Instruments Corporation 7-3 AutoCode Reference
Example 7-2 Code Generated with Variable Block Optimization Turned On
/* Model variable definitions */
RT_FLOAT var;
RT_FLOAT var1;
void subsys_1(U, Y)
struct _Sys_ExtIn *U;
struct _Subsys_1_out *Y;
{
static RT_INTEGER iinfo[4];
/***** Local Block Outputs. *****/
RT_FLOAT new_11_1;
RT_FLOAT new_12_1;
/******* Initialization. *******/
if (SUBSYS_PREINIT[1]) {
iinfo[0] = 0;
iinfo[1] = 1;
iinfo[2] = 1;
iinfo[3] = 1;
SUBSYS_PREINIT[1] = FALSE;
return;
}
/***** Output Update. *****/
/* ---------------------------- Read from Variable */
/* {new..11} */
new_11_1 = var;
/* ---------------------------- Read from Variable */
/* {new..1} */
/* ---------------------------- Sum of Vectors */
/* {new..12} */
new_12_1 = U->new_1 + var1;
/* ---------------------------- Write to Variable */
/* {new..3} */
var = new_12_1;
/* ---------------------------- Sum of Vectors */
/* {new..5} */
Y->new_5_1 = U->new_1 - new_11_1;
if (iinfo[1]) {
SUBSYS_INIT[1] = FALSE;