Non-control algorithms, Process monitoring algorithm – VXI VT1422A User Manual

Page 206

Advertising
background image

204 Creating and Running Algorithms

Chapter 6

/* following line includes global setpoint var and hard coded input chan */
Error = Cold_setpoint - I109;
if (First_loop)
{

I_out = Error * I_factor;

Error_old = Error;

}
else /* not First trigger */
{

I_out = Error * I_factor + I_out; /* output channel hard coded here */

}
O116 = Error * P_factor + I_out + D_factor * (Error - Error_old);
Error_old = Error;

Non-Control Algorithms

Process Monitoring

Algorithm

Another function the VT1422A performs well is monitoring input values
and testing them against pre-set limits. If an input value exceeds its limit,
the algorithm can be written to supply an indication of this condition by
changing a CVT value or even forcing a VXIbus interrupt. The following
example shows acquiring one analog input value from channel 0 and one
VT1533A digital channel from channel 16 and limit testing them.

/* Limit test inputs, send values to CVT and force interrupt when exceeded */
static float Exceeded;
static float Max_chan0, Min_chan0, Max_chan1, Min_chan1;
static float Max_chan2, Min_chan2, Max_chan3, Min_chan3;
static float Mask_chan16;
if ( First_loop ) Exceeded = 0; /* initialize Exceeded on each INIT */
writecvt( I100, 330); /* write analog value to CVT */
Exceeded = ( ( I100 > Max_chan0 ) || ( I100 < Min_chan0 ) ); /* limit test analog */
writecvt( I101, 331); /* write analog value to CVT */
Exceeded = Exceeded + ( ( I101 > Max_chan1 ) || ( I101 < Min_chan1 ) );
writecvt( I102, 332); /* write analog value to CVT */
Exceeded = Exceeded + ( ( I102 > Max_chan2 ) || ( I102 < Min_chan2 ) );
writecvt( I103, 333); /* write analog value to CVT */
Exceeded = Exceeded + ( ( I103 > Max_chan3 ) || ( I103 < Min_chan3 ) );
writecvt( I116, 334); /* write 8-bit value to CVT */
Exceeded = Exceeded + ( I116 != Mask_chan16); /* limit test digital */
If ( Exceeded ) interrupt( );

Advertising
This manual is related to the following products: