logo elektroda
logo elektroda
X
logo elektroda

[Solved] Heat pump control: time and temperature conditions in Arduino code

klon111 138 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21488927
    klon111
    Level 11  
    Hello everyone, there is an error in the programme, I don't see it;

    //switching heat pump, thermostat when tempDom is greater than TempZal, please help
    if (tempDom < TempZal && digitalRead(thermostatPoko) == 1 && delayTermostat < currentTime)

    
    f ((czasMin >  333 && czasMin <  611) || ( czasMin > 1211  &&  czasMin < 1411  )|| ( czasMin > 1711  &&  czasMin < 1911 ))
          {
             TempZal = TempDzi - TempDel;
             TempWyl = TempDzi;
          }
          else
          {
             TempZal = TempNoc - TempDel; // temp startu
             TempWyl = TempNoc;          // temp stop
          }
          
          
    /* 
              if ( czasMin >  1755 && czasMin <  1855    &&   RAMint[3] == 1)
          {
             TempZal = 25;    TempWyl = 27;
          }   */
    //załaczanie pmpy ciepła
          if (tempDom < TempZal &&  digitalRead(termostatPoko) == 1  &&  zwlokaTermostat < aktualnyCzas  )
          {
             digitalWrite(termostatPoko, 0); // powiadamia kaisai temp mala w pokoju
             digitalWrite(PompaCO, 0);
             StartPC = aktualnyCzas;
             zwlokaTermostat = aktualnyCzas +  900000 ; // 20 min
             welcome = "Staret PC Gołebia  \n\n";
             welcome += "TT z Kaisai / TT tempZewn / TempBoiler /doCO - " + StTempZkaisai + " / " + StTempZewn+ " / " + StTempBoiler + " / " + StTempOcZasil + "\n\n";
             
             bot.sendMessage(chat_id, welcome  , "");
          }
    
    .


    i
  • ADVERTISEMENT
  • #2 21489011
    viayner
    Level 43  
    Hello,
    you have not described anything,
    where is this error, what does it concern, what is not executing correctly?
    It would be good for you to describe the variables.
    Greetings
    PS. You read and write the same pin (thermostatPoko) without changing its function? And it works?
    " if (tempDom < TempZal && digitalRead(thermostatPoko) == 1 && delayTermostat < currentTime )
    {
    digitalWrite(thermostatPoko, 0); // notify kaisai temp small in room"
  • ADVERTISEMENT
  • #3 21489266
    klon111
    Level 11  
    >>21489011 .
    float tempDom = 22 , tempDomGora, TempZal, TempWyl, TempDzi, TempNoc, TempDel;

    >>21489011 .


    the programme is very elaborate therefore I do not present the whole
    these two variables "tempDom < TempZal" the printout is correct and the comparison is not tempDom = 21.67 TempZal 21.55 and it connects my PC kaisai thermostat I thought the DS18b20 was reading wrong temperatures at the start but I checked the reading is ok


    if (RAMint[9] == 2) // temperature control TempDzi TempNoc TempDel
    {
    // set temperature on off
    if ((timeMin > 333 && timeMin < 611) || ( timeMin > 1211 && timeMin < 1411 ) || ( timeMin > 1711 && timeMin < 1911 ))
    {
    TempZal = TempDzi - TempDel;
    TempWyl = TempDzi;
    }
    else
    {
    TempZal = TempNoc - TempDel; // temp start
    TempWyl = TempNoc; // temp stop
    }


    /*
    if ( timeMin > 1755 && timeMin < 1855 && RAMint[3] == 1)
    {
    TempZal = 25; TempWyl = 27;
    } */
    // switching on the heat pump
    if (tempDom < TempZal && digitalRead(thermostatPoko) == 1 && delayTermostat < currentTime )
    {
    digitalWrite(thermostatPoko, 0); // notifies kaisai temp small in room
    digitalWrite(pumpCO, 0);
    StartPC = currentTime;
    delayTermostat = currentTime + 900000 ; // 20 min
    welcome = "Staret PC of Kaiser";
    welcome += "TT from Kaisai / TT tempZewn / TempBoiler /doCO - " + StTempZkaisai + " / " + StTempZewn+ " / " + StTempBoiler + " / " + StTempOcZasil + "/ ";

    bot.sendMessage(chat_id, welcome , "");
    }


    // turning off the heat pump
    if (tempDom > TempWyl && digitalRead(thermostatPoko) == 0 && delayTermostat < currentTime ) {

    WorkTime = ( currentTime - StartPC )/60000 ;
    dailyWorkTimePC += WorkTime;
    delayTermostat = currentTime + 900000 ; // 20 min 450000- 10 min 45000-1min

    welcome = "Stop PC DoveWorkTime min/dailyWorkTime-" + String( WorkTime ) + " / " + String( dailyWorkTimePC )+" \"
    welcome += "TT of Kaisai / TT tempZewn / TempBoiler /doCO - " + StTempZkaisai + " / " + StTempZewn + " / " + StTempBoiler + " / " + StTempOcZasil + "/ ";

    bot.sendMessage(chat_id, welcome , "");

    digitalWrite(thermostatPoko, 1); // notify kaisai temp ok TempBoiler tempOcZasi
    }

    }
    }
  • ADVERTISEMENT
  • #4 21489526
    JacekCz
    Level 42  
    Squinting at this chaos, I suggest reading nt "comparison of floating point numbers" (assuming I can read it)

    PS. if you code as chaotically as you express your thoughts, then ....
  • #5 21489628
    klon111
    Level 11  
    Please review the code and suggest where the error is and do not judge thank you for your help two heat pumps programmed and working and two directional photovoltaic panels and not hanging up
  • ADVERTISEMENT
  • #6 21489683
    Plumpi
    Heating systems specialist
    Have you ever heard of punctuation?
    Do you realise that punctuation marks allow you to understand the meaning of a statement?
    The absence of such marks in statements forces you to read the text over and over again to understand its meaning, and this is very discouraging.
  • #7 21490077
    klon111
    Level 11  
    Closing without assistance

Topic summary

The discussion centers on troubleshooting an Arduino-based heat pump control program that switches the heat pump and thermostat based on time and temperature conditions. The main issue involves a conditional statement comparing room temperature (tempDom) with a setpoint temperature (TempZal) and controlling a thermostat pin (thermostatPoko). The user provides partial code snippets showing time intervals (czasMin/timeMin) used to adjust temperature thresholds (TempDzi, TempNoc, TempDel) for day and night modes. The user confirms temperature readings from a DS18B20 sensor are accurate. Respondents request clearer error descriptions and variable explanations, suggest reviewing floating-point comparison methods, and emphasize code clarity and punctuation for readability. No definitive solution is provided, and the thread closes without resolution.
Summary generated by the language model.
ADVERTISEMENT