Setting A Vxibus Interrupt; Determining Your Algorithm's Identity (Alg_Num) - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Individual element numbers are isolated by commas. A contiguous range of
elements is specified by: <starting element>colon<ending element>.
Writing values to the FIFO
The FIFO, as the name implies is a First-In-First-Out buffer. It can buffer up
to 65,024 values. This capability allows your algorithm to send a continuous
stream of data values related in time by their position in the buffer. This can
be thought of as an electronic strip-chart recorder. Each value is sent to the
FIFO by executing the Algorithm Language intrinsic statement
writefifo(<expression>). The following in an example algorithm statement:
writefifo(O124); /* send output channel 24's value to the FIFO */
Since you can determine the actual algorithm execution rate (see
"Programming the Trigger Timer" on page 84), the time relationship of
readings in the FIFO is very deterministic.
Reading values from the FIFO
For a discussion on reading values from the FIFO, see "Reading History
Mode Values From the FIFO" on page 88.
Writing values to the FIFO and CVT
The writeboth(<expression>,<cvt_element>) statement sends the value of
<expression> both to the FIFO and to a <cvt_element>. Reading these
values is done the same way as mentioned for writefifo() and writecvt().
Setting a VXIbus
The algorithm language provides the function interrupt() to force a VXIbus
interrupt. When interrupt() is executed in your algorithm, a VXIbus
Interrupt
interrupt line (selected by the the SCPI command DIAG:INTR[:LINe]) is
asserted. The following example algorithm code tests an input channel value
and sets an interrupt if it is higher or lower than set limits.
static float upper_limit = 1.2, lower_limit = 0.2;
if( I124 > upper_limit || I124 < lower_limit ) interrupt();
Determining Your
When you define your algorithm with the ALG:DEF 'ALGn',... command,
the E1415's driver make available to your algorithm the constant
Algorithm's Identity
ALG_NUM. ALG_NUM has the value n from "ALGn". For instance, if you
(ALG_NUM)
defined an algorithm with <alg_name> equal to "ALG3", then ALG_NUM
within that algorithm would have the value 3.
What can you do with this value? To give you an idea, the standard PID
algorithm PIDB uses ALG_NUM to determine which CVT elements it should
use to store values. Here's a short example of the code used:
writecvt ( inp_channel, (ALG_NUM * 10) + 0 );
writecvt ( Error, (ALG_NUM * 10) + 1 );
writecvt ( outp_channel, (ALG_NUM * 10) + 2 );
writecvt ( Status, (ALG_NUM * 10) + 3 );
This code writes PID values into CVT elements 10 through 13 for ALG1,
CVT elements 20 through 23 for ALG2, CVT elements 30 through 33 for
Chapter 4
Creating and Running Custom Algorithms
121

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents