on System#Boot then $com1 = 'BLB Heishamon_rules20240821.txt'; $com1 = 'same rules as set 20240819 but without print command and rule 2 (TaManipulations) splitted to make the rule shorter'; $com1 = 'successful running on #574 3.61 https://github.com/IgorYbema/HeishaMon/actions/runs/10476556300'; #allowDHW = 1; #allowOpenThermThermostat = 1; #allowTaManipulations= 1; #allowPumpDuty = 1; #allowQuietMode = 1; #allowSyncHP = 1; #allowSyncOT = 1; #maxTa = 36; #3WayValve = -1; #chEnable = -1; #chEnableOffTime = -1; #chEnableTimeOff = -1; #CompFreqTarget = -1; #CompressorFreq = -1; #CompressorRunTime = -1; #CompressorState = -1; #CompressorStateChangeTime = -1; #DeFrost = -1; #DHWRun = -1; #FirstBoot = 1; #MaxPumpDuty = -1; #OMP = -1; #OMR = -1; #OMS = -1; #OutsideTemp = -1; #PreviousHPS = -1; #QuietMode = -1; #QuietModeLevel = -1; #RemoteOverRide = -1; #RHPState = -1; #RoomTempDelta = -1; #SHifT = -1; #Time = -1; setTimer(1,60); setTimer(2,10); end on TaManipulations then #com1 = 'somewhere in this rules an error causing + left something'; if #allowTaManipulations == 1 && #RemoteOverRide < 1 && #DHWRun < 1 && #3WayValve == 0 && #DeFrost == 0 then #allowTaManipulations= 2; #SHifT = @Z1_Heat_Request_Temp; #MainOutletTemp = @Main_Outlet_Temp; #Z1TargetTemp = @Z1_Water_Target_Temp; #MainDeltaTemp = #MainOutletTemp - #Z1TargetTemp; #ShiftDeltaTemp = #MainDeltaTemp + #SHifT; if #CompressorState == 1 && (#OutsideTemp > 5 || #SHifT != 0) then TaM2(); else #ST = -2 * #OutsideTemp - 30; if #CompressorState == 0 && #CompressorRunTime > #ST && #CompressorRunTime < 2 then #SHifT = -5; else #SHifT = 0; end end if (%hour > 22 || %hour < 7) && #OutsideTemp < 3 && #SHifT > -3 && #MainDeltaTemp < 0.5 && #CompressorState == 1 then #SHifT = -1 + #SHifT; end #SHifT = max(#SHifT, -5); #SHifT = min(#SHifT, 5); if #SHifT != @Z1_Heat_Request_Temp then @SetZ1HeatRequestTemperature = #SHifT; end setTimer(8,60); end end on TaM2 then if #ShiftDeltaTemp < 0 && #RoomTempDelta > -0.5 && #CompressorFreq > 24 && #CompressorRunTime < 16 then #allowTaManipulations= 1; else if #CompressorRunTime > 10 then if #MainDeltaTemp > 1.8 then #SHifT = 1 + #SHifT; else if #MainDeltaTemp < 0.5 && #SHifT > 0 then #SHifT = -1 + #SHifT; end end $mShift = floor(2 + (#OutsideTemp - 7 ) / 3); if #SHifT > $mShift then #SHifT = $mShift; end #SHifT = max(#SHifT, -1); if #RoomTempDelta < -0.5 then $dTC = floor(-2 * #RoomTempDelta); if $dTC > #SHifT then #SHifT = $dTC; end end if #RoomTempDelta > 0.4 && #CompressorRunTime > 60 then #SHifT = -5; end else if #CompressorRunTime > 0 && #CompressorRunTime < 3 && #MainOutletTemp < (#Z1TargetTemp - 4 - #SHifT) && @Z1_Water_Target_Temp > 30 then #SHifT = -2; else #SHifT = 0; end end end end on HeatPumpState then if @Heatpump_State != #RHPState && #RemoteOverRide != -1 then @SetHeatpump = #RHPState; end end on OperatingMode then if @Operating_Mode_State != #OMR then @SetOperationMode = #OMR; end end on OpenThermThermostat then if #allowOpenThermThermostat == 1 && #RemoteOverRide < 3 && #DHWRun < 1 && #3WayValve == 0 && #DeFrost == 0 then if #chEnable == 1 && #RoomTempDelta < 0.3 then #RHPState = 1; HeatPumpState(); end if (#RoomTempDelta > 0.7 || #chEnableOffTime > 30 || (#chEnableOffTime > 15 && #CompressorRunTime < -15) || (#chEnableOffTime > 5 && %hour > 22)) && #3WayValve == 0 && (#CompressorRunTime > 60 || #CompressorState == 0) && #OutsideTemp > -5 then #RHPState = 0; HeatPumpState(); if @Operating_Mode_State != 0 then @SetOperationMode = 0; end #allowOpenThermThermostat = 2; setTimer(7,600); end if #chEnable == 0 then #allowOpenThermThermostat = 3; setTimer(7,25); end end end on DHW then if #allowDHW == 1 && #RemoteOverRide < 4 then #allowDHW = 2; $lRD = 7; if #3WayValve == 0 && (@DHW_Temp < 37 || (%hour == 13 && (%day == $lRD || @DHW_Temp < (@DHW_Target_Temp + @DHW_Heat_Delta)))) then #DHWRun = 1; #OMP = @Operating_Mode_State; #PreviousHPS = @Heatpump_State; if #OMP == 0 then #OMR = 4; else if #OMP == 1 then #OMR = 5; else #OMR = 3; end end OperatingMode(); #RHPState = 1; HeatPumpState(); end if #DHWRun > 0 then if %day == $lRD && %hour >= 13 && @DHW_Temp > 47 && @Sterilization_State != 1 then @SetForceSterilization = 1; end if #3WayValve == 0 && @DHW_Temp >= @DHW_Target_Temp && #DeFrost == 0 && @Sterilization_State == 0 then @SetOperationMode = #OMP; if @Heatpump_State != #PreviousHPS then #RHPState = #PreviousHPS; HeatPumpState(); end #OMP = @Operating_Mode_State; #PreviousHPS = 1; #DHWRun = 0; end end setTimer(6,900); end end on pumpDuty then if #allowPumpDuty == 1 && #RemoteOverRide < 5 then #allowPumpDuty = 2; #MaxPumpDuty = 85; if #3WayValve == 1 then #MaxPumpDuty = 140; if (@Sterilization_State == 0 && @DHW_Temp > @DHW_Target_Temp) || (@Sterilization_State == 1 && @DHW_Temp > 57) then #MaxPumpDuty = 10 + #MaxPumpDuty; end else if @Heatpump_State == 1 then if #CompressorFreq == 0 && #DeFrost != 1 then #MaxPumpDuty = 82; else if #OMS != 1 then $QFH = 10; $QFL = 14; $tH = 11; $tL = -3; if #OutsideTemp >= $tH then #mPF = $QFH; else if #OutsideTemp <= $tL then #mPF = $QFL; else #mPF = 1 + floor(0.9 + $QFH + ($tH - #OutsideTemp) * ($QFL - $QFH) / ($tH - $tL)); end end if @Pump_Flow > 1 && @Pump_Flow < 8 && #MaxPumpDuty <= @Max_Pump_Duty then #MaxPumpDuty = @Max_Pump_Duty + 1; else #MaxPumpDuty = 55 + floor(#mPF * 3); if (@Pump_Speed / @Pump_Flow) > 145 then if @Pump_Flow > 8 then #MaxPumpDuty = @Max_Pump_Duty - 1; else #MaxPumpDuty = @Max_Pump_Duty; end end end else #MaxPumpDuty = 92; end end end end #MaxPumpDuty = max(#MaxPumpDuty, 82); if @Max_Pump_Duty != #MaxPumpDuty then @SetMaxPumpDuty = #MaxPumpDuty; end setTimer(5, 60); end end on SetQuietMode then if #QuietMode != #QuietModeLevel then @SetQuietMode = #QuietMode; end end on QuietMode then if #allowQuietMode == 1 && #RemoteOverRide < 2 && #DeFrost == 0 then #allowQuietMode = 2; if #OutsideTemp < 3 || (#OutsideTemp < 5 && #CompFreqTarget == 34) then #CompFreqTarget = 34; else #CompFreqTarget = 24; end if #CompressorRunTime< 3 && #CompressorFreq > 35 then #QuietMode = 3; else if #CompressorFreq < #CompFreqTarget || (#QuietMode == 0 && #CompressorFreq < #CompFreqTarget + 6) then #QuietMode = 0; else if #CompressorFreq < #CompFreqTarget + 6 || (#QuietMode == 1 && #CompressorFreq < #CompFreqTarget + 12) then #QuietMode = 1; else if #CompressorFreq < #CompFreqTarget + 26 || (#QuietMode == 2 && #CompressorFreq < #CompFreqTarget + 32) then #QuietMode = 2; else #QuietMode = 3; end end end end if #QuietMode > 1 && #3WayValve == 1 && %hour > 9 && %hour < 17 then #QuietMode = -1 + #QuietMode; end setTimer(3,120); end if #DeFrost == 1 && #allowQuietMode > 0 || #CompressorState < 1 then #QuietMode = 3; end SetQuietMode(); end on syncOT then if #allowSyncOT == 1 then ?outletTemp = @Main_Outlet_Temp; ?inletTemp = @Main_Inlet_Temp; ?outsideTemp = #OutsideTemp; ?dhwTemp = @DHW_Temp; ?dhwSetpoint = @DHW_Target_Temp; if ?chEnable == 1 then #chEnable = 1; if #chEnableTimeOff != -1 then #chEnableTimeOff = -1; #chEnableOffTime= -1; end else if #chEnableTimeOff == -1 then #chEnableTimeOff = #Time; end #chEnableOffTime= #Time - #chEnableTimeOff; if #chEnableOffTime> 5 || ?chSetpoint == 10 then #chEnable = 0; end end ?maxTSet = #maxTa; ?relativeModulation = round(@Compressor_Current / 15 * 100); if #CompressorFreq == 1 then ?flameState = 1; if @Heat_Power_Consumption > 0 then ?chState = 1; end if @DHW_Power_Consumption > 0 then ?dhwState = 1; end if @Cool_Power_Consumption > 0 then ?coolingState = 1; end else ?flameState = 0; ?chState = 0; ?dhwState = 0; ?coolingState = 0; end #RoomTempDelta = ?roomTemp - ?roomTempSet; end end on syncHP then if #allowSyncHP == 1 then #allowSyncHP = 2; #OMS = @Operating_Mode_State; #3WayValve = @ThreeWay_Valve_State; #CompressorFreq = @Compressor_Freq; #DeFrost = @Defrosting_State; #OutsideTemp = @Outside_Temp; #QuietModeLevel = @Quiet_Mode_Level; #RemoteOverRide = @Z2_Heat_Request_Temp; setTimer(9,30); end end on compFreq then if #CompressorFreq > 18 && #CompressorState == 0 then #CompressorStateChangeTime= #Time; #CompressorState = 1; end if #CompressorFreq < 18 && #CompressorState == 1 then #CompressorStateChangeTime= #Time; #CompressorState = 0; end end on timer=1 then setTimer(1,15); if #FirstBoot == 1 then #CompressorStateChangeTime= #Time; #RoomTempDelta = 0; if @Compressor_Freq > 18 then #CompressorState = 1; else #CompressorState = 0; end if #3WayValve == 1 && #allowDHW == 1 then #DHWRun = 2; end compFreq(); #FirstBoot = 2; else syncHP(); syncOT(); compFreq(); QuietMode(); pumpDuty(); DHW(); if #OMS == 0 || #OMS == 4 then OpenThermThermostat(); TaManipulations(); end end end on timer=2 then #Time = %day * 1440 + %hour * 60 + %minute; if #CompressorFreq > 18 then #CompressorRunTime= #Time - #CompressorStateChangeTime; if #CompressorRunTime< 0 then #CompressorRunTime= #Time - #CompressorStateChangeTime + 10080; end else #CompressorRunTime= #CompressorStateChangeTime- #Time; end setTimer(2,60); end on timer=3 then #allowQuietMode = 1; end on timer=5 then #allowPumpDuty = 1; end on timer=6 then #allowDHW = 1; end on timer=7 then #allowOpenThermThermostat = 1; end on timer=8 then #allowTaManipulations = 1; end on timer=9 then #allowSyncHP = 1; end