Loop In control modules?
I have made a custom function block for the Process StartUp Override and will be using it along with with entire logic which has been made in control modules.
However the issue is that I am receiving a loop error at download(by-passed it from the compiler switches); the entire logic works fine if I by-pass the loop error.
The question i wanted to ask is, what are the potential hazards that I will be facing if i by-pass the error and let it exist in my logic? Any manual i can refer if to remove this loop?
I have attached the loop inspection file that i get at compilation, any help in understanding it would be greatly appreciated.
Voted best answer
Hello,
Compiler does the code sorting of an application to arrange the execution order of code blocks correctly to avoid any executional delay (i.e. solve the logic to get the value of any variable before reading it). Loop error is generated when there is a discrepency of execution order (ex: Code tab A: varA := varC and varD, varC := varB, Code tab B: varB := not varA). When loop error is bypassed from complier switches, loop get breaked by using last scan value at any one interconnection between code blocks, one code block shall be executed with last scan value of variable(s).
In your project, there are two loop errors, one is with startup logic and another is with process logic, it seems.
Loop Block 1 (loop created with 22 code blocks):
In.Forward components are being red with a scan delay in control modules TD1_VoteBranch1, TD1_VoteBranch2 and TD1_VoteBranch3.
Loop Block 2 (Startup logic):
StartupOverrideM1.VoteOut.Forward is connected to LALL_0101.In.Forward. All components of In.Forward connection are being red with a scan delay in control module LALL_0101.
Suggestion:
Make sure that scan delay in these parameter/variables shall not affect the application. If you are sure that you can make a delay, those variables can be set to no sort attribute which will resolve the loop error by excluding it in complier. It is not advisable to change the complier setting as it will disable loop error for entire project application.
In case if you are sure that this is not affecting your application and do not want to change, you can live with it. Code loop shall not cause any other problem except an unintentional one scan delay in reading variable(s).
Answers
Greetings,
First of all Right Click the your project under Control Builder and then select "Compiler Switches" part.
And then a new pop up menu apperas. In this menu You have to change "Loops in Control Modules" part. Default value is always "Error", so you face an error message while downloading.
Hope it helps you.
failure.My advise would be to clear the loops before download.
The most obvious answer is that "loops" occur when you try to write something that hasn't been read yet. You have the cart before the horse. Ideally, we would read all of our inputs and variables before writing them to the various code blocks. Unfortunately this is not always possible (feasible). Some times an output has to "loop back" and become the input to another block. Here are a couple of methods that I use in my Function Diagrams:
- try resorting your data flow
- if you use variables with multiple instantiations, make sure that it is set to "nosort"
Best Regards.
one loop is a matter that in any PLC is it possible to have, the difference is that ABB control modules alerts you when your program have one loop.
if you use traditional way of programs you can not notice if you have one loop.
One program loop is when a variable depends of itself.
per example: A= B+C, C= A-1; in this case i have one loop because A depends of A.
to solve one loop, you should clarify in your program which variable should be write first. to solve ABB has variables with state attribute, this permits to have one old value of variable, and you can use in your program, other way is to assign the part of your logic with loop problem to another program inside control module, so you manually decide how to write the variables.
You can check out the manual, 3BSE04373 (System 800xA Control 5.1 AC 800M Planning)
This is to warn you about possible code execution errors that may occur due to wrong sorting of the code. Control modules are sorted automatically according to the input / output parameters, unlike programs with function blocks. If there is a clash in these parameters, your code may not be sorted correctly and the result may not be correct after each scan.
The Code Loops section in the mentioned manual describes the issue with examples. Also you can find details on how the code is sorted.
Add new comment