Problem with dynamic PID parameter change (node-red-contrib-pid)

#1

Hi all
I am a homebrewing, the process I am trying to control requires the control of an electric pot
with 28 liters of water in which some kg of malts are immersed, at different temperature steps.

To try to keep the temperature I use node node-red-contrib-pid

Each recipe can vary in the quantity of liters of water and kg of immersed malts
An example a receipe step ...
image

For this the 'first time' that I make a new recipe,
I must be able to change the parameters dynamically ( es. Prop_Band ),
to make the T oscillate, as little as possible,
around the value of the setpoint of each step.

My idea is for each recipe to find the right parameters and store them in a 'profile',
which I will use when replicing a recipe.

I tried to dynamically change the Prop_Band value, during the heating process
but I get an abnormal result

TEST RESULT
Initially I set the PB = 5 and the SetPoint = 28 in the PID and everything works fine.

When I try to modify the PB from 5 to 3,
I verify that also the PID set point has been modified,
the PID starts to intervene at 24 and ends at 27

The anomaly that returned is that,
the change in the value of the PB took place correctly,
but the SetPoint has also decreased by going from 28 to 27

I did other tests ...
if I change PB = 2 the SetPoint goes down to 26.5
if I change PB = 1 the SetPoint goes down to 26

DESCRIPTION OF THE ENVIRONMENT SYSTEM
The pot has a 2.8Kw electric heater on the base to heat the water.

A pump is applied to the pan tap which allows the recirculation
of the liquid during operation.

The temperature is read with a probe,
at the exit from the tap, before the pump enters.

Inside the pot, there is a basket with a perforated bottom,
equipped with feet to raise the basket from the bottom,
avoiding direct contact of the malts with the heating elements

#2

Put a debug node showing what is going into the pid node to change the PB and another on the output, both set to show complete message. Post what you see when you try to change the PB.

#3

I entered the debug nodes, here is the result ...

Every 2 seconds the probe temperature is sent to the PID.
Message for PID entry
image

Message for PID input, when I manually start a step, to set the setpoint
image

Message at the exit of the PID, before and after the attempt to modify the Prop_Band.
Between the two messages, there is the message sent to the PID for the PB change

To do the tests, I didn't use the pot, I entered a recipe with low temperatures (SetPoint 28 ° C).
By manually heating the probe, I visually check on the screen, what are the values at which the PID starts and ends working
image

#4

You can see from the debug output that the setpoint has not changed (it is in the output message).
What Ti and Td have you got?

#5

You are right, I have also seen that in the output of the PID, the message, maintains the previous value of the setpoit, but .....
in practice it is not so, in the test, it behaves as if the setpoint had changed (diminished)

You can see from the photo, after changing the PB from 5 to 3 ....
the setpoint is 28, the probe is at 27.4 and the PID output = 0
this is not correct, it should go to zero after the probe reaches 28
image

Setup PID

OUPUT PID

#6

Firstly consider what the definition of setpoint is. The definition is the value that the process will settle out at after equilibrium is reached. It is not (normally) in the middle of the proportional band as that would imply 50% power when the process is on the setpoint. The way a PID algorithm works is to move the proportional band around the setpoint (under the control of integral) to get a stable process with the pv at the setpoint.

Also I see you have Ti set to 1 second. That means that the proportional band will swing wildly about over a few seconds, making it impossible to find the edges of the proportional band in the way you have tried. Set it to 3600 and try again. What value of Ti did you determine gave you good control? I would have expected maybe around 20 minutes for your process (so Ti = 1200).
Did you follow the tuning technique linked to from the node's readme?
http://blog.clanlaw.org.uk/2018/01/09/PID-tuning-with-node-red-contrib-pid.html

#7

Actually I see that you have indeed found a bug in the PID node, so thanks for finding that. The result is that for a short time after changing the PB dynamically it is possible to get exactly the symptom you have found, with the process below the setpoint, but the power output 0. It is not a serious issue as the normal response of the control loop will cause the situation to recover. In normal operation with a well tuned system it is unlikely that this would be seen. However I have raised an issue and will get a fix in today, hopefully. Thanks again.

1 Like
#8

I think I was one of the first to read it, you published it in the old forum ( google groups ),
for me it's like the 'bible' :rofl:
I also translated it into Italian (I tried! :wink:)

Thanks for the support !

#9

I have released v1.1.5 of node-red-contrib-pid with the fix for the proportional band becoming dissociated from the setpoint. Available now from all good npm repositories.

If my guide is your bible then you should know better than to have Ti set to 1 second :slight_smile:
I may have to smite you with a bolt of lightning.

#10

:rofl::rofl::rofl:
:zap::boom:

however there is a reason ... :innocent:
I had this problem a year ago, I thought it was caused by incorrect data being sent to the PID.
A few days ago, I read about the same problem on GITHUB "Problem setting values dynamically # 9" and I intervened, describing my experience

I had modified my program to calculate the Oveshot and T1, as indicated by your document
image
to find a solution to the problem, I subsequently re-modified the calculated values and remained a bit at random :sleepy:

later, I update the node and let you know

#11

Oh, I thought you were the originator of #9 on github, when you joined in I did not notice that you were a new contributor. The original problem on that issue was not the one you have found, it was due to a misunderstanding on the part of the originator.

When you say "remained a bit random" do you mean you are having problems getting it tuned well? If so I will gladly try to help. Your process does not look as if it should be difficult to control.

#12

a year ago ... failing to solve the problem, I gave up the tests :worried:,
without putting back the correct values

#13

true, but it helped me to understand how to send the data correctly to the PID
and this prompted me to try again ...

#14

I did a test with the new version 1.1.5
but I continue to always find the same problem :pensive:

#15

Did you remember to restart node-red?

#16

Yes, after upload,
I turned off and restarted the system (Raspberry)
image

#17

Can you post the debug again so I can see? Set Ti to a sensible value if you have not already done that, to stop that confusing things.
[Edit] Also could you expand the dots on one of them so I can see all the numbers please.

#18

#19

That is odd. What was the PB initially?

#20

PB initially = 5