-
-
Notifications
You must be signed in to change notification settings - Fork 90
Weighted average room temperature
When using BSB-LAN as a replacement for a room unit, you might ask yourself what is the best approach to send a room temperature to the heater. On this page, we shall have a look at three different approaches that may be useful in different situations:
The simplest way to mirror the functionality of a room unit is to act exactly like it: You just send the temperature measured in one room to the heating system. Let's assume you have a sensor that tells you that it's 19.7 °C in the living room, then you would tell this to the heating system by calling this URL:
http://bsb-lan.local/I10000=19.7
Depending on the setpoint temperature (parameters 710/712), the heating system would act accordingly to reach this temperature by turning on or off it's heat generation.
This approach is easy and feasible if your main concern is to get the main room in the house or apartment up to the desired temperature, more or less leaving aside the temperature of the other rooms.
In case we have several rooms which all should be taken into account when sending a single room temperature to the heating system, we may just send the average temperature. So if we have sensors in rooms A (18.0 °C), B (19.8 °C) and C (23.0 °C), we would calculate the average by adding the temperatures of all rooms and the divide that sum by the number of rooms (in this case three). Therefore, the average would be (18.0+19.8+23.0)/3 = 20.26 °C
. In case our setpoint is at 20 °C, the heating system would assume that the setpoint temperature is reached in all rooms and thus turn off heat generation, even though two rooms are still (quite) a bit below the setpoint temperature. If we assume that our heating system has an optimized hydraulic balancing, then we could assume that there is an open window or something else that causes that one room to be below the setpoint temperature when all others are, and therefore ignore this divergence.
A weighted average is an average where some data points have a greater weight than others. Since we can only send one room temperature for each heating circuit, we may not want to send an average temperature if the temperatures in our rooms differ to quite some extent because of insufficient hydraulic balancing.
Hydraulic balancing means that the heating system has been adjusted based on the heat consumption of each room and the heating power that each radiator can provide. In a well-balanced heating system, the internal valves in each radiator are set up in such a way that the radiator gets as much or as little hot water as it needs to get the room up to the desired temperature.
If your heating system has not undergone hydraulic balancing, some rooms may heat up faster than others. In this case, you may not want to include these rooms to the same extent in the calculation of the average because you want to make sure that in the end, all rooms reach the setpoint temperature without the heating system turning off heat generation before that.
What can be done in this case is to ignore those rooms where the setpoint temperature has already been reached and only take those rooms into account where the room temperature still needs to reach the setpoint temperature. Of these rooms, we take the highest setpoint temperature (in case it differs from room to room) and send this to parameter(s) 710/712. As the actual room temperature, we take the average cumulated difference from the setpoint temperature and subtract it from the setpoint temperature.
Taking the same temperatures as in the example above, we have a difference of (20.0-18.0) = 2.0 °C
for room A and (20.0-19.8) = 0.2 °C
for room B. Room C is left out of the equation as the room temperature has reached the setpoint temperature already. Now we add the differences and divide by the number of rooms: (2.0+0.2)/2 = 2.2/2 = 1.1 °C
. Finally, we subtract this average cumulated difference from the setpoint temperature (20.0 °C): 20.0-1.1 = 18.9 °C
. Ergo, we send 18.9 as the room temperature to the heating system. A difference of 1.1 °C will force the heating system to turn on the heating and do so until the last room has reached the setpoint temperature.
If all rooms are at or above the setpoint temperature, we take the smallest difference between the rooms' (highest) setpoint temperature and the actual room temperature and add it to the (highest) setpoint temperature. For example, if rooms A, B and C have a room temperature of 20.2 °C, 21.0 °C and 21.4 °C and the setpoint temperature remains at 20.0 °C, then 20.2-20.0 = 0.2 °C
will be the smallest difference which will be added to the highest setpoint (in this case 20.0 °C for all rooms), i.e. 20.2 °C will be sent.
This coding example in Perl for FHEM was taken from here and adjusted for more stringent variable names:
sub WeightedAverageTemperature($@){
my @devices = @_;
my ($device, $send_room_temperature, $lowest_room_temperature_difference, $temperature_difference, $rooms, $setpoint_temperature, $maximum_setpoint_temperature) = (0)x7;
my $lowest_temperature_difference = 99;
foreach $device (@devices) {
my $room_temperature = ReadingsVal("$device","temperature",0); # adjust this to get the device's room temperature
my $setpoint_temperature = ReadingsVal("$device","desiredTemperature",0); # adjust this to get the device's setpoint temperature
if ($room_temperature - $setpoint_temperature < $lowest_temperature_difference {
$lowest_temperature_difference = $room_temperature - $setpoint_temperature;
}
if ($setpoint_temperature > $maximum_setpoint_temperature) { $maximum_setpoint_temperature = $setpoint_temperature }
if ($room_temperature < $setpoint_temperature) {
$rooms++;
$temperature_difference = $temperature_difference + $room_temperature - $setpoint_temperature;
}
}
if ($rooms > 0) {
$send_room_temperature = $maximum_setpoint_temperature + ($temperature_difference / $rooms);
} else {
$send_room_temperature = $maximum_setpoint_temperature + $lowest_temperature_difference;
}
# This assumes you have a FHEM device called "BSB-LAN" and have setup parameters 710, 712 and 10000 for writing:
fhem("set BSB-LAN 710 $maximum_setpoint_temperature");
fhem("set BSB-LAN 712 $maximum_setpoint_temperature");
fhem("set BSB-LAN 10000 $send_room_temperature");
return 1;
}
Quick links:
BSB-LAN manual | BSB-LAN latest version | BSB-LAN bug report | BSB-LAN discussions