colinl / node-red-contrib-pid

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

Ability to change settings dynamically seems to be broken #34

Closed NorbNorb closed 1 month ago

NorbNorb commented 2 months ago

Hi @colinl

I checked the documentation and older issues here but still think there's something broken with the possibility to change the settings dynamically.

Here's what I'm trying to do: Using your example from another topic, I try to change, let's say, t_integral from 18 to 60. When I hit the inject button the message (containing a proper topic and payload) is sent to the PID node. However, when I double click on the PID node the old setting is still visible (18).

1

Click to show example nodes

`[{"id":"51cd26c7.8d53d8","type":"PID","z":"d7ff0732.2f81d8","name":"","setpoint":"10","pb":"20","ti":"18","td":"5","integral_default":"0","smooth_factor":"0","max_interval":600,"enable":"1","disabled_op":"0","x":396.4285888671875,"y":545.2857666015625,"wires":[["c7e53e5d.c80b88"]]},{"id":"c7e53e5d.c80b88","type":"debug","z":"d7ff0732.2f81d8","name":"Never NaN! Yay.","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":520.4285888671875,"y":613.2857666015625,"wires":[]},{"id":"7b90a3b5.51797c","type":"inject","z":"d7ff0732.2f81d8","name":"PV 20.5","topic":"","payload":"20.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":139.5,"y":484,"wires":[["51cd26c7.8d53d8"]]},{"id":"eb05310f.3d5508","type":"inject","z":"d7ff0732.2f81d8","name":"setpoint","topic":"setpoint","payload":"25","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":136,"y":528,"wires":[["51cd26c7.8d53d8"]]},{"id":"762c92c8.5f77ac","type":"inject","z":"d7ff0732.2f81d8","name":"prob band","topic":"prop_band","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":147,"y":569,"wires":[["51cd26c7.8d53d8"]]},{"id":"9674c9ae.13e5d","type":"inject","z":"d7ff0732.2f81d8","name":"Ti","topic":"t_integral","payload":"60","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":136,"y":613,"wires":[["51cd26c7.8d53d8"]]},{"id":"547c4f40.7f62d8","type":"inject","z":"d7ff0732.2f81d8","name":"Td","topic":"t_derivative","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":137,"y":655,"wires":[["51cd26c7.8d53d8"]]}]`

My expectation is that the setting changes to 60 and the new value is shown in the UI.

I tested this on Node-RED v4.0.2 and v3.1.10.

colinl commented 2 months ago

Dynamic properties are dynamic. A dynamic change does not change the configured value (which is what you see when you open the node), it changes the value it is currently using.

NorbNorb commented 2 months ago

Dynamic properties are dynamic. A dynamic change does not change the configured value (which is what you see when you open the node), it changes the value it is currently using.

I understand what you're saying. So my assumption was wrong that these values in the UI are updated when it receives a message, but instead these are just the initial values. So there's no (built-in) way in the UI to see what values are used at the moment, right?

colinl commented 2 months ago

So there's no (built-in) way in the UI to see what values are used at the moment, right?

No need as you already know the current value, since you have just told it to use that value.

colinl commented 2 months ago

Why do you want to change the integral time? That is an unusual thing to need to do.

NorbNorb commented 2 months ago

In my use case, I have a UI (dashboard) where the user can fine-tune the parameters of the PID by entering the desired value in a text input node. After changing the parameters, I usually wait for hours to see how the changed values affect the outcome.

I was just confused when I looked in the PID node to find non-changing values for these settings.

So it means that I have to store the applied settings persistently outside of the PID node. It's not a problem, now that I know. As said, it's just confusing not to see what settings the node currently operates on when you're in the editor.

colinl commented 2 months ago

OK, so really the user wants to adjust the config permanently, but without using the editor. You can do that using the node-red admin api which allows you to modify a node's config permanently, in the same way as you would do manually by opening it in the editor, editing it and then deploying it.