This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Multiple PID Termostats
#1
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
Reply
#2
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()
Reply
#3
Thank you!
Reply


Forum Jump: