How Logic Programs Work
Each Logic program is configured to represent a calculation or a procedure. The Logic program uses values from the database (inputs) as part of the calculation or procedure. The result of the calculation or procedure is either written to the ClearSCADA database as a value or is used to execute a method such as a control.
The ClearSCADA logic engine is single threaded, this means that ClearSCADA can only run one logic program at a time. To protect logic programs from being affected by poorly written logic programs that cannot execute correctly ClearSCADA includes an instruction limit. This instruction limit or Maximum Number of Opcodes Executed prevents programs with infinite loops from locking out other programs.
Logic programs can be set to execute:
- When an input value changes
- At specified times.
When a Logic program begins, it reads its input values (Tag Read). These values can be the values of items in the database or can be values specified in a query.
After reading its input values the calculation or procedure that is defined in the configuration of the Logic program is executed. The input values are used as part of the calculation or procedure.
When the Logic program has executed, it produces an output. The output is either:
- The setting of an item's property, for example, a value that is written to a point
or:
- The execution of a method on an item in the database, for example, the output of a Logic program can initiate the Refresh Outstation method.
Logic programs are designed to have a similar architecture to PLC programs. The procedure for executing a Logic program is:
- Logic program reads its inputs
- Logic program executes
- Logic program writes its outputs
This sequence of events cannot be altered. The inputs are read first, and then the program executes, and then the outputs are written. Logic programs cannot use any other type of structure.
Methods are sometimes referred to as 'actions'.