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

Algorithmic closed loop controller
Table of Contents

Advertisement

E1415_ADDR);
(void) fprintf(stderr, "C-SCPI open error was %d\n", cscpi_open_error);
exit(1);
}
/* Check for startup errors */
INST_QUERY(e1415,"syst:err?\n", "%d,%S", &error, string);
if (error) {
(void) printf("syst:err %d,%s\n", error, string);
exit(1);
}
/* Start from a known instrument
INST_CLEAR(e1415);
INST_SEND(e1415, "*RST;*CLS\n");
/*
Setup SCP functions
INST_SEND(e1415, "sens:func:volt (@116)\n"); /* Analog in volts
INST_SEND(e1415, "sour:func:cond (@141)\n"); /* Digital output
/* Configure Trigger Subsystem and Data Format */
INST_SEND(e1415, "trig:sour timer;:trig:timer .001\n");
INST_SEND(e1415, "samp:timer 10e-6\n"); /* default */
INST_SEND(e1415, "form real,32\n");
/* Download algorithm with in-line code */
INST_SEND(e1415,"alg:def 'alg1','PIDB(I116,O100,O141.B0)'\n");
/* Preset Algorithm variables */
INST_SEND(e1415,"alg:scal 'alg1','Setpoint',%f\n", 3.0);
INST_SEND(e1415,"alg:scal 'alg1','P_factor',%f\n", 0.0001);
INST_SEND(e1415,"alg:scal 'alg1','I_factor',%f\n", 0.00025);
INST_SEND(e1415,"alg:upd\n");
/* Initiate Trigger System - start scanning and running algorithms
INST_SEND(e1415,"init\n");
/* Alter run-time variables and Retrieve Data */
while( 1 ) {
float32 setpoint = 0, process_info[4];
int i;
/* type in -100 to exit */
printf("Enter desired setpoint: ");
scanf( "%f",&setpoint );
if ( setpoint == -100.00 ) break;
INST_SEND(e1415,"alg:scal 'alg1','Setpoint',%f\n", setpoint );
INST_SEND(e1415,"alg:upd\n");
for ( i = 0; i < 10 ; i++ ) { /* read CVT 10 times */
/* ALG1 has elments 10-13 in CVT */
INST_QUERY( e1415, "data:cvt? (@10:13)","%f",&process_info );
printf("Process variable: %f, %f, %f, %f\n",process_info[0],
process_info[1],process_info[2],process_info[3]);
}
}
}
94 Programming the HP E1415 for PID Control
*/
/* Selected device clear */
*/
*/
*/
*/
Chapter 3

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents