From OpenSCADAWiki
Jump to: navigation, search
Other languages:
English • ‎українська
Constr.png Forming...
Name Version License Source Languages Author Description
Main library 1.1 GPLv2 OscadaLibs.db (SQL, GZip) > DAQ.tmplb_base en, uk, ru Roman Savochenko Library of the main templates of the DAQ sources processing and related services.
  • Founded: 2006

The library was created to provide main templates of the DAQ-sources processing and related services.

The template's names and their parameters are available in languages: English, Ukrainian and Russian. Their source code wrote in human language independent mode with calls for the translations by function tr() and the message's translation also allowed for English, Ukrainian and Russian.

For connection the library to a project of the OpenSCADA station you can obtain the database file as:

  • supplied with a ready and proper package of the Linux distribution like to "openscada-libdb-main", "openscada-LibDB.Main";
  • directly taken for most actual one from the subversion repository and converted to the DB SQLite file in the way:
$ wget http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql
$ sqlite3 -init OscadaLibs.sql OscadaLibs.db .exit

This obtained file next you can place into the project directory of the station and create the database object for the DB module "SQLite", registering the database file in the configuration.

For the DAQ-templates at generic you need create a device representing object into the Logical Level module and select proper template from the templates library. Next, to correct configuration, follow to specific of the template into the individual description.

1 Templates of standard structures of the DAQ-parameters

1.1 Analog signal (unified) (anUnif)

2.0 GPLv2 * en, uk, ru Roman Savochenko
Result and the operative setup.

Common, representative and unified template of analog input signals processing. The template forms a structure of analog parameter (complex tag) which can be easily connected to most widgets and cadres of the main elements library of the user interface just pointing the parameter object.

The representative structure of analog parameters (complex tags) is:

  • "Variable (var)" — end variable of the parameter — engineeric real value, allowed and suitable for archiving.
  • "Error (err)" — obligatory attribute of any parameter, consist of the combination of the error code and short text description, like to "2:No data or connection with source". The template reserves next error codes:
    • 1, 2 — hardware errors, when the data mostly wrong;
    • 3, 4 — alarm border errors;
    • 5, 6 — warning border errors;
    • 7 — the speed error of the variable changing.
  • "Scale:minimum (min)" and "Scale:maximum (max)" — main scale of the end variable, the output of which causes a hardware border error. The scale is also used as a scale of the variable trend display on the graphs.
  • "Logarithmic scale (log)" — the scale sign of the variable trend display on the graphs in the logarithmic scale.
  • "Dimension (ed)" — dimension (unit of measurement) of the variable.
  • "Precision (signs) (prec)" — number signs after the dot, for positive values, and precision (signs in whole), for negative ones, to display the real end variable on the screen.

Functions

  • Generic processing of the raw analog input for:
  • simple correction-calibration at the formula "in = iMult*(in+iAdd)";
  • scaling from the hardware border [plcMin...plcMax] to the main border [min...max], applying the square scale scSqr;
At.png The hardware borders can be inverted ones and disabled in whole for equal values of the maximum and minimum, when the main border only used.
  • permission to exceed the border for the input value on the value of plcExcess percent;
  • filtering the input value changing in the time Tf.
  • Simple imitation of the analog input, setting plcImit and linking the imitation-simulation source in plcImitIn.
At.png Missing the link plcImitIn (EVAL) causes to generating random analog input
  • Complex preprocessing and complete generation-imitation of the analog input on the internal programming language of OpenSCADA into the configuration IO inProc, where you can operate next service parameters:
  • in [IN|OUT] — the same raw analog input IO;
  • var [IN] — the end variable IO;
  • min, max [IN] — the main border IOs;
  • plcMin, plcMax [IN] — the hardware border IOs;
  • plcImit, plcImitIn [IN] — IOs of the simple imitation;
  • levErr, tErr [IN|OUT] — alarm level [-7...0] and text of the error (the attribute "err" format);
  • f_frq [IN] — frequency of calculation, the template IO;
  • this [IN] — reference to the parameter object, what executing the template;
  • ctx [IN] — object of the user context, what saved between the execution cycles.
  • Simple substitution for the variable subVar at the error (not valid) input variable (EVAL) in the modes: "no", "last" and "substitute".
  • Processing the result variable var for violation some borders and criteria, generating the alarms and proper setting the attribute err. The alarm borders can have some hysteresis HystBnd, can be delayed for the time alDelay and can be worked in the modes alSup: "init NORMA", "suppress", "save on change". Next borders and criteria are provided:
  • missing for data or connection with source at the EVAL input value — error code 1 and alarm level 5;
  • exceeding the input value of the hardware border — error code 1,2 and alarm level 5;
  • exceeding the end variable of the alarm border [aMin...aMax] — error code 3,4 and alarm level 4;
At.png Disabled at setting for equal or inverted values of the border
  • exceeding the end variable of the warning border [wMin...wMax] — error code 5,6 and alarm level 2;
At.png Disabled at setting for equal or inverted values of the border
  • big motion speed of the end variable — error code 7 and alarm level 2.

Template IOs

Identifier Name Type Mode Attribute Configuration Value
in Input Real Input Not attribute Link Input|var
inProc Input processing procedure Text Input Not attribute Constant
var Variable Real Input Read only Variable 0
ed Dimension String Input Full access Variable
min Scale: minimum Real Input Full access Variable 0
max Scale: maximum Real Input Full access Variable 100
scSqr Scale: square Boolean Input Full access Variable 0
subMode Substitute: mode Integer numbers selection Input Full access Variable 0

0;1;2
no;last;substitute

subVar Substitute: variable Real Input Full access Variable 0
alSup Violations

At.png The mode "save on change" is useful in duplicate configurations and the redundancy of the archive of violation messages when the duplicate station stopped for a long time and the context of the violations that are recoverable from the archive is no longer relevant.

Integer numbers selection Input Full access Variable 0

0;1;2
init NORMA;suppress;save on change

alDelay Violations delay, seconds Real Input Full access Variable 0
aMin Border down alarm Real Input Full access Variable 0
aMax Border up alarm Real Input Full access Variable 0
wMin Border down warning Real Input Full access Variable 0
wMax Border up warning Real Input Full access Variable 0
HystBnd Hysteresis of borders violation Real Input Full access Variable 1
speed Motion speed (%/cycle) Real Input Full access Variable 0
prec Precision (signs) Integer Input Full access Variable 2
log Logarithmic scale Boolean Input Full access Variable 0
Tf Filter time, seconds Real Input Full access Variable 0
iAdd Input addition Real Input Not attribute Constant 0
iMult Input multiplication Real Input Not attribute Constant 1
plcMin Minimum module scale Real Input Not attribute Constant 0
plcMax Maximum module scale Real Input Not attribute Constant 0
plcExcess Allowed scale exceeding, % Real Input Not attribute Constant 0
plcImit PLC imitation Boolean Input Not attribute Constant 0
plcImitIn PLC imitation input Real Input Not attribute Link Imitation|var
this Object Object Output Not attribute Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable
f_err Function error String Input Not attribute Variable 0
f_frq Frequency of calculation of the function (Hz) Real Input Not attribute Variable 1000
f_start Function start flag Boolean Input Not attribute Variable 0
f_stop Function stop flag Boolean Input Not attribute Variable 0
Configuration.

Configuring and using

1. Create and start a logical controller object or use any presented one with the needed scheduling properties.
2. Create a logical parameter object and select this template for it. Enable the parameter.
3. Into the tab "Template configuration" of the logical parameter object you need to set:
  • Inputlink to a source of the "raw" signal.
  • Input processing procedure — form for the complex preprocessing and complete generation of the analog input on the internal programming language of OpenSCADA. It is optional and should be defined in complex cases, for example:
  • simple and transparent preprocessing to bring the percentage of UPS load to power that can be done with iMult also:
in = 490*in/100;	//the UPS has 480W 
  • implementing of the input signal counter — consumed electricity of the UPS:
//Checking for the data validity
if(ctx.cntr.isEVal())	ctx.cntr = this.var.get();
if(!in.isEVal()) {
	pUPS = 33;
	if(ctx.cntr.isEVal())	ctx.cntr = (pUPS+in)/(3600*f_frq);
	else ctx.cntr += (pUPS+in)/(3600*f_frq);
}

//Checking for the next month reset
month = 0; SYS.localtime(SYS.time(), 0, 0, 0, 0, month);
if(!ctx.month.isEVal() && month != ctx.month)	ctx.cntr = 0;
ctx.month = month;

in = ctx.cntr; 
  • generating of the extended violations — processing for the external signals related to the source:
gO = this.cntr().prm_grps;
if(SYS.DAQ.JavaLikeCalc.lib_aviary.sensorError(gO.prm_generic.PRG_Input_Err_T_room_S.get(),levErr,tErr));
else if(!(tVl=gO.prm_alarms.PRG_Alarm_T_max.get()).isEVal() && tVl)
	levErr = -4, tErr = "11:above the set limit";
else if(!(tVl=gO.prm_alarms.PRG_Alarm_T_min.get()).isEVal() && tVl)
	levErr = -4, tErr = "11:below the set limit"; 
  • Minimum and maximum of the module scale — must be set at the case of significant difference the hardware and the generic scales, for example:
  • the input is raw and measured in value of the current [4...20]mA, here it is necessary to specify 4 and 20 mA;
  • the previous case where it is necessary to simply and transparently calibrate the end value — with a precision device set 4mA and 20mA and indicate here the real measured values of the "raw" signal.
  • Input addition and multiplication — use for easy and linear correction of the input, for example:
  • calibration for the end value, which is less transparent and these coefficients should be calculated according to the formulas:
iAdd = ((plcMin*precMeasMax)/plcMax - precMeasMin)*(plcMax/(plcMax-plcMin))
iMult = (plcMax - plcMin) / (precMeasMax - precMeasMin)
  • Allowed scale exceeding, % — set if necessary to exceed the value of the main border, and when this scale starts to perform the recommendation function, say for the initial display of the trend on this scale.
  • PLC imitation and the imitation input — define at the need to simulate the input as required in the functions.
4. RESULT: Launching the controller object (where this parameter is created) and if it has not been started, we must get the operational data in the tab "Attributes" for: variable, error status; and the generation of violations if the state of the error is nonzero.
5. In process of the working, through the tab "Attributes" of operational data, in addition to obtaining the result, it is possible to perform operative setup and control on:
  • Scale: minimum and maximum — strictly At.png set to the range of data changes by availability and according to the hardware border, otherwise the value will be distorted! In the absence of the hardware border, this, the main border, is arbitrary and advisory, although exceeding of the border by the value will be also accompanied by a violation.
  • Scale: square — set if the hardware border is square one.
  • Filter time, seconds — set the filtering time for noisy signals.
  • Substitute: mode and variable — set the desired substitution mode at invalidity the variable.
  • Violations — set to the required violation mode, or disable their generation in whole.
  • Violations delay, seconds — set the delay time for the generation of the violations, to exclude frequent generation, characteristic to uncertain sources of data, characterized by short-term loss of communication.
  • Border up/down alarm/warning — set when it is necessary to generate violations at the exceeding of the alarm/warning borders.
  • Hysteresis of borders violation — set the hysteresis of removing the violation, that is, removal of the violations occurs at the specified percentage later, in order to prevent the frequent generation by fluctuating the value near the border.
  • Motion speed (%/cycle) — set if it is necessary to warn about fast change of value.
  • Name, Description, Dimension, Precision (signs), Logarithmic scale — set this information as needed when displayed, or as an element of the passport.


1.2 Analog signal (unified, violation statuses) (anUnifSt)

1.1 GPLv2 * en, uk, ru Roman Savochenko

Common, representative and unified template of analog input signals processing, extended by binary states of indication the violations. The template grounded on the base template "Analog signal (unified)" with its representative structure and some differences characteristic to independent development and expansion.

Binary states were provided for the convenient use of algorithms of operation at the borders of violations of the parameter object, preferably in the block diagrams of general control algorithms.

Functions
Mostly the same as the basic template "Analog signal (unified)" and the borderline signs are additionally provided: "H", "L", "HH", "LL", "EVAL".

Template IOs

Identifier Name Type Mode Attribute Configuration Value
Template IOs of "Analog signal (unified)"
H Border up warning violation Boolean Output Read only Variable
L Border down warning violation Boolean Output Read only Variable
HH Border up alarm violation Boolean Output Read only Variable
LL Border down alarm violation Boolean Output Read only Variable
EVAL Error value Boolean Output Read only Variable

Configuring and using
Completely identical to "Analog signal (unified)]" with the difference of using the borderline signs: "H", "L", "HH", "LL", "EVAL"; which can be connected to external computing.


1.3 Manual input (unified) (manInUnif)

1.0 GPLv2 * en, uk, ru Roman Savochenko
Result and the operative setup.

Common, representative and unified template of a manual input and an analog output signal. The template forms a structure of parameter (complex tag) of the manual input what can be easily connected to most widgets and cadres of the main elements library of the user interface just pointing the parameter object, the control mostly can be performed through the Element cadre control panel.

The representative structure of the parameter (complex tag) of the manual input is:

  • "Variable (var)" — end variable of the parameter — engineeric real value, allowed and suitable for archiving.
  • "Variable input (varIn)" — attribute for entering a new engineering value, which in the next falls into the variable.
  • "Error (err)" — obligatory attribute of any parameter, consist of the combination of the error code and short text description, like to "2:No data or connection with source". The template reserves next error codes:
    • 1, 2 — hardware errors, when the data mostly wrong;
    • 3, 4 — alarm border errors;
    • 5, 6 — warning border errors;
    • 7 — the speed error of the variable changing.
  • "Scale:minimum (min)" and "Scale:maximum (max)" — main scale of the end variable, the output of which causes a hardware border error. The scale is also used as a scale of the variable trend display on the graphs.
  • "Logarithmic scale (log)" — the scale sign of the variable trend display on the graphs in the logarithmic scale.
  • "Dimension (ed)" — dimension (unit of measurement) of the variable.
  • "Precision (signs) (prec)" — number signs after the dot, for positive values, and precision (signs in whole), for negative ones, to display the real end variable on the screen.

Functions

  • Generic processing of the raw analog input for:
  • simple correction-calibration at the formula "in = iMult*(in+iAdd)";
  • scaling from the hardware border [plcMin...plcMax] to the main border [min...max], applying the square scale scSqr;
At.png The hardware borders can be inverted ones and disabled in whole for equal values of the maximum and minimum, when the main border only used.
  • permission to exceed the border for the input value on the value of plcExcess percent;
  • filtering the input value changing in the time Tf.
  • Processing the result variable var for violation some borders and criteria, generating the alarms and proper setting the attribute err. The alarm borders can have some hysteresis HystBnd and can be suppressed setting alSup. Next borders and criteria are provided:
  • missing for data or connection with source at the EVAL input value — error code 1 and alarm level 5;
  • exceeding the input value of the hardware border — error code 1,2 and alarm level 5;
  • exceeding the end variable of the alarm border [aMin...aMax] — error code 3,4 and alarm level 4;
At.png Disabled at setting for equal or inverted values of the border
  • exceeding the end variable of the warning border [wMin...wMax] — error code 5,6 and alarm level 2;
At.png Disabled at setting for equal or inverted values of the border
  • big motion speed of the end variable — error code 7 and alarm level 2.
  • Reverse conversion of the engineered variable value and writing to the output.
At.png In the absence of the "Input/Output" connection, the writing is not performed and there is the stand-alone operation.

Template IOs

Identifier Name Type Mode Attribute Configuration Value
inout Input/Output Real Output Not attribute Link Parameter|var
var Variable Real Input Read only Variable 0
varIn Variable input Real Input Full access Variable 0
ed Dimension String Input Full access Variable
min Scale: minimum Real Input Full access Variable 0
max Scale: maximum Real Input Full access Variable 100
scSqr Scale: square Boolean Input Full access Variable 0
alSup Violations suppress Boolean Input Full access Variable 0
aMin Border down alarm Real Input Full access Variable 0
aMax Border up alarm Real Input Full access Variable 0
wMin Border down warning Real Input Full access Variable 0
wMax Border up warning Real Input Full access Variable 0
HystBnd Hysteresis of borders violation Real Input Full access Variable 1
speed Motion speed (%/cycle) Real Input Full access Variable 0
prec Precision (signs) Integer Input Full access Variable 2
log Logarithmic scale Boolean Input Full access Variable 0
Tf Filter time, seconds Real Input Full access Variable 0
iAdd Input addition Real Input Not attribute Constant 0
iMult Input multiplication Real Input Not attribute Constant 1
plcMin Minimum module scale Real Input Not attribute Constant 0
plcMax Maximum module scale Real Input Not attribute Constant 0
plcExcess Allowed scale exceeding, % Real Input Not attribute Constant 0
this Object Object Output Not attribute Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable
f_err Function error String Input Not attribute Variable 0
f_frq Frequency of calculation of the function (Hz) Real Input Not attribute Variable 1000
f_start Function start flag Boolean Input Not attribute Variable 0
f_stop Function stop flag Boolean Input Not attribute Variable 0
Configuration.

Configuring and using

1. Create and start a logical controller object or use any presented one with the needed scheduling properties.
2. Create a logical parameter object and select this template for it. Enable the parameter.
3. Into the tab "Template configuration" of the logical parameter object you need to set:
  • Input/Outputlink to a source of the "raw" IO signal, or do not link for the stand-alone mode.
  • Minimum and maximum of the module scale — must be set at the case of significant difference the hardware and the generic scales, for example see the template "Analog signal (unified)".
  • Input addition and multiplication — use for easy and linear correction of the input, for example see the template "Analog signal (unified)".
  • Allowed scale exceeding, % — set if necessary to exceed the value of the main border, and when this scale starts to perform the recommendation function, say for the initial display of the trend on this scale.
4. RESULT: Launching the controller object (where this parameter is created) and if it has not been started, we must get the operational data in the tab "Attributes" for: variable, error status; and the generation of violations if the state of the error is nonzero; and it will be allowed to set new values.
5. In process of the working, through the tab "Attributes" of operational data, in addition to obtaining the result, it is possible to perform operative setup and control on:
  • Scale: minimum and maximum — strictly At.png set to the range of data changes by availability and according to the hardware border, otherwise the value will be distorted! In the absence of the hardware border, this, the main border, is arbitrary and advisory, although exceeding of the border by the value will be also accompanied by a violation.
  • Scale: square — set if the hardware border is square one.
  • Filter time, seconds — set the filtering time for noisy signals.
  • Violations suppress — set to disable the violations generation in whole.
  • Border up/down alarm/warning — set when it is necessary to generate violations at the exceeding of the alarm/warning borders.
  • Hysteresis of borders violation — set the hysteresis of removing the violation, that is, removal of the violations occurs at the specified percentage later, in order to prevent the frequent generation by fluctuating the value near the border.
  • Motion speed (%/cycle) — set if it is necessary to warn about fast change of value.
  • Name, Description, Dimension, Precision (signs), Logarithmic scale — set this information as needed when displayed, or as an element of the passport.


1.4 Discrete block (unified) (digitBlockUnif)

1.0 GPLv2 * en, uk, ru Roman Savochenko
Result and the operative setup.

Common, representative and unified template of the block for union of Discrete parameters for the common control device. The template forms a structure of discrete parameter-block (complex tag) which can be easily connected to most widgets and cadres of the main elements library of the user interface just pointing the parameter object.

The representative structure of discrete parameters (complex tags) is a latch object with two characteristic states and three commands, which in the final representation may have a different meaning and name:

  • "State "Opened" (st_open)" — the state "Opened" of the latch. Is the primary status signal that can be used without the next one, when 1 (true) is "Opened", and 0 (false) is 'Closed'.
  • "State "Closed" (st_close)" — the state "Closed".
  • "Command "Open" (com)" — the command "Open" of the latch. Is the primary command signal that can be used without the next one, when 1 (true) is "Open", and 0 (false) is 'Close'.
  • "Command "Close" (close)" — the command "Close" of the latch.
  • "Command "Stop" (stop)" — the command "Stop" of the latch.

Functions

  • Direct obtaining, by link, of the two states (read only) and three commands (reading and writing).
  • Possibility of holding the commands for a certain time and removing them.
  • Ability to redefine the states and commands by the appropriate settings of the interface elements, such as digStts, for statuses, and digComs, for commands.

Template IOs

Identifier Name Type Mode Attribute Configuration Value
com Command "Open" Boolean Output Full access Link com
close Command "Close" Boolean Output Full access Link close
stop Command "Stop" Boolean Output Full access Link stop
st_open State "Opened" Boolean Input Read only Link st_open
st_close State "Closed" Boolean Input Read only Link st_close
tCmd Time to hold the command, seconds Integer Input Not attribute Constant 5
last_cmd Last command Integer Output Not attribute Variable 0
w_tm Process command counter Real Output Not attribute Variable 0
f_err Function error String Input Not attribute Variable 0
f_frq Frequency of calculation of the function (Hz) Real Input Not attribute Variable 1000
f_start Function start flag Boolean Input Not attribute Variable 0
f_stop Function stop flag Boolean Input Not attribute Variable 0
Configuration.

Configuring and using

1. Create and start a logical controller object or use any presented one with the needed scheduling properties.
2. Create a logical parameter object and select this template for it. Enable the parameter.
3. Into the tab "Template configuration" of the logical parameter object you need to set:
4. RESULT: Launching the controller object (where this parameter is created) and if it has not been started, we must get the operational data in the tab "Attributes" for: states and commands.
5. In process of the working, through the tab "Attributes" of operational data, in addition to obtaining the result, it is possible to perform operative control, performing the commands:


1.5 Alarm discrete (digAlarm)

1.0 GPLv2 * en, uk, ru Roman Savochenko
Result and the operative setup.

Common, representative and unified template of separate discrete parameter (complex tag) processing with formation of signaling by the defined criterion. The template forms a structure of discrete parameter (complex tag) which can be easily connected to most widgets and cadres of the main elements library of the user interface just pointing the parameter object.

The template provides some fields of the representative structure of the discrete parameters and adds the error field:

  • "State "Opened" (st_open)" — the state "Opened".
  • "State "Closed" (st_close)" — the state "Closed".
  • "Error (err)" — obligatory attribute of any parameter, consist of the combination of the error code and short text description, like to "2:No data or connection with source". The template reserves next error codes:
    • 1 — hardware errors, when the data mostly wrong;
    • 3 — violation of the specified condition.

Functions

  • Direct obtaining, by link, of the initial state and formation of two representative states with the possibility of their inversion stInv.
  • Complex preprocessing and complete generation-imitation of the discrete input on the internal programming language of OpenSCADA into the configuration IO inProc, where you can operate next service parameters:
  • in [IN|OUT] — the same raw discrete input IO;
  • levErr, tErr [IN|OUT] — alarm level [-7...0] and text of the error (the attribute "err" format);
  • f_frq [IN] — frequency of calculation, the template IO;
  • this [IN] — reference to the parameter object, what executing the template;
  • ctx [IN] — object of the user context, what saved between the execution cycles.
  • Processing of the discrete input in for the purpose of creating a violation and correspondingly setting the attribute err, at the condition "{st}:{lev}:{mess}", that is generation violation of the level lev and the text mess for the input status st (0|1).

Template IOs

Identifier Name Type Mode Attribute Configuration Value
alrm Alarm "{st}:{lev}:{mess}" String Input Not attribute Constant
stInv State inversion Boolean Input Not attribute Constant
in Input Boolean Input Read only Link Input|in
inProc Input processing procedure Text Input Not attribute Constant
st_open State "Opened" Boolean Input Read only Variable
st_close State "Closed" Boolean Input Read only Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable
this Object Object Input Not attribute Variable
f_err Function error String Input Not attribute Variable 0
f_frq Frequency of calculation of the function (Hz) Real Input Not attribute Variable 1000
f_start Function start flag Boolean Input Not attribute Variable 0
f_stop Function stop flag Boolean Input Not attribute Variable 0
Configuration.

Configuring and using

1. Create and start a logical controller object or use any presented one with the needed scheduling properties.
2. Create a logical parameter object and select this template for it. Enable the parameter.
3. Into the tab "Template configuration" of the logical parameter object you need to set:
  • "Alarm "{st}:{lev}:{mess}" — define the criterion for the violation formation, leave blank to disable the violations generation.
  • "State inversion" — set to invert the representative attributes, that is, "st_open" set for "in" equal to false.
  • Inputlink to a source of the "raw" signal.
  • Input processing procedure — form for the complex preprocessing and complete generation of the discrete input on the internal programming language of OpenSCADA. For example:
  • complete creation for a complex status:
gO = this.cntr().prm_grps;
status = gO.prm_generic.PRG_Input_Err_T_Zone1_S.get();
in = gO.prm_generic.SET_CalcFan_UseSensor_T1.get() || !(status == 0 || status == 2 || status == 3); 
4. RESULT: Launching the controller object (where this parameter is created) and if it has not been started, we must get the operational data in the tab "Attributes" for: variable, error status; and the generation of violations if the state of the error is nonzero.


1.6 Code state (codeState)

1.1 GPLv2 * en, uk, ru Roman Savochenko
Result and the operative setup.

A variant of the common, representative and unified template of the block for union of Discrete parameters, expanded by more than two states and three commands that can be encoded by an integer value. The template forms a structure of parameter (complex tag) which can be easily connected to most widgets and cadres of the main elements library of the user interface just pointing the parameter object.

The representative structure of the parameter (complex tag) of the code state is:

  • "State "Text" (st_text)" — text description of the state.
  • "Command "Text" (com_text)" — text of the command.
  • "Commands (digComs)" — common list of the allowed commands, to form the selecting.

Functions

  • Direct receiving, by link, the status code and the command (read only), as well as setting the status text according to the list of states stats.
  • Working out the text of the command com_text to find it in the general list coms of commands and issuing the received command code to the output.
  • Generating from the general list coms of commands the list of commands to be selected in digComs.
  • Complex processing and complete generation-imitation of the code state, as well as processing the code or the command text for targeted actions, on the internal programming language of OpenSCADA into the configuration IO inProc, where you can operate next service parameters:
  • in [IN|OUT] — IO of the code state;
  • text [OUT] — direct text status setting;
  • coms [IN] — list of available commands, of the corresponded IO;
  • com_text [IN|OUT] — text of the received command;
  • levErr, tErr [IN|OUT] — alarm level [-7...0] and text of the error (the attribute "err" format);
  • f_frq [IN] — frequency of the calculation, the template IO;
  • this [IN] — reference to the parameter object, what executing the template;
  • ctx [IN] — object of the user context, what saved between the execution cycles.
  • Formation of the violation and the corresponding setting of the attribute err, provided at setting in the processing procedure or lack of the communication (in = EVAL).

Template IOs

Identifier Name Type Mode Attribute Configuration Value
in Input Integer Input Read only Link Signal|in
out Output Integer Output Read only Link Signal|out
inProc Input processing procedure Text Input Not attribute Constant
st_text State "Text" String Input Read only Variable
stats States, rows "{code}:{State}" Text Input Full access Variable
com_text Command "Text" String Input Full access Variable
coms Commands-states, rows "{code}:{State}" Text Input Full access Variable
digComs Commands Text Input Read only Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable
this Object Object Output Not attribute Variable
f_err Function error String Input Not attribute Variable 0
f_frq Frequency of calculation of the function (Hz) Real Input Not attribute Variable 1000
f_start Function start flag Boolean Input Not attribute Variable 0
f_stop Function stop flag Boolean Input Not attribute Variable 0
Configuration.

Configuring and using

1. Create and start a logical controller object or use any presented one with the needed scheduling properties.
2. Create a logical parameter object and select this template for it. Enable the parameter.
3. Into the tab "Template configuration" of the logical parameter object you need to set:
  • Input and Outputlink to a source of the "raw" signal.
  • Input processing procedure — form for the processing and complete generation-imitation of the input, and issuing of the specific output, on the internal programming language of OpenSCADA. For example:
  • complete creation for the state code and alarms forming:
gO = this.cntr().prm_grps;
if(gO.prm_fansControl.PRG_CntrFan_AutoMode_G1.get().isEVal())	in = 4;
else {
  if(!(tVl=gO.prm_fansControl.PRG_CntrFan_Alarm_ThermalRelay.get()).isEVal() && tVl)
    levErr = -4, tErr = "11:alarm";
  if(gO.prm_fansControl.PRG_CntrFan_AutoMode_G1.get())
    in = gO.prm_fansControl.PRG_CntrFan_On_G1.get() ? 1 : 2;
  else in = 3;
} 
  • forming the clock time text and issuing the time synchronization — direct status text setting and issuing for specific commands:
curTm = SYS.time();
text = SYS.strftime(curTm, "%H։%M %d.%m.%Y");
gO = this.cntr().prm_grps;
if(!(tVl=gO.prm_other.PRG_RTC_UNIX.get()).isEVal()) {
  text += " ("+(tVl-curTm).toString(10,0,true)+")";
}

if(com_text.length && !com_text.isEVal() && (tVl=coms.match("^([^:]+):"+com_text,"m")).length && tVl[1] == 1) {
  gO.prm_other.SET_RTC_New_UNIX.set(curTm);
  gO.prm_other.KEY_RTC_set_time.set(true);
} 
4. RESULT: Launching the controller object (where this parameter is created) and if it has not been started, we must get the operational data in the tab "Attributes" for: input, output, code-input state, error status; and the generation of violations if the state of the error is nonzero.
5. In process of the working, through the tab "Attributes" of operational data, in addition to obtaining the result, it is possible to perform operative control, performing the commands:
  • States, rows "{code}:{State}" — set to list of accordance with its status code to text.
  • Commands-states, rows "{code}:{State}" — set to list of accordance with its status-command code to text.
  • Command "Text" — set in the command text, which is described in the command list, for the code conversion and issuance.


1.7 PID signal (unified, violation statuses) (pidUnif)

1.1 GPLv2 * en, uk, ru Roman Savochenko

Constr.png Waiting to form ... The unified template for process analog signals with properties of PID ...


1.8 Impulse PID signal (unified, violation statuses) (pidUnifImp)

1.0 GPLv2 * en, uk, ru Roman Savochenko

Constr.png Waiting to form ... The unified template for process analog signals with properties of impulse PID ...


2 Templates of the complex objects

2.1 Uninterruptible power supply unifying data (UPS)

1.2 GPLv2 * en, uk, ru Roman Savochenko
Constr.png Waiting for the translation and actualizing ...

Uninterruptible power supply unifying data is to provide all the data into the single attribute "All items" of the object type for next control as object with the data providing as a table, alarming and allowing to set for writable attributes. The template designed for using with the data source module "System" as an "UPS" and the widget "Main.objProps" as the data presenter. The template you can use also as an example to create other data unification as the complex object with properties, alarming and writing.

Template IOs

Identifier Parameter Type Mode Attribute Configuration Value
srcAddr Source object's address String Input Not attribute Constant
items All items Object Output Full access Variable
alDelay Alarms delay, s Real Input Full access Variable 0
bChL Battery charge low Real Input Full access Variable 20
bChLL Battery charge critical Real Input Full access Variable 5
inVL Input voltage low Real Input Full access Variable 210
inVH Input voltage high Real Input Full access Variable 250
inFLL Input frequency too low Real Input Full access Variable 40
inFL Input frequency low Real Input Full access Variable 45
inFH Input frequency high Real Input Full access Variable 55
inFHH Input frequency too high Real Input Full access Variable 60
loadH Load high Real Input Full access Variable 80
loadHH Load too high Real Input Full access Variable 100
tH Temperature high Real Input Full access Variable 50
tHH Temperature too high Real Input Full access Variable 70
this Object Object Input Not attribute Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable

Configuring and using

1. Create a source controller object into the module "System" and set its Identifier like to "SYSData".
2. Create a source parameter object into the previous source controller object and set its Identifier like to "UPS".
3. Create and start a logical controller object or use any presented one with the needed scheduling properties.
4. Create a logical parameter object and select the template for it, one for each the devices. Enable the parameter.
5. Into the tab "Template configuration" of the logical parameter object you need to set:
  • Source object's address — to address of the source UPS parameter object (see to step 1) like to "System.SYSData.UPS".
6. Result: Into the attribute items you will get the object with all attributes and its properties. At some violations into the attribute "err" you will get information about that and some alarming borders you may adjust in the related attributes.
7. Into the visual interfaces developing of the module Vision place the widget "Main.objProps" to any page and link it to the parameter object, created into step 4.
8. Result: Into runtime of the page you get a table with data of the object, notifications about violations into the header and it is allowing to set of writable properties.


2.2 Network devices by SNMP unifying data (SNMP)

1.0 GPLv2 * en, uk, ru Roman Savochenko
Constr.png Waiting for the translation and actualizing ...

SNMP unifying data is to provide all the data into the single attribute "All items" of the object type for next control as object with the data providing as a table, alarming and allowing to set for writable attributes. The template designed for using with the data source module "SNMP" as an "SNMP device" and the widget "Main.objProps" as the data presenter. The template you can use also as an example to create other data unification as the complex object with properties, alarming and writing.

  • Sponsored by: PAC HARTRON

Template IOs

Identifier Parameter Type Mode Attribute Configuration Value
srcAddr Source object's address String Input Not attribute Constant
manTables Manual tables String Input Not attribute Constant
items All items Object Output Full access Variable
this Object Object Input Not attribute Variable
SHIFR Code String Input Not attribute Variable
NAME Name String Input Not attribute Variable
DESCR Description String Input Not attribute Variable

Configuring and using

1. Create a source controller object into the module "SNMP" and set its Identifier like to "SYSData".
2. Create a source parameter object into the previous source controller object and set its Identifier like to "DEV".
3. Create and start a logical controller object or use any presented one with the needed scheduling properties.
4. Create a logical parameter object and select the template for it, one for each the devices. Enable the parameter.
5. Into the tab "Template configuration" of the logical parameter object you need to set:
  • Source object's address — to address of the source SNMP device parameter object (see to step 1) like to "System.SYSData.DEV".
  • Manual tables — enter manually some static MIB-variables.
6. Result: Into the attribute items you will get the object with all attributes and its properties. At some violations into the attribute "err" you will get information about that.
7. Into the visual interfaces developing of the module Vision place the widget "Main.objProps" to any page and link it to the parameter object, created into step 4.
8. Result: Into runtime of the page you get a table with data of the object, notifications about violations into the header and it is allowing to set of writable properties.

3 Services

3.1 Notificator by SMS, EMail(SMTP) (ntf)

1.0 GPLv2 * => UserProtocol en Roman Savochenko
Constr.png Waiting for the translation and actualizing ...

The complex template of the notification, contains of parts of the dispatcher and the output user protocol of notification by EMail(SMTP) and SMS.

  • Sponsored by: SVItoVYR LTD

THE DISPATCHER can be performed for pointed messages of the message buffer of OpenSCADA and applied on the Logical level or the controller object of the module JavaLikeCalc.

Configuring and using

1. Create a parameter in a controller object of the Logical Level or a controller object in the module DAQ.JavaLikeCalc.
2. Create an output transport of the type "Serial" and set its Identifier like to "SMS", one transport suitable for more receivers.
3. Set for proper address, only for the Serial device. The serial port speed, asynchronous data format and timeouts will adjusted by the function.
4. Create an output transport of the type "Sockets" or "SSL" and set its ID like to "SMTP", one transport suitable for more receivers.
5. Set-up for proper address, for Sockets(25) or SSL(465). The transport timeouts will be adjusted by the function.
6. Into the tab "Template configuration" you need to set:
  • Maximum notification timeout, seconds.
  • Messages level, negative for alarms.
  • Messages category, template or regular expression.
  • Output transport for SMTP connection, empty for disable.
  • Auth, empty for disable.
  • Sender.
  • Destination receiver address.
  • EMail topic.
  • EMail message.
  • SMS serial transport, empty for disable.
  • SMS pin, empty for disable.
  • SMS destination receiver, tel. number.
  • SMS in text mode, else PDU.
7. Result: Sending for the pointed messages at SMS or EMail(SMTP).

THE OUTPUT USER PROTOCOL PART "SMS" provides operations with SMS by a GSM-modem connected as serial device. For now supported only sending SMS messages to a number of remote cell phone or GSM modem. For sending there are supported: ECHO disable, PIN check and set, sending in PDU and Text mode.

Output user protocol's XML request structure
<cmd pin="1111" tel="+380XXXXXXXXX" text="{0|1}" err="1:Error">{SMSText}</cmd>

cmd — command, for now only "send" allowed;
pin — PIN code to the SIM card access;
tel — telephone number of the receiver (remote cell phone or GSM modem);
text{0,1} — SMS in the text mode, only ASCII;
SMSText — the message text;
err — sets for the request result.

Configuring and using

1. Create an output transport of the type "Serial" and set its Identifier like to "SMS", one transport suitable for more receivers.
2. Set for proper address, only for the Serial device. The serial port speed, asynchronous data format and timeouts will adjusted by the function.
3. Create of needed user protocol object based on the templates, with ID like to "SMS".
4. Place some requesting commands directly into presented or a new internal OpenSCADA procedure like to:
req = SYS.XMLNode("send"); req.setAttr("ProtIt","SMS").setAttr("pin","1111").setAttr("tel","+380XXXXXXXXX").setText("Notify message");
SYS.Transport.Serial.out_SMS.messIO(req, "UserProtocol");
rez = req.attr("err").toInt() ? req.attr("err") : "OK";
5. Result: Into the variable rez you will get "OK" if no errors occur and the message successfully transmitted to the receiver.

THE OUTPUT USER PROTOCOL PART "SMTP" provides operations with a SMTP server for receiving EMails by their sending through TCP-Socket or SSL. For now there are supported: TCP, SSL, AUTH, topic encoding for UTF-8.

Output user protocol's XML request structure
<send auth="{user}:{pass}" from="{FromAddr}" to="{ToAddr}" topic="{My Topic}" err="1:Error">{MessageText}</send>

topic — topic of the message;
from — sender address;
to — destination address of the receiver;
auth — authenticate user and password;
MessageText — text of the message;
err — sets for the request result.

Configuring and using

1. Create an output transport of the type "Sockets" or "SSL" and set its ID like to "SMTP", one transport suitable for more receivers.
2. Set-up for proper address, for Sockets(25) or SSL(465). The transport timeouts will be adjusted by the function.
3. Create of needed user protocol object based on the templates, with ID like to "SMTP".
4. Place some requesting commands directly into allowed or a new internal OpenSCADA procedure like to:
req = SYS.XMLNode("send"); req.setAttr("ProtIt","SMTP").setAttr("from","noreply@oscada.org").setAttr("to","oscada@oscada.org").setAttr("topic","My topic").setText("My message");
SYS.Transport.Sockets.out_SMTP.messIO(req, "UserProtocol");
rez = req.attr("err").toInt() ? req.attr("err") : "OK";
5. Result: Into the variable rez you will get "OK" if no errors occur and the message successfully transmitted to the receiver.