20.05.2024, 17:48
(20.05.2024, 07:20)admin Wrote: You need to restart the script when heating/cooling mode changes because PID instance (p variable) is only created once the script starts.
Attach an event script to 1/6/4:
Code:name = 'pid' -- resident script name
script.disable(name)
script.enable(name)
Resident script can be simplified:
Code:-- init pid algorithm
if not p then
inverted = not grp.getvalue('1/6/4')
p = PID:init({
current = '5/2/8', -- actual temperature
setpoint = '1/4/11', -- desired temperature
output = '1/4/4', -- valve
inverted = inverted,
})
end
-- run algorithm
p:run()
Thank you very much! I was looking for a solution in that direction, but your proposal is much nicer than mine (and compacter).
Another question: the programmer/installer has made a resident script for each badroom. So, I have 4 scripts like that. Can I combine them into 1 resident script and working with a p1 for room 1, p2 for room2, p3 for room 3 and p4 for room4. Would it be less taxing for the LM?