3.2 Connecting the inputs and outputs in the control algorithm

The inputs and outputs of the driver must be interconnected with the individual tasks (.mdl files). The individual tasks (QTASK or TASK blocks) are connected to the QTask, Level0,…, Level3 outputs of the main EXEC block. Use the blocks depicted in Fig. 3.4 to interchange data between the control algorithm and the DbDrv driver.


PIC


Figure 3.4: Example of input and output flags of the DbDrv driver

The From block allowing the user to read one input signal has the Goto tag set to DB__<IN>. The Goto block allowing the user to set one output signal has the Goto tag set to DB__<OUT>, where <IN> and <OUT> are strings referring to the items defined in the *.rio configuration file. All the strings used for accessing data provided or accepted by the driver always have the DB prefix right at the beginning of the tag followed by two mandatory _ characters (underscore).

The rest of the input or output string reference is interpreted by the driver as defined in the *.rio configuration file.

There are additional auxiliary signals for each I/O signal. These can be assessed by appending the following strings to the signal reference:

_Disable
– If True, the read/write operations for the whole group are disabled.
_Trigger
– A rising edge triggers execution of the read/write operation.
_Age
– Number of seconds since the last read/write database access.
_Fresh
– Same as _Age
_AgeDb
– Number of seconds since the last read/write database access, on the contrary to the above the age is defined by the database item.
_FreshDb
– Same as _AgeDb
_Period
– Contains or sets the Period parameter, i.e. the period of SQL query execution as defined for each group.

The driver supports multi-flags, therefore it is possible to read/write several signals at once as displayed in Figure 3.4. See the INQUAD, OUTQUAD, INOCT, OUTOCT and INHEXD, OUTHEXD function blocks [2]. In this case the block name references the first object and the signals are mapped to this object and the consecutive ones (groups of 4, 8 or 16). This preserves communication bandwidth and also clarity of the algorithm.