
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Maximum Number of Opcodes Executed
Originally published on Geo SCADA Knowledge Base by Anonymous user | June 10, 2021 04:14 AM
📖 Home Back
The "Maximum Number of Opcodes Executed" error message simply indicates that a logic program is taking too long to execute and as a simple protection mechanism if the number of operations exceed the configured value the logic is terminated and this error generated. This is usually is only an issue for structured text programs however all logic programs have this setting and could possibly hit this limit.
The default value is nowhere near what a normal logic program should ever get near to, however the introduction of loops (FOR and WHILE and the usage of %S) means that this limit can be easily reached.
The following program will always generate this error...
PROGRAM CountTestWHILE (1) DO;END_WHILE;END_PROGRAM
...because the program will never end. It will reach the maximum number of operations and terminate.
The number of opcodes (instructions) of the last execution can be seen by doing a Logic Execution Query and seeing the "Number of Instructions" column.
Example Causes of this Error
- Large FOR loops within Large FOR loops (such as AGA8 calculations performed in logic)
- WHILE loops where it is possible to not reach the loop's false condition.
- Looping through an SQL resultset and forgetting to use .Next() (or any of the other navigation methods) for all possible paths.
- Dynamic programs, e.g. a program where the inputs are variable, and potentially all get handled, such as rows of a datagrid that grows over time.
Author
Link copied. Please paste this link to share this article on your social media post.