From OpenSCADAWiki
Jump to: navigation, search
Other languages:
Constr.png The translation checking and actualizing
Module Name Version License Source Languages Platforms Type Author Description
BlockCalc Block calculator 1.12 GPL2 en,uk,ru,de x86,x86_64,ARM DAQ Roman Savochenko
  Maxim Lysenko (2009,2012) — the page initial translation
Provides a block calculator.

The module of subsystems "DAQ" BlockCalc provides the system OpenSCADA with the mechanism for creating custom calculations. The mechanism of calculations based on the formal language of block circuits(functional blocks).

Also, the module implements the functions of the horizontal reservation, namely, working in conjunction with the remote station of the same level. In addition to the synchronization of the archives of values and archives of attributes of parameters the module implements synchronization of computational templates, in order to shockless catch of the algorithms.

Languages of block programming based on the notion of circuits(functional blocks). Moreover, depending on the substance of the block, block circuits may include: logic, relay logic circuits, a model of technological process, and more. The essence of the block circuit is that it contains a list of blocks and relations between them.

From a formal point of view a block is an element(function), which has inputs, outputs, and an algorithm for computing. Basing on the concept of programming area, block is a frame of values associated with the object of function.

Of course, the inputs and outputs of blocks may be needed to be connected for a solid block scheme. The following types of links are provided:

  • Interblock, connecting the input of one block to the output of another one, the input of one block to another one's input and output of one block to the input of another one;
  • Interblock remote, connection of blocks of controllers of different block circuits of the module;
  • Coefficients, the transformation of input into the constant, all inputs / outputs by default are initiated as a constant;
  • External attribute of the parameter.

Conditionally, connections of blocks can be represented as links between the blocks as a whole(Fig. 1) or detailing of the links(Fig. 2). In the process of binding parameters of blocks the connection of parameters of any type is acceptable. Thus, in the process of computation automatically casting of types will be done.

Fig. 1. General connections between blocks of a block scheme.
Fig. 2. Detailed links between blocks.

1 The controller of the module

Each controller of this module contains the block circuit, which he computes with the specified period. In order to provide calculated data in the system OpenSCADA the parameters can be created in the controller. Example of the configuration tab of the controller of the given type depicted in Fig. 3.

Fig. 3. Configuration tab of a controller.

From this tab you can set:

  • The state controller, as follows: State, "Enable", "Run" and the name of the database containing the configuration.
  • Id, name and description of the controller.
  • The state, in which the controller is to be translated at boot time: "To enabled" and "To start".
  • The names of tables to store the parameters and blocks of the controller.
  • The calculation schedule policy, priority and number of iterations in one cycle of calculating task of the block scheme of the controller.

2 The block scheme of the controller

The block scheme is formed by means of the tab controller's blocks, configuration of the block (Figure 4) and its connections (Fig. 5).

Blocks of block scheme can connect both among themselves and to the attributes of the parameters. Blocks themselves do not contain the structure of input/output(IO), but contain values, based on the IO-structure of related function. Function for linking with a block is used from the object model of the system OpenSCADA.

Any block may at any time be removed from the process and be reconfigured and then may be again included in the process. Communications between the blocks can be configured without exception blocks from the processing and stopping of the controller. All IO values without connections can be changed during processing.

Using tab of the blocks you can:

  • Add/remove a block in the block scheme.
  • To monitor the total number, number of enabled and the number of processing blocks.
Fig. 4. Configuration tab of a block scheme.

Using the form of block configuration it can be set:

  • The state of the block, as follows: "Enable" and "Process".
  • Id, name and description of the block.
  • The state in which the block is to be translated at boot time: "To enable" and "To process".
  • Set block which must calculate before this block.
  • Appoint a working function from the object model. Back to the function for familiarization.
Fig. 5. Configuration tab of links of a block of a block scheme.

Using the configuration tab of links of the block of the block scheme the links can be set for the parameter of each block separately.

The following types of links are supported:

  • Inter-block. Connecting the block input to the output of another block, the input of one block to another's input and output of one block to the input of another.
  • Distant inter-block. The connection of blocks from various controllers of the module.
  • Ratio. The transformation of the input to a constant. All inputs/outputs by default are initiated as constants.
  • External attribute of the parameter.

To set values for the parameter of the block there is the corresponding tab (Fig.6).

In accordance with the custom functions in the system OpenSCADA the four main types of IO are supported: integer, float, boolean and string.

Fig. 6. Configuration tab of values of parameters of a block of a block scheme.

The module provides a special treatment of a number of IO of the block:

  • f_frq — Frequency computation or the time after the last calculation of the block, the negative in seconds for scheduling of CRON, read-only.
  • f_start — First calculate of the block, start, read-only.
  • f_stop — Last calculate of the block, stop, read-only.
  • this — The block object.

3 Parameters of the controller

The module provides only one type of parameters — the "Standard". The parameter used to reflect the data, calculated in the blocks, on the attributes of the controller's parameters. Example of the configuration tab of the parameter is shown in Fig.7.

Fig. 7. Configuration tab of values of parameters of a controller.

From this tab you can set:

  • The state of the parameter, as follows: "Enable" and type of the parameter.
  • Id, name and description of the parameter.
  • The state in which the parameter must be translated at boot time: "To enable".
  • The list of attributes that are reflected on the parameters of the blocks. It is created as the list of elements in the format: {BLK}.{BLK_IO}[:{AID}:{ANM}]. Where:
{BLK} — block ID, block schemes ID; for constant value set to:
'*s' — string type;
'*i' — integer type;
'*r' — real type;
'*b' — boolean type.
{BLK_IO} — parameter of the block or of the the block scheme; for constant value set to attribute value;
{AID} — attribute of the parameter ID;
{ANM} — name of the attribute of parameter.

4 Copying of the block schemes

To simplify and expedite the development of complex and repetitive block schemes the mechanism of copying of the elements of block scheme both individually and block schemes entirely is provided. The mechanism of copying is integrated into the kernel of OpenSCADA and operates transparently.

5 User programming API

Some objects of the module provides functions for user's programming.

User object model of the module BlockCalc.

The object "Block" (SYS.DAQ.BlockCalc["cntr"]["blk_block"])

  • ElTp cfg( string nm ) — get value of configuration field nm of the object.
  • bool cfgSet( string nm, ElTp val ) [access to the appropriate subsystem] — set configuration field nm of the object to value val.
  • TCntrNodeObj cntr( ) — return the object of controller for the parameter nesting independent.

6 Links