Special module FLibSYS provides static library of functions for working with the OpenSCADA system at the level of its system API. These functions can be used in an user programming area of OpenSCADA system for the organization of not ordinary interaction algorithms.

To address the functions of the library you can use static call address "Special.FLibSYS.{Func}()" or dynamic "SYS.Special.FLibSYS["{Func}"].call()", "SYS.Special.FLibSYS.{Func}()". Where {Func} — function identifier in the library.

Below is the description of each function of the library. For each function it was evaluated the execution time. Measurements were made on the system with the following parameters: Athlon 64 3000 + (ALTLinux 4.0 (32bit)) by measuring the total execution time of the function when you call it 1000 times. Sampling was carried out of the five calculations, rounded to integer. Time is in angle brackets and is measured in microseconds.

1 System-wide functions

1.1 Calling the console commands and operating system utilities (sysCall)

Description:Call 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:

1.2 DB: SQL request (dbReqSQL)

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:

ID

Name

Type

Mode

By defaults

rez

Result

Object(Array)

Return

addr

DB address, "{TypeDB}.{DB}"

String

In

req

SQL request

String

In

trans

Transaction

Boolean

In

EVAL

1.3 XML node (xmlNode)

Description: Creation of the XML node object.Parameters:

ID

Name

Type

Mode

By defaults

rez

Result

Object(XMLNodeObj)

Return

name

Name

String

In

Example:

using Special.FLibSYS;
//Creating the "get" object of the XML node.
req = xmlNode("get");
//Creating the "get" object of the XML node with creating attributes.
//sub_DAQ/mod_ModBus/cntr_1/prm_1 — The path in accord of project structure.
req = xmlNode("get").setAttr("path","/sub_DAQ/mod_ModBus/cntr_1/prm_1/%2fprm%2fst%2fen");

1.4 Request of the management interface (xmlCntrReq)

Description: Request of the management interface to the system via XML. The usual request is written in the form "<get path="/OPat/%2felem"/>". When we indicate the station the request to the external station is made.Parameters:

1.5 Values archive (vArh)

Description: Getting the object of the values archive (VArchObj) by connecting to the archive using its address.Parameters:

ID

Name

Type

Mode

By defaults

rez

Result

Object(VArchObj)

Return

name

Name and address to the attribute of the parameter (DAQ.{Module}.{Cntr}.{Prm}.{Attr}) with the archive or directly to the archive of values (Archive.va_{ValArchive}).

String

In

1.5.1 VArchObj object

Functions:

bool isNull() — no initiated object.

int begin( int usec = 0, string archivator = "" ) — getting the start time of the archive through the return of seconds and microseconds usec for the archivator archivator.

int end( int usec = 0, string archivator = "" ) — getting the end time of the archive through the return of seconds and microseconds usec for the archivator archivator.

int period( int usec = 0, string archivator = "" ) — getting the periodicity of the archive through the return of seconds and microseconds usec for the archivator archivator.

ValObj get( int sec, int usec, bool upOrd = false, string archivator = "" ) — getting the value from the archive at the time sec:usec linked to the top upOrd for the archivator archivator. Real time of the value obtained is set in sec:usec.

bool set( ValObj val, int sec, int usec, string archivator = "" ) — writing of the value val to the archive for the time sec:usec for the archivator archivator.

bool copy( VArchObj src, int begSec, int begUSec, int endSec, int endUSec, string archivator = "" ) — copying of the part of the source archive src or its buffer in the current beginning from begSec:begUSec and ending with endSec:endUSec for the archivator archivator.

2.3 Absolute time (tmTime) <220>

Description: Returns the absolute time in seconds from the epoch and in microseconds, if usec is installed in a non-negative value.Parameters:

ID

Parameter

Type

Mode

By defaults

sec

Seconds

Integer

Return

0

usec

Microseconds

Integer

Out

-1

2.4 Conversion the time from the symbolic representation to the time in seconds from the epoch of 1/1/1970 (tmStrPTime) <2600>

Description: Returns the time in seconds from the epoch of 1/1/1970, based on the string record of time, in accordance with the specified template. 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 POSIX-function "strptime".Parameters: