- iRidi Studio 2019
- Function block diagrams
Function block diagrams
Programming iRidi Server logic with function blocks Works only on iRidi Server
The diagram editor creates PLC programs in FBD (Function Block Diagram), one of the languages in IEC 61131-3. Our implementation is not fully compatible with the standard and will be refined, but implements its basic requirements.
A diagram consists of items, their parameter values, and connections (circuits) between them.
A diagram item is a minimal function block that performs a specific operation (logical, arithmetic, delay, and so on) or connects the diagram to the programmable controller's input or output circuits.
A block connection is a line connecting one block's output to another's input. It transfers a value between blocks and shows the diagram's execution sequence.
Function blocks in iRidi Studio 2019 use their own implementation methods and have nothing in common with the beta function blocks in the old Studio (version 1.3.8 and earlier). Diagrams in projects created in the old Studio cannot be converted to the new function block logic. Use iRidi Studio version 1.3.8 to edit old projects, or recreate their logic in the new Studio.
The SCHEMES panel in iRidi Studio configures function block logic for iRidi Server.
Panel tools:

- Diagram template;
- Inputs/Outputs block list;
- Workspace for placing and configuring blocks and connecting them;
- Library of function blocks available in the diagram;
- Diagrams;
- Diagram debugging toolbar;
- Log of the diagram's last run. Source code generated from the block logic;
- Diagram properties;
- Block properties.
1. Template (diagram template)
A Template lets you create and reuse a diagram. Diagrams created within one template differ only in their inputs and outputs. Editing the template's logic or number of inputs and outputs affects every diagram based on that template. Changing the variable referenced by a diagram input or output affects only that diagram, keeping other diagrams' inputs and outputs unique.
The first template is created when you drag function blocks into the workspace. Add a new diagram template with + .
Right-click the diagram sheet to open a menu containing:
Rename - rename the template;
Delete - delete the template;
Clone - clone the template.
Exporting and importing function block diagrams
Diagram export and import lets you transfer frequently used diagrams to a new project while preserving connections, values, and driver bindings.
Exporting function block diagrams
- To export diagrams, click the floppy-disk button. A file browser opens for entering a name and selecting a save location.
Importing function block diagrams
- Click the "+" button, then Add from file. A file browser opens for selecting the import file.

After import, the imported Template and all its diagrams open. Value blocks retain their values. To tag , To command , From tag blocks retain their driver and/or token bindings.
2. Inputs/Outputs block list
The list contains blocks used for reading and writing within each diagram. Calculation blocks are not shown here. To change an item's assignment, double-right-click it and select the required channel, tag, or token.
Hover over a list item to display a tooltip with the full tag or command name.

3. Workspace
The workspace is the area for placing function blocks and connecting them. Each block input or output can have only one connection.
Splitting a large diagram into several separate diagrams makes it easier to check its operation. Tokens provide an effective way to divide a diagram: write the final values to them after simpler diagrams execute.
Creating blocks and connections
Creating a block
Add a block by drag-and-drop: drag the required item into the workspace, and a block appears with the corresponding color and characteristics.
Function blocks can be:
- Standard function blocks;
- Commands and feedbacks;
- Tokens (system or user-defined).
Creating connections between blocks
Blocks must be connected for the diagram to operate. To draw a connection:
- Position the cursor over the required block input or output.
- Hold the left mouse button on the required input or output and begin moving. The starting input or output turns red. Available inputs or outputs on other blocks turn green
- Keep holding the left mouse button and move to the required input or output of another block. The connection line follows the cursor.
- Release the left mouse button on the destination input or output to connect the two blocks.
Workspace zoom
Zoom controls increase or decrease the workspace scale.
- The current zoom percentage. Left-click the down arrow to select one of the available values.
- Zoom buttons:
- Zoom in - increases the current zoom in 10% steps;
- Zoom out - decreases the current zoom in 10% steps.

- Cursor coordinates on the X and Y axes.

4. Function block library
-
- Add (+). Addition;
- Sub (-). Subtraction;
- Mul (*). Multiplication;
- Div (/). Division;
- Mod (%). Remainder;
- Abs - absolute value.
-
Bit operations . Bitwise logical operations:
- Bin And. Bitwise AND;
- Bin Or. Bitwise OR;
- Bin Xor. Bitwise exclusive OR;
- Bin Not. Bitwise NOT;
- LSHIFT. Left bit shift;
- RSHIFT. Right bit shift;
-
Logic operations. Logical operations:
- Logic And. Logical AND;
- Logic Or. Logical OR;
- Logic Xor. Logical exclusive OR;
- Logic Not. Logical NOT.
-
- Value. Constant: signed floating-point number (float 64-bit);
- From Tag. Read a tag value;
- From Channel. Read a channel value.
-
- To Log. Write a value to the log;
- To Tag. Write a value to a tag;
- To Channel. Write a value to a channel.
-
Conditions . Comparison operators:
- X > Y. Greater than;
- X >= Y. Greater than or equal to;
- X Less than;
- X Less than or equal to;
- X == Y. Equal to;
- X != Y. Not equal to.
-
Selection . Selection operators:
- IF (SEL);
- Min;
- Max;
- Clamp.
-
- Duplicate;
- Caption;
- Timer;
- Map;
- RS trigger;
- D trigger;
- T trigger;
- Avg Statistics;
- Min Statistics;
- Max Statistics;
- RGBA to Color;
- Color to RGBA;
- Color to RGB;
- To Bool;
- To Int;
- To Float;
- Delta;
- Inc/Dec;
- Real div;
- P controller;
- PI controller;
- PD controller;
- PID controller;
- Threshold switch;
- ByteToBits;
- BitsToByte;
- TON;
- TOF;
- TP;
- Multiplexer;
- Selector;
- AvgMedian;
- PulseGenerator;
- Set interval;
- Valve control.
Math. Arithmetic functions.
- Add (+) - addition.
- Sub (-) - subtraction.
- Mul (*) - multiplication.
- Div (/) - division.
- Mod (%) - remainder.
- Abs - absolute input value.
Add (+). Addition
Add(+) performs addition, an arithmetic operation that combines two or more numbers into a new number containing as many units as all the original numbers together. The block has two input channels and one output channel.
Sub(-). Subtraction
Sub(-). Subtraction is an arithmetic operation that subtracts one number from another. The block has two input channels and one output channel.
Mul(*). Multiplication
Mul(*). Multiplication is an arithmetic operation that repeats a number as an addend as many times as there are units in another number, the multiplier. The block has two input channels and one output channel.
Div(/). Integer division
Div(/) performs integer division, an arithmetic operation that determines how many times one number is contained in another. The block has two input channels and one output channel. Multiplication and division help convert between numeral systems.
Mod (%). Remainder
Mod (%) returns the remainder, the value left when one integer is divided by another. The block has two input channels and one output channel.
Abs. Absolute input value
Abs outputs the absolute input value. Used to eliminate negative values.
Input:
- In - input value. Output:
- Out - absolute input value.
Bit operations. Bitwise operations.
- Bin And - bitwise logical AND.
- Bin Or - bitwise OR.
- Bin Xor - bitwise logical exclusive OR.
- Bin Not - bitwise logical NOT.
- LSHIFT - left bit shift.
- RSHIFT - right bit shift.
Bin And. Bitwise AND
Bin And. Bitwise AND is a binary operation equivalent to applying logical AND to each pair of bits at matching positions in the binary representations of the input values. If both corresponding input bits are 1, the result bit is 1; if at least one bit in the pair is 0, the result bit is 0. It has two inputs and one output. It supports up to 16 inputs, inclusive.
- Input 1 - 11001010
- Input 2 - 11100010
- Output - 11000010
Bin Or. Bitwise OR
Bin Or. Bitwise OR is a binary operation equivalent to applying logical OR to each pair of bits at matching positions in the binary representations of the input values. If both corresponding input bits are 0, the result bit is 0; if at least one bit in the pair is 1, the result bit is 1. It has two inputs and one output. It supports up to 16 inputs, inclusive.
- Input 1 - 11001010
- Input 2 - 11100010
- Output - 11101010
Bin Xor. Bitwise exclusive OR
Bin Xor. Bitwise exclusive OR is a binary operation whose result is 1 if the number of set bits being added is odd, and 0 if it is even. If the corresponding input bits are equal, the result bit is 0; otherwise, it is 1. It has two inputs and one output.
- Input 1 - 11001010
- Input 2 - 11100010
- Output - 00101000
Bin Not. Bitwise NOT
Bin Not. Bitwise NOT inverts the state of every bit in the original variable. It has one input and one output.
- Input - 11001010
- Output - 00110101
LSHIFT. Left bit shift
LSHIFT. Left bit shift performs a left bit shift.
See RSHIFT below for details. It is similar to RSHIFT, differing only in shift direction.
RSHIFT. Right bit shift
RSHIFT. Right bit shift performs a right bit shift.
Inputs:
- Value - unsigned 32-bit input value (the unsigned type is important)
- Count - number of bits to shift.
Outputs:
- Out - bit-shift result.
Block properties:
- Cyclic - enables cyclic shifting (False/True).
Logic: with cyclic shifting (Cyclic = 1), the last Count bits become the first bits.
Example: 15 (00000000 00000000 0000000 000011112) RHIFT 2 = 3221225475 (11000000 00000000 00000000 000000112).
With noncyclic shifting (Cyclic = 0), the value shifts right and the first Count bits become zeros. This behaves like the >> operator in C, C++, C#, and similar languages.
Logic operations. Logical operations.
- Logic And - logical AND.
- Logic Or - logical OR.
- Logic Xor - logical exclusive OR.
- Logic Not - logical NOT.
Logic And. Logical AND
Logic And. Logical AND is a logical operation that compares two values and returns false if at least one value is false. If both input values are not 0, the result is 1; if at least one value is 0, the result is 0. It has two inputs and one output. It supports up to 16 inputs, inclusive.
- Input 1 - 10
- Input 2 - 15
- Output - 1.0000
Logic Or. Logical OR
Logic Or. Logical OR is a logical operation that compares two values and returns true if at least one value is true. If both input values are 0, the result is 0; if at least one value is not 0, the result is 1. It has two inputs and one output. It supports up to 16 inputs, inclusive.
- Input 1 - 120
- Input 2 - 0
- Output - 1.0000
Logic Xor. Logical exclusive OR
Logic Xor. Logical exclusive OR is a logical operation that compares two values and returns true if one is true and the other false. If both values are 0 or both are not 0, the result is 0; otherwise, it is 1. It has two inputs and one output.
- Input 1 - 215
- Input 2 - 0
- Output - 1.0000
Logic Not. Logical NOT
Logic Not. Logical NOT is a logical operation that returns true if the value is 0 and false if it is not 0. It has one input and one output.
- Input 1 - 123
- Output - 0
Input. Input data.
- Value.
- From Tag.
Value
Value is a constant: a signed floating-point number (float 64-bit). Its single output connects to a calculation block or output block.
Properties:
- Name - block name.
- Type - block type (Value).
- Value - numeric value. Up to 9 digits before and 2 after the decimal separator.
From Tag
From Tag reads a value from feedbacks or tokens for further use in the diagram.
Properties:
- Name - block name.
- Type - From Tag.
- Value - displays the feedback address.
- Data Type - type of data sent.
From Channel
From Channel reads a value from a channel or tokens for further use in the diagram.
Properties:
- Name - block name.
- Type - From Channel.
- Value - displays the channel address.
Output. Output data.
- To Log.
- To Tag.
- To Channel.
To Log
To Log writes a value to the log displayed in the diagram's last-run window (No.9).
Properties:
- Name - block name.
- Type – To Log.
- Data Type - type of data sent.
To Tag
To Tag writes to a driver tag, virtual channel, or token.
Properties:
- Name - block name.
- Type – To Tag.
- Value - displays the channel address.
To Channel
To Channel writes to a driver command, virtual channel, or token.
Properties:
- Name - block name.
- Type – To Channel
- Value - displays the channel address.
Conditions. Comparison operators.
Return false/true as the comparison result.
- X > Y. Greater than.
- X >= Y. Greater than or equal to.
- X < Less than.
- X <= Less than or equal to.
- X == Y. Equal to.
- X != Y. Not equal to.
X>Y. Greater than
X>Y. Greater than outputs True if X is greater than Y, and False otherwise.
X>=Y. Greater than or equal to
X>=Y. Greater than or equal to outputs True if X is greater than or equal to Y, and False otherwise.
X < Y. Less than
X < Y. Less than outputs True if X is less than Y, and False otherwise.
X< = Y. Less than or equal to
X < = Y. Less than or equal to outputs True if X is less than or equal to Y, and False otherwise.
X == Y. Equal to
X == Y. Equal to compares X and Y, returning True if they are equal and False otherwise.
X != Y. Not equal to
X != Y. Not equal to compares X and Y, returning False if they are equal and True otherwise.
Selection. Selection operators.
Return the value that meets the block's condition:
- IF (SEL);
- Min;
- Max;
- Clamp.
IF (SEL)
SEL selects one of two inputs according to the value of the first input, IF.
Inputs:
- IF - (BOOL) - selects the input value;
- TRUE(THEN) - (Any) - input value;
- FALSE(ELSE) - (Any) - input value.
Outputs:
- OUT - (Any) - output value.
Logic:
Depending on the value received at IF:
-
If IF = 0, the FALSE(ELSE) input value appears at OUT.
-
If IF is any value other than 0, the TRUE(THEN) input value appears at OUT.
-
If there is no data at IF, the FALSE(ELSE) input value appears at OUT.
Properties:
- Name - block name.
- Type – IF (SEL).
- Data Type - type of data sent
Min
Min calculates the smaller of two values.
Inputs: *In1 - first input value; *In2 - second input value.
Outputs: *Out - the smaller of the two input values.
Max
Max calculates the larger of two values
Inputs: *In1 - first input value; *In2 - second input value.
Outputs: *Out - the larger of the two input values.
Clamp
Clamp limits value to the range min >= value
Inputs: *Min - minimum range value; *Max - maximum range value; *Value - input value.
Outputs: *Out - output value.
Logic: *If the value exceeds the maximum, returns the maximum. *If the value is below the minimum, returns the minimum. *Formula: Out = max(min(Value, Max), Min)
Interlock
Interlock displays the active input in the interface. Only one input can be active at a time; all others output 0. It supports up to 16 inputs and outputs, inclusive.
Inputs:
- Clear (0/1);
- Set all (0/1);
- Inputs In1, In2, ... In16 (0/1).
- The lowest-numbered input has priority: if data is received at Clear, the block does not accept data arriving at the other inputs.
Outputs:
- Out1, Out2, ... Out16 (0/1)
Properties:
- Name - block name;
- Type – Interlock;
- Count inputs & outputs - edit the number of block inputs and outputs.
Logic:
- When 1 arrives at Clear, all configured outputs (Out1/.../Out16) are set to 0 and hold it until the next change;
- When 1 arrives at Set all, all configured outputs (Out1/.../Out16) are set to 1 and hold it until the next change;
- When 1 arrives at any configured input (In1.../In16), the block sets and holds 1 at the corresponding output (o1/.../o16); all other outputs = 0;
- When 0 arrives at Clear, the block does not change the current output values;
- When 0 arrives at Set all, the block does not change the current output values;
- When 0 arrives at any configured input (In1.../In16), the current output value does not change.
Multiple NOT
Multiple NOT performs logical NOT: it returns true if the value is 0 and false if the value is not 0. It supports up to 16 inputs and outputs, inclusive.
Inputs:
- In1, In2, ... In16 (0/1)
Outputs
- Out1, Out2, ... Out16 (0/1)
Properties:
- Name - block name;
- Type – Multiple Not;
- Count inputs & outputs - edit the number of block inputs and outputs.
Logic:
- If a String value arrives at the input, the output is 1;
- If 1 arrives at the input, the output is 0;
- If 0 arrives at the input, the output is 1.
Other. Other blocks.
- Duplicate;
- Caption;
- Timer;
- Map;
- To Bool;
- To Int;
- To Float;
- Color to RGBA;
- RGBA to Color;
- Delta;
- Threshold switch;
- Inc/Dec.
Duplicate
Duplicate duplicates the input value. It supports up to 8 outputs, inclusive, that duplicate the input value.
Caption
Caption provides a message block that can be placed in the workspace. It can also be used for notes within the diagram.
Properties:
- Name - block name.
- Type - From Tag.
- Value - value displayed on the block.
Timer
Timer passes the input signal value until 0 appears at Switch. When a signal greater than 0 appears, the block starts and passes In1 to the output, repeating it at the specified interval.
Properties:
- Name - block name.
- Type - From Tag.
- Value - interval for resending the input value (ms).
Map
Map converts a value from one range to another.
Inputs:
- Val - input value.
Outputs:
- Out - output.
Block properties:
- From min - minimum value of the original range$
- From max - maximum value of the original range
- To min - minimum value of the new range
- To max - maximum value of the new range
Logic: conversion formula: Out = ([Val] - [From min]) * ([To max] -[To min]) / ([From max] -[From min]) +[To min];
RS trigger
A trigger is a device with two stable states ("0" or "1") that can switch abruptly between them under an input signal. It is a simple state machine with memory that can store 1 bit of information ("0" or "1").
RS trigger stores binary information. Its memory is the ability to remain in either of two states after the switching signal stops. Taking one state as "1" and the other as "0", the trigger stores one digit of a number written in binary.
Inputs:
- R - reset;
- S - set.
Outputs:
- Q - direct output;
- |Q - inverted output.
Logic: the device remains in a stable state when C=0. Pulses at the D data input do not affect it; the output is determined by the previously stored value. When C=1, the output depends on the signal at D. If D=1, the output is 1; if D=0, the output is 0. Truth table.
D trigger
D trigger takes its name from "delay", implemented by signals at the synchronization input. An RS trigger has two input signals, but a binary code needs only one input with different voltage levels: high (1) and low (0). The two inputs could not both receive a one, so the D trigger combines them through an inverter (figure 1a), preventing the forbidden state.
Inputs:
- D - input (0/1)
- C - synchronization input, flag (0/1)
Outputs:
- Q - direct output;
Logic: the device remains in a stable state when C=0. Pulses at the D data input do not affect it; the output is determined by the previously stored value. When C=1, the output depends on the signal at D. If D=1, the output is 1; if D=0, the output is 0. Truth table.
T trigger
- Coming soon.
T trigger implements an asynchronous T trigger. An asynchronous T trigger has no count-enable input T and toggles on every clock pulse at C.
Inputs:
- In - boolean (0/1) input.
Outputs:
- Out - boolean (0/1) output.
Logic: stores a value (0/1) in memory and outputs it when In = 0. When In = 1, inverts the stored value and sends it to Out.
Truth table.
Avg Statistics
Avg Statistics tracks the average value.
Inputs:
- Value - current value
- Reset - flag (0/1), where 1 resets the average to Value
Outputs:
- Avg - maximum of all previously supplied values (when Reset = 0). The Value input when Reset = 1.
Logic: Works similarly to MinStatistics and MaxStatistics. The block stores the current average. If Reset = 1, it is in reset mode and passes the input value to the output. If Reset = 0, it collects statistics and outputs the average of two values: the stored value and the Value input. Like MinStatistics and MaxStatistics, its memory stores the value output on the previous run. On first use, when no previous value is stored, Value is both output and stored in memory.
Min Statistics
Min Statistics tracks the minimum value.
Inputs:
- Value - current value
- Reset - flag (0/1), where 1 resets the minimum to Value
Outputs:
- Min - minimum of all previously supplied values (when Reset = 0). The Value input when Reset = 1.
Logic: the block stores the current minimum. If Reset = 1, it is in reset mode and passes the input value to the output. If Reset = 0, it collects statistics and outputs the smaller of the stored and input values. Its memory stores the value output on the previous run. On first use, when no previous value is stored, Value is both output and stored in memory.
Max Statistics
Max Statistics tracks the maximum value.
Inputs:
- Value - current value
- Reset - flag (0/1), where 1 resets the maximum to the Value input
Outputs:
- Max - maximum of all previously supplied values (when Reset = 0). The Value input when Reset = 1.
Logic: works similarly to MinStatistics. The block stores the current maximum. If Reset = 1, it is in reset mode and passes the input value to the output. If Reset = 0, it collects statistics and outputs the larger of the stored and input values. Like MinStatistics, its memory stores the value output on the previous run. On first use, when no previous value is stored, Value is both output and stored in memory.
RGBA to Color
RGBA to Color converts color components (Red, Green, Blue, Alpha) to a 32-bit unsigned integer RgbaColor.
Inputs: (each input ranges from 0 to 255)
- Red - red channel;
- Green - green channel;
- Blue - blue channel;
- Alpha - alpha channel.
Outputs:
- RgbaColor - 32-bit unsigned integer in 0xRRGGBBAA format.
Color to RGBA
Color to RGBA reverses RGBA to Color, converting 0xRRGGBBAA to separate Red, Green, Blue, Alpha values.
Inputs:
- RgbaColor - 32-bit unsigned integer in 0xRRGGBBAA format.
If 24 bits are supplied, Alpha is 0xFF, producing a 32-bit 0xRRGGBBFF value
Outputs: (values from 0 to 255)
- Red - red channel;
- Green - green channel;
- Blue - blue channel;
- Alpha - alpha channel.
Color to RGB
Color to RGB converts 0xRRGGBB to separate Red, Green, Blue values.
Inputs:
- RgbColor - 32-bit unsigned integer in 0xRRGGBB format.
If 24 bits are supplied, Alpha is 0xFF, producing a 32-bit 0xRRGGBBFF value.
Outputs: (values from 0 to 255)
- Red - red channel;
- Green - green channel;
- Blue - blue channel.
To Bool
To Bool converts automatically to Bool.
Inputs:
- In - input value.
Outputs:
- Out - output. Converts to Bool.
To Int
To Int converts automatically to Int.
Inputs:
- In - input value.
Outputs:
- Out - output. Converts to Int.
To Float
To Float converts automatically to Float.
Inputs:
- In - input value.
Outputs:
- Out - output. Converts to Float.
Delta
Delta calculates the delta of the input value.
Inputs:
- In - input value.
Outputs:
- Value - output value;
- RisingEdge - flag (0/1), 0 - the value has not increased, 1 - the value has increased;
- FallingRange - flag (0/1), 0 - the value has not decreased, 1 - the value has decreased.
Properties:
- Delta - delta.
Logic: compares the input with the previous value stored in the block. If the absolute difference exceeds Delta, the input is sent to Value; otherwise, the previously stored value is output.
Inc/Dec
Inc/Dec increases (if Step > 0) or decreases (if Step
Inputs:
- Value - input value;
- Control - flag (0/1) - do not increase/increase.
Outputs:
- Out - output value.
Properties:
- Step - step
Logic:
- If Control = 0, returns Value at Out;
- If Control = 1, returns Value + Step.
Real div
Real div performs division with a remainder: one number is divided by another with a decimal fraction in the result. It has two input channels and one output channel. Multiplication and division help convert between numeral systems.
P controller
P controller implements P-controller logic.
Inputs:
- ACT - process variable;
- SET - setpoint;
- SUP - deadband;
- OFS - offset;
- MAN_IN - manual input signal;
- MAN - control mode 1/0 (manual/automatic);
- KP - proportional gain;
- LL - lower control-signal limit;
- LH - upper control-signal limit.
Outputs:
- Y - control output;
- DIFF - error signal;
- LIM - flag 1/0: limit reached for Y.
Logic: For details, see p.550.
PI controller
PI controller implements PI-controller logic.
Inputs:
- ACT - process variable;
- SET - setpoint;
- SUP - deadband;
- OFS - offset;
- MAN_IN - manual input signal;
- MAN - control mode 1/0 (manual/automatic);
- RST - integral reset signal 1/0;
- KP - proportional gain;
- KI - integral gain;
- LL - lower control-signal limit;
- LH - upper control-signal limit;
- dT - delta time - time between measurements (needed for integration).
Outputs:
- Y - control output;
- DIFF - error signal;
- LIM - flag 1/0: limit reached for Y.
Logic: for details, see p.550.
PD controller
PD controller implements PD-controller logic.
Inputs:
- ACT - process variable;
- SET - setpoint;
- SUP - deadband;
- OFS - offset;
- MAN_IN - manual input signal;
- MAN - control mode 1/0 (manual/automatic);
- KP - proportional gain;
- KD - derivative gain;
- LL - lower control-signal limit;
- LH - upper control-signal limit;
- dT - delta time - time between measurements (needed for integration).
Outputs:
- Y - control output;
- DIFF - error signal;
- LIM - flag 1/0: limit reached for Y.
Logic: For details, see p.550.
PID controller
PID controller - implements PID-controller logic.
Inputs:
- ACT - process variable;
- SET - setpoint;
- SUP - deadband;
- OFS - offset;
- MAN_IN - manual input signal;
- MAN - control mode 1/0 (manual/automatic);
- RST - integral reset signal 1/0;
- TN - integral time constant;
- TV - derivative time constant;
- KD - derivative gain;
- LL - lower control-signal limit;
- LH - upper control-signal limit;
- dT - delta time - time between measurements (needed for integration).
Outputs:
- Y - control output;
- DIFF - error signal;
- LIM - flag 1/0: limit reached for Y.
Logic: For details, see p.550.
Threshold switch
Threshold switch is a threshold switch.
Inputs:
- In - input value;
- Threshold - threshold value;
- Range - range.
Outputs:
- Out - boolean output value (0/1).
Logic: if the absolute difference between In and Threshold is no greater than Range, returns 1; otherwise, returns 0.
Formula: Out = | In - Threshold | <= Range
ByteToBits
ByteToBits converts the input byte into a set of output bits.
Inputs:
- In - input byte.
Outputs:
- Out1 - bit 1 (counting from the end; for example, this output reflects the first bit of 00000001),
- Out2 - bit 2,
- Out3 - bit 3,
- Out4 - bit 4,
- Out5 - bit 5,
- Out6 - bit 6,
- Out7 - bit 7,
- Out8 - bit 8.
BitsToByte
BitsToByte converts a set of input bits to an output byte.
Inputs:
- In1 - bit 1 (counting from the end; for example, this input reflects the first bit of 00000001),
- In2 - bit 2,
- In3 - bit 3,
- In4 - bit 4. * In5 - bit 5,
- In6 - bit 6,
- In7 - bit 7,
- In8 - bit 8. Outputs:
- Out - output byte assembled from the input bits.
TON
TON implements an on-delay timer.
Inputs:
- In - boolean input (0/1).
Outputs:
- Out - boolean output (0/1).
Properties:
- Interval (ms) - on-delay (in milliseconds).
Logic: when In = 1, the timer starts. After Interval elapses, the timer outputs 1 (previously it output 0).
TOF
TOF implements an off-delay timer.
Inputs:
- In - boolean input (0/1).
Outputs:
- Out - boolean output (0/1).
Properties:
- Interval (ms) - on-delay (in milliseconds).
Logic: when In = 0, the timer starts counting. After Interval elapses, the timer outputs 0 (previously it output 1).
TP
TP implements TP-timer logic.
Inputs:
- In - input (0/1).
Outputs:
- Out - output (0/1).
Properties:
- Interval (ms) - time interval (in milliseconds).
Logic: TP outputs a pulse of the specified duration (Interval (ms)) when its input activates. Another pulse does not extend the closed state.
Multiplexer
Multiplexer implements multiplexer logic.
Inputs:
- Control - control input (unsigned integer),
- In1-8 - signal inputs.
Outputs:
- Out - value from one of the signal inputs.
Logic: the Control input receives an unsigned integer specifying the index of the signal input whose value is to be output. The index ranges from 1 to 8, inclusive, matching the number of signal inputs.
Selector
Selector stores a value, allows incrementing or decrementing it by Step, and sets a new value from Set when Reset is 1. If no initial value has been set (for example, Reset = 0 and there is no previous value), MinValue is output and stored in the block's memory.
Inputs:
- Inc - increment (1/0);
- Dec - decrement (1/0);
- Set - value to set;
- Reset - set the value from Set as the current value (1/0).
Outputs:
- Out - output value.
Properties:
- MinValue - minimum value;
- MaxValue - maximum value;
- Step - increment/decrement step;
- Cyclic - if 0, exceeding the limits (MinValue, MaxValue) outputs MinValue or MaxValue respectively (clamping as in Clamp); if 1, exceeding the limits (MinValue, MaxValue) outputs a cyclically shifted value (example: MinValue = 3, MaxValue = 6, Step = 4, Inc = 1, Dec = 0; the output is 4).
The shift below the lower limit is calculated as:
Out = MaxValue - ( |MinValue - CurrentValue| mod |MaxValue - MinValue| )
The shift above the upper limit is calculated as:
Out = MinValue + ( |CurrentValue - MaxValue| mod |MaxValue - MinValue| ),
where CurrentValue is the current value to output.
AvgMedian
AvgMedian calculates the average, excluding values outside the 3*sigma range.
Inputs:
- In1-In7 - sensor inputs.
Outputs:
- Out - average value.
PulseGenerator
PulseGenerator is a pulse generator.
Inputs:
- In - input (0/1).
Outputs:
- Out - output (0/1).
Properties:
- Interval (ms) - interval between pulses (in milliseconds);
- Duration (ms) - pulse duration (in milliseconds).
Logic: outputs true for the specified duration (Duration) at the specified interval (Iterval) while the control input is true.
Set interval
Set interval implements periodic value transmission.
Inputs:
- In - input.
Outputs:
- Out - output.
Properties:
- Interval (ms) - time interval in milliseconds.
Logic: whenever Interval elapses, sends the value from In to Out. If the interval has not yet elapsed, sends 0.
Valve control
Valve control implements valve-control logic.
Inputs:
- In - input (any floating-point values).
Outputs:
- Out - output.
Properties:
- Preventative closing(bool) - preventive valve closing;
- Interval (hours) - number of hours between preventive valve closings;
- Duration (ms) - number of milliseconds to hold it closed.
Block limitation: works correctly only when the diagram updates at an interval.
Logic:
"Close the valve" means outputting 0 for the entire time the valve is closed. When it is open, the value from In is forwarded to Out.
If Preventative closing = true, the block is operational. It closes the valve every Interval hours for Duration (ms).
If Preventative closing = false, the block simply passes the value from In to Out.
5. Schemes (diagrams)
Diagrams are copies of the original template in which channel and feedback paths can be changed on Inputs/Outputs. The same diagram can provide standard logic for different commands and feedbacks.
Changing blocks responsible for logic changes other blocks in the template.
Each diagram has its own Inputs/Outputs (IO) block list. IO are the unique variables referenced by the diagram. Add a diagram in either of two ways:
- Add
- click "+" to copy the blocks and connections. Channel, tag, and token paths are not copied.
- Clone
- make a full copy of the diagram, including channel, tag, and token paths.
6. Diagram debugging toolbar
Diagram debugging buttons.
These buttons debug only the current diagram. You can check the diagram without running the project.
Launch - runs the diagram and checks its operation. Errors and logging results appear in the log area.
Clear log - removes entries from the log area.
7. Last-run diagram log. Source code generated from block logic
Diagram run log
Displays calculation-block results and diagram errors. To display calculation information here, connect To Log to the calculation block's output.
Source code generated from block logic
Select Code to view the code generated from the function block diagram.
The source code generated from the block logic is for information only.

8. Diagram properties
- Name,
- Active:
- True,
- False.
- Run Mode:
- On Tag Changed,
- By Interval.
Name - diagram name.
Active - diagram state. True means the diagram runs and performs calculations. False means it is inactive and performs no calculations.
Run Mode - diagram run mode, with these options:
On Tag Changed - run the diagram when tag (token) values change;
By Interval - run the diagram at a specified interval. Adds Interval to the diagram properties (in milliseconds). To run the diagram once at server startup, set 0. 
9. Block properties
Block properties show the block's operating parameters. Name and Type are required. Depending on block type, Value may also be available.
- Name.
- Type.
- Value.
Name - block name.
Type - the block type selected in the diagram. Select another type from the drop-down menu to change it; the diagram updates accordingly. If a connected input or output changes to the opposite type, its connection to the next block disappears.
- Value - depending on block type, Value can be a number or a path to a tag, channel, or token.