I have a rather niche application of PID control, and I am looking for ideas on how to solve it.


  1. Temperature sensor is externally mounted on a liquid vessel's body --> T_surface
  2. Goal is to control the liquid temperature to a variable setpoint around 35°C --> T_liquid
  3. There are stick-on heaters mounted to the liquid vessel's body --> ability to heat the liquid --> heater_power
  4. The liquid is cooled by just letting the vessel cool down

PID Set Up

I have a PID control algorithm with:

  • Feedback: T_surface
  • Output: heater_power
  • Setpoint: T_liquid

The vessel wall is thick enough that T_surface != T_liquid.

Temperature Offset

The difference in temperature is: dT = T_liquid - T_surface

Note: dT is a function of T_liquid. For example, if:

  • T_liquid = ~30°C --> dT = ~1
  • T_liquid = ~40°C --> dT = ~2

My Implementation

  1. I roughly mapped dT to be linearly related with T_liquid --> offset_value
  2. I set the feedback sensor's value to be T_surface - offset_value. In other words, my input signal is a biased value of the feedback
  3. I tuned my PID loop based on this and it works okay


I realized I am basically trying to tune a PID algorithm to have a steady state offset. The offset is a function of T_liquid. Let's assume I know what I want offset to be. Here are my questions:

  • How can I tune a PID algorithm to have a steady state offset?
  • Can you think of a better way to go about this? (Assume an inability to change the mechanical design)
  • $\begingroup$ What you are describing sounds like feed forward, is that correct? $\endgroup$ – fibonatic May 15 '19 at 8:57
  • $\begingroup$ @fibonatic first of all, thank you for commenting. My understanding of feed forward is that you account for disturbances by adjusting the control loop's input signal. In this case, I am not necessarily accounting for disturbances, more for a steady state offset. $\endgroup$ – Intrastellar Explorer May 16 '19 at 16:40
  • 1
    $\begingroup$ @fibonatic one thing I could do is just do closed-loop control based on T_surface, and just bias the setpoint to be an established/mapped value. That way, I just closed-loop control the surface cleanly, and know that T_liquid varies from T_surface by an offset_value $\endgroup$ – Intrastellar Explorer May 16 '19 at 16:44

Feedback control tries to drive the error, reference minus measured value, to zero. However, in your case the output (the temperature of the outside of the tank, denoted with $T_\text{out}$) does not match the quantity the reference is a desired value for (the temperature of the liquid inside the tank $T_\text{in}$). Since you do have an estimated relation between $T_\text{out}$ and $T_\text{in}$, so $T_\text{in} \approx f(T_\text{out})$, with the function $f(\cdot)$ known.

In order to make the system do what you want (let $T_\text{in}$ go to a desired reference value $r$) it might be easiest to define the error, $e$ as the difference between a "desired value" and "measured value" expressed as the same quantity. When expressing both the "desired value" and "measure value" in terms of the internal temperature you could define the error as

$$ e = r - f(y), $$

with $y$ the measured value of the temperature of the outside of the tank. And $e$ is the signal that you feed into the PID controller. Similarly when expressing both the "desired value" and "measure value" in terms of the external temperature you could define the error as

$$ e = f^{-1}(r) - y, $$

with $f^{-1}(\cdot)$ meaning the inverse of $f(\cdot)$, so $T_\text{out} \approx f^{-1}(T_\text{in})$.

| improve this answer | |

Perhaps you could encode a positive feedback system into your programming. This system would analyze the output of the PID. If the water heater is heating and the water heater was actually heating the water, the water heater would automatically draw more power, and therefore, heat more.

| improve this answer | |
  • 1
    $\begingroup$ Thank you for your suggestion @Jmon. So I can understand, are you proposing to try to closed-loop control the heat transfer into the liquid vessel? $\endgroup$ – Intrastellar Explorer May 17 '19 at 15:59

In my understanding, you are already tuning your PID to have a steady state offset, through your usage of DT, assuming your usage is similar to the first diagram here: PID Theory. Note that the feedback is subtracted from the "set point", which is very similar to what you're doing currently, by creating an offset in the sensors readings to create a kind of offset in the "set point". In theory, this should be sufficient for your current application. Perhaps more tuning of the PID parameters may help improve the plants response from "okay" to "Better than okay".

As for other methods for approaching the problem, I am personally a very big fan of State Space control. Assuming you can find a way to accurately model the system, it is a relatively simple endeavor to find the optimal control gains for your desired state. Although, this can be a bit challenging to properly grasp depending on your background, and creating a model of your plant may be difficult.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.