LogicMachine Forum
Multiple PID Termostats - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Multiple PID Termostats (/showthread.php?tid=2920)



Multiple PID Termostats - MariusB - 22.10.2020

Hello

I'm a total newbie on scripting, but i'm trying to learn, so please bear with me Smile

I want to add more than one PID termostats. Can i put more than one PID in one Resident skript?

The case is: 
I have 2 bedrooms with one temp sensor, and one heater controlled by a KNX in each room. The heaters should only be controllable by visualization.

This is the code for one heater, and it works great, but where can i put in the code for the second heater?


Code:
-- init pid algorithm -- Panelovn Mikkel if not p then   p = PID:init({     current = '2/2/0',     setpoint = '2/2/7',     output = '2/2/6'   }) end -- run algorithm p:run()


I have tried to put it in on the bottom of the code, and inside before p:run()

Only the first one works. The codes are identical for both heaters (except group adresses)

Thanks! Big Grin


RE: Multiple PID Termostats - admin - 22.10.2020

Use different variable name for each PID. Do a full script restart via disable/enable after making changes.

Code:
if not p1 then   p1 = PID:init({     current = '2/2/0',     setpoint = '2/2/7',     output = '2/2/6'   })   p2 = PID:init({     current = '3/2/0',     setpoint = '3/2/7',     output = '3/2/6'   }) end -- run algorithm p1:run() p2:run()



RE: Multiple PID Termostats - MariusB - 22.10.2020

Thank you!