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.

Underfloor Water heating - Night lowering
#1
Hi!

I am using PID script for UFH. And i want to have 2 adjustable setpoint temperatures for day/nighttime.
is this possible? 
Another alternative is to use the current setpoint temperature, but lower it by ie 4 degrees in night time.
My current script:

-- init pid algorithm
if not p1 then
  p1 = PID:init({
    current = '1/5/41',
    setpoint = '1/5/21',
    output = '1/5/1'
  })
end
Reply
#2
Hi,

You need to create a event based script that has 2 setpoints as input and a output that is given a value by the day/night logic to set one of the 2 inputs to the output. The output can then be used for the PID.

BR,

Erwin
Reply
#3
You can modify PID library compute function like this. Then you need to specify night_mode (boolean, true = night mode) and setpoint_night (float16 or similar) addresses in PID init. After that restart your script via enable/disable so new library and parameters are loaded.

Code:
1234567891011121314151617181920212223242526272829303132333435
function PID:compute()   local params, current, setpoint, deltasc, deltain, output   params = self.params   -- get input values   current = grp.getvalue(params.current)   setpoint = grp.getvalue(params.setpoint)   if params.night_mode and grp.getvalue(params.night_mode) then     setpoint = grp.getvalue(params.setpoint_night)   end   -- delta between setpoint and current   deltasc = setpoint - current   -- calculate new iterm   self.iterm = self.iterm + params.ki * self.deltatime * deltasc   self:clampiterm()   -- delta between current and previous value   deltain = current - self.previous   -- calculate output value   self.output = params.kp * deltasc + self.iterm   self.output = self.output - params.kd / self.deltatime * deltain   -- write to output   self:setoutput()   -- save previous value   self.previous = current   return self.output end
Reply


Forum Jump: