Embedded PID Temperature Control, Part 6: Ziegler–Nichols Tuning

In this article we will use a simple, proven tuning procedure to find effective values for proportional, integral, and derivative gain.

Supporting Information

  • This project makes use of a custom-designed PCB; please refer to Custom PCB Design with an EFM8 Microcontroller for guidance on incorporating EFM8 devices into your custom hardware.
  • You can find a brief overview of thermocouples along with some general information about the MAX31855 in Make an EFM8-Based System for Monitoring and Analyzing Thermocouple Measurements.
  • An Introduction to Control Systems: Designing a PID Controller Using MATLAB’s SISO Tool
  • Negative Feedback, Part 1: General Structure and Essential Concepts
  • This article introduces Scilab.
  • Two previous articles provide information on incorporating USB communication into an EFM8 project: Communicating with an EFM8 Microcontroller via USB and EFM8 Sound Synthesizer: Playing Melodies via USB.


Before we get started, here is the PID control system diagram presented previously:



And here are PID-related portions of the schematic:




The Limitations of Guess-and-Check

In the previous article we employed some basic system analysis followed by crude experimentation to determine workable PID gain parameters. The resulting performance was quite good—but then again, we only tested the system with one specific control task, so we don’t know much about what the controller might do under different operating conditions. We also don’t know how much better the performance could be. It’s all well and good to be satisfied when you see adequate performance, but what if the system could be significantly improved simply by changing the gain values? The guess-and-check approach is also rather impractical, or at least tiresome. The process was time-consuming even with this little experimental temperature controller—what would you do if each control run took an hour instead of a few minutes? My point here is that efficient, effective PID tuning is an essential part of control-system design.
It should come as no surprise that the people designing jet fighters and Mars rovers need something way better than guess-and-check. Sophisticated PID software packages or simulation environments are probably the method of choice for most modern control systems; we, on the other hand, will use a simple, time-tested technique known as the Ziegler–Nichols method.

Ziegler–Nichols

This procedure was first described in a paper published in 1942—credit to Ziegler and Nichols for coming up with a tuning method that has survived almost 75 years of overwhelming technological development. The process starts with a proportional-gain-only system. You increase the P gain until the system exhibits oscillations that are sustained (i.e., stable in terms of amplitude) and regular (i.e., stable in terms of period); the oscillation does not need to be centered around the setpoint. This is the only tiresome part of the Ziegler–Nichols method. The rest is just math.
Once you have sustained, regular oscillation, you record the proportional gain and measure the oscillation period. These values are referred to as the ultimate gain (KU) and the ultimate period (PU), respectively. Now you calculate KP, KI, and KD according to the following table:


KP
TI
TD
P-only control
KU/2


PI control
KU/2.2
PU/1.2

PID control
KU/1.7
PU/2
PU/8

Note that the integral and derivative columns are labeled TI and TD instead of KI and KD. These “T” variables refer to the time constant used when calculating the integral or derivative. For our discrete-time controller, we use the following relationships to determine KI and KD:

where T is the PID interval, i.e., the amount of time between successive executions of the routine that calculates the PID output and updates the control circuitry. The current version of our temperature controller uses a PID interval of 2 seconds.

Seeking Oscillation

So first we need to find the ultimate gain and period. Feedback systems often burden engineers with the problem of preventing oscillation; there is something relaxing about encouraging oscillation and even feeling a sense of satisfaction when it occurs with sufficient regularity.
In the previous article we saw that a P-only system with KP = 70 does not produce stable oscillation:



So let’s increase KP to 90 and see what happens.



This is looking better, but the amplitude of the oscillations clearly decreases over time. Let’s try KP = 100:



I would consider this borderline. The oscillations are regular but not quite sustained (the decreasing amplitude is not really apparent until the last three cycles). Here’s KP = 110:



This looks good to me. I don’t notice any significant irregularity or reduction in amplitude. So we will say that the ultimate gain is 110.

As indicated in the following plot, the ultimate period is about 55 seconds.




Calculations

The first table shows the Ziegler–Nichols values for the proportional gain, integral time constant, and derivative time constant assuming KU = 110 and TU = 55 seconds. The second table has gain values instead of time constants for the integral and derivative terms, assuming that the PID interval is 2 seconds. All values in the second table are rounded to the nearest integer; these are the values that we will actually use in the system, which does not support non-integer gains.


KP
TI
TD
P-only control
55


PI control
50
45.8

PID control
64.7
27.5
6.9


KP
KI
KD
P-only control
55


PI control
50
2

PID control
65
5
223

Results

We will compare the performance of different system configurations based on convergence time, which we will define as follows: the interval between the time at which the measured temperature first reaches the setpoint and the time at which the measured temperature remains directly on top of or immediately adjacent to the setpoint line. (This convergence criterion corresponds to a range of about 1°C above or below the setpoint temperature.) We want the interval to begin when the measured temperature first reaches the setpoint (rather than at the beginning of the control run) because this should minimize errors associated with variations in the initial system state (the dominant concern being variations in the measured temperature at the beginning of the control run).
First let’s look at the Ziegler–Nichols P-only system:



Unsurprisingly, this system doesn’t even converge. There’s only so much you can do with a P-only system.
Here is the Ziegler–Nichols PI system:



This is good—probably about the best we can do without any derivative gain. Actually, after all the time I have spent experimenting with this system, I cannot remember a better PI control run. As marked in the plot, the convergence time was 198 seconds. Note also the reasonable amount of overshoot. It’s important to keep in mind that the Ziegler–Nichols method includes a tuning procedure specifically for PI control because in many situations it is acceptable or even preferable to use only proportional and integral gain. Derivative action can be problematic when the system is susceptible to major disturbances or noise in the measured variable.
Now we’re ready for the full PID:



Nicely done, Ziegler and Nichols. This far surpasses any control run I’ve seen so far. The convergence time has decreased from 198 seconds to 43 seconds, and the overshoot has increased by only about 1°C. Despite what I said above about the dangers of derivative gain, it is clearly beneficial in this system. I suppose this is not too surprising—we have no major disturbances, and there is not much noise in the measured temperature (in part because the temperature measurements are effectively filtered by the limited resolution of the MAX31855 and the relatively long PID interval).
One weakness with the standard Ziegler–Nichols approach is the overshoot. In our system, and many other systems, this amount of overshoot is no problem. But there are situations in which overshoot is unacceptable—an extreme example is a substance that will ignite if the temperature goes too far above the setpoint. So before we finish up, we’ll look at tuning parameters that are intended to minimize overshoot. This article from Microstar Laboratories includes a table with the parameters for this “no overshoot” tuning method, as well as for two additional methods that differ from the standard Ziegler–Nichols technique.


KP
TI
TD
No overshoot
KU/5
TU/2
TU/3

The corresponding rounded gains are KP = 22, KI = 2, and KD = 202. Here are the results:



The method succeeded in eliminating overshoot, to the serious detriment of convergence time. We can’t directly compare this run to previous runs because our convergence-time rule doesn’t work when the measured temperature never crosses the setpoint, and because this run never quite converges according to our previous criterion. But we can get a general idea from the overall time to near-convergence. With the Ziegler–Nichols PID system, the overall time to convergence was 134 seconds, whereas the “no overshoot” PID system comes very close to convergence at 275 seconds.

Conclusion


We now understand the value of proven tuning methods. We had great success with the Ziegler–Nichols approach, but other methods are available. With this particular temperature controller, the Ziegler–Nichols procedure achieved performance that looks close to optimal. However, it’s important to understand that there is nothing magical about Ziegler–Nichols or any other method. If the system’s performance is not adequate, then the gain values generated by the method become a starting point for further observation and refinement.
Previous
Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.
Related Posts Plugin for WordPress, Blogger...

Label

KITAIFA NEWS KIMATAIFA MICHEZO BURUDANI SIASA TECHNICAL ARTICLES f HAPA KAZI TU. LEKULE TV EDITORIALS ARTICLES DC DIGITAL ROBOTICS SEMICONDUCTORS MAKALA GENERATOR GALLERY AC EXPERIMENTS MANUFACTURING-ENGINEERING MAGAZETI REFERENCE IOT FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT VIDEO ZANZIBAR YETU TRANSDUCER & SENSOR MITINDO ARDUINO RENEWABLE ENERGY AUTOMOBILE SYNCHRONOUS GENERATOR ELECTRICAL DISTRIBUTION CABLES DIGITAL ELECTRONICS AUTOMOTIVE PROTECTION SOLAR TEARDOWN DIODE AND CIRCUITS BASIC ELECTRICAL ELECTRONICS MOTOR SWITCHES CIRCUIT BREAKERS MICROCONTROLLER CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES CAMERA TECHNOLOGY GENERATION WEARABLES BATTERIES COMMUNICATION FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE NUCLEAR ENERGY CONTROL SYSTEM FILTER`S SMATRPHONE BIOGAS POWER TANZIA BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT cartoon CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP ENERGY SOURCE FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR 555 TIMER CIRCUITS AUTOCAD C PROGRAMMING HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY DEFECE & MILITARY FLUORESCENT LAMP HOME AUTOMATION INDUSTRIAL ROBOTICS ANDROID COMPUTER ELECTRICAL DRIVES GROUNDING SYSTEM BLUETOOTH CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR USB AUDIO BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS ELECTRICAL LAWS HMI[HUMANI INTERFACE MACHINES INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS CONTROL MOTION ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS APPS & SOFTWARE BASIC AC THEORY BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE RECTIFIER AND CONVERTERS SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS BUILDING SERVICES COMPRESSOR CRANES DC MOTOR DRIVES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION LAPTOP THERMOCOUPLE TRIGONOMENTRY REFERENCE UART WIRELESS BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING FILTER DESIGN HARDWARE INDUSTRIAL DRIVES JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER SCIENCE VALVE WWE oscilloscope 3D TECHNOLOGIES COLOR CODES ELECTRIC TRACTION FEATURED FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER MATERIAL PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF