Module | Name | Version | License | Source | Languages | Platforms | Type | Author | Description |
---|---|---|---|---|---|---|---|---|---|
FLibSYS | System functions | 1.8 | GPL2 | spec_FLibSYS.so | en,uk,ru,de | x86,x86_64,ARM | Special | Roman Savochenko Maxim Lysenko (2009) — the page initial translation |
Provides a library of the system functions of the user programming area of OpenSCADA. |
The module provides OpenSCADA for static library of functions for use in the user programming environment and the organization of extraordinary interaction algorithms.
To address the functions of the library you can use the static call address Special.FLibSYS.{Func}() or dynamic SYS.Special.FLibSYS["{Func}"].call(), SYS.Special.FLibSYS.{Func}(). Where {Func} — function identifier in the library.
Description: Calling the console commands of the OS. The function offers great opportunities to the OpenSCADA user by calling any system software, utilities and scripts, as well as getting the access to the huge volume of system data by means of them. For example the command "ls-l" returns the detailed contents of the working directory.
Parameters:
Identifier | Name | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
com | Command | String | Input |
Example:
using Special.FLibSYS;
test=sysCall("ls -l");
messPut("Example",0,"Example: "+test);
Description: Input/Output to: file, string stream.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(IO) | Return | |
name | File name or data (for string stream) | String | In | |
accs | File access (""-string stream;"r[+]"-read;"w[+]"-write from zero;"a[+]"-append;...) | String | In | |
mFormat | Machine data format ('n'-sys order;'b'-BigEndian;'l'-LittleEndian) | Integer | In | "n" |
enc | String encoding in the file/stream | Boolean | In |
Values:
Properties:
Functions:
Description: Formation of the SQL-request req to the DB addr, inside (trans=true), outside (trans=false) or no matter (trans=EVAL) to a transaction. At an error the result's property "err" sets to the error value.
Parameters:
Identifier | Name | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(Array) | Return | |
addr | DB address, "{TypeDB}.{DB}" | String | Input | |
req | SQL request | String | Input | |
trans | Transaction | Boolean | Input | EVAL |
Description: Creating a XML node object.
Parameters:
Identifier | Name | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(XMLNodeObj) | Return | |
name | Name | String | Input |
Example:
using Special.FLibSYS;
//Creating the "get" object of the XML node.
req = xmlNode("get");
//Creating the "get" object of the XML node with attributes creating.
//sub_DAQ/mod_ModBus/cntr_1/prm_1 — path according to the project structure.
req = xmlNode("get").setAttr("path","/sub_DAQ/mod_ModBus/cntr_1/prm_1/%2fprm%2fst%2fen");
Description: Requesting for control the program, by XML. The usual request is written in the form "<get path="/OPat/%2felem"/>". When we indicate the station the request to the specified external station is made.
Parameters:
Identifier | Name | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
req | Request | Object(XMLNodeObj) | Output | |
stat | Station | String | Input |
Example (more examples see for the equal internal function SYS.cntrReq()):
using Special.FLibSYS;
//Getting status "Off/On" of the parameter "1" of the controller "1" of the module "ModBus".
//sub_DAQ/mod_ModBus/cntr_1/prm_1 — the path according to the project structure.
req = xmlNode("get").setAttr("path","/sub_DAQ/mod_ModBus/cntr_1/prm_1/%2fprm%2fst%2fen");
rez = xmlCntrReq(req);
messPut("test",0,"Example: "+req.text());
//Setting the status "On" of the parameter "1" of the controller "1" of the module "ModBus".
req = xmlNode("set").setAttr("path","/sub_DAQ/mod_ModBus/cntr_1/prm_1/%2fprm%2fst%2fen").setText(1);
rez = xmlCntrReq(req);
//Setting the status "Off of the parameter "1" of the controller "1" of the module "ModBus".
req = xmlNode("set").setAttr("path","/sub_DAQ/mod_ModBus/cntr_1/prm_1/%2fprm%2fst%2fen").setText(0);
rez = xmlCntrReq(req);
Description: Returns the absolute time in seconds from the epoch of 1/1/1970 and the microseconds part into usec, if such a variable is indicated and its value is negative.
Parameters:
Identifiers | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
sec | Seconds | Integer | Return | 0 |
usec | Microseconds | Integer | Output | -1 |
Description: Full date and time in seconds, minutes, hours, etc., based on the absolute time in seconds from the epoch of 1.1.1970.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
fullsec | Full seconds | Integer | Input | 0 |
sec | Seconds [0...59] | Integer | Output | 0 |
min | Minutes [0...59] | Integer | Output | 0 |
hour | Hours [0...23] | Integer | Output | 0 |
mday | Day of the month [1...31] | Integer | Output | 0 |
month | Month [0...11] | Integer | Output | 0 |
year | Year, from 1900 | Integer | Output | 0 |
wday | Day of the week [0...6] | Integer | Output | 0 |
yday | Day of the year [0...365] | Integer | Output | 0 |
isdst | Daylight saving time | Integer | Output | 0 |
Example:
using Special.FLibSYS;
curMin=curHour=curDay=curMonth=curYear=0;
tmDate(tmTime(),0,curMin,curHour,curDay,curMonth,curYear);
messPut("test",0,"Current minute: "+curMin);
messPut("test",0,"Current hour: "+curHour);
messPut("test",0,"Current day: "+curDay);
messPut("test",0,"Current month: "+curMonth);
messPut("test",0,"Current Year: "+curYear);
Description: Getting the time in the formatted string. Recording of the format corresponds to the POSIX-function "strftime()".
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
val | Date and time string | String | Return | |
sec | Seconds | Integer | Input | 0 |
form | Date and time format | String | Input | %Y-%m-%d %H:%M:%S |
Example:
using Special.FLibSYS;
test = tmFStr(SYS.time(),"%d %m %Y");
messPut("Example",0,"tmFStr(): "+test);
Description: Converting the string data and time, for the form, to the time in seconds since 01.01.1970. For example, template "%Y-%m-%d %H:%M:%S" corresponds the time "2006-08-08 11:21:55". Description of the format of the template can be obtained from the documentation on the POSIX-function "strptime()".
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
sec | Seconds | Integer | Return | 0 |
str | Date and time string | String | Input | |
form | Date and time format | String | Input | %Y-%m-%d %H:%M:%S |
Example:
using Special.FLibSYS;
curMin=curHour=curDay=curMonth=curYear=0;
tmDate(tmTime(),0,curMin,curHour,curDay,curMonth,curYear);
test = tmStrPTime(""+curYear+"-"+(curMonth+1)+"-"+curDay+" 9:0:0","%Y-%m-%d %H:%M:%S");
messPut("Example",0,"tmStrPTime(): "+test);
Description: Scheduling the time at the CRON standard, returning the planned time from the base time or from the current time, if the base is not specified.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
res | Result, seconds | Integer | Return | 0 |
str | CRON | String | Input | * * * * * |
base | Base time, seconds | Integer | Input | 0 |
Description: Short sleeping from nanoseconds and up to STD_INTERF_TM (5 seconds).
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
res | Result | Integer | Return | 0 |
tm | Time, seconds | Real | Input |
Description: Getting size of the string.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Integer | Return | |
str | String | String | Input |
Example:
using Special.FLibSYS;
messPut("Example",1,"ReturnString: "+strSize("Example"));
Description: Getting of the substring.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
str | String | String | Input | |
pos | Position | Integer | Input | 0 |
n | Number | Integer | Input | -1 |
Example:
using Special.FLibSYS;
test = strSubstr("Example", 0, strSize("Example")-1);
messPut("Example", 1, "ReturnString: "+test);
Description: Inserting a string to another string.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
str | String | String | Output | |
pos | Position | Integer | Input | 0 |
ins | String to insert | String | Input |
Description: Replacing a part of the string by another string.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
str | String | String | Output | |
pos | Position | Integer | Input | 0 |
n | Number | Integer | Input | -1 |
repl | String to replace | String | Input |
Description: Parsing the string with a separator.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
str | String | String | Input | |
lev | Level | Integer | Input | |
sep | Separator | String | Input | "." |
off | Offset | Integer | Output |
Example:
using Special.FLibSYS;
ExapleString = "Example:123";
test = strParse(ExapleString, 1, ":");
messPut("Example", 0, "strParse(): "+test);
Description: Parsing of the path for items.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
path | Path | String | Input | |
lev | Level | Integer | Input | |
off | Offset | Integer | Output |
Example:
using Special.FLibSYS;
test = strParsePath(path, 0, "/");
messPut("Example", 1, "strParsePath(): "+test);
Description: Converting the path to the separated string.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
src | Source | String | Input | |
sep | Separator | String | Input | "." |
Example:
//Converting the value "/ses_AGLKS/pg_so" of the attribute "path" to the value "ses_AGLKS.pg_so"
using Special.FLibSYS;
test = strPath2Sep(path);
messPut("Example", 0, "path: "+path);
messPut("Example", 0, "strPath2Sep(): "+test);
Description: Encoding the string to use into the HTML source.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
src | Source | String | Input |
Description: Encoding the text to the binary, for the text format <00 A0 FA DE>.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
src | Source | String | Input |
Description: Decoding the text from the binary, for the text format <00 A0 FA DE>.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
src | Source | String | Input |
Description: Converting the real value to the string format.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
val | Value | Real | Input | |
prc | Precision | Integer | Input | 4 |
tp | Type | String | Input | "f" |
Description: Converting the integer value to the string format.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
val | Value | Integer | Input | |
base | Base (8, 10, 16) | Integer | Input | 10 |
Description: Converting the string value to the real format.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Real | Return | |
val | Value | String | Input |
Description: Converting the string value to the integer format.
Parameters:
ID | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Integer | Return | |
val | Value | String | Input | |
base | Base (2...36) | Integer | Input | 0 |
Description: Unified and completed implementing of the Cyclic Redundancy Code for the width in 1-64 bits with normal polynomial, the initial CRC, the input and output reference, and the XOR for output.
The previous notation of the function is supported also, where the reversed polynomial is placed in the width place!
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Integer | Return | |
data | Data | String | Input | |
width | Width | Integer | Input | 16 |
poly | Polynomial | Integer | Input | 32773 (0x8005) |
init | Initial | Integer | Input | -1 (0xFFFFFFFFFFFFFFFF) |
RefIn | Reference input | Bool | Input | 1 |
RefOut | Reference output | Bool | Input | 1 |
XorOut | XOR for output | Integer | Input | 0 |
Description: Calculating for the message Digest 5 of the data.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | String | Return | |
data | Data | String | Input |
Description: Splitting the float value (4 bytes) to the two words (2 bytes).
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
val | Value | Real | Input | |
w1 | Word 1 | Integer | Output | |
w2 | Word 2 | Integer | Output |
Description: Forming the float value (4 bytes) from the two words (2 bytes).
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Real | Return | |
w1 | Word 1 | Integer | Input | |
w2 | Word 2 | Integer | Input |
Description: Extracting for mantissa and exponent from the float value.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
magn | Magnitude | Real | Return | |
val | Value | Real | Input | |
exp | Exponent | Integer | Output |
Description: Get messages of the program.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(Array) | Return | |
btm | Begin time, seconds | Integer | Input | |
etm | End time, seconds | Integer | Input | |
cat | Category | String | Input | |
lev | Level | Integer | Input | |
arch | Archiver | String | Input |
Description: Put a message to the program.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
cat | Category | String | Input | |
lev | Level | Integer | Input | |
mess | Message | String | Input |
Example:
rnd_sq_gr11_lineClr="red";
Special.FLibSYS.messPut("Example",1,"Event: "+rnd_sq_gr12_leniClr);
Description: Getting the value archive object (VArchObj) through connecting to the archive at its address.
Parameters:
Identifier | Name | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(VArchObj) | Return | |
name | Name — address to the attribute of the parameter (DAQ.{Module}.{Cntr}.{Prm}.{Attr}) with the archive or directly to the value archive (Archive.va_{ValArchive}). | String | Input |
Functions:
Example:
using Special.FLibSYS;
val = vArh(strPath2Sep(addr)).get(time,uTime,0,archtor);
return val.isEval() ? "Empty" : real2str(val,prec);
Description: Getting a value buffer object (VArchObj) for temporary values storing and performing the intermediate operations on frames of data.
Parameters:
Identifier | Parameter | Type | Mode | By defaults |
---|---|---|---|---|
rez | Result | Object(VArchObj) | Return | |
tp | Type of the archive values (0-Boolean, 1-Integer, 4-Real, 5-String) | Integer | Input | 1 |
sz | Maximum buffer size | Integer | Input | 100 |
per | Period of the buffer values, microseconds | Integer | Input | 1000000 |
hgrd | Hard time grid | Boolean | Input | 0 |
hres | High time resolution (microseconds) | Boolean | Input | 0 |
The module, as an object, provides user programming functions.
The object "Functions library" (SYS.Special.FLibSYS)
The object "User function" (SYS.Special.FLibSYS["funcID"])
Modules/FLibSYS/en - GFDL | March 2024 | OpenSCADA 0.9.7 |