How the example pida operates, Modifying the example pida, Algorithm to algorithm communication – VXI VT1422A User Manual

Page 203: Communication using channel identifiers

Advertising
background image

Creating and Running Algorithms 201

Chapter 6

How the Example PIDA

Operates

A PID algorithm is to control a bath temperature at 140°F. With the Setpoint
at 140 and the process variable (PV) reading 130, the value sent to the output
is a positive value which drives the digital output to 1 (heater on). When the
process value reading reaches 140, the "error term" would equal zero so the
value sent to the digital output would be 0 (heater off). Fine so far, but as the
bath temperature coasts even minutely above the setpoint, a small negative
value will be sent to the digital output which represents a boolean true value.
At this point the output will again be 1 (heater on) and the bath temperature
will continue to go up rather than down. This process is now out of control!

Modifying the

Example PIDA

This behavior is easy to fix. Simply modify the example PIDA algorithm
source code (supplied with the VT1422A in the file PIDA.C) and then define
it as an algorithm. Use the following steps:

1. Load the source file for the example PIDA algorithm into a text

editor.

2. Find the line of code near the end of PIDA that reads:

outchan = Error * P_factor + I_out + D_factor * (Error - Error_old)

and insert this line below it:

if ( outchan <= 0 ) outchan = 0; /* all values not positive are now zero */

3. Going back to the beginning of the file, change all occurrences of

"inchan" to the input channel specifier desired (e.g., I100).

4. As in step 3, change all occurrences of "outchan" to the digital output

channel/bit identifier desired (e.g., O108.B0).

5. Now save this algorithm source file as "ONOFFPID.C."

Algorithm to Algorithm Communication

The ability for one algorithm to have access to values from another can be
very important particularly in more complex control situations. One of the
important features of the VT1422A is that this communication can take
place entirely within the algorithms' environment. The application program
is freed from having to retrieve values from one algorithm and then send
those values to another algorithm.

Communication

Using Channel

Identifiers

The value of all defined input and output channels can be read by any
algorithm. Here is an example of inter-algorithm channel communication.

Advertising
This manual is related to the following products: