# PID controlling in general and a specific case

**URL:** <https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169>\
**Category:** Hardware\
**Created:** [19 March 2019 08:47 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169 "2019-03-19T08:47:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 08:47 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/1 "2019-03-19T08:47:11Z")

</div>

I hope this is the right category. This isnt entirely Node-RED specific but I cant think of any other forum with as many smart people.

I'm new to PID control and would like to spar about a conondrum.

I have particularly pesky and slow floor heating in our ground floor which consume a lot of the heat in our heating circuit when open 100%. And when it's been at 0% for a while it takes forever (36+ hours) to heat up again. I therefore would ideally like to keep it at between 5% and max 40%.

It's controlled by an electric valve which I can send PID parameters to, but cannot limit at a maximum opening.

Is there a way through setting the Xp, Tn and Tv parameters I can get it into a slow loop which never will hit bottom (0%) or the top (100%) ? As far as I can understand, through reading some articles about PID control and testing a bit, this behaviour could only be created by manipulating setpoints over time (?).

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [19 March 2019 08:52 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/2 "2019-03-19T08:52:33Z")

</div>

If you search the forum there are many posts about PID control. @Colin is the PID guru here, there is a link to a blog post of his explaining it in great detail somewhere too.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [19 March 2019 08:58 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/3 "2019-03-19T08:58:56Z")

</div>

[http://blog.clanlaw.org.uk/2018/01/09/PID-tuning-with-node-red-contrib-pid.html](http://blog.clanlaw.org.uk/2018/01/09/PID-tuning-with-node-red-contrib-pid.html)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2019 09:12 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/4 "2019-03-19T09:12:14Z")

</div>

Are you running the PID in node-red? If so which node are you using (node-red-something)?  
**[Edit]** Also how are you then driving the valve?

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 09:59 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/5 "2019-03-19T09:59:42Z")

</div>

Incidentally, that’s one of the good articles I referred to.😊

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 10:02 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/6 "2019-03-19T10:02:38Z")

</div>

Sadly not using the node which would be easier to tune perhaps. I’m actually manipulating the Xp, Tn and Tv, and setpoints, from NR via KNX-RF to a system of radiator valve actuators and sensors.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2019 10:08 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/7 "2019-03-19T10:08:17Z")

</div>

If the valves are doing the PID control then whether you can limit the output range must be down to whether that feature is supported int the valve. There may be ways round it though.  
Can you read the current percentage output back from the valve?  
Do you measure the current temperature. I presume you do.  
Does the valve have a manual mode where you can control the power directly?

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 10:41 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/8 "2019-03-19T10:41:45Z")

</div>

The interface through the KNX-RF system is such that I can't seem to find a way to just limit the output (/opening) of the valve, and I can't control the power (/movement) directly.

I do read current temperature and current valve opening. And can set Xp, Tn, Tv and setpoint. But the clincher is that this is only in a time window periodically. The system slowly cycles through both battery operated and wired components and reads and sets parameters. So continually watching results and instantly changing parameters is not an option either.

Is it true that generally to get a system to "never" reach 100% or 0% the Xp, Tv AND Tn needs to be "too" high ? And that my only option is to set up the setpoints over and under in a careful schedule to achieve my wanted behaviour of always having some opening but never 100 % ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2019 11:22 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/9 "2019-03-19T11:22:28Z")

</div>

> [@bohtho](#):
>
> Is it true that generally to get a system to "never" reach 100% or 0% the Xp, Tv AND Tn needs to be "too" high ? And that my only option is to set up the setpoints over and under in a careful schedule to achieve my wanted behaviour of always having some opening but never 100 % ?

To be frank I can't think of any way you can limit it and have any sort of effective control. How often can you get/set data?

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 11:31 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/10 "2019-03-19T11:31:39Z")

</div>

At the latest every hour but usually more often. Maybe when the system thinks its pertinent and critical. It's an older Siemens KNX-RF system... but having invested so much in it 10 years ago, and it being quite advanced and working very well for all the normal radiators in the house, it's a shame to throw it out. It considers flow temp, outside temp and barometer and hydrostatic particulars of each radiator and room characteristic.

I'm not looking for "efficient control" but to lessen the effects of 0% or 100%, but if this proves theoretically totally impossible I will have to consider investing in a wired zigbee valve actuator for this particular floor instead so I can fully and manually control it in NR however.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2019 11:39 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/11 "2019-03-19T11:39:40Z")

</div>

Sorry, at only once an hour I can't think of any good ideas.  
If you are willing to change the pipework I suppose you could fit a bypass so that the minimum is 5% and a restrictor so the max is 40%. I guess you might need a valve in the bypass so you could really switch it off when you need to. In fact there is likely an isolator valve already which you could partially close to limit the max even without changing the pipework.

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [19 March 2019 12:47 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/12 "2019-03-19T12:47:26Z")

</div>

Sadly no isolator I think. Old-timey direct pipe from the main circuit and then this valve actuator.

I guess the setting "Actuator running time" is of no help either ? Could it be set to extremely low to make it almost stand still ? What's its relationship to Xp, Tn and Tv ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2019 13:41 UTC](https://discourse.nodered.org/t/pid-controlling-in-general-and-a-specific-case/9169/13 "2019-03-19T13:41:37Z")

</div>

> [@bohtho](#):
>
> I guess the setting "Actuator running time" is of no help either ? Could it be set to extremely low to make it almost stand still ? What's its relationship to Xp, Tn and Tv ?

Not much idea, sorry. Have you got a link to the manual for the device?  
Do you set that to the time taken to fully close/open the valve? In which case it will just be used to keep track of approx where the valve is, and if the controller thinks is at, say 25% and wants to move it to 50% it would drive for 25% of the running time. If so then it has no relationship to the tuning constants. You can't set it too small a value, because it would be just as likely to prevent it coming down far from open, thinking it has driven enough to close it, as it would be to going up far from closed.  
As for Xp, Tn and Tv unless they define exactly what they mean then it can be very difficult to predict the operation of the system. That is why in the algorithm I developed I use equivalents which mean something in the real world.
