Watchdog/Notify control over valves (heating)

Begonnen von Martijn, 05 Januar 2017, 15:35:35

Vorheriges Thema - Nächstes Thema

Martijn

Hi,

Background: I want to control my heating a bit more than the FHT does. I have city-heating (?) and I have noticed that an opening of the actuator of 7% , makes the heaters a bit warm, but above 15-20% they will get very hot. The FHT leaves the actuators open too long, with the result that I get a big overshoot in temperature (+2 degrees from desired temp). Also I will use probably too much energy=costs.

Therefor I wanted to monitor the actuator and intervene with the desired-temp if the actuator is too long open from a certain %. And after a certain period go back to the original desired-temp.

Logic:

if actuator > 15% and no timer running then
      start timer X of 3 minutes                'keep in mind the lazy updates!
end if

if actuator > 15% and timer X finished then
     requested_desired-temp = FHT_3b32.desired-temp
     new_desired-temp = requested_desired-temp - (requested_desired-temp - FHT_3b32.measured-temp)/2     ' or maybe some other logic here
     set FHT_3b32.desired-temp = new_desired-temp
     start timer Y of 45 minutes
end if

if new_desired-temp>0 and new_desired-temp<>requested_desired-temp and timer Y finished then
     set FHT_3b32.desired-temp = requested_desired-temp
     new_desired-temp = 0
end if



I'm not sure how to implement this (a bit noob ;)).
I tried a start with the watchdog but it doesn't seem to work:
defmod watchdog_OpenValve watchdog FHT_3b32.actuator:/[1-9][0-9]% 00:03:00 SAME { Log 1, "TEST Open Valve >= 10%" }
....


Also some more help with the code will be appreciated!

malc_b

Is this a standard (water filled) radiator with a valve at each end?  Why don't you just restrict the flow with the lockshield valve (the correct name for the other valve that isn't the TRV or on/off valve BTW).  The lockshield's function is to balance the radiators normally so that each gets it's fair share.  You could use that to restrict the flow so the room warms up slower and so doesn't overshoot.

I've never heard of city-heating, what it is?  It is a mistranslated CH, central heating?  Is the heating system actually balanced?  A quick test is start the heating from cold with a cold house.  Do all the radiators get equally hot all at the same time?  Or are some very hot, some lukewarm and take a long time to warm up (not until the hot radiator rooms are warm and their TRVs cut in).

It sounds to me like your problem is putting too much energy into the room too fast.  The valve takes too long to respond either because the air takes that long to circulate or the valve control loop is set too long (is it adjustable).  You could also lower the CH water temperature so the radiator runs cooler and so puts out less energy.

fruit

City heating is sometimes called district heating. Hot water source is external to dwellings and perhaps buildings as well, may even be waste heat from an indutrial unit or factory.
Not something done much in the UK but often talked about in the past :(
Feel free to follow up in German if you prefer

Martijn

Hi, here in NL we call it "city-heating" (one-on-one translation ;) ). It is waste heat from the (electrical) power plants. A good concept, but in the end too expensive  :(
It's an option to regulate the total flow; unfortunately it cannot be done,  in my situation, per radiator. I will give it a try! Hopefully it will not end up in a big dead time. Or the FHT will 'learn' to deal with it...
Another disadvantage will be the option to boots quicky the temp in unexpected situations: e.g. coming home early.

On the other hand; for myself it would find it cool to write the logic with a watchdog ;)

Martijn

Ok, That doesn't work.

So what I want:
1. On Event that a valve opens more than 15% a timer X should start
2. If Timer X reaches 5 minutes, valve should be closed by dropping desired-temp (DT)  to a lower value, e.g current temp and remember requested desired-temp (RT) to a variable. New timer Y should start.
3. If Timer Y reaches 15 minutes, desired-temp should be set to the original desired-temp (RT) form point 2 unless current desired-temp is lower than set temperarure from 2 (DT) .

Who can help me. I think I need a watchdog, but I'm not sure.??

fruit

You can wait for valve percentage change then test for > 15%. There will be examples across the forum I am sure but take a look at http://www.ply.me.uk/bits_and_pieces/fhem_snippets.html#Controlling_heating as a start - though it's not particularly clever.

Within the sub look for the line containing t0, this defines a delay before the command in the rest of the line is run - you could set up a delay for 5 minutes, another for 15

You need to be a bit careful that you don't define the same delay timer again whilst the first is still running!

Any help?
Feel free to follow up in German if you prefer

ggaljoen

#6
Martijn,

Maybe this can help you to trigger the timers 'DOIF' on value changes:

define KamerOost_doif DOIF ([MAX_KamerOost_Heating:valveposition:sec] < 2) ({Pump_Guard ()})
attr KamerOost_doif do always


The Pump_Guard sub is added in 99_myUtils.pm:

# Enter you functions below _this_ line.
######## Valve position heating control  ############
sub
Pump_Guard()
{
my $threshold_val = 24;
my $valve = 0;
my $desiredTemperature = 0;
my $temperature = 0;
my $actual_down = ReadingsVal( "MAX_Pomp0_Heating", "state", "off");
my $disered_down = "off °C";
my @MAX_Down=devspec2array("userattr=down");
  foreach(@MAX_Down) {
$valve=ReadingsVal( $_, "valveposition", "101" );
$desiredTemperature=ReadingsVal( $_, "desiredTemperature", "101" );
$temperature=ReadingsVal( $_, "temperature", "101" );
if ( $valve > $threshold_val )
{
$disered_down = "on °C";
if ( ReadingsVal( $_, "triggerValve", "101" ) != $valve )
{
fhem "setreading $_ triggerValve $valve";
Log 3, "Heater $_: $temperature°C/$desiredTemperature°C = VALVE $valve%";
}
} else
{
if ( ReadingsVal( $_, "triggerValve", "101" ) != 0 )
{
fhem "setreading $_ triggerValve 0";
Log 3, "Heater $_: $temperature°C/$desiredTemperature°C = valve $valve%";
}
}
  }
  if ( $actual_down eq $disered_down )
  {
        Log 3, "nothing to do!";
  }
  elsif ( $actual_down eq "off °C" )
  {
fhem "set MAX_Pomp0_Heating desiredTemperature on";
Log 3, "Pomp0 is OFF switching ON";
  } else
  {
fhem "set MAX_Pomp0_Heating desiredTemperature off";
Log 3, "Pomp0 is ON switching OFF";
  }


It does use variables to park (and callback) the info you seem to need back afterwards. Thanks #Fruit for your ply stuffed webside!
Dirty coding, I know but it does work well for me  ;) en hopelijk brengt dit je dichter bij de oplossing  8)

Martijn

Hi made the following with DOIF, however the timers keeps resetting. I do not understand why?
I hoped that the actions 1,2,3 would be processed with the specific wait time, but when something is updated on the FHT the DOIF gets triggerd again.
Can I stop the retriggering until all de commands (with waits) have been processed. Or is there a better solution?

defmod Woonkamer_doif DOIF ([FHT_3b32:actuator:d] > 15 and [?myDesiredTemp] eq 0) \
(set myDesiredTemp [FHT_3b32:desired-temp], {Log 1, "Actie 1, laat open [FHT_3b32:actuator], meet:[FHT_3b32:measured-temp], gewenst:[FHT_3b32:desired-temp] - [FHT_3b32:desired-temp:sec]"})\
(set FHT_3b32 desired-temp 16, {Log 1, "Actie 2, sluit tijdelijk na 180 sec [FHT_3b32:actuator], meet:[FHT_3b32:measured-temp], gewenst:[FHT_3b32:desired-temp] - [FHT_3b32:desired-temp:sec]"}) \
(set FHT_3b32 desired-temp [myDesiredTemp], set myDesiredTemp 0, {Log 1, "Actie 3, reset desired-temp [FHT_3b32:actuator], meet:[FHT_3b32:measured-temp], gewenst:[FHT_3b32:desired-temp] - [FHT_3b32:desired-temp:sec]"})\

attr Woonkamer_doif room 1.Myexperiment
attr Woonkamer_doif wait 0,300,1200