HP VXI 75000 C Series User's And Scpi Programming Manual page 417

Algorithmic closed loop controller
Table of Contents

Advertisement

if ((Mfactor<=32767) && (Mfactor>= -32768) )
} /* end for */
for ( ii=0 ; ii<=64 ; ii++ ) /* 0 to -FS */
{
input[ii] = center - ( (tbl_range/64.0)*(float64)(ii));
result[ii] = (*custom_function)( input[ii] );
if ( ii == 0 ) continue; /* This is the first point - skip slope */
jj = ii - 1;
t = result[ii-1];
if (t< 0.0) t *= -1.0; /* use abs value (magnitude) of t */
/* compute the exponent of the offset (B is 31 bits) */
if (t!=0.0)
exponent = 31.0 - (log10(t)/log10(2.0));/* take log base 2 */
else
exponent = 100.0;
}
/* compute slope in bits (each table entry represents 512 bits) */
slope = ( result[ii] - result[ii-1] ) / 512.0;
/* don't take the log of a negative slope */
absslope = (slope < 0 )? -slope : slope;
/* compute the exponent of the slope (M is 16 bits) */
if ( absslope != 0 )
else
/* Choose the smallest exponent -- maximize resolution */
if (exponent2 < exponent) exponent = exponent2;
Xfactor = (int32)(exponent);
Appendix G
/* There is an endpoint problem. Re-compute if on endpoint */
Xfactor--;
Mfactor =round32f( two_to_the_N(Xfactor)*slope );
}
{
/* only save if M is within limits */
/* Adjust EX to match runtime.asm */
EX[jj] = (uint16)(Xofst - Xfactor );
M[jj] = (uint16)(Mfactor & 0xFFFF);
B = round32f( two_to_the_N(Xfactor )*result[ii-1] );
Bhigh[jj] = (uint16)((B >> 16) & 0x0000FFFF);
Blow[jj] = (uint16)(B & 0x0000FFFF);
}
/* generate numbers for prev segment */
/* for second and subsequent points */
/* using prev seg base */
{
/* don't take log of zero */
}
{
{
exponent2 = 15.0 -(log10(absslope)/log10(2.0));
}
{
exponent2 = 100.0;
}
/* remove leading 1's*/
Example Program Listings
417

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents