The Sequential Controller function block allows programming function sequences in text form.
Various processes that require sequential control can be automated this way.
The function block can simplify these processes, which often require several conventional function blocks with complex programming.
The individual steps are programmed line by line, a group of lines that performs a specific function is referred to as a sequence.
Table of Contents
- Application Example
- Functional Description
- Operators, Inputs/Outputs (IOs) and Variables
|S1-8||Activates sequence 1-8||-|
|AI1-8||Analog inputs 1-8||-|
|AIS||Analog input start sequence||0...8|
|R||Reset||Resets the block and locks it.||-|
|AQ1-8||Analog outputs 1-8||-|
|AQs||Current sequence||Currently active sequence||∞|
|AQl||Current line||Current program line of the active sequence||∞|
|TQ||Text output||Text output that can be set by the sequence||-|
|Configuration||Program code editor||-|
|Interval [ms]||Interval from line to line in milliseconds. Influences the processing speed of sequences. Low values increase the processing speed, but can also increase the CPU load.||500|
The following example shows a simple application for domestic water heating, in which two hot water tanks are heated consecutively by a central heater.
The temperatures of the heater, the two hot water tanks and the temperature setpoint for the hot water are provided at the function block's inputs.
Sequence 1 is started via the S1 input, in this example by a pulse at a specific time.
The heater, pumps and valves are controlled via the outputs:
Double-click on the function block to open the programming window.
The library on the left side of the window lists the available inputs, outputs, commands and variables.
Double-clicking on one of these objects will insert it into the editor window on the right where it can be further customized:
Each line must begin with a command, as can be seen in the example above.
The green comments are not required for the sequence to function, but allow to document the individual steps.
Note: This example is intended to provide an overview of the function block and its functionality. It can be applied to a specific application only to a limited extent.
Sequences are executed line by line at an adjustable interval. Specific sections can be skipped using conditions or delayed by time commands.
It is possible to create multiple sequences, each sequence can be started individually or switched to using a command.
The function block also includes a syntax check, which highlights syntax errors while editing a sequence. Invalid or empty lines are skipped when the sequence is running.
A programming line always starts with the desired function, followed by the required parameters and operators, each separated by a space.
The inputs and outputs specified in the library of the block can be set or queried.
If an input is connected to logic, the last set value is valid. Changes to the input overwrite the value set by a sequence.
The commands supported by the Formula function block can be used to set and compare outputs(e.g. SET AQ1 = AI2 * 3).
Operators, Inputs/Outputs (IOs) and Variables↑
Available operators are =, >=, >, <=, <, !=
Available inputs: AI1 - AI8. The input names can be customized in the dialog.
Available outputs: AQ1 - AQ8. The output names can be customized in the dialog.
Variables: value1 - value5. The variable names can be customized in the dialog.
Variables are used to process values that are not available at the IOs. They can be set like IOs, used in calculations or as a memory.
Wait for the specified time
Syntax: sleep [value] [s: seconds, m: minutes]
sleep 300 s (waits for 300 seconds, then proceeds with next line)
sleep 10 m (waits for 10 minutes, then proceeds with next line)
Wait for condition to be met
Syntax: waitcondition [IO] [operator] [value]
waitcondition AI1 > AQ1 (waits until AI1 is greater than AQ1, then proceeds with next line)
waitcondition AI1 + 3 > value1 (waits until AI1 + 3 is greater than the variable value1, then proceeds with next line)
Set an input, output or variable to a value
Syntax: set [IO] = [value]
set AQ1 = AI1 - AI2 (subtracts AI2 from AI1 and outputs the result on AQ1)
set value1 = AI2 + AI3 (adds AI2 and AI3 and sets the variable value1 to the result)
Pulses an input or output
Syntax: setpulse [IO]
setpulse AQ1 (provides a short pulse to AQ1)
setpulse AI2 = 4 (provides a short pulse with value 4 on AI2)
Starts a specific sequence
Syntax: startsequence [number] or startsequence [name of sequence]
startsequence 2 (starts the second sequence)
startsequence Alarm (starts the sequence named “Alarm”)
If the current sequence was started by another sequence with [startsequence], this command returns to the calling sequence and proceeds to its next line
Go to specific line
Syntax: goto [value]
goto 1 (starts the sequence from the beginning)
goto 23 (jumps to line 23 and continues from there)
"If" checks whether a condition is true first. Only if the condition is true, the subsequent commands up to "endif" are executed.
Syntax: if [left term] [operator] [right term] ... endif
if AQ3 >= 4
set AQ1 = AQ3
Comments and Texts
Add a comment to the current line or disable the rest of the line
waitcondition AI2 > AI4 // wait until AI2 is greater than AI4 (comment is used to describe the line)
// waitcondition AI2 > AI4 (comment slashes are used at the beginning to disable the whole line)
Text output TQ
Characters in quotation marks are output as text, otherwise they are handled like analog values
Syntax: set TQ = "..."
[set TQ = AQ2] will output "27.5"
[set TQ = "Value of AQ2 is" AQ2] will output "Value of AQ2 is 27.5"