This application contains a standard PID algorithm that can be used to control any number of devices. The USC can be programmed to accept an input signal, condition it, compare it to a set point signal and produce a corrective output signal.
Steps To Implement PID Control Using a USC701
Import UAP and Setting Inputs For PID
The Ziegler Nichols Tuning Method
The Standard Program Details
USC PID Program List
Determine Equation Update Time
USC PID Application Program
Steps To Implement PID Control Using a USC701
- Follow the application section to set up UAP0025 for use with your input devices.
- To change the sampling rate read the section about the Equation Update Time.
- The standard program details and program listing are explained so that you may modify it to suit your application. To change to reverse acting operation reverse the inputs or reverse the order of Read Ch1, Read Ch2 commands in the program list.
- The AM702-02 in trim mode can be used to adjust the PID operation using the Ziegler Nichols tuning method.
Import UAP and Setting Inputs For PID
| This application procedure will apply each step to a specific control example. |
|
EXAMPLE
|
- Import
UAP0025x.USC
module definition file into the USC Config PC software. - The measurement input must now be configured to match the input or sensor type.
-
- Click on CH1 and press configure.
- The example uses type J thermocouple measurement input.
- Click the small r button to open the change range wizard and select Type = temperature, Range = thermocouple and press next.
- In the channel 1 list select T/C Type J, click on Scale C and fill in Eng. Units as 0 to 1000.
- It may be necessary to click in the Scale list to copy the required scale over into the engineering units column.
- Set to 40ms on fast rate.
- Press next until the "evaluate equation outputs" screen appears.
Enter the initial PID control parameters;
- PB(%) = 50
- I time S = 9999
- D time S = 0.
- Input span is 200 to 900
- Enter the integral reset value

- Enter the set point in constant e = 600.
- Enter the engineering range for memories 6, 7, 8 and 9 as the measurement range.
- M6 200-900I
- M7 200-900PiD
- M8 200-900 delta
- M9 200-900 olddelta.
The output type and range must be configured to match the required control output type and engineering range.- The example has 4 to 20mA control output.
- Ensure that the control output is connected to the PID output M7.
- Enter the engineering range of the measurement input Cal Min = 200, Cal Max = 900. Failure to follow this step will cause incorrect PID factors.
- Press finish to close the wizard, connect and program the USC701. The PID control must now be tuned.
- Use the AM702-02 in trim mode to adjust constants I set and D set to minimum values.
Reduce constant PB in small steps until the process just begins to cycle continuously
and determine the cycle period Pu- Calculate final settings:

The Ziegler Nichols Tuning Method
Example Tuning and Caculation
I set an example system up with;
- PBcycle = 6
- I = 999
- D = 0
- I then started a circular reading log of 40 points and recorded the results shown. The white vertical lines on the graph represent a 10-second period.
- Reading from the graph PBcycle is about 1.5 cycles for 10 seconds or 6.66 seconds for 1 cycle.
- I then calculated PB = 9.6, I = 0.3 and D = 0.833.
- I updated the USC program and ran the test again.
- As the process was still unstable I then reduced the PB until stable operation was achieved at PB(%)= 11.
- Finally the integral reset value (PB% of input range) should be recalculated.
As PB(%) is now = 11 and the input range is 200 to 900.
The Standard Program Details
Declarations
| Variable | Label | Description |
Value
|
|---|---|---|---|
| CH1 | Measure | Measurement input |
0 to 100%
|
| Con_a | PB(%) | Proportional band setting |
(25)
|
| Con_b | I time S | Integration setting |
(1)
|
| Con_c | D set | Differential setting |
(0)
|
| Con_e | SetPoint | Controller set point |
(60)
|
| Con_f | IntReset | Used to limit the integral value when outside proportional band and when control is not possible |
(25)
|
| Mem6 | i | Integral error signal | |
| Mem7 | PiD | Controller output error signal | |
| Mem8 | delta | Difference between set point and process feedback (error) | |
| Mem9 | old delta | value of delta in previous sample. | |
| Timer enable: |
Y
|
||
| Timer sec: |
0.1
|
||
| Update on input: |
N
|
| Variable | Label | Description |
Value
|
|
|---|---|---|---|---|
| Issue c | Issue d | |||
| Con_d | Var04 | EquTime | Set to same value as the equation evaluation timer. |
(0.1)
|
| Con_i | Var01 | Val 2 | equation constant |
2
|
| Con_j | Var03 | Val 100 | equation constant |
100
|
USC PID Program List (for issue c)
| Program List | Comment |
|---|---|
| Con_e | Read set point (measurement if reverse) |
| Read Ch1 | Read measurement (set point if reverse) |
| Subtract | Determine difference |
| Save Mem8 | Save delta |
| Con_j | Start PREPOSITIONAL. Read 100 into stack |
| Multiply | Multiply delta by 100 |
| Con_a | Read PB% setting |
| Divide | Determine proportional error for this reading Proportional correction signal is left on stack |
| Goto INTERGRL | |
| Exit | |
| Lab: DIFERENT | Start DIFFERENTIAL |
| Read Mem9 | Read delta this reading |
| Read Mem8 | Read delta last reading |
| Subtract | Get change in value |
| Con_c | Read differential setting |
| Multiply | Calculate differential value |
| Con_d | Read sample time |
| Divide | Convert differential value to time domain |
| Add | Add integral error |
| Add | Add proportional error |
| Save Mem7 | Save PID output |
| Send M7 | |
| Read Mem8 | Read new delta |
| Save Mem9 | Update old delta |
| Exit | The program will always finish here. |
| LAB: INTERGRL | Determine if the integration calculation should be skipped |
| Read MEM8 | |
| ABS | |
| Con_f | |
| Subtract | |
| If > Goto Skip Int | |
| Del S | Start INTEGRATION calculation |
| Read Mem8 | Read delta this reading |
| Read Mem9 | Read delta last reading |
| Add | Add old and new delta |
| Con_d | Read equation update time |
| Multiply | Convert delta into time domain |
| Con_I | Read the value 2 |
| Divide | Get average |
| Con_b | Get integration setting |
| Divide | Calculate integration correction for this reading |
| Read Mem6 | Read previous integration value |
| Add | |
| Save Mem6 | Save new accumulated integration value |
| Send M6 | |
| Goto DIFERENT | Go to differential calculation |
| Exit | |
| LAB: Skip Int | |
| Del S | |
| Read Mem6 | Read last integral value onto stack |
| Goto DIFERENT |
Determine Equation Update Time
When designing a PID controller the rate that the measurements are available for use in the equation is very important.
- The equation update time MUST NOT be faster than the measurements are available from the analogue to digital converter.
- The equation update time should be about ten times faster than the cycle period or the oscillation frequency that occurs when the PB% is too low (gain too high).
- The PID algorithm takes 60ms to execute therefor the fastest possible equation update time is 70ms with any input configuration.
- The equation update time can run at the same time as the update for one channel.
- Also the equation update time must be extended by 20ms per linearisation table (add 20ms per RTD input, 40ms per thermocouple input.
In general it is better to run the system at the maximum possible rate for best PID control however better noise immunity is achieved at the slow sample rate.
Analogue to Digital Converter Measurement Rates
For one channel of measurement, there is an overhead of one cycle of the sample rate after each sample time. For a 50Hz system, slow overhead is 20msec, fast overhead is approximately 1msec.
|
Sample Time Setting
|
Slow Rate Slow
50Hz Update Time |
Fast Sample Rate
900Hz Update Time |
|---|---|---|
|
20ms |
40 |
21 |
|
40ms |
60 |
41 |
|
100ms |
120 |
101 |
|
200ms |
220 |
201 |
|
500ms |
520 |
501 |
For two channels of measurement, there is an overhead of ten cycles of the sample rate after each sample time. If we consider two channels at the same sample times and rates, then the number of samples (per channel) and update time (2 channels of overhead) is:
|
Sample Time Setting
|
Slow Rate Slow
50Hz Update Time |
Fast Sample Rate
900Hz Update Time |
|---|---|---|
|
20ms
|
440
|
60
|
|
40ms
|
480
|
100
|
|
100ms
|
600
|
220
|
|
200ms
|
800
|
420
|
|
500ms
|
1400
|
1020
|
USC PID Application Program
| File | Comment |
|---|---|
| If unexpected results occur when loading the .usc file press back and click on help for instructions. | |
| This program is designed for use with UscConfig 105 or higher. Add integral reset function. |
|
|
This program is designed for use with UscConfig 106 or higher.
|