10 REM *** THIS PROGRAM CONTROLS LEAD-LAG FOR KE2 CONTROLLERS ON 2 SYSTEMS ***
20 REM *** THIS PROGRAM CONTROLS LEAD KE2 WITH 2ND ROOM TEMP INPUT AND MONITORS ***
30 REM *** COMPRESSOR AMPS TO MAKE SURE LEAD SYSTEM RUNS ***
40 IF+ SYSASCH THEN SUBSYSAEDGE = 1
50 IF+ SYSBSCH THEN SUBSYSBEDGE = 1
60 IF SYSASCH THEN SUBSYSAACTIVE = 1
70 IF SYSBSCH THEN SUBSYSBACTIVE = 1
80 REM *** END OF MAIN PROGRAM ***
90 REM *** SUBROUTINE EDGE ***
100 IF SUBSYSAEDGE THEN LASTLEAD = 1
110 IF SUBSYSBEDGE THEN LASTLEAD = 0
120 IF SUBSYSAEDGE OR SUBSYSBEDGE AND NOT LEADRAN AND LASTLEAD = 0 THEN SYSAFAIL = SYSAFAIL + 1 ELSE SYSBFAIL = SYSBFAIL + 1
130 IF SUBSYSAEDGE OR SUBSYSBEDGE AND LEADRAN AND LASTLEAD = 0 THEN SYSAFAIL = 0 ELSE SYSBFAIL = 0
140 IF SYSAFAIL > 0 THEN SYSAFLT = 1 ELSE SYSAFLT = 0
150 IF SYSBFAIL > 0 THEN SYSBFLT = 1 ELSE SYSBFLT = 0
160 IF SYSAFAIL > 1 OR SYSBFAIL > 1 THEN SYSAFLT = 1 , SYSBFLT = 1 ELSE SYSAFLT = 0 , SYSBFLT = 0
170 IF SYSAFAIL > 1 AND SYSBFAIL > 1 THEN ALLFLT = 1 ELSE ALLFLT = 0
180 IF SUBSYSAEDGE THEN SYSA2ND = 1
190 IF SUBSYSAEDGE THEN SYSB2ND = 0
200 IF SUBSYSAEDGE THEN LEADRAN = 0
210 IF SUBSYSBEDGE THEN SYSA2ND = 0
220 IF SUBSYSBEDGE THEN SYSB2ND = 1
230 IF SUBSYSBEDGE THEN LEADRAN = 0
240 IF SUBSYSAEDGE THEN SUBSYSAEDGE = 0
250 IF SUBSYSBEDGE THEN SUBSYSBEDGE = 0
260 REM *** END OF SUBROUTINE ***
270 REM *** SUBROUTINE ACTIVE ***
280 IF SUBSYSAACTIVE AND PROOF_A THEN LEADRAN = 1
290 IF SUBSYSBACTIVE AND PROOF_B THEN LEADRAN = 1
300 IF SUBSYSAACTIVE THEN SUBSYSAACTIVE = 0
310 IF SUBSYSBACTIVE THEN SUBSYSBACTIVE = 0
320 REM *** END OF SUBROUTINE ***
330 END
The T3000 software is reporting the above code as an endless loop. how is it an endless loop with no goto or gosub statements?
1 Like
I have had this happen twice on two different systems. I had to split the code into two different programs. The programs were operating just fine and then ‘endless loop’ appeared. Last night cost me a few hours splitting the code into two programs. This started several months ago when I noticed that the T3-BB kept rebooting. This seems to happen with longer code where ‘something like’ a decision for when to turn heat demand on or off is used in the same program.
I broke the program up into different programs.
It appears that the endless loop is caused by the following code section.
10 IF SYSAFAIL > 0 THEN SYSAFLT = 1 ELSE SYSAFLT = 0
20 IF SYSBFAIL > 0 THEN SYSBFLT = 1 ELSE SYSBFLT = 0
30 IF SYSAFAIL > 1 OR SYSBFAIL > 1 THEN SYSAFLT = 1 , SYSBFLT = 1 ELSE SYSAFLT = 0 , SYSBFLT = 0
40 IF SYSAFAIL > 1 AND SYSBFAIL > 1 THEN ALLFLT = 1 ELSE ALLFLT = 0
By splitting this section into two different programs the endless loop message goes away.
10 IF SYSAFAIL > 0 THEN SYSAFLT = 1 ELSE SYSAFLT = 0
20 IF SYSBFAIL > 0 THEN SYSBFLT = 1 ELSE SYSBFLT = 0
10 IF SYSAFAIL > 1 OR SYSBFAIL > 1 THEN BOTHFAILVAR = 1 ELSE BOTHFAILVAR = 0
20 IF BOTHFAILVAR THEN SYSAFLT = 1 , SYSBFLT = 1 , ALLFLT = 1
30 IF NOT BOTHFAILVAR THEN SYSAFLT = 0 , SYSBFLT = 0 , ALLFLT = 0
Still not sure the reason for the issue.
My guess is that the T3000 doesn’t like any program with more than one if statement that adjusts the same variable.
1 Like
T3000 does its best to keep track of line numbers and statements but as you can see there are limitations. I will have the team check into this.
This will give me a chance to spount on again about keeping program simple with one thing happening per line.
You can break things up by aiming a section of logic at a variable, all the logic acts on this variable and it can be as complex as you like. Once you have the logic tied up in the variable you can then use it in subsequent lines while keeping things to one action per line. This makes it easier for you to debug and everyone else maintaining the system later on.