I am building a subroutine called subLeachLine hat will run a leach line for an up timer amount of time. The sub is called by an OptoScript block that is running a while loop. The while loop runs as long as the leach field (1 or 2) is enabled. I want the current leach line being called to stop running immediately if the current leach field is disabled or if the line is disabled. I know that I can watch for the line itself to be disabled within the sub, but I’m not sure where or how many times I want to check… but if the leach field is disabled, the original while loop that calls the sub will not quit and shut down the sub because the processing of that chart has suspended while the subroutine subLeachLine that it called is running. Am I correct?
So, if I want to shut down the current leach line in either instance I would have to check if both the current line or the current leach field get disabled somewhere during the subroutine…correct?
In my SCADA program I used to write ‘watchdog’ blocks to do this. They would simply run and say if disabled, then shut down subroutine and leach line and reset. Is that the best way to do it in this instance (as in a chart that just watches anything I want to disable) or would it be better to pass the ‘leach field enabled’ variable into the sub as well as the ‘current line enabled’ variable and shut it down from the sub?
Right now I’m wondering if instead of doing all of this code with the flow chart, maybe I should have just encapsulated all this code in OptoScript between some ‘while’ loops within my subroutine instead? No way to build that with the flow chart programming is there?
It’s hard to decide because with limited programmers (me) where I work, I don’t know if the person doing this after me would do better with OptoScript code or if they would do better with the flow chart… Thanks to the OptoForums for being my fellow programmers to collaborate with since I have no one here to bounce ideas off!