Reset PID Controller?

Hi there, I have an application in a flow where a vacuum pump has to maintain a certain pressure. Example: Water is in a container that can be drained downwards and is held in place by the negative pressure. A pressure sensor continuously measures the pressure and thus regulates the vacuum pump. If, for example, more water is now added to the container, the pressure increases and the pump adjusts. I installed a PID controller for this (via node-red library "node-red-node-pidcontrol"). There are cases where the pressure suddenly goes so far above setpoint that the PID ramps up to infinity and never comes back. Hence my question, is there a way to reset the PID controller? In the best case from the outside via GUI?

That node hasn't been updated in over six years. You may want to look at one of the other three pid nodes and see if they suit your needs:

Personally I would go for node-red-contrib-pid. But I am the author so you might consider me biased.


I am used to PID control using industrial application based on PLC architecture.
The problem you describe seems to me linked to how the intergral term limitation is managed inside the PID block/node.
The problem is that the output of the controller is always limited to a range but that the integral term can continue to increase when big deviation to setpoint and it take a very long time to recover..
This is why in industrial PID block, the integral term is frozen when the total resulting output goes out of the range. I am not sure that this has been implemented in the PID node.
In my industrial practice, we have also some cases where the range limit are variable, in that case the integral term should be recalculated to have better dynamic.

Pierre RUWET

There certainly is integral locking in node-red-contrib-pid to stop this happening. Looking at the code for the node @vincesnider is using it does not appear to have integral locking, so I suspect you may well be right as to the cause of the problem.

What do you mean by that (though I think this is probably off topic here).

Hello Collin, I did not have time to investigate in the code of the nodes. But I am happy to know that you did it and that have foreseen the integral locking when output reach the limit of output range in the node your wrote.
What I mean with variable range is that sometimes the 0 1 range of the output could be limited, for example if the actuator range depends on other condition.
For example the actuator could be a fan speed and the maximum fan speed could depend on air temperature.
Another case is when a controller act to control the heating of gas with electrical heater using thyristor control and that another controlle check the heating element temperature to avoid over temperature. In that case the over temperature controller will act on the high limit of the heating PID controller output.
In the case this range can change, the way the integral locking is done can create some trouble ( I agree this is out of scope of the question of this topic)

Pierre RUWET

OK, understood. Yes, that certainly could be problematic.

Yes, that's my problem. I get continuous input values from the pressure sensor (Range is here 6100 - 6400, these are millivolts, but not important here). These values go into the PID controller and are passed on to the pump as speed. Unfortunately, values of 0 and 1 are not sufficient here.

I don't understand what you mean. Where are 0 and 1 not sufficient? It is only if the end to end range of the output device varies over time that it should be an issue. Even then there are probably ways around the problem.

I want to pick up on what piwi447 said. Output values of 0 and 1 turn my pump on or off. But I need speeds adjusted to the pressure that the sensor supplies me with.

Do you have a speed controller for the pump? If so then how do you set the speed from noder-red?

Further to that, node-red-contrib-pid does not just output 0 and 1, it outputs values between those two which you should use to control the speed of the pump.

Hi Colin, I am trying to get the PID controller to work with a power inverter. I need to control the inverter dynamically, not with 1 and 0. Which parameter do I use ?

payload: 0

pv: 532

setpoint: 200

proportional: 332

integral: 3.509600000000014

derivative: 0

smoothed_value: 392.4

_msgid: "0149a56cd3b957e8"


Sorry, I am not sure what you mean. The node should output values between 0 and 1, not just the values 0 and 1.

Hi Colin, thanks for your reply. Maybe if I can give you some background as to what I would like to accomplish you could advise me. I am trying to get your node-red PID node to work with a battery inverter. I want to give a setpoint (800) watts to the PID controller. The feedback I get from the Grid meter is example (400) watts. The difference (400) watts between the two should be sent as payload to the Inverter battery controller to charge the batteries with 400 watts. If the grid meter exceeds the setpoint of 400 watts, the battery must discharge to keep the grid at the required setpoint.

I have it working to the point were the setpoint is trying to be reached, but the controls are very aggressive and shoot over and under and over compensate. How can I get the controls stable?

The variable between 0 – 1 only seems to give an in between value if I set the Proportional Band to 1000. Example 0,34. This I have to multiply a value so I can control the inverter with values (400 charging) and (-800) discharging.
Can you send an example FLOW to see what I am doing wrong? Thanks

That does not look like a system that should be controlled with PID. When you change the value sent to the inverter how quickly does it have effect?

generally about 500 watts a second, what other suggestions would you have? I have another 6 weeks to come up with some kind of solution to this problem.

after allot of time and trial by error I have it stable, now I have to get the speed up.

If it responds in subsecond time then pid with node-red is unlikely to work. It is too fast, unless you are able to sample the meter values many times a second.

You said

Why don't you just do that then? Send the difference to the controller.

If that is too aggressive then do something simple like taking half way (or three quarters, or whatever) between that value and the current value so that it moves towards it over a number of readings. How often do you get a value from the meter?

Hi Colin, I have got it working with the PID node, it works really well now. I first tried what you suggested with difference calculation, but it was all over the place. Then I experimented with switching the proportional band between 0 and 1 and suddenly it started tracking unbelievably well. What would it mean for the controller (0 or 1) most of the other settings I have tried results in the payload being 0 or 1 and nothing in between. Now it controls between 0 =(400 watts charging) and 1 = (-800 watts discharging),

other decimals between are now working 0.5 will be somewhere in between the 400 and the -800. I would just like to understand what the “proportional Band” means if you switch between 0 and 1?

Thanks for you replys

Can you export the relevant section of the flow so I can see what you have done please?