Question about 2 PID controllers working side by side

I’m building an system which has:

  1. a heating element working with a dedicated temp sensor (temp1) and a PID Controller (PID1). The heating element needs to sustain a certain temperature (temp1) when enabled.

  2. There’s another temp sensor that measures the air temp (temp2), which also needs to sustain a certain temperature. Presumably, it also needs a PID controller (PID2) as the temp1 is different from temp2 (but controlled by heating element & PID1).

The challenge is that with two co-dependent PID Controllers, I’m not sure how to make PID1 and PID2 work together, so that when temp2 is out of target, then PID2 activates PID1 to sustain temp2. In its turn PID1 would sustain temp1.

I hope this makes sense. Any help would be appreciated.

This is a bit confusing to understand from how it’s written. Are you trying to regulate temperature in two different locations (one temperature sensor per location) with one heating element?

Thank you for a quick response, Kyle. Let me clarify the setup:

  • There’s a water heater that has a heating element and a temp sensor to heat the water to 35C, when enabled. It’ll only be turned on when it needs to heat the ambient environment to 22C (temp2). I’m planning to use a PID controller to control water’s temp level when the heater is on.

  • Secondly, there’s a temp sensor in the room heated by the water heater. The temperature 22C in the room needs to be sustained at a steady level by the water heater (that heats to 35C). I was planning to use another PID controller (PID2) to sustain the temperature in the room.

This would work as follows:

  • the air temperature in the room needs to be 22 Celcius
  • when it falls below it, PID2 controller turns on the water heater
  • the water heater, controlled by PID1, heats up the water, say, to 35 Celcius to heat the air in the room to 22 Celcius.

With PID controllers, I was only able to turn on / off the relays that controll the heater, but need to enable the heaters PID1 + heater element from the room’s PID2 interface. Tried some other outputs to see if they show up in PID config, but wasn’t able to solve it so far.

Let me know if you have any questions, I’ll elaborate.

@KyleGabriel maybe you’ve got a moment to take a look at this? Left some clarificaitons as you asked, but cannot progress without sorting it out…

So you essentially want to use the water heater to regulate the air temperature? Why don’t you use one PID for that?

If only one PID is used to regulate the air temperature by using the water heater as an output, then the water temperature would go beyond the desired temperature value, i.e. the water would easily heat to 60C-70C by the time the air temp reaches 22C-24C.
The goal is to keep the water temperature at a set level in order to sustain the air temp.

I assumed 1 PID controller was needed to keep the water at a certain temp level, and the other one to keep the air temperature. However, I wasn’t able to find the way to choose the water heater (water PID controller + water temp sensor) as an output for air’s PID controller. Maybe there’s a better way, but so far I’m stuck. Would appreciate your further advice…

Unless you’re very familiar with PID tuning, you’re not likely going to be able to successfully get two PID controllers using the same heater to regulate temperature of two different environments. I would suggest you use simple conditional statements to turn the heater on and off based on the various temperature measurements you have available. This can be accomplished with a Conditional Controller Function.

Thank you, Kyle. I’ll check the Conditional route out to see if that works for my setup. It’s a great piece of sotware, well done!