Weather compensation

I am working on replacing an old building automation computer from the 80s with some cleaver built in functions such as multiple pids and weather compensation curves ready to use, you just fill in the parameters dependent on your project.
The programming language is boolean (suspect c or c++ in the background) and you just call on these above ready to use functions.

Is it possible to create a heating setpoint dependent on outside temperature?

I would like to create a temperature curve that is dependent on outside conditions. For lower outside temperatures, more heating capacity is needed. This means lower supply temperatures can be sufficient to meet heating demand.

I am using the PID library to control a motorvalve.

Iam looking for something like this:

Some float In = Outside temperature.

float x[7] = {-30,-20,-10,0.0,10,20,30} degree celsius
float y[7] = {65,58,51.5,-44.5,35,25} degree celcius

Some float Out = Outside temperature dependent setpoint.

I have been looking at kerinin/splines but I am not sure how to use it.

Do you want to calculate, from the outside temperature, a floating point "index" to table y, which sets the Out parameter?

One approach is to use interpolation, of which there are many possibilities.

Note: what is the "-" doing in table y?

Yes, exactly.

As I wrote,

I have been looking at the GitHub - kerinin/arduino-splines: 1D splines for the arduino environment for the purpose but don´t know how to use it.

In the kerinin/arduino splines is a version called Catmull wich seems suitable when I run it.

I am new in C++ pogramming and got stuck here and would appreciate some help.

You are right no “-” in the Y table.

Catmull4.ino (487 Bytes)

If you don't know how to use that method, why did you choose it? If it were my problem, I would spend some more time on background reading, and study the pros and cons of various approaches before settling on one of them.

Where do these numbers come from?

Those appear to be very simple curves, although in addition to the wrong sign, one value is missing from the y data.

Consider linear interpolation.

You may be missing my point, I do understand the logic and background in Automatic Control.

I am almost ready with my project using the PID library and the OneWire library for my sensors.

What I need is a function like this to get my setpoint dynamic:

This is a draft from the old systems programming enviroment Weather compensation module K01.

K01-YIN A005 5.1 Outside temperature sensor.
K01-YUT B001 41.5 Setpoint for the PID to control motorvalve, sensor at boiler outlet.
K01-X1 -30.0
K01-Y1 63.0
K01-X2 -20.0
K01-Y2 56.0
K01-X3 -10.0
K01-Y3 50.0
K01-X4 0.0
K01-Y4 45.0
K01-X5 15.0
K01-Y5 35.0

The possibilty to “bend” the curve to get a summit around zero degrees is very useful.

I have been looking at this:

double x[10] = {0,1,2,3,4,5,6,7,8,9};
double y[10] = {0,0,5,5,0,0,3,4,5,6};
doulbe m[10] = {0,.5,.5,.5.,.25,.25,.75,1,1,1}

Spline stepSpline(x,y,10,0);
Spline linearSpline(x,y,10,1);
Spline hermiteSpline(x,y,m,10); // No neet to specify type since m passed
Spline catmullsSpline(x,y,10,Catmull);

stepSpline.value(5.5); // => 0
linearSpline.value(5.5); // => 1.5

Spline mySpline();
mySpline.setPoints(x,y);
mySpline.setDegree(1);

mySpline.value(5.5); // => 1.5

Is it possible to integrate the outside sensor in the code.

If not, I do appreciate some help with this.

The code:

#include <spline.h>

Spline tempCurve;

void setup(void) {

Serial.begin(9600);

float x[7] = {-30,-20,-10,0.0,15};
float y[7] = {63,56,50,45,35};
tempCurve.setPoints(x,y,7);
tempCurve.setDegree( Catmull );

for( float i = 0; i <= 4; i+= .1 ) {
float temp = tempCurve.value(i);
Serial.print(i);
for(float j=0; j<= temp; j += .2) {
Serial.print( “*” );
}
Serial.print( " " );
Serial.println(temp);
}
}

void loop(void) {

}

Yes, I am missing the point. You haven't clearly explained what you want to do with the two tables, or why you think you need to perform some nonlinear operation.

What is this supposed to mean?

The possibilty to "bend" the curve to get a summit around zero degrees is very useful.

What I want to accomplish is nothing I have found on.
This is a quote from a swedish publication explaning the use of a control curve (heating curve):

"The control curve for the radiator system temperature is designed so that it varies
non-linearly with the outdoor temperature, that is, the curve is slightly curved to compensate
to emission from the radiators increases disproportionately at high surface temperatures
due to increased radiant heat. The feedforward signal (outdoor temperature) to
the controller is subdued to compensate for the building's thermal inertia: indoor temperature
is not changed immediately when the outdoor temperature is changed, and the feedforward signal
sometimes supplemented by such a correction for wind speed. The radiators
are often equipped with thermostatic valves, which serve to compensate for
"Free heat" (solar radiation, electrical equipment and body heat) by reducing
the flow through the radiator.
In Küçüka [32] compared the return temperature of a heating system regulated only
with temperature compensation or solely with thermostatic radiator valves.
The comparison was performed for both direct and indirect district heating connection. The conclusion was that a variable flow gives a lower return temperature. However, it is often difficulty
to achieve good regulation of indoor temperature only with thermostatic
radiator valves. In Britain, where such regulation is common, one study showed that 65
percent of thermostatic valves functioned poorly."

Link to graphical example:

The curve shape and slope depends on other factors also, geographical location ,type of building , insulation.
When the right curve is selected only paralell shift is made for personal preference.

As I wrote in my first post ,the goal is to replace an existing system because there are no spare parts or possibility to interact anymore.

Before embarking on what appears to be a quite complex system of control, I'd be inclined to see first how well a simple PID can regulate your temperature.

I agree with wildbill's suggestion to try simple PID first.

The "clever tricks" and heating curves you mention appear to be used to anticipate and overcome nonlinear behavior of the heat transfer fixtures within the building. The approach obviously depends on the details of the building construction, the weather and the heating system.

The question is: would reviving and implementing such a complicated approach actually result in cost savings or improved energy efficiency? That would be something for a professional heating (HVAC) engineer to evaluate.

Old post but I'd like to say that this is common for the major building automation systems I've worked with. It makes it easier to fine tune a building's energy use. A 19th century stone house with little or none insulation demands a different heating curve compared to a building built in the 70's...
Also you can program a controller valve to suit the connected heating system as seen in this picture: link

#Swedenhielm
Did you make any progress with this?

//Thomas