A couple of questions/comments on your programming.
Why do you have the two virtual outlets?
Many of the outlets you have unneeded redundancy (it doesn't add redundancy, it just makes the code hard to read) for example:
Return Pump Fallback ON Set ON If Output MAINT_WC = ON Then OFF If Output MAINT_WC = OFF Then ON Defer 000:05 Then OFF Defer 000:05 Then ON
You don't need both of these:
If Output MAINT_WC = ON Then OFF If Output MAINT_WC = OFF Then ON
Because you have the "Set ON" statement. So whenever the MAIN_WC is OFF, the outlet will be "SET ON". I am also not sure why you have Two Defer statements:
Defer 000:05 Then OFF
Defer 000:05 Then ON
When using the "Defer" statement, Defer 05:00 Then OFF = Defer the OFF state for 05 minute. (ON would be immediate). You also have the Set On statement so the Outlet would be "On" if any of the statements below it are false. Instead of a second "Defer" you could use the "Min" statement. ie Min Time 5:00 Then OFF = Minimum Time of 5 minutes in the OFF state. (ON would be immediate).
For the heater statements, you don't need the Set "OFF". Your Main Heater:
Fallback OFF Set OFF If D_Tmp < 79.0 Then ON If D_Tmp > 80.0 Then OFF
What will happen when using the Set command with a heater is that this program will not cause the outlet to operate over the desired range of temperature; instead, it will operate around a single temp of ~ 78.9 degrees. If the temp drops to 78.9, the heater outlet will turn ON, and it will shut off as soon as the temp goes up to 79.0. TheIf D_Tmp > 80.0 statement does nothing here, because the Set OFF will be the only true statement as soon as the temp goes up to 79.0. The result will be that your heater gets switched on and off fairly rapidly. If you want a cleaner code and the temp to stay at 80, then just use this:
If D_Tmp < 79.0 Then ON If D_Tmp > 80. Then OFF
The heater will turn ON until the temp hits 80 and then will turn off, it will stay off until the temp goes to 79 again and will turn On until the temp exceeds 80.
I think in your case you may want to look at incorporating the "when" or "and" statements: for example:
The 'When' will be an force an output to the OFF state if it has been ON for more than a specified duration:
When On > 005:00 Then OFF
For using the "AND" command, for the outlet you need to turn off if both virtual outelts are true: ie:
XandY Set OFF If X = ON Then ON If Y = OFF Then OFF
If Outlet XandY = ON Then OFF
Hopefully it all makes sense and I understood what you were trying to do in your code. If you need more info:
For the DEFER and MIN TIME:
For the SET command:
And general programming usage: