200 Creating and Running Algorithms
Chapter 6
A Very Simple First Algorithm
This section shows how to create and download an algorithm that simply
sends the value of an input channel to a CVT element. It includes an example
application program that configures the VT1422A, downloads (defines) the
algorithm, starts, and then communicates with the running algorithm.
Writing the
Algorithm
The most convenient method of creating an algorithm is to use the
hps1422.exe soft front panel program. Use the Algorithms Panel to create,
edit and save the algorithm to a file called "
mxplusb.c
." The following
algorithm source code is on the examples disc in a file called "
mxplusb.c
."
/* Example algorithm that calculates 4 Mx+B values upon
* signal that sync == 1. M and B terms set by application
* program.
*/
static float M, B, x, sync;
if ( First_loop ) sync = 0;
if ( sync == 1 ) {
writecvt( M*x+B, 10 );
writecvt(-(M*x+B), 11 );
writecvt( (M*x+B)/2,12 );
writecvt( 2*(M*x+B),13 );
sync = 2;
}
Running the
Algorithm
A C-SCPI example program "
file_alg.cpp
" shows how to retrieve the
algorithm source file "
mxplusb.c
" and use it to define and execute an
algorithm. When "
file_alg.cpp
" is compiled, type
file_alg mxplusb.c
to run the example and load the algorithm. View the readme.txt file provided
with the VXI
plug&play
driver for example program file location.
Modifying an Example PID Algorithm
While the example PID algorithms supplied as source files with the
VT1422A can provide excellent general closed loop process control, there
will be times when the process has specialized requirements that are not
addressed by the as-written form of these PID algorithms. In this section,
coping and modifying an example PID algorithm is described.
PIDA with Digital
On-Off Control
The example PID algorithms are written to supply control outputs through
analog output SCPs. While it would not be an error to specify a digital
channel as the PID control output, the PID algorithm as written would not
operate the digital channel as desired.
The value written to a digital output bit is evaluated as if it were a boolean
value. That is, if the value represents a boolean true, the digital output is set
to a binary 1. If the value represents a boolean false, the digital output is set
to a binary 0. The VT1422A's Algorithm Language (like 'C') specifies that a
value of 0 is a boolean false (0), any other value is considered true (1). With
that in mind, the operation of an example PIDA will be analyzed with a
digital output as its control output.
Содержание VT1422A
Страница 2: ...This page is blank...
Страница 8: ...8 Notes...
Страница 22: ...22 Support...
Страница 57: ...Field Wiring 57 Chapter 2...
Страница 58: ...58 Field Wiring Chapter 2...
Страница 96: ...94 Programming the VT1422A VT1529A B for Remote Strain Measurement Chapter 3...
Страница 162: ...160 Programming the VT1422A for Data Acquisition and Control Chapter 4...
Страница 224: ...222 Creating and Running Algorithms Chapter 6...
Страница 419: ...VT1422A Command Reference 417 Chapter 7 Notes...
Страница 420: ...418 VT1422A Command Reference Chapter 7 Notes...
Страница 425: ...Specifications 423 Appendix A Thermocouple Type E 200 800 C SCPs VT1501 02 03A...
Страница 426: ...424 Specifications Appendix A Thermocouple Type E 200 800 C SCPs VT1508 09A...
Страница 427: ...Specifications 425 Appendix A Thermocouple Type E 0 800 C SCPs VT1501A 02A 03A...
Страница 428: ...426 Specifications Appendix A Thermocouple Type E 0 800 C SCPs VT1508A 09A...
Страница 429: ...Specifications 427 Appendix A Thermocouple Type E Extended SCPs VT1501A 02A 03A...
Страница 430: ...428 Specifications Appendix A Thermocouple Type E Extended SCPs VT1508A 09A...
Страница 431: ...Specifications 429 Appendix A Thermocouple Type J SCPs VT1501A 02A 03A...
Страница 432: ...430 Specifications Appendix A Thermocouple Type J SCPs VT1508A 09A...
Страница 433: ...Specifications 431 Appendix A Thermocouple Type K SCPs VT1501A 02A 03A...
Страница 434: ...432 Specifications Appendix A Thermocouple Type R SCPs VT1501A 02A 03A...
Страница 435: ...Specifications 433 Appendix A Thermocouple Type R SCPs VT1508A 09A...
Страница 436: ...434 Specifications Appendix A Thermocouple Type S SCPs VT1501A 02A 03A...
Страница 437: ...Specifications 435 Appendix A Thermocouple Type S SCPs VT1508A 09A...
Страница 438: ...436 Specifications Appendix A Thermocouple Type T SCPs VT1501A 02A 03A...
Страница 439: ...Specifications 437 Appendix A Thermocouple Type T SCPs VT1508A 09A...
Страница 440: ...438 Specifications Appendix A 5k Thermistor Reference SCPs VT1501A 02A 03A...
Страница 441: ...Specifications 439 Appendix A 5k Thermistor Reference SCPs VT1508A 09A...
Страница 442: ...440 Specifications Appendix A RTD Reference SCPs VT1501A 02A 03A...
Страница 443: ...Specifications 441 Appendix A RTD SCPs VT1501A 02A 03A...
Страница 444: ...442 Specifications Appendix A RTD SCPs VT1508A 09A...
Страница 445: ...Specifications 443 Appendix A 2250 Thermistor SCPs VT1501A 02A 03A...
Страница 446: ...444 Specifications Appendix A 2250 Thermistor SCPs VT1508A 09A...
Страница 447: ...Specifications 445 Appendix A 5k Thermistor SCPs VT1501A 02A 03A...
Страница 448: ...446 Specifications Appendix A 5k Thermistor SCPs VT1508A 09A...
Страница 449: ...Specifications 447 Appendix A 10k Thermistor SCPs VT1501A 02A 03A...
Страница 450: ...448 Specifications Appendix A 10k Thermistor SCPs VT1508A 09A...
Страница 454: ...452 Specifications Appendix A...
Страница 480: ...478 VT1529A B Verification Calibration Appendix C...
Страница 484: ...482 Glossary Appendix D Notes...