Scalar Gain Block Example - National Instruments AutoCode NI MATRIX Reference

National instruments ni matrixx reference manual
Table of Contents

Advertisement

Chapter 6
Vectorized Code Generation
Example 6-1
Scalar Code Generated for Gain Block Example
void subsys_1(U, Y)
struct _Sys_ExtIn *U;
struct _Subsys_1_out *Y;
{
static RT_INTEGER iinfo[4];
/******* Initialization. *******/
if (SUBSYS_PREINIT[1]) {
iinfo[0] = 0;
iinfo[1] = 1;
iinfo[2] = 1;
iinfo[3] = 1;
SUBSYS_PREINIT[1] = FALSE;
return;
}
/***** Output Update. *****/
/* ----------------------------
/* {gain..2} */
Y->gain_2_1 = 1.2*U->gain_1;
Y->gain_2_2 = 2.3*U->gain_2;
Y->gain_2_3 = 3.4*U->gain_3;
Y->gain_2_4 = 4.5*U->gain_4;
Y->gain_2_5 = 5.6*U->gain_5;
Y->gain_2_6 = 6.7*U->gain_6;
Y->gain_2_7 = 7.8*U->gain_7;
Y->gain_2_8 = 8.9*U->gain_8;
Y->gain_2_9 = 9.1*U->gain_9;
Y->gain_2_10 = 10.11*U->gain_10;
AutoCode Reference

Scalar Gain Block Example

Example 6-1 shows the scalar code generated for a gain block.
The scalar code for the gain block should be familiar. Some characteristics
of the code for later comparison should be mentioned. First, this is the
canonical example of the concept of unrolling. The basic equation for a
gain block is:
Gain Block */
Y(i) = GainParameter(i) * U(i)
6-2
ni.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AutoCode NI MATRIX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Autocode ni matrixx

Table of Contents