pomoc s logikou help with Logic

potřebuji pomoct s logikou:
tady potřebuji logiku pro bojler ohřev elektrospirálou kdy 40 st. je dolní hranice,
50. je horní hranice teploty,
současně bude v akumulační nádobě víc než 60. tak je nutné
zapnout čepadlo bojler současně blokovat elektro ohřev po provedení teploty v bojleru 50 st vypnout ohřev z aku
a čekat až bojler zchladne, poté pokud není v aku dost teplá voda povolit elektro ohřev

navíc při teplotě v aku 75 je třeba ji vychladit do topení
při fázi 70 st vypnout čerpadlo topení

výstupy pro relé:
ElOhrev - elektro ohřev SSRelay obrácená logika HIGH je zapnuto, LOW vypnuto
CerpBojler - čerpadlo z aku do bojleru LOW zapnuto HIGH vypnuto
CerpTopeni - čerpadlo z aku do topení LOW zapnuto HIGH vypnuto
Co dělám špatně?

i need help with logic:

here I need logic for boiler electric heating when 40 st. is the lower limit,
50. is the upper limit of temperature,
is prepared in an accumulation tank more than 60. so it is necessary
switch on the boiler boiler uses to block the electric heating after the temperature in the boiler is 50 st turn off the heating from the battery
and wait until the boiler cools down, then if there is not enough hot water in the battery to enable electric heating

in addition, at a temperature of 75 batteries, it must be brought up for heating
at phase 70 st switch off the heating pump

relay outputs:
ElOhrev - electric heating SSRelay reverse logic HIGH is on, LOW off
CerpBojler - pump from battery to boiler LOW on HIGH off
CerpTopeni - battery from battery to heating LOW on HIGH off

What am I doing wrong?

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include "DHT.h"
#include <OneWire.h>
#include "DS18B20.h"
#include <DallasTemperature.h>

WidgetLED led1(33);  // A8  // 62 // V33 // Led 1 obeh cerp. kotel
WidgetLED led2(35);  // A9  // 63 // V35 // Led 2 oběh ohřev TUV
WidgetLED led3(41);  // A11 // 65 // V41 // Led 3  obeh cerp. topeni
WidgetLED led8(64);  // A16 // 64 // V64 // Led 8 TUV el ohřev

#define DS18_1  33 // kotel
#define DS18_2  35 // bojler
#define DS18_3  37 // aku vrch
#define DS18_6  41 // topeni    //43

DS18B20 kotel(DS18_1);
DS18B20 bojler(DS18_2);
DS18B20 akuvrch(DS18_3);
DS18B20 topeni(DS18_6);


#define CerpKotel 62    //  A8 // obeh cerp. kotel
#define CerpBojler 63   //  A9 // obeh cerp. bojler
#define ElOhrev 64      // A10 // blokovani el.ohrevu
#define CerpTopeni 65   // A11 // obeh cerp. topeni


char auth[] = "";
#define W5100_CS  10
#define SDCARD_CS 4
int buttonState; // expecting 0 or 1
float NastavTopeni; // expecting 0.00-80.00
BlynkTimer timer;
/* pošle na virtuálpin(5).V aplikaci by četnost čtení Widgetu měla být nastavena na PUSH. 
 *  To znamená že definujete, jak často mají být data odesílána do aplikace Blynk.*/

void odesli() // veskere senzory
{
float kotelC = kotel.readTempC();  Blynk.virtualWrite(V0, kotelC);
float bojlerC = bojler.readTempC(); Blynk.virtualWrite(V1, bojlerC);
float akuvrchC = akuvrch.readTempC(); Blynk.virtualWrite(V2, akuvrchC);
float topeniC = topeni.readTempC(); Blynk.virtualWrite(V5, topeniC);
float severC = sever.readTempC(); Blynk.virtualWrite(V6, severC); 


// ovladani cerpadla kotel // tohle je ok 
if (35 < kotelC==true && 45 < kotelC==true)
{
  digitalWrite(CerpKotel,LOW); 
  }
if(kotelC< 55 ==true)
{ 
  digitalWrite(CerpKotel,HIGH);
  }


/*  
tady potřebuji logiku pro bojler ohřev elektrospirálou kdy 40 st. je dolní hranice ,
a 50st. je horní hranice teploty  ,
zároveň pokud bude v akumulační nádobě víc než 60st tak je zapotřebí 
zapnout čepadlo bojler zároveň blokovat elektro ohřev po dosažení teploty v bojleru 50 st vypnout ohřev z aku 
a čekat až bojler zchladne , poté pokud není v aku dost teplá voda povolit elektro ohřev 

navíc při teplotě v aku 75 st je třeba ji vychladit do topení 
při teplotě 70 st vypnout čerpadlo topení 

výstupy pro relé: 
ElOhrev - elektro ohřev SSRelay obrácená logika  HIGH je zapnuto , LOW vypnuto
CerpBojler - čerpadlo z aku do bojleru LOW zapnuto HIGH vypnuto
CerpTopeni - čerpadlo z aku do topení  LOW zapnuto HIGH vypnuto
*/
// zasobnik teple uzitkove vody 
float El_offset = 5; if(bojlerC > 40)  // pokud je bojler víc než 40st
 { 
  if((bojlerC - 45) > El_offset) // pokud je bojler mínus 45 st. víc než ofset 

   
{
  digitalWrite(ElOhrev, LOW); //zapni
 }
  }     
else 
{ 
 if(bojlerC < 40) // když bojlecC je větší než 40 st.
 { // když 45 st. mínus bojlerC je menší než nastavený offset
if((45 - bojlerC) > El_offset) 

 
  {  
  digitalWrite(ElOhrev, HIGH); // vypni
 }
  }
   }
    
//  Akuvrch
float Aku_offset = 10; if(akuvrchC > 50) //když je akuvrch víc než 50 st. 
 {
  if((akuvrchC - 60) > Aku_offset) //když je akuvrch minus 60 větší než > offset 
  { 
  digitalWrite(CerpBojler, LOW); // zapni 
  } 
   } 
  else  
  {  
    if(akuvrchC < 50) // když je akuvrch < menší než 50 st. 
  { 
    if((60 - akuvrchC) > Aku_offset)// když 60 st. mínus akuvrch> je větší než offset(( 60 - 71)>10)rovná se 11 tak vypni 
  { 
    digitalWrite(CerpBojler, HIGH); // vypni
 }
  }
   }
// Topení
float temp_offset = 0.5; 
if
(topeniC > NastavTopeni) 
{ 
  if((topeniC - NastavTopeni) > temp_offset) 
  { 
    digitalWrite(CerpTopeni, HIGH); 
    }  
     }
else 
{ 
  if(topeniC < NastavTopeni) 
  { 
    if((NastavTopeni - topeniC) > temp_offset) 
    { 
      digitalWrite(CerpTopeni, LOW);
      }
       }
        }
} 
// konec odešli


void setup() {

Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT); 
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);

 pinMode(CerpKotel,  OUTPUT); digitalWrite(CerpKotel,  LOW);// obeh cerpadlo kotel
 pinMode(CerpBojler, OUTPUT); digitalWrite(CerpBojler, LOW);// obeh cerpadlo bojler
 pinMode(ElOhrev,    OUTPUT); digitalWrite(ElOhrev,    LOW);// blokovani ohrevu
 pinMode(CerpTopeni, OUTPUT); digitalWrite(CerpTopeni, LOW);// obeh topeni 

 
 pinMode(V30, OUTPUT); // nastaveni teploty topeni 
 pinMode(2, OUTPUT);
  
// Nastaví funkci, která se bude volat každou sekundu
 timer.setInterval(1000L, odesli);
 timer.setInterval(1050L, stavKotle);
 timer.setInterval(1125L, TUV);
 timer.setInterval(1150L, stavTopeni);  
 timer.setInterval(1250L, CerpObehBojler);

}
void stavKotle() //62
{bool b = digitalRead(62); if (b == 0) {  led1.on(); 
  BLYNK_LOG(" Cerpadlo Kotel Zap . "); 
  } 
  else {led1.off(); 
  BLYNK_LOG(" Cerpadlo Kotel Vyp . ");
  }}

void CerpObehBojler() //63 (67) bojler cerpadlo LED 2
{ bool x = digitalRead(63); if (x == 0) {led2.on(); 
BLYNK_LOG("z AKU -> bojler Zap "); 
}
else { led2.off(); 
BLYNK_LOG("z AKU -> bojler Vyp "); 
} }
void TUV() //64 Led 8
{bool c = digitalRead(64); if (c == 0)  { led8.off(); 
  BLYNK_LOG("TUV nahrato z Elektriky"); }
  else 
  {led8.on();  BLYNK_LOG("TUV nahriva z Elektriky "); }
  }
void stavTopeni() //65 LED 3
{ bool x = digitalRead(65); if (x == 0) { led3.on(); 
BLYNK_LOG("Topí"); } 
 else 
 {  led3.off();  BLYNK_LOG("Netopí");}
 } 



}
void loop() {


Blynk.run(); 
timer.run();

}

This is going to be tricky - you may get best results from a Czech speaker. Perhaps if you could avoid using abbreviations in the comments it would be easier for Google translate to make sense of it. e.g. What does this mean: aku vrch. I'm also confused by the fact that kotel and bojler translate to be the same thing.

Anyway, here's the first problem. This code is broken, I'm pretty sure you should have used > or >= in there a couple of times.

  if (35 < kotelC == true && 45 < kotelC == true)
  {
    digitalWrite(CerpKotel, LOW);
  }
  if (kotelC < 55 == true)
  {
    digitalWrite(CerpKotel, HIGH);
  }

edited, translated

yes,
a few things don't go to my head in the code there will be bugs and bad practices..
please help thanks

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include "DHT.h"
#include <OneWire.h>
#include "DS18B20.h"
#include <DallasTemperature.h>

WidgetLED led1(33);  // A8  // 62 // V33 // Led 1 // wood boiler circulation pump      //oběhové čerpadlo kotle na dřevo 
WidgetLED led2(35);  // A9  // 63 // V35 // Led 2 // domestic hot water circulation pump // oběh ohřev TUV
WidgetLED led3(41);  // A11 // 65 // V41 // Led 3 // heating circulation pump // obeh cerp. topeni
WidgetLED led8(64);  // A16 // 64 // V64 // Led 8 // electric domestic hot water heating//TUV el ohřev

#define DS18_1  33 //sensor wood boiler // kotel
#define DS18_2  35 //sensor domestic hot water tank // bojler
#define DS18_3  37 //sensor storage tank for hot heating water from a wood boiler or solar panels // aku vrch
#define DS18_6  41 //heating sensor // topeni    //43

DS18B20 kotel(DS18_1);
DS18B20 bojler(DS18_2);
DS18B20 akuvrch(DS18_3);
DS18B20 topeni(DS18_6);


#define CerpKotel 62    //  A8 // wood boiler circulation pump  // obeh cerp. kotel
#define CerpBojler 63   //  A9 // domestic hot water circulation pump //obeh cerp. bojler
#define ElOhrev 64      // A10 //switching electric heating// blokovani el.ohrevu
#define CerpTopeni 65   // A11 // heating circulation pump // obeh cerp. topeni


char auth[] = "";
#define W5100_CS  10
#define SDCARD_CS 4
int buttonState; // expecting 0 or 1
float NastavTopeni; // heating temperature setting // expecting 0.00-80.00 
BlynkTimer timer;
/* pošle na virtuálpin(5).V aplikaci by četnost čtení Widgetu měla být nastavena na PUSH. 
 *  To znamená že definujete, jak často mají být data odesílána do aplikace Blynk.*/

void odesli() // sensors left //  veskere senzory
{
float kotelC = kotel.readTempC();  Blynk.virtualWrite(V0, kotelC); // wood boiler
float bojlerC = bojler.readTempC(); Blynk.virtualWrite(V1, bojlerC);  //domestic hot water
float akuvrchC = akuvrch.readTempC(); Blynk.virtualWrite(V2, akuvrchC); //storage tank for hot heating water from a wood boiler or solar panels
float topeniC = topeni.readTempC(); Blynk.virtualWrite(V5, topeniC); // heating



//controlled pump wood boiler // ovladani cerpadla kotel // tohle je ok 
if (35 < kotelC==true && 45 < kotelC==true)
{
  digitalWrite(CerpKotel,LOW); 
  }
if(kotelC< 55 ==true)
{ 
  digitalWrite(CerpKotel,HIGH);
  }

// zasobnik teple uzitkove vody 
float El_offset = 5; if(bojlerC > 40) //domestic hot water // pokud je bojler víc než 40st
 { 
  if((bojlerC - 45) > El_offset) //domestic hot water // pokud je bojler mínus 45 st. víc než ofset 

   
{
  digitalWrite(ElOhrev, LOW);//domestic hot water on //zapni
 }
  }     
else 
{ 
 if(bojlerC < 40) // když bojlecC je větší než 40 st.
 { // když 45 st. mínus bojlerC je menší než nastavený offset
if((45 - bojlerC) > El_offset) 

 
  {  
  digitalWrite(ElOhrev, HIGH); //domestic hot water off // vypni
 }
  }
   }
    
//  Akuvrch //storage tank for hot heating water from a wood boiler or solar panels
float Aku_offset = 10; if(akuvrchC > 50) 

 {
  if((akuvrchC - 60) > Aku_offset) 
  { 
  digitalWrite(CerpBojler, LOW); //on // zapni 
  } 
   } 
  else  
  {  
    if(akuvrchC < 50) 
  { 
    if((60 - akuvrchC) > Aku_offset)
  { 
    digitalWrite(CerpBojler, HIGH); // off // vypni
 }
  }
   }
//heating // Topení
float temp_offset = 0.5; 
if
(topeniC > NastavTopeni) // heating temp > settemp heating
{ 
  if((topeniC - NastavTopeni) > temp_offset) 
  { 
    digitalWrite(CerpTopeni, HIGH); // heating circulation pump
    }  
     }
else 
{ 
  if(topeniC < NastavTopeni) 
  { 
    if((NastavTopeni - topeniC) > temp_offset) 
    { 
      digitalWrite(CerpTopeni, LOW); // heating circulation pump 
      }
       }
        }
} 
// end send // konec odešli


void setup() {

Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT); 
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);

 pinMode(CerpKotel,  OUTPUT); digitalWrite(CerpKotel,  LOW);// obeh cerpadlo kotel
 pinMode(CerpBojler, OUTPUT); digitalWrite(CerpBojler, LOW);// obeh cerpadlo bojler
 pinMode(ElOhrev,    OUTPUT); digitalWrite(ElOhrev,    LOW);// blokovani ohrevu
 pinMode(CerpTopeni, OUTPUT); digitalWrite(CerpTopeni, LOW);// obeh topeni 

 
 pinMode(V30, OUTPUT); // settemp heating // nastaveni teploty topeni 
 pinMode(2, OUTPUT);
  
// Nastaví funkci, která se bude volat každou sekundu
 timer.setInterval(1000L, odesli);
 timer.setInterval(1050L, stavKotle);
 timer.setInterval(1125L, TUV);
 timer.setInterval(1150L, stavTopeni);  
 timer.setInterval(1250L, CerpObehBojler);

}
void stavKotle() //62
{bool b = digitalRead(62); if (b == 0) {  led1.on(); 
  BLYNK_LOG(" Cerpadlo Kotel Zap . "); // circulation pump wood boiler on
  } 
  else {led1.off(); 
  BLYNK_LOG(" Cerpadlo Kotel Vyp . ");// circulation pump wood boiler off
  }}

void CerpObehBojler() //63 (67) bojler cerpadlo LED 2
{ bool x = digitalRead(63); if (x == 0) {led2.on(); 
BLYNK_LOG("z AKU -> bojler Zap ");  // domestic hot water circulation pump on
}
else { led2.off(); 
BLYNK_LOG("z AKU -> bojler Vyp "); // domestic hot water circulation pump off
} }
void TUV() //64 Led 8
{bool c = digitalRead(64); if (c == 0)  { led8.off(); 
  BLYNK_LOG("TUV nahrato z Elektriky"); } // domestic hot water ( electric heating )
  else 
  {led8.on();  BLYNK_LOG("TUV nahriva z Elektriky "); }// domestic hot water ( electric heating )
  }
void stavTopeni()// state heating //65 LED 3
{ bool x = digitalRead(65); if (x == 0) { led3.on(); 
BLYNK_LOG("Topí"); } // heating on
 else 
 {  led3.off();  BLYNK_LOG("Netopí");} // heating off
 } 



}
void loop() {


Blynk.run(); 
timer.run();

}

I am not sure what you're trying to do in the code and I am not convinced I know what your systems do. Looking at the code, I think this is what it's trying to do:

If wood boiler temp is between 35 and 40, run the wood boiler pump
If wood boiler temp is over 55, stop circulating.

if domestic hot water is over 50 turn electric heater off.
if domestic hot water is under 40 turn electric heater on.

if Storage tank is over 70 turn domestic hot water circulation pump on.
if Storage tank is under 50 turn domestic hot water circulation pump off.

if heating temperature greater than heating setting Plus 0.5, turn heating circulation pump off
if heating temperature less than heating setting minus 0.5, turn heating circulation pump on

I assume the wood boiler tries to heat the storage tank water. I don't understand why there is a cutoff at 40.

It looks like the electric heating is working as planned except that I think you want to use electric heat only if the storage tank is too cold to help.

I think the storage tank is used to provide hot water to the domestic tank if it's hot enough to save on electricity. Does that water go into the domestic tank or is is a heat exchanger?

It looks like heating pump runs to heat the place based on a temperature set outside the code. I expect via Blynk eventually. It looks like the logic would work if you had the temperature setting bit.

So the bit I really don't understand is the Wood boiler piece with its odd limits.

Does the above describe what you're trying to do?

yes you understand correctly

this one wrong
"If the wood boiler temperature is between 35 and 40, start the wood boiler pump
If the temperature of the wood boiler is higher than 55, stop circulating. "

correctly:
If the domestic hot water tank temperature is between 35 and 40, start the heating pump from the heating water tank
If the temperature of the domestic hot water tank is higher than 55, stop circulating.
but if there is not enough heat in the heating water tank, switch on the electric heating coil

if the domestic hot water is higher than 50, switch off the electric heater.
if the domestic hot water is lower than 40, switch on the electric heater.

if the tank is over 75, switch on the heating circulation pump.
if the storage tank is below 70, switch off the heating pump. (this is a safety action against overheating - excess heat is heated), I have an older house where the heat is always used

this function is ok in the code
if the heating temperature is higher than the heating setting Plus 0.5, switch off the heating circulation pump
if the heating temperature is lower than the heating setting minus 0.5, switch on the heating circulation pump

the wood boiler heats the water in the tank to 75 degrees maximum
its pump switches on at 60 degrees and switches off to cool down at 50 degrees and supplies heat to the heating water tank

the heater uses heat from the heating water tank and I set the target temperature using the Blynk app

In your description you have used tank, heating water tank and domestic tank. How many are there? What does each one do?

Maybe you could draw a picture of what the pieces are and how they're connected and attach a photo of it.

I suspect now that the solar and wood burner heat water to fill a storage tank which is used to heat your house based on the desired temperature. If that water gets really hot, the heating circulation must run for safety, so the house may get hotter than you actually wanted.

In addition, you have another tank for domestic hot water (showers, washing up etc.). That water is electrically heated, but there is some mechanism to pump water from the storage tank to provide hot water for domestic use.

So I make that two tanks and two pumps. The code has another pump though. What's that for?

There's also the question of priorities. I think the heating setting controls hot heating water circulation except that high water temperature in the storage tank overrides it.

Also, the electric heating of domestic water should not occur if there is hot enough water in the storage tank.

So, I nearly understand I think. If I ever finally do, the code is easy :slight_smile:

I tried the drawing ...

schematic.pdf (102 KB)

That helps a lot. Now I understand, apart from this:

The wood boiler heats the water in the tank to 75 degrees maximum
its pump switches on at 60 degrees and switches off to cool down at 50 degrees

I know the storage tank must not exceed 75 degrees. If it does (from Solar?) the heating circulation pump must run to keep it below the limit. When can heating circulation stop in this case?

While that safety cooling is taking place I assume that the wood boiler circulation pump must not run.

When does the wood boiler circulation pump run? When is it turned off?

Is the quote above saying that the wood boiler pump only comes on when it's sensor reads 60 or more and must stop when that temperature falls to 50? If so, why? I would expect that the wood boiler pump would run while it has a higher temperature than the tank, unless the temp is over 75.

I wrote some code. It doesn't follow your plan completely - some of it seemed overly complex or unnecessary. So it is probably subtly wrong somewhere or I didn't see the whole picture.

Take a look & see if has any glaring flaws.

bool SafeMode=false;  // Indicates when storage tank water is too hot

void odesli() // sensors left //  veskere senzory
{
  float kotelC = kotel.getTempC();  Blynk.virtualWrite(V0, kotelC); // wood boiler
  float bojlerC = bojler.getTempC(); Blynk.virtualWrite(V1, bojlerC);  //domestic hot water
  float akuvrchC = akuvrch.getTempC(); Blynk.virtualWrite(V2, akuvrchC); //storage tank for hot heating water from a wood boiler or solar panels
  float topeniC = topeni.getTempC(); Blynk.virtualWrite(V5, topeniC); // heating

  ControlWoodBoilerPump(kotelC,akuvrchC);
  ControlDomesticWaterHeating(bojlerC,akuvrchC);
  ControlDomesticHeat(topeniC,akuvrchC);
 }

void ControlWoodBoilerPump(float kotelC,float akuvrchC)
{
 //controlled pump wood boiler // ovladani cerpadla kotel // tohle je ok
  if(SafeMode)  // safety limit is exceeded. Stop wood boiler circulation pump
    {
    digitalWrite(CerpKotel, HIGH);          
    }
  else  // Storage tank is cool enough to be heated. 
    {
    if (kotelC >= 60)  // Wood boiler water is hot enough, safety limit is ok. Run the circulation pump
      {
      digitalWrite(CerpKotel, LOW);
       }
    if (kotelC < 50 )  // Wood boiler water is too cool. Stop circulation pump
      {
      digitalWrite(CerpKotel, HIGH);
      }
    }
}

void ControlDomesticWaterHeating(float bojlerC, float akuvrchC)
{
// zasobnik teple uzitkove vody
float El_offset = 5;
if ((akuvrchC-bojlerC) > El_offset) // If storage tank water is hotter by some margin we can use it for heating domestic water
  {
  digitalWrite(ElOhrev, LOW); // domestic hot water electric heat off - make sure we're not using both// vypni
  if(bojlerC <= 52) // Domestic water not hot enough yet. 52 to avoid rapid cycling of the relay
    {
    digitalWrite(CerpBojler, LOW);//domestic hot water circulation pump on //zapni
    }
  if  (bojlerC >= 55) // Domestic water hot enough
    {
    digitalWrite(CerpBojler, HIGH); //domestic hot water circulation pump off // vypni
    }
  }
else // Storage water too cold. Use electric heating if necessary
  {
  digitalWrite(CerpBojler, HIGH); //domestic hot water circulation pump off - storage water is too cold
  if(bojlerC <= 45) // Domestic water not hot enough yet
    {
    digitalWrite(ElOhrev, HIGH);//domestic hot water electric heat on //zapni
    }
  if  (bojlerC >= 50) // Domestic water hot enough, at least when using electric heat
    {
    digitalWrite(ElOhrev, LOW); //domestic hot water electric heat pump off // vypni
    }
  }
}

void   ControlDomesticHeat(float topeniC, float akuvrchC)
{
if(SafeMode)
  {
  if(akuvrchC < 70)  
    {
    SafeMode=false;  // Safety is ok now, Storage water cool enough, exit safemode
    }  
  }
else
  {  
  if(akuvrchC >= 75)  
    {
    SafeMode=true;  // Safety is not ok, Storage water too hot,cool it by heating the house. Enter safe mode
    digitalWrite(CerpTopeni, LOW); // heating circulation pump on
    }
  else   // Safety is ok, handle house heat by requested temperature
    {
    DoNormalHeating(topeniC);  
    }
  }
}

void DoNormalHeating(float topeniC)
{
//heating // Topení
float temp_offset = 0.5;
if (topeniC > NastavTopeni) // heating temp > settemp heating
  {
  if ((topeniC - NastavTopeni) > temp_offset)
    {
    digitalWrite(CerpTopeni, HIGH); // heating circulation pump off
    }
  }
else
  {
  if ((NastavTopeni - topeniC) > temp_offset)
    {
    digitalWrite(CerpTopeni, LOW); // heating circulation pump on 
    }
  }
}

thank you very much for the help, I will try the code about the weekend

That helps a lot. Now I understand, in addition:

The wood boiler heats the water in the tank to a maximum of 75 degrees
its pump switches on at 60 degrees and switches off, at 50 degrees, when the wood boiler is no longer burning

========================================

  1. I know that the storage tank must not exceed 75 degrees. If so (from the solar system?), The heating circulation pump must run to keep it below the limit. When can the heating circulation stop in this case?
    Answer 1) Switch off the heating circulation when there is 70 degrees in the storage tank

  2. While this safety cooling is taking place, I assume that the circulating pump of the wood boiler must not run.
    Answer 2) the boiler pump must run all the time when the temperature in the wood boiler is more than 60 degrees and if it is no longer burning, switch off the pump at 50 degrees.

  3. When does the wood boiler circulation pump run? When is it turned off?
    answer 3) is also in answer 2)

  4. Does the above quote say that the wood boiler pump will only turn on when the sensor reads 60 or more, and must it stop when the temperature drops to 50? If so, why? I would expect the wood boiler pump to run while it has a higher temperature than the tank if the temperature is not higher than 75.

Answer 4) Yes, 60 degrees is due to tar that forms at temperatures below 60 degrees and the pump can run all the time when the wood is burning. The wood boiler supplies hot water to the heating water tank and it has a maximum temperature of 80 degrees, so it is 75 degrees as a safeguard against overheating.

jirimitura:
thank you very much for the help, I will try the code about the weekend

Don't without tweaking it. It doesn't satisfy the requirement to run the wood boiler pump properly. My code turns it off if the storage tank is too hot. Your answers indicate that that is wrong.