Go Down

Topic: Weather compensation (Read 440 times) previous topic - next topic

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.


Mar 24, 2015, 08:26 pm Last Edit: Mar 24, 2015, 08:26 pm by jremington
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 https://github.com/kerinin/arduino-splines 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.


Mar 25, 2015, 08:23 pm Last Edit: Mar 25, 2015, 08:29 pm by jremington
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.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) {

 float x[7] = {-30,-20,-10,0.0,15};
 float y[7] = {63,56,50,45,35};
 tempCurve.setDegree( Catmull );
 for( float i = 0; i <= 4; i+= .1 ) {
   float temp = tempCurve.value(i);
   for(float j=0; j<= temp; j += .2) {
     Serial.print( "*" );
   Serial.print( "   " );

void loop(void) {



Today at 04:26 am Last Edit: Today at 04:28 am by jremington
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.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131