The general digital controller function code implements a fourth order difference equation with variable deadtime. This function block uses previous outputs and error signals (SP minus PV) to calculate the present output. The starting point for calculations can be initiated by time or trigger. This block can function as a digital controller, digital filter, or a digital process model for the implementation of sophisticated control schemes.
Outputs:

Specifications:
Spec 
Tune 
Default 
Type 
Range 
Description 
S1 
N 
5 
I 
Note 1 
Block address of process variable 
S2 
N 
5 
I 
Note 1 
Block address of set point 
S3 
N 
5 
I 
Note 1 
Block address of track value 
S4 
N 
5 
I 
Note 1 
Block address of feedforward 
S5 
N 
0 
I 
Note 1 
Block address of release/track flag: 0 = track 1 = release 
S6 
N 
1 
B 
Note 1 
Execution mode: 0 = trigger 1 = time 
S7 
N 
0 
I 
Note 1 
Block address of external trigger flag: 1 = run 
S8 
N 
1.000 
R 
0  9.2E18 
Time between runs (in secs) 
S9 
Y 
105.000 
R 
Full 
High output limit 
S10 
Y 
5.000 
R 
Full 
Low output limit 
S11 
Y 
0.000 
R 
Full 
Coefficient a0 
S12 
Y 
0.000 
R 
Full 
Coefficient a1 
S13 
Y 
0.000 
R 
Full 
Coefficient a2 
S14 
Y 
0.000 
R 
Full 
Coefficient a3 
S15 
Y 
0.000 
R 
Full 
Coefficient a4 
S16 
Y 
1.000 
R 
Full 
Coefficient b0 
S17 
Y 
0.000 
R 
Full 
Coefficient b1 
S18 
Y 
0.000 
R 
Full 
Coefficient b2 
S19 
Y 
0.000 
R 
Full 
Coefficient b3 
S20 
Y 
0.000 
R 
Full 
Coefficient b4 
S21 
N 
0 
I 
0  255 
Numerator deadtime expressed as a number of sample intervals 
S22 
N 
0 
I 
0  255 
Denominator deadtime expressed as a number of sample intervals 
S23 
Y 
0.000 
R 
Full 
Spare parameter 
S24 
Y 
0.000 
R 
Full 
Spare parameter 
NOTES:
1. Maximum values are:9,998 for the BRC100, IMMFP11/12 and 31,998 for the HAC
157.1 Explanation
157.1.1 Specifications
S1
(Block address of process variable) Current value of the input from the process. Specifications S1 and S2 define the error term in the difference equation:
e(t) = <S2>  <S1>
S2
(Block address of set point) Block address of the set point. This is the current value of the set point input. It defines the desired value of the process variable. Specifications S1 and S2 define the error term in the difference equation:
e(t) = <S2>  <S1>
S3
(Block address of track value) Supplies the block output N when the controller is tracking. The output is limited before it is output to the field and before it is used to update the output buffer. The final output from the general digital controller is the sum of this limited internal control output value and the feedforward signal.
S4
(Block address of feedforward input) Block address of the feedforward input. This input biases the output of the general digital controller based on the changing value of some other variable. The feedforward input is an externally generated signal.
S5
(Block address of input selecting controller tracking) Block address of the input that selects controller tracking. When tracking is selected, the output N tracks the value referenced by S3.
0 = track <S3>
1 = release
S6
(Time and trigger mode select) Defines the mode of data collection. In the time mode, data is collected at fixed intervals of time defined by S8. In the trigger mode, data is collected when <S7> makes a zero to one transition.
0 = trigger mode
1 = time mode
S7
(Block address of external trigger) Block address of the external trigger. If the trigger mode of execution is selected, the calculation is initiated each time this input makes a zero to one transition. The calculation is also initiated when the track switch <S5> is set to zero to force the output to track the desired value.
S8
(Interval between executions) Identifies the interval between executions in seconds if the time based mode of execution is selected.
S9
(High output limit) Actual control output will not exceed this value.
NOTE: The actual control output equals the sum of the low limited internally calculated control output plus the feedforward input value, then high limited if necessary.
S10
(Low output limit) Internally calculated control output will not be less than this value. The actual control output will not be less than this value plus the feedforward input value.
NOTE: The actual control output equals the sum of the low limited internally calculated control output plus the feedforward input value, then high limited if necessary.
S11 through S20
(Coefficients used in difference equation) Values of the coefficients used in the difference equation. The coefficient values are determined from the relationships between the operating parameters of the device being controlled (control theory modeling of process).
S21
(Numerator deadtime) Numerator deadtime expressed as a number of sample intervals. The error signal entering the general digital controller block is not acted on by the block until this number of sample intervals has passed.
S22
(Denominator deadtime) Denominator deadtime expressed as a number of sample intervals. The outputs of the general digital controller are recycled back into the equation after they are calculated. The outputs being fed back into the controller are not acted on until the sample intervals have passed.
NOTE: The value of S21 and S22 affects memory utilization. Refer to Appendix B for details.
S23 and S24
Spare parameters.
157.1.2 Output
N
Calculated from previous outputs, current and previous errors, and the feedforward value. During module startup or tracking, the output is controlled by the track value input.
157.2 Application
General Information
The general digital controller is used to implement control algorithms that are based on discrete time sampled data that are sampled at a rate that can be internally generated (<S8> when S6 equals one) or externally generated (<S7> when S6 equals zero).
Discrete time based functions are simple continuous time based functions that have been sampled at some periodic rate. Just as Laplace transforms are useful to represent complex continuous time functions in a simple manner, Zdomain transforms are used to represent complex discrete time sampled functions in an analogous simple manner. Like Laplace transforms, Zdomain transforms can be used to simplify a complex continuous function into a simple equation. Since in the world of digital control systems all continuous time based data is sampled into discrete time based data, it is more relevant to perform complex continuous time based control algorithms using their equivalent discrete time based algorithms. These continuous time based control algorithms can be converted into discrete time based algorithms via the use of Zdomain transforms. As in Laplace transforms, Zdomain transforms can be algebraically manipulated and simplified into simple equations consisting of simple terms. Conversion tables exist for converting these simple terms back and forth between their equivalent continuous time and Zdomain functions. Further information on this can be found in any good basic control textbook.
Any complex controller algorithm can be implemented by first determining its continuous time base transfer function. With the use of the knowledge of Zdomain transforms, the continuous time based function can be translated into the Zdomain function representation of the equivalent discrete time based function. The Zdomain equation can then be algebraically manipulated into one or more terms that is equivalent to the Zdomain transfer function of function code 157. Therefore, one or more function code 157 general digital controller function blocks can be used to implement the original complex time based control algorithm.
The Zdomain transfer function representation of the general digital controller is:
where:
U(z) 
= 
Z  transfer function of u(t).

E(z) 
= 
Z  transfer function of e(t).

Specific Information
The general digital controller block calculates an output based on previous outputs and error signals. The calculation uses the discrete function:
where:
a0a4 b0b4

= 
Coefficients (specified in S11 through S20)

N 
= 
Numerator (input) deadtime expressed as a number of sample intervals (S21)

D 
= 
Denominator (output feedback) deadtime expressed as a number of sample intervals (S22)

e(t) 
= 
Present error = (<S2>  <S1>)

e(tNn) 
= 
Error from (N+n)th previous run of the algorithm

u(t) 
= 
Current internal control output value

u(tDn) 
= 
Internal control output from the (D+n)th previous run of the algorithm

The general digital controller takes inputs and holds them for a specified number of time intervals for each step before releasing them to the next step as shown in Figure 1571. On startup, the error queue is filled with the error signal and the output queue is filled with the track value minus the feedforward value.
The general digital controller block implements a deadtime queue for the error signal and previous output values. The length of these queues are specified as integer multiples of sample time. On startup and transfer from manual to automatic, all elements of the error queue are initialized with the current error value, and the output queue is initialized with the track value minus the feedforward. Both queues are of the firstin, firstout (FIFO) type. A new value is placed in the queue at each execution time; values already in the queue are shifted one element to make room for the new value, and the oldest value in the queue is discarded.
The internal control output of the general digital controller block is formed by adding together the following values:
a0/b0X 
(fifth oldest value in error queue) 
a1/b0X 
(fourth oldest value in error queue) 
a2/b0X 
(third oldest value in error queue) 
a3/b0X 
(second oldest value in error queue) 
a4/b0X 
(oldest value in error queue) 
b1/b0X 
(fourth oldest value in output queue) 
b2/b0X 
(third oldest value in output queue) 
b3/b0X 
(second oldest value in output queue) 
b4/b0X 
(oldest value in output queue) 
The output is limited before it is output to the field and before it is used to update the output queue. The final output from the general digital controller is the sum of this limited internal control output value and the feedforward signal.