Icon

PID Control plus Ziegler Nichols tuning Method

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

  1. Follow the application section to set up UAP0025 for use with your input devices.
  2. To change the sampling rate read the section about the Equation Update Time.
  3. 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.
  4. The AM702-02 in trim mode can be used to adjust the PID operation using the Ziegler Nichols tuning method.

(back to top)

Import UAP and Setting Inputs For PID

This application procedure will apply each step to a specific control example.

EXAMPLE

A PID controller will control the temperature of a vessel to a set point stored within the USC where;

  1. Measurement input CH1 = Thermocouple type J (Input range used will be 200 to 900°C)
  2. Set point (equation constant e) = 600°C
  3. Output to controller = 4-20mA
  1. Import UAP0025x.USC module definition file into the USC Config PC software.
  2. The measurement input must now be configured to match the input or sensor type.
    1. Click on CH1 and press configure.
    2. The example uses type J thermocouple measurement input.
    3. Click the small r button to open the change range wizard and select Type = temperature, Range = thermocouple and press next.
    4. In the channel 1 list select T/C Type J, click on Scale C and fill in Eng. Units as 0 to 1000.
    5. It may be necessary to click in the Scale list to copy the required scale over into the engineering units column.
    6. Set to 40ms on fast rate.
    7. Press next until the "evaluate equation outputs" screen appears.
  3. Enter the initial PID control parameters;
    1. PB(%) = 50
    2. I time S = 9999
    3. D time S = 0.
    4. Input span is 200 to 900
  4. Enter the integral reset value

  5. Enter the set point in constant e = 600.
  6. Enter the engineering range for memories 6, 7, 8 and 9 as the measurement range.
    1. M6 200-900I
    2. M7 200-900PiD
    3. M8 200-900 delta
    4. M9 200-900 olddelta.
    Press Ok to continue.
  7. The output type and range must be configured to match the required control output type and engineering range.
    1. The example has 4 to 20mA control output.
    2. Ensure that the control output is connected to the PID output M7.
    3. Enter the engineering range of the measurement input Cal Min = 200, Cal Max = 900. Failure to follow this step will cause incorrect PID factors.
  8. Press finish to close the wizard, connect and program the USC701. The PID control must now be tuned.
  9. (Back to top)

    The Ziegler Nichols Tuning Method

  10. Use the AM702-02 in trim mode to adjust constants I set and D set to minimum values.
  11. Reduce constant PB in small steps until the process just begins to cycle continuously

    and determine the cycle period Pu
  12. Calculate final settings:

Example Tuning and Caculation

  1. I set an example system up with;
    • PBcycle = 6
    • I = 999
    • D = 0
  2. 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.
  3. Reading from the graph PBcycle is about 1.5 cycles for 10 seconds or 6.66 seconds for 1 cycle.
  4. I then calculated PB = 9.6, I = 0.3 and D = 0.833.
  5. I updated the USC program and ran the test again.
  6. As the process was still unstable I then reduced the PB until stable operation was achieved at PB(%)= 11.
  7. 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.

(Back to top)

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

(back to top)

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  

(back to top)

Determine Equation Update Time

When designing a PID controller the rate that the measurements are available for use in the equation is very important.

  1. The equation update time MUST NOT be faster than the measurements are available from the analogue to digital converter.
  2. 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).
  3. The PID algorithm takes 60ms to execute therefor the fastest possible equation update time is 70ms with any input configuration.
  4. The equation update time can run at the same time as the update for one channel.
  5. 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
Help If unexpected results occur when loading the .usc file press back and click on help for instructions.
UAP0025c.usc This program is designed for use with UscConfig 105 or higher.
Add integral reset function.
UAP0025d.usc

This program is designed for use with UscConfig 106 or higher.
Add power on branch and replaced the use of three constants to make then available for use on the AM702 trim menu if required.

  • Con_d has been replaced by Var04
  • Con_i has been replaced by Var01
  • Con_j has been replaced by Var03.