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.

Outside compensation curve
#1
I have tried to make an outside compensation curve for a heating system in the FB editor, but do not find out completely of unwanted blocks that are most powerful to use.
I need to write from four groups
-10 ° C = 45 ° C
-5 ° C = 40 ° C
0 ° C = 35 ° C
5 ° C = 30 ° C
In order to get a set point out of what outdoor temperature it is, is this possible?
Reply
#2
Do you really need a curve here? From your data it looks like simple linear compensation, for each 5 degrees of temperature the setpoint is lowered by 5 degrees:
Code:
setpoint = 35 - temperature
Reply
#3
Yes wee need a curve besause all values is going to be able to change in the visualizatione
Reply
#4
This might be helpful: http://lua-users.org/wiki/SimpleFit
Reply
#5
There is block in match advance curve function with 2 points, it might be good starting point.
------------------------------
Ctrl+F5
Reply
#6
Hello.

You can try this:

Code:
function linear_by_table(input,curve,offset)
local FDY = offset or 0
    fk1= (curve["y"][1] - curve["y"][2]) / (curve["x"][1] - curve["x"][2])
    fk2= (curve["y"][2] - curve["y"][3]) / (curve["x"][2] - curve["x"][3])
    fk3= (curve["y"][3] - curve["y"][4]) / (curve["x"][3] - curve["x"][4])

    if input < curve["x"][1] then
        out = curve["y"][1] + FDY;
    elseif input >= curve["x"][1] and input < curve["x"][2] then    
        out = fk1 * (input - curve["x"][1]) + curve["y"][1] + FDY
    elseif input >= curve["x"][2] and input < curve["x"][3] then
        out = fk2 * (input - curve["x"][2]) + curve["y"][2] + FDY
    elseif input >= curve["x"][3] and input < curve["x"][4] then    
        out = fk3 * (input - curve["x"][3]) + curve["y"][3] + FDY
    else
        out = curve["y"][4] + FDY
    end
 return out
end

curve = {}
curve["x"] = {-20,-10,0,20}
curve["y"] = {80,70,65,18}

--offset=2
--log(linear_by_table(20,curve,offset))
log(linear_by_table(-15,curve))
Reply


Forum Jump: