Chapter 5 Generated Code Architecture
AutoCode Reference 5-28 ni.com
new_total = y;
endif;
Example 5-8 Generated Code from Example5-7
void subsys_1(U, Y)
struct _Sys_ExtIn *U;
struct _Subsys_1_out *Y;
{
/***** States Array. *****/
static struct _Subsys_1_states ss_1_states[2] = {{0.0}, {0.0}};
/***** Current and Next States Pointers. *****/
static struct _Subsys_1_states *X = &ss_1_states[0];
static struct _Subsys_1_states *XD = &ss_1_states[1];
static struct _Subsys_1_states *XTMP;
/***** Output Update. *****/
/* ---------------------------- BlockScript Block */
/* {bsb..2} */
if (INIT) {
X->bsb_2_S1 = 0.0;
}
Y->bsb_2_1 = U->bsb_1 + X->bsb_2_S1;
/***** State Update. *****/
/* ---------------------------- BlockScript Block *
/* {bsb..2} */
XD->bsb_2_S1 = Y->bsb_2_1;
/***** Swap state pointers. *****/
XTMP = X;
X = XD;
XD = XTMP;}