Humidity Control T3TB 3H/2C w/ Dehumid control

I was hoping to put this in a Tstat10, but I cannot get programs to save to it. I am going to try connecting through my 485 converter again later and trying to update.

System is 3H/2C with humidity control.

Stage 1 heat is Heat Reclaim from the refrigeration (HRCLM)
Stage 2 and 3 heat is Gas (GAS1, GAS2)

If the PID for the humidity gets about 30%, it sets DSTAT to 1. This allows the actual HEAT COOL CONTROL program to bring on COOL1 though PID OR DSTAT. (One program controlling the output)
If the temp in the store raises above cool setpoint, it will stage the cooling on at 35% and 70% PID+
If the temp in the store drops below heat setpoint, it will stage the heating on at 25%, 50% and 70% PID-

GAS1 and GAS2 are locked out by OTEMP being below GLOCK (Gas Lockout Temp)

I have a “SYSTEM CHECK” program that sets the FSTAT (Fan Status) and prevents HTSET from being set too close to CLSET and causing short cycling (set by SOVERLMT var)

I have a “Humidity Status” that sets DSTAT to 1 If Humidity PID is above 30 AND Heat PID is below 1. This keeps the dehumidification confined to “cool mode”.

There is a “fan proof” loop that will stop all outputs on a fan failure.

I have the subroutine “heat/cool control” set to run every so many minutes (CDELAY var, currently set to 00:05:00).

Thoughts?

HEAT COOL CONTROL:

10 REM HEAT COOL CONTROL
100 REM CHECK FOR FAN PROOF
110 IF FSTAT = OFF THEN GOSUB 1000
120 IF INTERVAL ( CDELAY ) THEN GOSUB 200
130 WAIT 00:00:03
140 GOTO 110
200 REM HEAT/COOL CONTROL
210 IF PID1 > 70 THEN START COOL2 ELSE STOP COOL2
220 IF PID1 > 35 OR DSTAT = 1 THEN START COOL1 ELSE STOP COOL1
230 IF PID2 > 25 THEN START HRCLM ELSE STOP HRCLM
240 IF PID2 > 50 AND OTEMP > GLOCK THEN START GAS1 ELSE STOP GAS1
250 IF PID2 > 70 AND GAS1 = 1 AND OTEMP > GLOCK THEN START GAS2 ELSE STOP GAS2
270 RETURN
1000 REM FULL STOP ON FAN FAILURE
1010 STOP COOL1
1011 STOP COOL2
1012 STOP HRCLM
1013 STOP GAS1
1014 STOP GAS2
1015 WAIT 00:00:03
1020 RETURN

HUMIDITY STATUS:

10 REM SET HUMIDITY STATUS
100 IF PID3 > 30 AND PID2 < 1 THEN DSTAT = 1 ELSE DSTAT = 0
110 WAIT 00:00:03
120 GOTO 100

SYSTEM CHECKS:

10 REM FAN/SETPOINT STATUS CHECK
100 FSTAT = FANP
105 IF CLSET - HTSET <= SOVERLMT - 0.200 THEN HTSET = CLSET - SOVERLMT
110 WAIT 00:00:15
120 GOTO 100

The way the T3 controllers work is that once hte last line is executed, the program exits and the outputs are updated. Then the program automatically starts again at the top line. Your programs should therefor flow from top to bottom with little or no GOTO jumps in them. Lines lower in the program can override the lines further up, the output will not be chattering after each line is executed, the output only gets refreshed once the program exits.

Here is another example I just helped out with, the program on the right does not work becuase there is an infinite loop, the program never exits and gives the outputs a chance to refresh. The program on the left works well, it runs from the top to the bottom with no jumps, it exits at the end and then the outputs have a chance to refresh. Safety interlock program lines are placed at the end and have highest priority.