(29.08.2021, 12:19)morkovka Wrote: Hi,
I have a thermopump that can be put in either cooling or heating mode - I want to design a logic that will automatically decide when to switch the modes and do it, instead of requiring manual switchover.
Don't do that. It may sound like a good idea, but it really isn't.
1. If you have a heat pump, you also have a nice insulated building with minimal heat losses.
2. Weather forecast is never 100% accurate, you'll miss a lot.
3. It's easy to click on a heat/cool mode icon once in six months, do you really need that level of autonomy?
If you really want to automate this part, then better work on an algorithm that will calculate your heat/cool demand (0-100%). When you have your numbers, it's easy to switch the heat pump mode. But this numbers will give you something much better - now you can modulate the heat pump itself, if it's not fixed.
You should also develop a heating curve based on outdoor temperature, for example T_out=10 > T_flow=25, T_out=0 > T_flow=30. Then you can modulate this curve based on heat demand. Tweak until you are satisfied.
Demand can be calculated as simply as counting the total number of valves in the system, and checking how many are open. Better way is to add weight to each valve, because it's not the same if it's controlling a 5 sqm bathroom or 25 sqm room. Some thermostats also have a "demand %" output, you can use that in the same way. More complex methods are looking at the difference between setpoint and actual temperature. Bigger the diffence, bigger the demand value.
Sorry I couldn't give you a working code, I never implemented this in LM.
Edit:
Sorry, I didn't saw the date of the original post.