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

Oh, just noticed that you had max sample interval set to 0. Is that still like that? That is not a sensible value, put it to 60 for the moment.

Found the problem !!!!!
with the valueimage
operation is correct,

Great result !

Excellent.
There really aught to be more validation of sensible values in the node config.

what value do you suggest?
60 -> ??

The max sample interval tells the algorithm that if longer than that period has elapsed then there has been a problem with getting process values, so you should set it rather longer than the longest interval you would expect between samples. The value has no effect on the control unless there is such a gap in samples, in which case it helps the algorithm to cope with that. If you are expecting samples at two second intervals then you could set it much lower than one minute, but it doesn't matter much what you set it to. The main purpose is so that if, for example, there is some problem with the system and no samples are available for an hour that the algorithm does not get confused when data suddenly arrives again. In your position I would probably just leave it at 60 seconds.
As a matter of interest, how are you driving the heater? Are you using node-red-contrib-timeprop? Relay or SSR? Also what temperature sensor are you using?

This is my block diagram of the control unit for pot management
image

yes, use time_prop, this is the test config ( for the moment )
image

To manage the power circuit, I use an SSR

The temperature sensor is a DS18B20
image

between the PID node and time_prop, I inserted a function node ( Check minimun ), to manage the values when they are too small.image

Too small values, for example 0.15, produce a too-low pot ignition time, which has no effect on a volume of about 30 liters of water / malt

To limit damage to the SSR, with frequent switch-offs, I decided to limit the smallest output value from the PID to 0.2

In practice, the output value of the PID, after the function node,
can take the values 0 , 1 or vary between 0.2 and 1

Excellent stuff, very interesting. My only query would be whether you need to switch it as fast as 10 seconds. When you did the tuning runs about what frequency did you find the process ringing at?

... 10 Sec

I did, only two tests, with the pot at full load.

A test with water only (28 Lt), reaching and maintaining the setpoint, very excellent, perfect !

The second test, with all the ingredients, did not go well,
because I did not reach the set point, due to the too many short starts, without effect,
when approaching the set point.
The PB = 5 with only water, it was fine, at full load NO ( PB too big )

Now, that the dynamic modification of the PB works,
I can continue with the calibration of the system.

I added two fields to the control panel for dynamically change
the PB and the 'PID minimun value' during the next test
image

... I will add an additional field, to dynamically change on the TimeProp, 'Cycle Time' value to a test in progress

Did you not do the initial startup in on/off mode as in the tutorial? That will show you the natural frequency of the process, which is a useful thing to know.
You will need to chart the process and power in order to check how well it is performing. That is the only way you will understand fully what it is going on.

I am sure you will find that you can push the 10 second cycle time up, and hence also the trigger period, which will be better for the SSR and may allow you to remove the 0.2 min power feature (as the min On time is the trigger time). But without seeing how it performs on a chart one cannot tell.

I agree with you
The graphs are

  1. from panel
    image
  2. from Grafana ( DB Infllux )
    image
    zoom

I just have to find the time to make the next beer! :beer:

Colinl , in the node-red-contrib-timeprop ,
is it possible to modify Cycle Time, with an incoming message?
Thanks !

No, there should be no need to change it dynamically.
To understand the small oscillations you need to plot the pid output also. In fact plot the value into the timeprop node to rule out your function as a cause.
With the power plotted too it will be possible to determine whether it is the control that is doing it of if that is just natural fluctuations caused by some feature of the process.
[Edit] Don't make the power go full scale on the grafana chart, just make it a couple of your divisions, othewise it will be too difficult to see what is going on.

Just want to point out that a PB that is too large will not prevent the loop attaining the setpoint, it will just take longer. The time that it takes will depend on the Integral time and the PB. Looking at the graph you posted it looks to me as if Ti is much too large, but without seeing the power on the chart too, and without seeing the startup response with the PB set to 0, which gives a first estimate of the performance of the process, it is not possible to be certain.
I suggest your best course of action would be to tune it for mimimum quantity first. Then for the larger quantities you may have to increase Ti a bit as the time constant of the process will be longer. Having done that I will be surprised if that value of Ti does not also give perfectly acceptable performance at minimum load. It should not be necessary to change PB as the Gain of the process will not be changed by changing the quantity, only the time response will be changed.

hi Colin
Thanks for the suggestions
I added the PID output to the graph (Grafana),
when I can redo a beer :beer:,
I will publish the results here

You can tune it with just water, it won't make a huge difference.

Unfortunately it is not so, there is a lot of difference.

All homebrewers who have used a PID system, to control the process, tell, that they have verified that it is not possible to calibrate the PID, trying with ONLY Water

Watch this video at minute 1:20, it can help, to understand the difference
https://www.youtube.com/watch?v=Vtc18aCk4YQ&t=311s

That didn't tell me why it should make a big difference. Can you explain more please?
Obviously you should add extra water to make up about the same mass as the missing ingredients. But alternatively you could use spent ingredients while tuning. There is no way you will tune it well at the same time as trying to brew. It may well take a five or ten goes to get it right.

system A: only 25Lt of water
system B: 25 lt water + 5kg ground malt grains
B with respect to A, has a greater volume, different density, different thermal inertia.
The setup of A does not go well with B

... you are right
possible solutions :

  1. "Add extra water to make up the same mass as the missing ingredients."
    Yes, but how much, how much water should I add to replace 5kg of malt?
    It is not easy to determine it

  2. After finishing the brewing process, re-using the exhausted malts, I add the water again and repeat the process to determine the correct parameters.
    I can repeat a tuning, it only takes time

  3. I use the parameters found with the test with water only, as starting parameters and using the possibility to vary the parameters dynamically, I find the correct setup.

I chose the solution 3

Colin, I am aware that this process is not the most suitable to be regulated with a PID system.
The critical point is that the 'system' is not always the same from time to time, I don't always make the same beer, it can change the quantity of water and the kg of grains

It is perfectly well suited for PID control. Many industrial processes are much more variable than this. All I can say is that the chart you posted of the full cycle shows a process that is not particularly well tuned. Also the fact you say that you have to change the proportional band based on the position in the cycle shows that it is not well tuned. If you want assistance with the tuning show me what it does when you switch on from cold with reused malts with the the PB set to 0 (which makes it on/off control) and the setpoint set midrange of the required values. If you are happy with how you currently have it tuned that thats fine too.

I know a lot more about drinking beer than brewing it, but according to this page, the specific heat of malt is 0.44 relative to water. (Some sources report it slightly smaller, depending on the moisture content of the malt.) So in your tests, you should be able to replace malt with water weight-for-weight at the ratio of about 0.4 : 1. Good luck.