Example Language Usage; The Algorithm Execution Environment; The Main Function - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Example Language
Usage

The Algorithm Execution Environment

The Main Function

Chapter 4
No decimal point or exponent specified.
32-bit hexadecimal integer; 0Xhhh... or 0xhhh... where h is a hex digit.
32-bit floating point; ddd., ddd.ddd, ddde±dd, dddE±dd, ddd.dddedd,
or ddd.dddEdd where d is a decimal digit.
Flow Control: conditional construct if(){ } else { }
Intrinsic Functions:
Return minimum; min(<expr1>,<expr2>)
Return maximum; max(<expr1>,<expr2>)
User defined function; <user_name>(<expr>)
Write value to CVT element; writecvt(<expr>,<expr>)
Write value to FIFO buffer; writefifo(<expr>)
Write value to both CVT and FIFO; writeboth(<expr>,<expr>)
Here are examples of some Algorithm Language elements assembled to
show them used in context. Later sections will explain any unfamiliar
elements you see here:
Example 1;
/*** get input from channel 8, calculate output, check limits, output to ch 16 & 17 ***/
static float output_max = .020;
static float output_min = .004;
static float input_val, output_val;
input val_ = I108;
output_val = 12.5 * input_val;
if ( output_val > output_max )
output_val = output_max;
else if( output_val < output_min)
output_val = output_min;
O116 = output_val / 2;
O117 = output_val / 2;
Example 2;
/*** same function as example 1 above but shows a different approach ***/
static float max_output = .020;
static float min_output = .004;
/* following lines input, limit output between min and max_output, and outputs.
/* output is split to two current output channels wired in parallell to provide 20mA */
O116 = max( min_output, min( max_output, (12.5 * I108) / 2 ) );
O117 = max( min_output, min( max_output, (12.5 * I108) / 2 ) );
This section describes the execution environment that the HP E1415
provides for your algorithms. Here we describe the relationship of your
algorithm to the main() function that calls it.
All 'C' language programs consist of one or more functions. A 'C' program
must have a function called main(). In the HP E1415, the main() function is
usually generated automatically by the driver when you execute the INIT
command. The main() function executes each time the module is triggered,
Creating and Running Custom Algorithms
/* 20 mA max output */
/* 4 mA min output */
/* intermediate I/O vars */
/* get value from input buffer channel 8*/
/* calculate desired output */
/* check output greater than limit */
/* if so, output max limit */
/* check output less than limit */
/* if so, output min limit */
/* split output_val between two SCP */
/* channels to get up to 20mA max
/* 20 mA max output */
/* 4 mA min output */
*/
*/
115

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents