# Node-red-contrib-pid delete I-contribution

**URL:** https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260
**Category:** General
**Tags:** function-node
**Created:** [19 August 2024 06:08 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260 "2024-08-19T06:08:14Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jan-garfield](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jan-garfield/32/93623_2.png) [@jan-garfield](https://discourse.nodered.org/u/jan-garfield)
#### Post date: [19 August 2024 06:08 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/1 "2024-08-19T06:08:14Z")

</div>

Hi everyone,

I'm using the node-red-contrib-pid and that works quite well.

My heating system has long heat up times (20min to 2hr).  
During the heating period, the I-contribution gets summed up and while reaching the setpoint the I-contribution is too high for the actual temperature and I get a large overshoot.

I worked with two pid controllers, one P-controller for the heating and one PI-controller for the stabilization period.  
But as soon as the 2nd (PI) controller is switched on, the latest (random) I-contribution is still active and gets part of the control process and I get a large overshoot.

I tried different workarounds but it all comes down to the latest stored I-contribution in the pid-controller.  
Is there a way to set and/or delete the active I-contribution?  
Or is there another way of solving the problem?

Regards Jan

---

<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 August 2024 08:51 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/2 "2024-08-19T08:51:12Z")

</div>

> [@jan-garfield](#):
>
> During the heating period, the I-contribution gets summed up and while reaching the setpoint the I-contribution is too high for the actual temperature and I get a large overshoot.

That should not happen if the loop is correctly tuned. There is a [tuning guide](http://blog.clanlaw.org.uk/pid-loop-tuning.html) linked from the node's page on the node red flows site. If you have not already worked through that then it is probably worth doing so.

> [@jan-garfield](#):
>
> I worked with two pid controllers, one P-controller for the heating and one PI-controller for the stabilization period.

Again, that should not be necessary if the loop is correctly tuned. Get rid of the second pid node, it will not be necessary.

If you believe that it is correctly tuned, but you still get the overshoot then show us a chart showing the output of the pid node and also the current temperature, during the startup and stabilisation. You may have to scale the power output so that it appears correctly on the chart.

---

<div class="post-metadata">

### Author: ![pandoras\_node](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pandoras_node/32/91739_2.png) [@pandoras\_node](https://discourse.nodered.org/u/pandoras_node)
#### Post date: [19 August 2024 12:49 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/3 "2024-08-19T12:49:13Z")

</div>

If your heating system have long heat up time then I-time can be turned off by putting it to a very high value as you do not really need it for slow moving systems. So you only need your P controller pid and nothing else

---

<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 August 2024 13:03 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/4 "2024-08-19T13:03:12Z")

</div>

node-red-contrib-pid has integral locking when the temperature is well away from the setpoint in order to prevent integral windup.

> [@pandoras\_node](#):
>
> I-time can be turned off by putting it to a very high value as you do not really need it for slow moving systems. So you only need your P controller pid and nothing else

Without an appropriate I setting the process will take a very long time to settle exactly onto the setpoint.

---

<div class="post-metadata">

### Author: ![pandoras\_node](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pandoras_node/32/91739_2.png) [@pandoras\_node](https://discourse.nodered.org/u/pandoras_node)
#### Post date: [19 August 2024 14:32 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/5 "2024-08-19T14:32:17Z")

</div>

If it is for room heating (which i assume) i think he is better off just using P-controller for simplicity. That is atleast what im doing, and that works very well.

P band around 3, and I-time to very high value. Initial integral at 0 of course.

---

<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 August 2024 14:41 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/6 "2024-08-19T14:41:50Z")

</div>

> [@pandoras\_node](#):
>
> i think he is better off just using P-controller for simplicity.

Without tuning the loop correctly and seeing the result it is impossible to know what would be best in any particular case.

---

<div class="post-metadata">

### Author: ![jan-garfield](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jan-garfield/32/93623_2.png) [@jan-garfield](https://discourse.nodered.org/u/jan-garfield)
#### Post date: [20 August 2024 07:04 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/7 "2024-08-20T07:04:22Z")

</div>

@ Colin, @ pandoras\_node

Thanks for your advice. I tuned the PID controller already but at first, I try to do the PID tuning again and keep some records. It will take me a couple of days to do it.

---

<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: [20 August 2024 07:17 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/8 "2024-08-20T07:17:54Z")

</div>

Feel free to post the results as you go and I will offer advice.

---

<div class="post-metadata">

### Author: ![jan-garfield](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jan-garfield/32/93623_2.png) [@jan-garfield](https://discourse.nodered.org/u/jan-garfield)
#### Post date: [10 October 2024 06:07 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/9 "2024-10-10T06:07:43Z")

</div>

Sorry about the delay but I didn't have the time to perform the test. I will do it in the near future.

---

<div class="post-metadata">

### Author: ![khanzain](https://avatars.discourse-cdn.com/v4/letter/k/df705f/32.png) [@khanzain](https://discourse.nodered.org/u/khanzain)
#### Post date: [10 October 2024 06:29 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/10 "2024-10-10T06:29:55Z")

</div>

Hi Jan,

It sounds like you're dealing with a classic issue in PID control, especially in systems with long heat-up times. Here are some suggestions to manage the integral contribution and mitigate overshoot:

1. **Reset Integral Windup** : If the `node-red-contrib-pid` allows it, look for a method to reset the integral term when switching between controllers. This could be done by manually setting the integral value to zero in your PI controller when it takes over.
2. **Anti-Windup Strategies** : Implement an anti-windup mechanism. This can involve clamping the integral contribution within a specific range or only allowing the integral to accumulate when the error is within a certain threshold.
3. **Gain Tuning** : Experiment with tuning the PID gains, particularly the integral gain. Lowering the integral gain can help reduce overshoot, though it may slow the system's response.
4. **Using Conditional Logic** : Use a function node to manage the transitions between your P and PI controllers. You can switch the control strategy based on the current state of the system, ensuring that the I-contribution is handled appropriately.  
If you provide more details about your current implementation, I might be able to suggest more specific changes. Good luck! for better understanding come to this site [https://iqratechnology.com/](https://iqratechnology.com/)

---

<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: [10 October 2024 08:09 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/11 "2024-10-10T08:09:22Z")

</div>

> [@khanzain](#):
>
> **Reset Integral Windup** : I

node-red-contrib-pid includes logic to prevent integral windup. Resetting the integral is unlikely to be necessary.

> [@khanzain](#):
>
> **Anti-Windup Strategies** :

Again, such logic is already implemented in the node.

> [@khanzain](#):
>
> **Using Conditional Logic** : Use a function node to manage the transitions between your P and PI controllers.

Such strategies should not be necessary with an approximately linear process such as simple heating. It can be necessary with significantly non-linear processes such as exothermic reactions where the transfer function of the process changes significantly dependent on the current conditions.

You missed out the true number 1, which is to make sure the PID loop is optimally tuned. If it is then other strategies are rarely necessary.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [8 January 2025 08:09 UTC](https://discourse.nodered.org/t/node-red-contrib-pid-delete-i-contribution/90260/12 "2025-01-08T08:09:55Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
