202 Creating and Running Algorithms Chapter 6

Implementing

Multivariable Control

In this example, two PID algorithms each control part of a process and due
to the process dynamics are interactive. This situation can call for what is
known as a "decoupler." The job of the decoupler is to correct for the
"coupling" between these two process controllers. Figure 6-3 shows the two
PID controllers and how the de-coupler algorithm fits into the control loops.
As mentioned before, algorithm output statements don't write to the output
SCP channels but are instead buffered in the Output Channel Buffer until the
Output Phase occurs. This situation allows easy implementation of
decouplers because it allows an algorithm following the two PIDs to inspect
their output values and make adjustments to them before they are sent to
output channels. The decoupler algorithm's Decoupl_factor1 and
Decouple_factor2 variables (assumes a simple interaction) are local and can
be independently set using ALG:SCALAR:
/* decoupler algorithm. (must follow the coupled algorithms in execution sequence) */
static float Decouple_factor1, Decouple_factor2;
O124 = O124 + Decouple_factor2 * O125;
O125 = O125 + Decouple_factor1 * O124;
CommunicationUsing Global
Varia bles
A more traditional method of inter-algorithm communication uses global
variables. Global variables are defined using the ALG:DEF command in the
form:
ALG:DEF 'GLOBALS','<variable_declaration_statements>'
Example of global declaration
ALG:DEF 'GLOBALS','static float cold_setpoint;'

Implementing Feed

Forward Control

In this example, two algorithms mix hot and cold water supplies in a ratio
that results in a tank being filled to a desired temperature. The temperature
of the make-up supplies is assumed to be constant. Figure 6-4 shows the
process diagram.
O124
O124
PID Controller ALG1
PID Controller ALG2
+
+
Decoupl_factor2
Process Interaction
Decoupl_factor1
+
_
_
+
+
O125
O125
Setpoint
Setpoint ALG3
De-coupler
Figure 6-3. Algorithm Communication with Channels
+