colinl / node-red-contrib-pid

A node-red PID loop controller node intended for the control of real world processes
Apache License 2.0
26 stars 17 forks source link

[question] signs of components #25

Closed avk999 closed 8 months ago

avk999 commented 8 months ago

Hi Colin, I'm happily running home heating system controlled by your PID node. The question is: when I plot the P, I, D components as emitted by the node I see negative values when the output goes up. Is this a bug or a feature?

colinl commented 8 months ago

If you have general questions about the node, I would rather discuss them on discourse.nodered.org if possible please. It is easier for me there. But to answer this one briefly, the sense of the algorithm is that when the output increases the process value is expected to increase, therefore if the process value is too high then the output reduces in order to reduce the process value, so indeed the components may go negative. The individual values are normally in the range -0.5 to +0.5 and the power output calculation allows for that by adding on 0.5 in the calculation power = -1.0/node.prop_band * (proportional + node.integral + node.derivative) + 0.5

avk999 commented 8 months ago

https://discourse.nodered.org/t/node-red-contrib-pid-components-values/82688