If a control loop is oscillating, would it be best to increase or decrease the controller gain?
The standard answer of decreasing the controller gain is right for a decaying or growing oscillation in a relatively fast self-regulating loop (loop whose PV quickly goes to a steady value when in manual and disturbances have dissipated). If the oscillation is banging between set point limits of a secondary loop or output limits of any loop, then you could end up with an equal amplitude oscillation for an unstable loop and the best thing to do is to first decrease the controller gain until it settles down.
If the oscillation amplitude does not decay but is relatively constant and the loop is staying well within its set point and output limits, the oscillation is probably a limit cycle caused by stick-slip, or a resolution limit in the control valve. Decreasing the controller gain will not reduce the oscillation amplitude but will make its period longer. Over a narrow time range, this may make the trend appear smoother but the longer oscillation period is less filtered out by downstream volumes and is consequently more likely to appear in the product. Here a well mixed downstream volume divided by the throughput flow acts like a filter time constant.
If you have an integrating loop (a loop whose PV ramps away from the set point when in manual) or a runaway loop (a loop whose PV accelerates away from the set point when in manual), decreasing the controller gain can make the oscillation worse if you were below the low controller gain limit. Note that the oscillations are extremely slow and may not be noticeable over a trend for a single shift. The minimum controller gain for an integrating loop is approximately 4 divided by the product of the reset time and integrating process gain. The minimum controller gain for a runaway loop is approximately the inverse of the process gain.
For integrating loops, if you are near the limit, the controller gain should be increased if the reset time is decreased to prevent an oscillation, which is counter intuitive. With real processes, the dynamics can change so any tuning should be thoroughly tested and the user must be well below the high gain limit that causes instability. Lambda tuning prevents violating the low gain limit for integrating processes. To avoid getting too close to the high gain limit, Lambda must be larger than the largest possible total loop dead time.
There are many important types of loops that have an integrating response besides level, such as batch chemical and fermenter dissolved oxygen, pH, overhead pressure, and temperature. Extremely exothermic batch and continuous reactors (e.g. polymerization reactors) can have a runaway response.