Changing An Algorithm While; It's Running - HP VXI 75000 C Series User's And Scpi Programming Manual

Algorithmic closed loop controller
Table of Contents

Advertisement

Changing an
Algorithm While

it's Running

Defining an Algorithm for
Swapping
126 Creating and Running Custom Algorithms
block's <data byte(s)>. For Definite Length Block Data you must account
for the null byte in the byte count <digit(s)> . If the null byte is not included
within the block, the error "Algorithm Block must contain termination '\0'"
will be generated.
Indefinite Length Block Data Example
Retrieve algorithm source code from file and send to HP E1415 in indefinite
length format using VTL/VISA instrument I/O libraries:
int byte_count, file_handle;
char source_buffer[8096], null = 0;
file_handle = open( "< filename >", O_RDONLY + O_BINARY);
byte_count = read( file_handle, source_buffer, sizeof( source_buffer ) );
close( file_handle );
source_buffer[ byte_count ] = 0; /* null to terminate source buffer string */
viPrintf( e1415, "ALG:DEF 'ALG8',#0%s%c\n", source_buffer, null );
Definite Length Block Data Example
Retrieve source code from text file, determine length of file, create a
Definite Length Block header and send algorithm to HP E1415 using HP
VISA instrument I/O Libraries:
int byte_count, file_handle;
char header_string[12], source_buffer[8096], null = 0;
file_handle = open( "< filename >", O_RDONLY+O_BINARY);
byte_count = read( file_handle, source_buffer, sizeof( source_buffer ) );
close( file_handle );
source_buffer[ byte_count ] = 0; /* null to terminate source buffer string */
sprintf( header_string, "%d", byte_count + 1 ); /* note byte_count+1for null byte */
sprintf( header_string, "%d%d", strlen( header_string ), byte_count);
viPrintf( e1415, "ALG:DEF 'ALG4',#%s%s%c\n", header_string, source_buffer, null );
See the section "Running the Algorithm" later in this chapter for more on
loading algorithms from files.
The HP E1415 has a feature that allows you to specify that a given algorithm
can be swapped with another even while it is executing. This is useful if, for
instance, you needed to alter the function of an algorithm that is currently
controlling a process and you don't want to leave that process uncontrolled.
In this case, when you define the original algorithm, you can enable it to be
swapped.
The ALG:DEF command has an optional parameter that is used to enable
algorithm swapping. The command's general form is:
ALG:DEF '< alg_name >'[,< swap_size >],'< source_code >'
Note the parameter <swap_size>. With <swap_size> you specify the amount
of algorithm memory to allocate for algorithm <alg_name>. Make sure to
allocate enough space for the largest algorithm you expect to define for
Chapter 4

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents