esi-pibridge

A library for communicating with the PI-Bridge (PI AF SDK and PI SDK)

Changes

  • esi-bridge

version date description

0.1.1

2018-04-13

Initial release.

0.3.0

2018-05-14

CURRENTVALUES, CREATEAFATTRIBUTES, CREATEAFHIERARCHY, CREATEPIPOINTS, FINDEVENTFRAMES, FINDELEMENTSCHILDS and FINDELEMENTATTRIBUTESBYPATH added.

0.4.0

2018-05-14

RECORDEDVALUES added.

0.4.1

2018-05-15

RECORDEDVALUES now lets you read multiple PI Tags with different start- and endtimes and some minor bugfixes.

0.4.2

2018-05-17

Commenting and Errorhandling; e.g. removed most todo’s.

0.4.3

2018-05-23

Errorhandling and Documentation.

0.5.0

2018-05-25

PITAGSEXISTS und GETAFELEMENTSCONFIG implemented.

0.5.1

2018-05-25

Implement ESI standards and documentation.

0.6.0

2018-05-28

Implemented FINDPIBATCHHEADERS and GETPITAGSCONFIG.

0.7.0

2018-05-29

Implemented DELETEPITAGS and UPDATEPITAGSCONFIG. Documentation of every function in MD.

0.7.1

2018-05-30

UPDATEVALUES was not functioning correct. Fixed errors and updated Lua example.

0.7.2

2018-06-04

Bugfixes and made some functions easier to use

0.7.3

2018-06-05

Bugfixes and dokumentation

0.7.4

2018-06-05

FINDPIBATCHES and FINDPIBATCHHEADERS now working. Reworked PITAGSEXISTS, AFELEMENTSEXISTS and RECORDEDVALUES

0.7.5

2018-06-05

Dokumentation reworked and some bugfixes in functions

0.7.6

2018-06-07

Dokumentation reworked, some bugfiexes and reworked some function parameters

0.7.7

2018-06-08

Dokumentation reworked, some bugfiexes and reworked some function parameters

0.7.8

2018-06-11

Changed return value of DELETEPITAGS. No more unnecessary return parameters

0.7.9

2018-06-12

the sys attribute is now hardcoded for every function as the user doesn’t need to change it

0.7.10

2018-06-13

tested every function and fixed errors

0.7.11

2018-06-19

pibridge fixes #4

0.8.0

2018-07-20

Implemented qualities for RECORDEDVALUES, CURRENTVALUES and UPDATEVALUES

0.8.1

2018-07-31

writes values of type 'number' into the db (before type 'string')

0.8.2

2018-07-31

tested RECORDEDVALUES and fixed error

0.8.3

2018-08-02

reconnection improvement (tested automated reconnect) and errorhandling

0.8.4

2018-08-08

enhanced debugging

0.8.5

2018-08-14

memory improvements (in RECORDEDVALUES)

0.8.6

2018-08-20

fixed creation of variable if debugoption is not enabled

0.8.7

2018-09-03

UPDATEVALUES: Errorhandling and fixed not updating qualities in PI Archive

0.9.1

2018-09-05

improvements performance and errorhandling

0.9.2

2018-09-05

UPDATEVALUES: predictive errorhandling

0.9.3

2018-09-10

_tcpreceive: transfer speed (json telegram) improvement (default buffer size 2048)

0.9.4

2018-09-10

RECORDEDVALUES: retrieve only a given number of PI-Archive points (optional); UPDATEVALUES: if inmation value == nil no PI-Archive entry

0.9.5

2018-10-15

Translation Table: from 'Unit Down' to 'Shutdown' when PI quality 'BadShutdown'

0.9.6

2018-10-29

fixed error FINDPIBATCHES in SearchStartTime and SearchEndTime

0.9.7

2018-11-20

Change Filter for FINDPIBATCHHEADERS

0.9.8

2018-11-21

Change Filter for FINDPIBATCHES

0.9.9

2018-11-30

Implement new Function - FINDPIUNITBATCHES (Search Batches with Unitnames)

0.9.10

2018-12-17

FINDPIUNITBATCHES fixed wrong send telegram ⇒ Unique IDs must be empty not "*"

0.10.0

2018-12-20

add DELETEAFELEMENTS and DELETEAFATTRIBUTES Methodes

0.10.1

2019-01-06

edit one wronge status mapping

0.10.2

2019-01-06

redefine Mapping

0.10.3

2019-02-15

Errorhandling for function arguments which are 'nil'; Log Table (_convertopcqualitiesintopiqualities) updated; response with more information

0.10.4

2019-02-20

revert changed responses (reason: compatibility problems)

0.10.5

2019-04-04

GETAFELEMENTSCONFIG extension to define what should be returned (Attributes,Childs and much more)

0.10.6

2019-04-04

FINDEVENTFRAMES compare if all necessary information was send if not use default

0.10.7

2019-05-10

FINDEVENTFRAMES new Parameter "GetTemplateName"

0.10.8

2019-05-17

FINDEVENTFRAMES change GetChildren from bool > GetAllChildren to an integer where you can define the depth of returning children, new return parameter

  • inmationPIBridge

version date description

1.0.4.0

2018-04-09

Connection improvement

1.0.5.0

2018-04-27

AF Methodes available

1.0.6.*

2018-07-03

PI and AF Methodes impovements

1.0.7.*

2018-09-06

Conversion Unix Problems solved, Change few Methodes to new Error handling

1.0.8.*

2018-09-10

Fixing Memory Leak, include Buffersize for faster communication

1.0.9.*

2018-09-20

include miliseconds in times

1.0.10.*

2018-09-25

add RecordedValuesbyCount

1.0.11.*

2018-11-21

change from global to local handling, Refresh Af Database if necessary, ,improvements, GETAFELEMENTSCONFIG extensions (select needed informations, add new key "AllowExtensions"), Fix problem by reading af attributes value, fix RecordedValue read System state

1.0.12.*

2019-01-09

Add DeleteAFElement, AFAttribute and some fixes in CreateAFHierarch and CreatAFAttributes, fixing some Start-Stop Problems from the Service

1.0.12.47

2019-04-04

some fixed issues, Improvements, FindEventFrames you are now able to define if attributes and/or children should we searched and returned

1.0.12.48

2019-04-04

fixed error if PI Point was send in wronge case

1.0.12.49

2019-04-05

fixed error where wronge excmax key was used, more usable response for CreatePIPoints

1.0.12.50

2019-05-10

FindEventFrames extension and improvments > new paramter to define if TemplateName should be in the response > all times are now converted in UTC Posix

1.0.12.51

2019-05-17

FindEventFrames change Children Handling from bool to integer > integer defines depth for child search

1.0.13.*

2019-XX-XX

-

Dependencies

library version inmation core library

dkjson

2.5.0

yes

esi-variables

0.1.3

no

socket

3.0.0

yes

Legend

Content of the data table:

  • func the function to be called in the bridge, an example "UpdateValues".

  • piserver the name of the PI server.

  • afserver the name of the PI AF server.

  • afdatabase the name of the PI AF server database.

  • farg contains the function arguments.

Available functions

Function table

category function description min. Lua Version min. PIBridge Version

AF Configuration

CONNECTTOAF

connects to the AF server

0.1.0

1.0.0

PI Configuration

CONNECTTOPI

connects to the PI server

0.1.0

1.0.0

PI Configuration

SETCONNECTION

sets connection parameters

0.1.0

-

PI Configuration

GETSTATUS

gets info about the connected PI server

0.1.0

1.0.1

PI Configuration

SETALIAS

shortens the PI identifiers

0.1.0

-

AF Data

AFELEMENTSEXISTS

checks if AF element already exists

0.7.4

1.0.7

AF Data

CREATEAFATTRIBUTES

creates an AF attribute

0.3.0

1.0.3

AF Data

CREATEAFHIERARCHY

create the tree structure in the AF

0.3.0

1.0.3

AF Data

FINDELEMENTATTRIBUTESBYPATH

finds element attribute using its path

0.3.0

1.0.3

AF Data

FINDELEMENTSCHILDS

gets all sub elements

0.3.0

1.0.3

AF Data

DELETEAFELEMENTS

deletes af elements

0.10.2

1.0.12

AF Data

DELETEAFATTRIBUTES

deletes af ettributes

0.10.2

1.0.12

Eventframes

FINDEVENTFRAMES

gets info about all event frames

0.3.0

1.0.3

AF Data

GETAFELEMENTSCONFIG

gets complete AF element configuration

0.5.0

1.0.5

PI Data

CREATEPIPOINTS

creates a(n) PI point(s)

0.3.0

1.0.3

PI Data

DELETEPITAGS

deletes one or more PI points

0.7.0

1.0.7

PI Data

CURRENTVALUES

gets value and last timestamp

0.4.0

1.0.4

PI Batch

FINDPIBATCHES

gets batch and sub batches

0.7.4

1.0.7

PI Batch

FINDPIBATCHHEADERS

gets Batch-Header of a certain period of time

0.6.0

1.0.6

PI Batch

FINDPIUNITBATCHES

gets Unit-Batch of a certain period of time

0.9.9

1.0.9

PI Data

GETPITAGSCONFIG

gets complete PI tag configuration

0.6.0

1.0.6

PI Data

PITAGSEXISTS

check if PI tag already exists

0.5.0

1.0.5

PI Data

RECORDEDVALUES

gets all values and timestamps from one PI tag

0.4.0

1.0.4

PI Data

UPDATEPITAGSCONFIG

changes the PI tag settings

0.7.0

1.0.7

PI Data

UPDATEVALUES

updates the values and timestamps from multiple PI tags

0.7.1

1.0.7


CONNECTTOAF

Available at Lua: Version 0.1.0

Available at inmationPIBridge: Version 1.0.0

Connect to the PI Asset Framework.

  • Variables

PB:CONNECTTOAF(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

return values from function

returns data type meaning

1. value

boolean

true if connection was successfully established, false if not

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOAF{
    ["afserver"] = "PI-Default"
}
return J.encode({result=result,exception=exception})
  • Return Values

{
    "result": true
}
parameter data type meaning

boolean

boolean

true if connected to af, false if not

  • Failure in function call or connection

  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "msg": "Error during TCP connection",
        "tcp": "Socket is not connected"
    }
}
  • The function argument afserver is an empty string "" (not given)

{
    "result": false,
    "exception": [
        {
            "msg": "No connection to the PI AF Server!",
            "notconnected": true,
            "afserver": ""
        }
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "ConnectToAF",
    "afserver": "PI-Default",
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "ConnectToAF",
    "afserver": "PI-Default",
    "ConnectToAF": "PI AF Server: PI-Default  Connection: True ",
    "Connected": true
}xEOFx

CONNECTTOPI

Available at Lua: Version 0.1.0

Available at inmationPIBridge: Version 1.0.0

Connect to PI, e.g. not AF.

  • Variables

PB:CONNECTTOPI(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server instance you want to connect to

return values from function

returns data type meaning

1. value

boolean

true if connection was successfully established, false if not

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
return J.encode({result=result,exception=exception})
  • Return Values

{
    "result": true
}
parameter data type meaning

boolean

boolean

true if connection was successfully established

  • Failure in function call or connection

  • Specified PI-Server cannot be found

{
    "exception": [
        {
            "notconnected": true,
            "msg": "No connection to the PI Server!",
            "piserver": "PI-Default"
        }
    ],
    "result": false
}
  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "tcp": "Socket is not connected",
        "msg": "Error during TCP connection"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "ConnectToPI",
    "piserver": "PI-Default",

}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "ConnectToPI",
    "piserver": "PI-Default",
    "ConnectToPI": "PI Server: PI-Default  Connection: True ",
    "Connected": true
}xEOFx

SETCONNECTION

Available at Lua: Version 0.1.0

Sets connection parameters to connect to PI or AF

  • Variables

PB:SETCONNECTION(data) content of the table data

parameter data type required meaning

alias

table

yes

table of shorten words to cut down the amount of transfered characters

port

number

yes

port where the inmation PI-Bridge listens for connections

host

string

yes

the name or the IP address of the executing maschine

timeout

number

yes

time in seconds till the receive process from the PI interface gets aborted

debugoption

boolean

yes

enables the debug option

buffersize

number

no

sets the optional buffer size ATTENTION missmatches with the inmationpibridge causes bad communication (by default 2048)

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false,
        --["buffersize"] = 4096
}

GETSTATUS

Available at Lua: Version 0.1.0

Available at inmationPIBridge: Version 1.0.1

Returns the status of the PI Bridge alongside with basic information.

  • Variables

PB:GETSTATUS()

called with no parameters

return values from function

returns data type meaning

1. value

table

table with connection parameters, PI bridge and PI server status

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:GETSTATUS()
return J.encode({result=result,exception=exception})
  • Return Values

{
    "result": {
        "Version": "0.1.0.5",
        "VersionAFSDK" : "2.9.2.8185", // only in the InmationPIBridge.NET4.5
        "BufferSize" : 2048,
        ".NET Version" : "4.0.30319.42000",
        "VersionPISDK" : "1.4.6",
        "PIServerNames": [
            {
                "PIServerName": "PI-Default"
            }
        ],
        "PIServerReconnectTimeSec": 30,
        "PISystems": [
            {
                "PISystemName": "PI-Default"
            }
        ],
        "PIDataBase": "PI-Database",
        "TCPEndOfTransmissionSignal": [
            "x",
            "E",
            "O",
            "F",
            "x"
        ]
    }
}
parameter data type meaning

TCPEndOfTransmissionSignal

table

the charakters that signal the end of the string sent or received over the TCP connection

Version

string

the version of the PIBridge

VersionAFSDK

string

the version of the AF SDK

VersionPISDK

string

the version of the PI SDK

BufferSize

string

the current configured Buffersize

.NET Version

string

the framework version of the running system

PIServerReconnectTimeSec

number

the server reconnect time in seconds

PIDataBase

string

the PI Data Base name

PIServerNames

table

the PI Server names

PISystems

table

the PI Server names

  • Failure in function call or connection

  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "tcp": "Socket is not connected",
        "msg": "Error during TCP connection"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "inmationPIBridge",
    "func": "GetStatus",
    "farg": []
}xEOFx
  • Response

{
    "result": {
        "Version": "0.1.0.5",
        "VersionAFSDK" : "2.9.2.8185", // only in the InmationPIBridge.NET4.5
        "BufferSize" : 2048,
        ".NET Version" : "4.0.30319.42000",
        "VersionPISDK" : "1.4.6",
        "PIServerNames": [
            {
                "PIServerName": "PI-Default"
            }
        ],
        "PIServerReconnectTimeSec": 30,
        "PISystems": [
            {
                "PISystemName": "PI-Default"
            }
        ],
        "PIDataBase": "PI-Database",
        "TCPEndOfTransmissionSignal": [
            "x",
            "E",
            "O",
            "F",
            "x"
        ]
    }
}

SETALIAS

Available at Lua: Version 0.1.0

The SETALIAS function is used to override the alias configuration.

  • Variables

PB:SETALIAS(data) content of the table data

parameter data type required meaning

PIPoint

string

no

set the alias for PIPoint

Values

string

no

set the alias for Values

AFtime

string

no

set the alias for AFtime

Value

string

no

set the alias for Value

maxhistorypoints

number

no

set the maximum number of historypoints

  • Function call example

local PB = require'esi-pibridge'

PB:SETALIAS{
    ["PIPoint"] = "P",
    ["Values"] = "V",
    ["AFtime"] = "t",
    ["Value"] = "v",
    ["maxhistorypoints"] = 1000,
}

AFELEMENTSEXISTS

Available at Lua: Version 0.7.4

Available at inmationPIBrdige: Version 1.0.7

Checks if the paths with elements exist in the connected PI system.

  • Variables

PB:AFELEMENTSEXISTS(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

afpaths

table

yes

the paths to the AF elements you want to check if existing

return values from function

returns data type meaning

1. value

table

a table with all the AF paths checked if existing and the time it took to check

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
    }
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultAFELEMENTSEXISTS, exceptionAFELEMENTSEXISTS = PB:AFELEMENTSEXISTS{
    ["afserver"] = "PI-Default",
    ["afdatabase"] = "AF-Database",
    ["afpaths"] = {
        "TestSDK\\Test\\Test",
        "TestSDK\\Test\\Test-2",
        "Exercise01_1\\Element1",
        "Exercise02_1\\Element1test"
    }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["AFELEMENTSEXISTS"] = {result = resultAFELEMENTSEXISTS, exeption = exceptionAFELEMENTSEXISTS}}
    }
)
  • Return values

  • Possibility 1: multiple elements

{
    "AT": [
        "TestSDK\\Test\\Test",
        "TestSDK\\Test\\Test-2",
        "Exercise02_1\\Element1",
        "Exercise02_1\\Element1test"
    ],
    "E": [
        true,
        false,
        true,
        false
    ]
}
parameter data type meaning

AT

table

the AF Elements that were checked if existing

E

table

true of false whether the elements exist or not

  • Possibility 2: one element

true
parameter data type meaning

boolean

boolean

true or false if only one AF Element was checked

  • Failure in function call or connection

  • The function argument afpaths is nil (not given)

{
    "result": {
        "TimeProcessPerformance": {
            "TotalTimeExecution": 15.1659,
            "ReadTelegramArguments": 0.008,
            "TotalBytesOfMemoryUsed": 241901568,
            "ReadDataFromPISer": 0.0304
        },
        "afserver": "PI-Default",
        "afdatabase": "AF-Database",
        "sys": "OSI",
        "func": "AFElementsExists"
    },
    "exception": [
        "AFElementsExists: No data Retrieved"
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "AFElementsExists",
    "piserver": "PI-Default",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "AT": [
            "TestSDK\\Test\\Test",
            "TestSDK\\Test\\Test-2",
            "Exercise02_1\\Element1",
            "Exercise02_1\\Element1test"
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "AFElementsExists",
    "piserver": "PI-Default",
    "farg": {
        "AT": [
            "TestSDK\\Test\\Test",
            "TestSDK\\Test\\Test-2",
            "Exercise02_1\\Element1",
            "Exercise02_1\\Element1test"
        ],
        "E": [
            true,
            false,
            true,
            false
        ]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 1.1945,
        "ResultAFvaluesFromPISer": 23279.2746,
        "Total": 23378.2599,
        "TotalBytesOfMemoryUsed": 85471232
    }
}xEOFx

CREATEAFATTRIBUTES

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Extension at inmationPIBridge: Version 1.0.12

Creates one or multiple AF attribute in PI.

  • Variables

PB:CREATEAFATTRIBUTES(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

hierarchies

table

yes

hierarchy where the attributes should be created

afattributes

table

yes

datatable which contains a collection for creating an afattribute

content of the table afattributes

parameter data type required meaning

name

string

yes

name of the attribute which should be created

description

string

yes/no(since 1.0.12)

description Default = empty

categoriesstring

string

no

defines in which category the attribute should be categorize

defaultuom

string

no

to define a Unit of Measure of the attribute. The UOM must first be defined/created in PI AF if not already or an error occurs

typequalifier

table

no

defines the datatype of the AF attribute. Default = Double

datareferenceplugIn

string

yes

tells AF where the tag will get the values from. In the example it’s from a PI Point (e.g.: PI Point = reference to a PI-Point)

configstring

string

yes/no (since 1.0.12)

the path in PI system where the AF attribute will get it’s value from (e.g.: reference path to the PI-Point, Formula,…​). Since 1.0.12 it is possible to send an empty configstring but only for None datareferences

return values from function

returns data type meaning

1. value

table

a table with the attribute name and if it was successfully created

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultCREATEAFATTRIBUTES, exceptionCREATEAFATTRIBUTES = PB:CREATEAFATTRIBUTES{
    ["afserver"] = "PI-Default",
    ["afdatabase"] =  "PI-Default-AF",
    ["hierarchy"] = "TestSDK\\Test\\Test",
    ["afattributes"] = {
        {
            ["name"] = "TestAttribute1",
            ["description"] = "Test",
            ["categoriesstring"] = "General",
            ["defaultuom"] = "bar",
            ["typequalifier"] = "System.Double",
            ["datareferenceplugIn"] = "PI Point",
            ["configstring"] = "\\\\PI-Default\\Testtag00001"
        },
        {
            ["name"] = "TestAttribute2",
            ["description"] = "Test",
            ["typequalifier"] = "System.Single",
            ["datareferenceplugIn"] = "None",
            ["configstring"] = ""
        }
    }
}

return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["CREATEAFATTRIBUTES"] = {result = resultCREATEAFATTRIBUTES, exeption = exceptionCREATEAFATTRIBUTES}}
    }
)
  • Return Values

{
    "result": {
        "hierarchy": "TestSDK\\Test\\Test",
        "afattributes": [
            {
                "AT": "TestAttribute1",
                "V": true
            },
            {
                "AT": "TestAttribute2",
                "V": true
            }
        ]
    }
}
parameter data type meaning

hierarchy

string

the path where the attributes were created

afattributes

table

a table of the attribute names that the user wanted to create

AT

string

the attribute name

V

boolean

the value wether it was created or not

  • Failure in function call or connection

  • The desired attribute to create already exists

{
    "exception": [
        {
            "exists": true,
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "msg": "Attribute already exits!",
            "P": "TestAttribute4"
        },
        {
            "exists": true,
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "msg": "Attribute already exits!",
            "P": "TestAttribute5"
        }
    ],
    "result": {
        "sys": "OSI",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 45.0148,
            "ErrorHandle": 36.6153,
            "TotalBytesOfMemoryUsed": 271577088,
            "TotalTimeExecution": 52.9365
        },
        "afserver": "AF-Server",
        "func": "CreateAFAttributes",
        "afdatabase": "AF-Database"
    }
}
  • The specified path/element doesn’t exist

{
    "result": {
        "afdatabase": "AF-Database",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 281739264,
            "TotalTimeExecution": 17.754,
            "ErrorHandle": 0.0019,
            "ReadTelegramArguments": 0.0843
        },
        "sys": "OSI",
        "func": "CreateAFAttributes",
        "afserver": "AF-Server"
    },
    "exception": [
        {
            "piafserver": "PI-Default",
            "AT": "ErrorTest\\Test\\Test",
            "notexists": true,
            "msg": "AF Element doesnot exist in Database!",
            "piafdatabase": "AF-Database"
        }
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "CreateAFAttributes",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "hierarchy": "TestSDK\\Test\\Test",
        "afattributes": [{
            "name": "TestAttribute1",
            "description": "Test",
            "categoriesstring": "General",
            "defaultuom": "bar",
            "typequalifier": "System.Double",
            "datareferenceplugIn": "PI Point",
            "configstring": "\\\\PI-Default\\Testtag00001"
        },
        {
            "name": "TestAttribute2",
            "description": "Test",
            "categoriesstring": "Allgemein",
            "defaultuom": "bar",
            "typequalifier": "System.Single",
            "datareferenceplugIn": "PI Point",
            "configstring": "\\\\PI-Default\\Testtag00002"
        }]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "CreateAFAttributes",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "hierarchy": "TestSDK\\Test\\Test",
        "afattributes": [{
            "AT": "TestAttribute1",
            "V": true
        },
        {
            "AT": "TestAttribute2",
            "V": true
        }]
    },
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.0153,
        "ErrorHandle": 0.0042,
        "TotalTimeExecution": 0.0373,
        "TotalBytesOfMemoryUsed": 361263104
    }
}xEOFx

CREATEAFHIERARCHY

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Extension at inmationPIBridge: Version 1.0.12

Creates hierarchy of the given paths in AF.

  • Variables

PB:CREATEAFHIERARCHY(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

hierarchies

table

yes

AF path to be created

return values from function

returns data type meaning

1. value

table

in a table the hierarchy names and a boolean if they were created

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultCREATEAFHIERARCHY, exceptionCREATEAFHIERARCHY = PB:CREATEAFHIERARCHY{
    ["afserver"] = "PI-Default",
    ["afdatabase"] = "PI-Default-AF",
    ["hierarchies"] = {
        "TestSDK\\Test\\Test",
        "TestSDK\\Test\\Test2"
    }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["CREATEAFHIERARCHY"] = {result = resultCREATEAFHIERARCHY, exeption = exceptionCREATEAFHIERARCHY}}
    }
)
  • Return Values

{
    "result": {
        "hierarchies": [
            {
                "V": true,
                "AT": "TestSDK\\Test2"
            },
            {
                "V": true,
                "AT": "TestSDK\\Test2\\Test1"
            }
        ]
    }
}
parameter data type meaning

hierarchies

table

a table of the hierarchie names that the user wanted to create

AT

string

the attribute path to be created

V

boolean

true it the attribute path was created, false if not

  • Failure in function call or connection

  • The function argument [afserver] is nil (not given)

{
    "exception": [
        {
            "msg": "Missing piserver in Json-Telegram!",
            "notconnected": true
        }
    ],
    "result": {
        "afserver": "",
        "func": "CreateAFHierarchy",
        "afdatabase": "AF-Database",
        "sys": "OSI"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "CreateAFHierarchy",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "hierarchies": [
        "TestSDK\\Test\\Test",
        "TestSDK\\Test\\Test2"
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "CreateAFHierarchy",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "hierarchies": [{
            "AT": "TestSDK\\Test\\Test",
            "V": true
        },
        {
            "AT": "TestSDK\\Test\\Test2",
            "V": true
        }]
    },
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.0223,
        "CallPISDKFunction": 16.4405,
        "ErrorHandle": 0.0354,
        "TotalTimeExecution": 16.5033,
        "TotalBytesOfMemoryUsed": 582967296
    }
}xEOFx
{
    "exception": [
        {
            "msg": "None or wronge AF Database retrieved!",
            "piafserver": "AF-Server",
            "notdata": true,
            "piafdatabase": ""
        }
    ],
    "result": {
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 298156032,
            "ReadTelegramArguments": 0.0177,
            "ErrorHandle": 0.0011,
            "TotalTimeExecution": 0.0284
        },
        "sys": "OSI",
        "afdatabase": "",
        "afserver": "AF-Server",
        "func": "CreateAFHierarchy"
    }
}

FINDELEMENTATTRIBUTESBYPATH

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Returns the attributes of an element only needing the path of the Element or their path.

  • Variables

PB:FINDELEMENTATTRIBUTESBYPATH(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

AttributeElements

table

yes

table with AF paths to the element

ElementPath

string

yes

AF path to the element or name of the element

return values from function

returns data type meaning

1. value

table

in a table the attributes of the wanted AF elements

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultFINDELEMENTATTRIBUTESBYPATH, exceptionFINDELEMENTATTRIBUTESBYPATH = PB:FINDELEMENTATTRIBUTESBYPATH{
    ["afserver"] = "PI-Default",
    ["afdatabase"] =  "PI-Default-AF",
    ["AttributeElements"] = {
        {ElementPath="Batch Tank 1"},
        {ElementPath="TestSDK\\Test\\Test"}
    }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["FINDELEMENTATTRIBUTESBYPATH"] = {result = resultFINDELEMENTATTRIBUTESBYPATH, exeption = exceptionFINDELEMENTATTRIBUTESBYPATH}}
    }
)
  • Return Values

{
    "ValuesToRead": [
        {
            "AT": [
                {
                    "V": "232",
                    "N": "BatchNr",
                    "T": "BatchNr",
                    "D": ""
                },
                {
                    "V": "656,221496582031",
                    "N": "Druck",
                    "T": "Druck",
                    "D": ""
                }
            ],
            "Element": "Batch Tank 1"
        },
        {
            "AT": [
                {
                    "V": "Pt Created",
                    "N": "TestAttribute2",
                    "T": "",
                    "D": "Test"
                }
            ],
            "Element": "Test"
        }
    ]
}
parameter data type meaning

AT

table

the element table containing all AF attributes

Element

string

the name of the element table

V

string

the current value of the AF attribute

N

string

the name of the AF attribute

T

string

the type of the AF attribute

D

string

the description of the AF attribute

  • Failure in function call or connection

  • The given function argument is an empty string: [AttributeElements] = {{ElementPath = ""}}

{
    "exception": [
        "FindElementAttributesByPath Element  Not exists in OSI Pi Server"
    ],
    "result": {
        "afserver": "AF-Server",
        "func": "FindElementAttributesByPath",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 788815872,
            "ErrorHandle": 0.0015,
            "TotalTimeExecution": 8.1766,
            "ReadDataFromPISer": 0.0038,
            "ReadTelegramArguments": 0.02
        },
        "afdatabase": "AF-Database",
        "sys": "OSI"
    }
}
  • The function argument [AttributeElements] is nil (not configured)

{
    "result": {
        "afdatabase": "AF-Database",
        "afserver": "AF-Server",
        "func": "FindElementAttributesByPath",
        "sys": "OSI",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.02,
            "TotalBytesOfMemoryUsed": 788606976,
            "TotalTimeExecution": 12.7122,
            "CallPISDKFunction": 0.0003
        }
    },
    "exception": [
        "FindElementAttributesByPath: Error Reading AFElements attributes in OSI PI! Accessed JArray values with invalid key value: \"AttributeElements\". Int32 array index expected."
    ]
}
  • The given function argument is empty: [AttributeElements] = {}; should be: [AttributeElements] = {{ElementPath = "Test\\Test"}, …​ }

{
    "result": {
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 786763776,
            "TotalTimeExecution": 8.8937,
            "ReadTelegramArguments": 0.0196,
            "ErrorHandle": 0.0019
        },
        "func": "FindElementAttributesByPath",
        "sys": "OSI",
        "afdatabase": "AF-Database",
        "afserver": "AF-Server"
    },
    "exception": [
        "FindElementAttributesByPath: No data Retrieved"
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "farg": {
        "AttributeElements": [
            {
                "ElementPath": "Batch Tank 1"
            },
            {
                "ElementPath": "TestSDK\\Test\\Test"
            }
        ]
    },
    "afdatabase": "af-database",
    "func": "FindElementAttributesByPath",
    "afserver": "af-server",
    "piserver": "PI-Default"
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindElementAttributesByPath",
    "piserver": "PI-Default",
    "farg": {
        "ValuesToRead": [
            {
                "Element": "Batch Tank 1",
                "AT": [
                    {
                        "N": "BatchNr",
                        "D": "",
                        "T": "BatchNr",
                        "V": "268"
                    },
                    {
                        "N": "Pressure",
                        "D": "",
                        "T": "Pressure",
                        "V": "967,700317382813"
                    }
                ]
            },
            {
                "Element": "Test",
                "AT": [
                    {
                        "N": "TestAttribute2",
                        "D": "Test",
                        "T": "",
                        "V": "68"
                    }
                ]
            }
        ]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 0.0038,
        "ResultAFvaluesFromPISer": 82.2339,
        "Total": 168.5337,
        "TotalBytesOfMemoryUsed": 87031808
    }
}

FINDELEMENTSCHILDS

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Returns the Children of an element.

  • Variables

PB:FINDELEMENTSCHILDS(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

Elements

table

yes

a table with one or more ElementPaths of which the children should be returned

ElementPath

string

yes

AF path to the element or name of the element

return values from function

returns data type meaning

1. value

table

the parent path, the element name and the element path is returned

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultFINDELEMENTSCHILDS, exceptionFINDELEMENTSCHILDS = PB:FINDELEMENTSCHILDS{
    ["afserver"] = "PI-Default",
    ["afdatabase"] =  "PI-Default-AF",
    ["Elements"] = {
        {ElementPath="Batch Tank 1"},
        {ElementPath="TestSDK\\Test"}
    }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["FINDELEMENTSCHILDS"] = {result = resultFINDELEMENTSCHILDS, exeption = exceptionFINDELEMENTSCHILDS}}
    }
)
  • Return Values

{
    "Elements": [
        {
            "ElementPath": "Batch Tank 1"
        },
        {
            "ElementPath": "TestSDK\\Test",
            "ELPath": "TestSDK\\Test\\Names",
            "ELName": "Names"
        },
        {
            "ElementPath": "TestSDK\\Test",
            "ELPath": "TestSDK\\Test\\Products",
            "ELName": "Products"
        }
    ]
}
parameter data type meaning

Elements

table

datatable with OSIsoft AF Element paths

ElementPath

string

element path to get Attributes

ELPath

string

the path of teh childelement

ELName

string

the name of the childelment

  • Failure in function call or connection

  • The given function argument is empty: [Elements] = {{ElementPath = ""}}

{
    "exception": [
        "FindElementsChilds: Error searching for Child Elements on AFServer:AF-Server and Database: AF-Database !  Reason: ElementPath is empty!",
        "FindElementsChilds: No data Retrieved"
    ],
    "result": {
        "afdatabase": "AF-Database",
        "func": "FindElementsChilds",
        "TimeProcessPerformance": {
            "CallPISDKFunction": 0.015,
            "ErrorHandle": 0.0096,
            "TotalBytesOfMemoryUsed": 321720320,
            "ReadDataFromPISer": 0.0134,
            "TotalTimeExecution": 8.4156
        },
        "afserver": "AF-Server",
        "sys": "OSI"
    }
}
  • The function argument afdatabase is wrong or nil

{
    "result": {
        "afserver": "AF-Server",
        "afdatabase": "",
        "sys": "OSI",
        "func": "FindElementsChilds",
        "TimeProcessPerformance": {
            "CallPISDKFunction": 0.0173,
            "TotalBytesOfMemoryUsed": 322547712,
            "TotalTimeExecution": 0.0269
        }
    },
    "exception": [
        "FindElementsChilds: Error searching for Child Elements on AFServer:AF-Server and Database:  !  Reason: AF Database cannot be found"
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "FindElementsChilds",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "Elements":[
            {
                "ElementPath":"TestSDK\\Test"
            },
            {
                "ElementPath":"TestSDK\\Test2"
            }
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindElementsChilds",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "Elements": [{
            "ElementPath": "TestSDK\\Test",
            "ELName": "Test",
            "ELPath": "TestSDK\\Test\\Test"
        },
        {
            "ElementPath": "TestSDK\\David",
            "ELName": "Test",
            "ELPath": "TestSDK\\David\\Test"
        }]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 0.0261,
        "ReadDataFromPISer": 0.1566,
        "ErrorHandle": 0.0015,
        "TotalTimeExecution": 0.1924,
        "TotalBytesOfMemoryUsed": 424726528
    }
}xEOFx

DELETEAFELEMENTS

Available at Version 1.0.12

Deletes one or multiple AF Elements in the AF Database according to the given name. ATTENTION: Deleting an AF Element results in loss of the Element configuration and the configured child elements and attributes!

Deleting AF Elements is not recommended! Only use it in a test environment, never in a productive system.

Must be enabled in the .config in order to delete PI-Tags.

  • Variables

PB:DELETEAFELEMENTS(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

elementspaths

table

yes

a table with one or more ElementPaths of which should be deleted

return values from function

returns data type meaning

1. value

table

returns elementspath and value that indicates delete status (true/false)

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
 local resultDELETEAFELEMENTS, exceptionDELETEAFELEMENTS = PB:DELETEAFELEMENTS {
        ["afserver"] = "PI-Default",
        ["afdatabase"] = "PI-Default-AF",
        ["elementspaths"] = {
            "\\\\PI-Default\\AF-Database\\TestTest\\Child",
            "\\\\PI-Default\\AF-Database\\TestTest"
        }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["DELETEAFELEMENTS"] = {result = resultDELETEAFELEMENTS, exeption = exceptionDELETEAFELEMENTS}}
    }
)
  • Return Values

{
    "result": {
        "sys": "OSI",
        "afdatabase": "AF-Database",
        "result": [
            {
                "AT": "\\\\PI-Default\\AF-Database\\TestSDK\\Test\\Test3",
                "V": true
            }
        ],
        "func": "DeleteAFElements",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.0134,
            "TotalTimeExecution": 192.6386,
            "TotalBytesOfMemoryUsed": 744488960
        },
        "afserver": "AF-Server"
    }
}
parameter data type meaning

result

table

datatable with OSIsoft AF Element paths and result of deletion

AT

string

element path

V

boolean

result of deletion, true if successful

  • Failure in function call or connection

  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "msg": "Error during TCP connection",
        "tcp": "Socket is not connected"
    }
}
  • The specified path cannot be found in the AF system

{
    "exception": [
        {
            "piafdatabase": "AF-Database",
            "piafserver": "AF-Server",
            "AT": "\\\\PI-Default\\AF-Database\\TestSDK\\delete\\delete2",
            "msg": "No AF Element found!",
            "notfound": true
        }
    ],
    "result": {
        "afdatabase": "AF-Database",
        "sys": "OSI",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.0165,
            "TotalTimeExecution": 11.3421,
            "TotalBytesOfMemoryUsed": 743292928
        },
        "afserver": "AF-Server",
        "func": "DeleteAFElements"
    }
}
  • The given function argument elementspaths leads to an attribute and not an element

{
    "exception": [
        {
            "piafdatabase": "AF-Database",
            "piafserver": "AF-Server",
            "AT": "\\\\PI-Default\\AF-Database\\Errortest\\Test|TestAttribute42",
            "notfound": true,
            "msg": "No AF Element found!"
        }
    ],
    "result": {
        "func": "DeleteAFElements",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.0234,
            "TotalBytesOfMemoryUsed": 757829632,
            "TotalTimeExecution": 24.4397
        },
        "sys": "OSI",
        "afserver": "AF-Server",
        "afdatabase": "AF-Database"
    }
}
  • An unexpected error in the AF system occured

{
    "sys": "OSI",
    "func": "DeleteAFElements",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "errors": [
        {
            "msg": "AF Element cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestTest\\Child",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        }
    ],
    "result": [
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestTest\\Child",
            "V": false
        },
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestTest",
            "V": true
        }
    ],
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.1961,
        "TotalTimeExecution": 318.1084,
        "TotalBytesOfMemoryUsed": 102182912
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "DeleteAFElements",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "farg": {
        "AT": [
        "\\\\PI-Default\\AF-Database\\TestTest\\Child",
        "\\\\PI-Default\\AF-Database\\TestTest"
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "DeleteAFElements",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "errors": [
        {
            "msg": "AF Element cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestTest\\Child",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        }
    ],
    "result": [
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestTest\\Child",
            "V": false
        },
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestTest",
            "V": true
        }
    ],
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.1961,
        "TotalTimeExecution": 318.1084,
        "TotalBytesOfMemoryUsed": 102182912
    }
}xEOFx

DELETEAFATTRIBUTES

Available at Version 1.0.12

Deletes one or multiple AF Attributes in the AF Database according to the given name. ATTENTION: Deleting an AF Attribute results in loss of the attribute configuration and the configured child attributes!

Deleting AF Attributes is not recommended! Only use it in a test environment, never in a productive system.

Must be enabled in the .config in order to delete PI-Tags.

  • Variables

PB:DELETEAFATTRIBUTES(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

attributepaths

table

yes

a table with one or more AttributePaths of which should be deleted

return values from function

returns data type meaning

1. value

table

returns attributepaths and value that indicates delete status (true/false)

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultDELETEAFATTRIBUTES, exceptionDELETEAFATTRIBUTES = PB:DELETEAFATTRIBUTES {
        ["afserver"] = "PI-Default",
        ["afdatabase"] = "PI-Default-AF",
        ["attributepaths"] = {
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute5",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7"
        }
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["DELETEAFATTRIBUTES"] = {result = resultDELETEAFATTRIBUTES, exeption = exceptionDELETEAFATTRIBUTES}}
    }
)
  • Return Values

{
    "result": {
        "afserver": "AF-Server",
        "afdatabase": "AF-Database",
        "sys": "OSI",
        "func": "DeleteAFAttributes",
        "TimeProcessPerformance": {
            "TotalTimeExecution": 116.3853,
            "ReadTelegramArguments": 0.0238,
            "TotalBytesOfMemoryUsed": 757465088
        },
        "result": [
            {
                "V": true,
                "AT": "\\\\PI-Default\\AF-Database\\Errortest\\Test|TestAttribute52"
            }
        ]
    }
}
parameter data type meaning

result

table

datatable with OSIsoft AF Element paths and result of deletion

AT

string

attribute path

V

boolean

result of deletion, true if successful

  • Failure in function call or connection

  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "msg": "Error during TCP connection",
        "tcp": "Socket is not connected"
    }
}
  • Given path is an attribute not an element

{
    "exception": [
        {
            "piafdatabase": "AF-Database",
            "AT": "\\\\PI-Default\\AF-Database\\Errortest\\Test|TestAttribute52",
            "piafserver": "AF-Server",
            "msg": "No AF Attribute found!",
            "notfound": true
        }
    ],
    "result": {
        "afserver": "AF-Server",
        "afdatabase": "AF-Database",
        "sys": "OSI",
        "func": "DeleteAFAttributes",
        "TimeProcessPerformance": {
            "TotalTimeExecution": 13.4694,
            "ReadTelegramArguments": 0.0207,
            "TotalBytesOfMemoryUsed": 758771712
        }
    }
}
  • If the attribute or the element holding the attribute is created from a template, the deletion will fail

{
    "sys": "OSI",
    "func": "DeleteAFAttributes",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "errors": [
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute5",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        }
    ],
    "result": [
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "V": false
        },
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7",
            "V": true
        }
    ],
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.063,
        "TotalTimeExecution": 284.4499,
        "TotalBytesOfMemoryUsed": 100683776
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "DeleteAFAttributes",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "farg": {
        "AT": [
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute5",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7"
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "DeleteAFAttributes",
    "afserver": "AF-Server",
    "afdatabase": "AF-Database",
    "errors": [
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute4|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute is defined in an Template and cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute5",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        },
        {
            "msg": "AF Attribute cannot be deleted!",
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "piafserver": "AF-Server",
            "piafdatabase": "AF-Database",
            "notdeletion": true
        }
    ],
    "result": [
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7|Attribute1",
            "V": false
        },
        {
            "AT": "\\\\PI-Default\\AF-Database\\TestAFSDK Delete Attribute|Attribute7",
            "V": true
        }
    ],
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.063,
        "TotalTimeExecution": 284.4499,
        "TotalBytesOfMemoryUsed": 100683776
    }
}xEOFx

FINDEVENTFRAMES

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Extension at inmationPIBridge: Version 1.0.12.47 Extension at inmationPIBridge: Version 1.0.12.50 Extension at inmationPIBridge: Version 1.0.12.51

Returns the found eventframes according to their search filter in function arguments.

Currently the maximum possible number of returned eventframes is defined in the config file.

  • Variables

PB:FINDEVENTFRAMES(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

EF

table

yes

the search criteria for finding the event frames

Content of the EF table:

parameter data type required meaning

guid

string

no

unique guid of the event frame

AFEventFrameRoot

string

no

root object to start the search. If null, then the search starts at the AFDatabase

EventFrameFilter

string

yes

this field defines the parameter what you’re looking for. it is possible to use different filter: - string is null or empty then it matches everything- string without wildcard is used for an exact match - string with Wildcard * can be used to match zero or more character - string with Wildcard ? can be used to match exact one character - string with a[bc] would match 'ab' or 'ac', but it would not match 'ad' or 'abd' - string with a[!bc] would match 'ad', but it would not match 'ab', 'ac', or 'abd' - string with a[a-c] would match 'aa', 'ab', or 'ac', but it would not match 'ad' or 'abc'.

AFSearchField

number

yes

predefined option from AFSDK where your object’s properties are searched (Name: 1, Description: 2, Categories: 4, Template: 8, Department: 16)

SearchFullHierarchy

boolean

yes

specifies if the search should include objects nested further than the immediate children of the searchRoot

AFSortField

number

yes

defines the field by which the collection is sorted (ID: 0, Name: 1, Type: 2, StartTime: 3, EndTime: 4)

AFSortOrder

number

yes

defines the sort order (Ascending: 0, Descending: 1)

StartIndex

number

yes

start index, starting with 0, the items are returned

MaxCount

number

yes

number of event frames that are returned

GetChildren

boolean (number since 1.0.12.51)

yes

defines if Event Frame Children should be returned or not (inmationPIBridge: 1.0.12.47) (inmationPIBridge: 1.0.12.51: now this parameter defines children search depth All: -1 None: 0 Layer: 1-n)

GetAttributes

boolean

yes

defines if Event Frame Attributes should be returned or not (inmationPIBridge: 1.0.12.47)

GetTemplateName

boolean

yes

defines if Event Frame TemplateName, if exists, should be returned or not (inmationPIBridge: 1.0.12.50)

return values from function

returns data type meaning

1. value

table

a table of the found event frameswith timestamps and values

2. value

table

if there was an error, you get a table exception here

3. value

table

if statistics are enabled in the inmationpibridge, you get a table of runtime statistics (inmationPIBridge: 1.0.12.51)

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultFINDEVENTFRAMES, exceptionFINDEVENTFRAMES, comstatsFINDEVENTFRAMES = PB:FINDEVENTFRAMES{
    ["afserver"] = "PI-Default",
    ["afdatabase"] =  "PI-Default-AF",
    ["EF"] = {
        --["guid"] = {
        --"f1e1de6c-9ff0-474d-0000-00000000246c"
        --},
        ["AFEventFrameRoot"] = "",
        ["EventFrameFilter"] = "Batch*",
        ["AFSearchField"] = 1,
        ["SearchFullHierarchy"] = true,
        ["AFSortField"] = 3,
        ["AFSortOrder"] = 0,
        ["StartIndex"] = 0,
        ["MaxCount"] = 50,
        --["GetChildren"] = 0,
        --["GetAttributes"] = true
        --["GetTemplateName"] = true
    }
}

return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["FINDEVENTFRAMES"] = {result = resultFINDEVENTFRAMES, exeption = exceptionFINDEVENTFRAMES, comstats=comstatsFINDEVENTFRAMES}}
    }
)
  • Return Values

up to inmationPIBridge Version: 1.0.12.49

[
    {
        "EFName": "EF_3",
        "ST": "12.04.2018 10:25:25",
        "ET": "12.04.2018 10:26:26",
        "AT": [{
            "Te": "Maximum pressure",
            "V": "23"
        },
        {
            "Te": "Maximum temperature",
            "V": "0"
        }]
    },
    {
        "EFName": "EF_2",
        "ST": "12.04.2018 10:25:25",
        "ET": "12.04.2018 10:26:26",
        "AT": [{
            "Te": "Maximum pressure",
            "V": "23"
    },
        {
            "Te": "Maximum temperature",
            "V": "0"
        }]
    }
]

from inmationPIBridge Version: 1.0.12.50 and above

[
  {
    "EFName": "EF_2",
    "AT": [
      {
        "Te": "Timestamp",
        "V": 1557439200000
      },
      {
        "Te": "Maximum pressure",
        "V": "23"
      },
      {
        "Te": "Maximum temperature",
        "V": "0"
      }
    ],
    "ET": "1523521586000",
    "EFTemplate": "EventFrameTemplate_test",
    "ST": "1523521525000",
    "GUID": "f1e1de6c-9ff0-474d-0000-00000003ba4f"
  },
  {
    "EFName": "EF_3",
    "AT": [
      {
        "Te": "Maximum pressure",
        "V": "23"
      },
      {
        "Te": "Maximum temperature",
        "V": "0"
      }
    ],
    "ET": "1523521586000",
    "EFTemplate": "EventFrameTemplate_test",
    "ST": "1523521525000",
    "GUID": "f1e1de6c-9ff0-474d-0000-00000003ba50"
  }
]
parameter data type meaning

EFName

string

event frame name

EFTemplate

string

event frame templatename if exists (inmationPIBridge: 1.0.12.50)

ST

string

start time of the event frame (1.0.12.50: Convert from DateTime to UTC Posix)

ET

string

end time of the event frame (1.0.12.50: Convert from DateTime to UTC Posix)

AT

table

attribute name

Te

string

key of the event frame

V

string

value of the event frame (1.0.12.50: Convert from DateTime to UTC Posix)

  • Failure in function call or connection

  • The function argument EF is nil (not given)

{
    "exception": [
        "FindEventFrames: Error Reading AFEventFrame in OSI PI! Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
    ],
    "result": {
        "sys": "OSI",
        "func": "FindEventFrames",
        "afdatabase": "AF-Database",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 811417600,
            "TotalTimeExecution": 0.1971
        },
        "afserver": "AF-Server"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "FindEventFrames",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "AFEventFrameRoot": "",
        "EventFrameFilter": "*EF_*",
        "AFSearchField": 1,
        "SearchFullHierarchy": true,
        "AFSortField": 1,
        "AFSortOrder": 1,
        "StartIndex": 0,
        "MaxCount": 10
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindEventFrames",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg": {
        "ValuesToRead": [{
            "EFName": "EF_4",
            "T1": "12.04.2018 10:25:25",
            "T2": "12.04.2018 10:26:26",
            "AT": [{
                "Te": "Maximum pressure",
                "V": "23"
            },
            {
                "Te": "Maximum temperature",
                "V": "0"
            }]
        },
        {
            "EFName": "EF_3",
            "T1": "12.04.2018 10:25:25",
            "T2": "12.04.2018 10:26:26",
            "AT": [{
                "Te": "Maximum pressure",
                "V": "23"
            },
            {
                "Te": "Maximum temperature",
                "V": "0"
            }]
        },
        {
            "EFName": "EF_2",
            "T1": "12.04.2018 10:25:25",
            "T2": "12.04.2018 10:26:26",
            "AT": [{
                "Te": "Maximum pressure",
                "V": "23"
            },
            {
                "Te": "Maximum temperature",
                "V": "0"
            }]
        },
        {
            "EFName": "EF_1",
            "T1": "12.04.2018 10:25:25",
            "T2": "12.04.2018 10:26:26",
            "AT": [{
                "Te": "Maximum pressure",
                "V": "23"
            },
            {
                "Te": "Maximum temperature",
                "V": "0"
            }]
        },
        {
            "EFName": "EF_0",
            "T1": "12.04.2018 10:25:25",
            "T2": "12.04.2018 10:26:26",
            "AT": [{
                "Te": "Maximum pressure",
                "V": "23"
            },
            {
                "Te": "Maximum temperature",
                "V": "0"
            }]
        }]
    },
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 753.6452,
        "ReadDataFromPISer": 36.3131,
        "ErrorHandle": 0.0088,
        "TotalTimeExecution": 0.0473,
        "TotalBytesOfMemoryUsed": 237543424
    }
}xEOFx

GETAFELEMENTSCONFIG

Available at Lua: Version 0.5.0

Available at inmationPIBridge: Version 1.0.5

Extension at inmationPIBridge: Version 1.0.12.47 Extension at Lua: Version 0.10.5

Returns the AF elements config of the given AF paths.

  • Variables

PB:GETAFELEMENTSCONFIG(data) content of the table data

parameter data type required meaning

afserver

string

yes

the name of the AF server you want to connect to

afdatabase

string

yes

the name of the AF database

elementspaths

table

yes

a table with the paths to the elements at the AF

GetAnalysis

boolean

no

defines if Analysis of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

GetPorts

boolean

no

defines if Ports of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

GetNotifications

boolean

no

defines if Notifications of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

GetExtendedProperties

boolean

no

defines if Extended Properties of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

GetChildren

boolean

no

defines if Children of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

GetAttributes

boolean

no

defines if Attributes of the Element should be returned or not (inmationPIBridge: 1.0.12.47 / Lua: 0.10.5)

return values from function

returns data type meaning

1. value

table

the config of the AF elements as a table

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
    }
local result, exception =
    PB:CONNECTTOAF {
    ["afserver"] = "PI-Default"
}
local resultGETAFELEMENTSCONFIG, exceptionGETAFELEMENTSCONFIG = PB:GETAFELEMENTSCONFIG{
    ["afserver"] = "PI-Default",
    ["afdatabase"] = "PI-Default-AF",
    ["elementspaths"] = {
        "Sysmon\\Server\\PI-Default\\PIPerfMon1",
        "Exercise02_1\\Element1",
        "\\TestSDK"
    },
    --["GetAnalysis"] = false,
    --["GetPorts"] = false,
    --["GetNotifications"] = false,
    --["GetExtendedProperties"] = false,
    --["GetChildren"] = true,
    --["GetAttributes"] = true
}
return J.encode(
    {
        {["CONNECTTOAF"] = {result = result, exeption = exception}},
        {["GETAFELEMENTSCONFIG"] = {result = resultGETAFELEMENTSCONFIG, exeption = exceptionGETAFELEMENTSCONFIG}}
    }
)
  • Return Values

[
    {
            "VersionCreationDate": "1549349361187",
            "IsNew": false,
            "IsAnnotated": false,
            "DefaultUndirectedPort": "",
            "VersionID": "29f9806e-2912-11e9-9454-0050568f2fad",
            "VersionModifier": "NT-AUTORITÄT\\SYSTEM",
            "DefaultOutputPort": "",
            "Description": "",
            "AllowExtensions": "",
            "Type": "None",
            "CheckOutInfo": "",
            "IsRoot": false,
            "SecurityRights": "ReadWrite, Delete, Admin, ReadWriteData, Annotate",
            "VersionOwner": "Test",
            "SecurityString": "Administrators:A(r,w,rd,wd,d,x,a,s,so,an)|Engineers:A(r,w,rd,wd,d,x,s,so,an)|World:A(r,rd)|CTSGMBH\\svcpi:A(r,w,rd,wd,x,an)|Asset Analytics:A(r,w,rd,wd,x)|Notifications:A(r,w,rd,wd,an)",
            "HasAnalyses": false,
            "AFAttributes": [
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|Attribute2",
                    "DefaultUOM": "",
                    "AtUniqueID": "06624adc-96c6-4245-af02-37b1dbc5e075",
                    "Value": "0",
                    "Description": "",
                    "IsManualDataEntry": false,
                    "Type": "Double",
                    "IsHidden": false,
                    "Template": "",
                    "AttributeConfigString": "",
                    "AtName": "Attribute2",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": true,
                    "TypeQualifier": "",
                    "DataReferencePIPoint": ""
                },
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|Attribute1",
                    "DefaultUOM": "",
                    "AtUniqueID": "0d09645e-b1d6-4e70-b42e-96482befd6c3",
                    "Value": "0",
                    "Description": "",
                    "IsManualDataEntry": false,
                    "Type": "Double",
                    "IsHidden": false,
                    "Template": "",
                    "AttributeConfigString": "",
                    "AtName": "Attribute1",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": true,
                    "TypeQualifier": "",
                    "DataReferencePIPoint": ""
                },
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|TESTÖÄÜ%",
                    "DefaultUOM": "",
                    "AtUniqueID": "9e66dd1e-373f-4c50-a435-80f58675b3d0",
                    "PISystem": "CTSBGKPI01",
                    "Value": "35",
                    "Description": "",
                    "IsManualDataEntry": false,
                    "Type": "Int32",
                    "IsHidden": false,
                    "PIPoint": "TestTagÖ",
                    "Template": "",
                    "AttributeConfigString": "\\\\CTSBGKPICOL?271e3394-035e-4a1e-bf63-3c4e2018dba7\\TestTagÖ?209240",
                    "AtName": "TESTÖÄÜ%",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": false,
                    "TypeQualifier": "",
                    "DataReferencePIPoint": "PI Point"
                },
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|TestAttribute11",
                    "DefaultUOM": "bar",
                    "AtUniqueID": "3d145639-2ce6-4218-869d-b71e02e73178",
                    "PISystem": "CTSBGKPI01",
                    "Description": "Test",
                    "IsManualDataEntry": false,
                    "Type": "Double",
                    "IsHidden": false,
                    "PIPoint": "Testtag00002",
                    "Template": "",
                    "AttributeConfigString": "\\\\PI-Default\\Testtag00002",
                    "AtName": "TestAttribute11",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": false,
                    "TypeQualifier": "",
                    "PIPointError": "PI Data Archive 'PI-Default' was not found",
                    "DataReferencePIPoint": "PI Point"
                },
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|TestAttribute110",
                    "DefaultUOM": "bar",
                    "AtUniqueID": "5925e3a4-107f-45d5-8926-3111a27c059b",
                    "PISystem": "CTSBGKPI01",
                    "Description": "Test",
                    "IsManualDataEntry": false,
                    "Type": "Double",
                    "IsHidden": false,
                    "PIPoint": "Testtag00002",
                    "Template": "",
                    "AttributeConfigString": "\\\\PI-Default\\Testtag00002",
                    "AtName": "TestAttribute110",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": false,
                    "TypeQualifier": "",
                    "PIPointError": "PI Data Archive 'PI-Default' was not found",
                    "DataReferencePIPoint": "PI Point"
                },
                {
                    "AtPath": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test|TestAttribute101",
                    "DefaultUOM": "bar",
                    "AtUniqueID": "e9962f09-cdb1-4ce7-82f8-055410ffce85",
                    "PISystem": "CTSBGKPI01",
                    "Description": "Test",
                    "IsManualDataEntry": false,
                    "Type": "Double",
                    "IsHidden": false,
                    "PIPoint": "Testtag00002",
                    "Template": "",
                    "AttributeConfigString": "\\\\PI-Default\\Testtag00002",
                    "AtName": "TestAttribute101",
                    "IsGood": true,
                    "IsExcluded": false,
                    "Trait": "",
                    "IsConfigurationItem": false,
                    "TypeQualifier": "",
                    "PIPointError": "PI Data Archive 'PI-Default' was not found",
                    "DataReferencePIPoint": "PI Point"
                }
            ],
            "DefaultAttribute": "",
            "AFElementChild": [
                "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test\\Test",
                "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test\\Test2",
                "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test\\Test30",
                "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test\\Test40"
            ],
            "VersionEffectiveDate": "0",
            "Identity": "Element",
            "CategoriesString": "",
            "DefaultInputPort": "",
            "IsDeleted": false,
            "Database": "CTSBGK-Server",
            "UniqueID": "29f9806d-2912-11e9-9454-0050568f2fad",
            "Template": "",
            "VersionComment": "",
            "Parent": "TestSDK",
            "IsDirty": false,
            "HasChildren": true,
            "Path": "\\\\CTSBGKPI01\\CTSBGK-Server\\TestSDK\\Test",
            "VersionObsoleteDate": "253402300799000",
            "VersionModifyDate": "1550733817718",
            "HasNotifications": false,
            "Name": "Test",
            "Version": "01.01.1970 00:00:00, Revision 16"
    }
]
parameter data type required meaning

IsRoot

boolean

yes

returns true if the element is a member of the AFDatabase.Elements collection

SecurityRights

string

yes

returns the AFSecurity information for the object

Version

string

yes

the current version information as an AFVersion object

DefaultUndirectedPort

string

no

default undirected AFPort for the AFBaseElement. If the default port does not exist or has not been set, then null will be returned.

VersionCreationDate

string

yes

the creation date in Unix

Identity

string

yes

contains identity of the object

UniqueID

string

yes

the object’s ID as a String

VersionID

string

yes

the current version ID of the attribute

VersionModifyDate

string

yes

the date in Unix when it was last modified

DefaultInputPort

string

no

default input AFPort for the AFBaseElement. If the default port does not exist or has not been set, then null will be returned.

Path

string

yes

the full path to the object

CheckOutInfo

string

no

the checked out status information for the object

HasNotifications

boolean

yes

returns true if there are any AFNotification objects that target this element.

AFNotificationRules

table

yes

collection of AFNotificationRule objects that target this element

AFPorts

table

yes

collection of AFPort objects representing the possible connection ports for this element

AFAnalyses

table

yes

collection of analyses that target this element.

AFAttributes

table

yes

collection of attributes that are owned by this element

HasChildren

boolean

yes

returns true if the element has child elements.

IsAnnotated

boolean

yes

indicates whether this element has any annotations

CategoriesString

string

no

returns the list of categories in a string separated by semicolons

Description

string

no

a more detailed description of the object

IsDeleted

boolean

yes

indicates whether the object has been deleted

SecurityString

string

yes

base type of the element

VersionOwner

string

yes

the owner of the current version

Type

string

yes

specifies the base type of the element

VersionObsoleteDate

string

yes

the date when the version was obsolete

HasAnalyses

boolean

yes

returns true if there are any AFAnalysis objects that target this element

IsDirty

boolean

yes

indicates whether the object has been modified since the last save to the PI AF Server

Parent

string

no

the primary parent AFElement that owns the element if it is referenced by another element

VersionComment

string

no

the comment which was included with the new version

Database

string

yes

the AFDatabase where this object is defined

IsNew

boolean

yes

indicates whether the object is new and has never been saved to the PI AF Server

Template

string

no

the AFElementTemplate that was used to define this object

VersionEffectiveDate

string

yes

the effective date of the version

VersionModifier

string

yes

the last modifier of the attribute

DefaultOutputPort

string

no

default output AFPort for the AFBaseElement

DefaultAttribute

string

no

default AFAttribute for the AFBaseElement

IsGood

boolean

no

indicates if the value of the attribute is good or not

  • Failure in function call or connection

  • The function argument elementspaths is nil (not given)

{
    "exception": [
        {
            "piafdatabase": "AF-Database",
            "notdata": true,
            "msg": "No AF Elements retrieved!",
            "piafserver": "PI-Default"
        }
    ],
    "result": {
        "func": "GetAFElementsConfig",
        "afserver": "AF-Server",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 137605120,
            "TotalTimeExecution": 3.1601,
            "ReadTelegramArguments": 0.0115
        },
        "afdatabase": "AF-Database",
        "sys": "OSI"
    }
}
  • Return 2nd Parameter

"GetAFElementsConfig: AFElement not found in PIServer: Sysmon\\Server\\PI-Default\\PIPerfMon1",
"GetAFElementsConfig: AFElement not found in PIServer: Exercise02_1\\Element1"

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "GetAFElementsConfig",
    "piserver": "PI-Default",
    "afserver": "PI-Default",
    "afdatabase": "PI-Default-AF",
    "farg":
    {
        "AT": [
            "Exercise02_1\\Element1",
            "\\TestSDK",
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "TimeProcessPerformance": {
        "CallPISDKFunction": 0.0003,
        "TotalBytesOfMemoryUsed": 95535104,
        "ResultAFvaluesFromPISer": 155.485,
        "Total": 155.7298
    },
    "farg": {
        "AT": {
            "Element1": {
                "CheckOutInfo": "",
                "Version": "01.01.1970 00:00:00, Revision 1",
                "DefaultOutputPort": "",
                "SecurityRights": "ReadWrite, Delete, Admin, ReadWriteData, Annotate",
                "IsDeleted": false,
                "HasNotifications": false,
                "IsDirty": false,
                "IsNew": false,
                "AFAnalyses": [
                    "Null",
                    ""
                ],
                "DefaultInputPort": "",
                "IsRoot": false,
                "Parent": "Exercise02_1",
                "VersionEffectiveDate": "0",
                "VersionModifier": "DOMAIN\\t.user",
                "AFPorts": [],
                "AFNotificationRules": [
                    "Null",
                    ""
                ],
                "VersionObsoleteDate": "253402300799000",
                "IsAnnotated": false,
                "DefaultAttribute": "",
                "VersionID": "b8196dd8-43ad-11e8-9439-0050568f2fad",
                "Description": "",
                "VersionCreationDate": "1524127467830",
                "UniqueID": "b8196dd7-43ad-11e8-9439-0050568f2fad",
                "Identity": "Element",
                "SecurityString": "Administrators:A(r,w,rd,wd,d,x,a,s,so,an)|Engineers:A(r,w,rd,wd,d,x,s,so,an)|World:A(r,rd)|DOMAIN\\svcpi:A(r,w,rd,wd,x,an)|Asset Analytics:A(r,w,rd,wd,x)|Notifications:A(r,w,rd,wd,an)",
                "CategoriesString": "",
                "Template": "",
                "Database": "PI-Default-AF",
                "Path": "Exercise02_1\\Element1",
                "VersionModifyDate": "1524127467892",
                "HasChildren": false,
                "VersionOwner": "Element1",
                "HasAnalyses": false,
                "DefaultUndirectedPort": "",
                "Type": "None",
                "AFAttributes": [
                    {
                        "Trait": "",
                        "AttributeConfigString": "\\\\PI-Default?271e3394-035e-4a1e-bf63-3c4e2018dba7\\2WDS_CIP_VENT_1_1.F_CV?2566",
                        "DefaultUOM": "",
                        "DataReferencePIPoint": "PI Point",
                        "TypeQualifier": "Exercise02_Valve",
                        "AtUniqueID": "3db7d158-3968-4564-b9be-edb99c81b08b",
                        "IsHidden": false,
                        "IsConfigurationItem": false,
                        "Type": "AFEnumerationValue",
                        "IsExcluded": false,
                        "IsManualDataEntry": false,
                        "Value": "Open",
                        "AtName": "Valve1.1",
                        "Description": "",
                        "AtPath": "\\\\PI-Default\\PI-Default-AF\\Exercise02_1\\Element1|Valve1.1",
                        "Template": ""
                    },
                    {
                        "Trait": "",
                        "AttributeConfigString": "\\\\PI-Default?271e3394-035e-4a1e-bf63-3c4e2018dba7\\2WDS_CIP_VENT_1_2.F_CV?2567",
                        "DefaultUOM": "",
                        "DataReferencePIPoint": "PI Point",
                        "TypeQualifier": "Exercise02_Valve",
                        "AtUniqueID": "7527292d-9e4e-41cd-95b5-be30f5ae4b8e",
                        "IsHidden": false,
                        "IsConfigurationItem": false,
                        "Type": "AFEnumerationValue",
                        "IsExcluded": false,
                        "IsManualDataEntry": false,
                        "Value": "Closed",
                        "AtName": "Valve1.2",
                        "Description": "",
                        "AtPath": "\\\\PI-Default\\PI-Default-AF\\Exercise02_1\\Element1|Valve1.2",
                        "Template": ""
                    },
                    {
                        "Trait": "",
                        "AttributeConfigString": "\\\\PI-Default?271e3394-035e-4a1e-bf63-3c4e2018dba7\\2WDS_CIP_VENT_1_3.F_CV?2568",
                        "DefaultUOM": "",
                        "DataReferencePIPoint": "PI Point",
                        "TypeQualifier": "Exercise02_Valve",
                        "AtUniqueID": "2ec12d59-b580-445e-bff9-792dad30720b",
                        "IsHidden": false,
                        "IsConfigurationItem": false,
                        "Type": "AFEnumerationValue",
                        "IsExcluded": false,
                        "IsManualDataEntry": false,
                        "Value": "Open",
                        "AtName": "Valve1.3",
                        "Description": "",
                        "AtPath": "\\\\PI-Default\\PI-Default-AF\\Exercise02_1\\Element1|Valve1.3",
                        "Template": ""
                    },
                    {
                        "Trait": "",
                        "AttributeConfigString": "\\\\PI-Default?271e3394-035e-4a1e-bf63-3c4e2018dba7\\2WDS_CIP_VENT_1_4.F_CV?2569",
                        "DefaultUOM": "",
                        "DataReferencePIPoint": "PI Point",
                        "TypeQualifier": "Exercise02_Valve",
                        "AtUniqueID": "d3070dff-8f4c-4cb5-86e6-6bf1056280b6",
                        "IsHidden": false,
                        "IsConfigurationItem": false,
                        "Type": "AFEnumerationValue",
                        "IsExcluded": false,
                        "IsManualDataEntry": false,
                        "Value": "Open",
                        "AtName": "Valve1.4",
                        "Description": "",
                        "AtPath": "\\\\PI-Default\\PI-Default-AF\\Exercise02_1\\Element1|Valve1.4",
                        "Template": ""
                    },
                    {
                        "Trait": "",
                        "AttributeConfigString": "\\\\PI-Default?271e3394-035e-4a1e-bf63-3c4e2018dba7\\2WDS_CIP_VENT_1_5.F_CV?2570",
                        "DefaultUOM": "",
                        "DataReferencePIPoint": "PI Point",
                        "TypeQualifier": "Exercise02_Valve",
                        "AtUniqueID": "cab27f41-5902-479a-93d5-1739b3c974aa",
                        "IsHidden": false,
                        "IsConfigurationItem": false,
                        "Type": "AFEnumerationValue",
                        "IsExcluded": false,
                        "IsManualDataEntry": false,
                        "Value": "Closed",
                        "AtName": "Valve1.5",
                        "Description": "",
                        "AtPath": "\\\\PI-Default\\PI-Default-AF\\Exercise02_1\\Element1|Valve1.5",
                        "Template": ""
                    }
                ],
                "VersionComment": ""
            },
            "TestSDK": {
                "CheckOutInfo": "",
                "Version": "01.01.1970 00:00:00, Revision 4",
                "DefaultOutputPort": "",
                "SecurityRights": "ReadWrite, Delete, Admin, ReadWriteData, Annotate",
                "IsDeleted": false,
                "HasNotifications": false,
                "IsDirty": false,
                "IsNew": false,
                "AFAnalyses": [
                    "Null",
                    ""
                ],
                "DefaultInputPort": "",
                "IsRoot": true,
                "Parent": "",
                "VersionEffectiveDate": "0",
                "VersionModifier": "DOMAIN\\d.user",
                "AFPorts": [],
                "AFNotificationRules": [
                    "Null",
                    ""
                ],
                "VersionObsoleteDate": "253402300799000",
                "IsAnnotated": false,
                "DefaultAttribute": "",
                "VersionID": "054916d6-37f4-11e8-9437-0050568f2fad",
                "Description": "",
                "VersionCreationDate": "1522838194128",
                "UniqueID": "054916d5-37f4-11e8-9437-0050568f2fad",
                "Identity": "Element",
                "SecurityString": "Administrators:A(r,w,rd,wd,d,x,a,s,so,an)|Engineers:A(r,w,rd,wd,d,x,s,so,an)|World:A(r,rd)|DOMAIN\\svcpi:A(r,w,rd,wd,x,an)|Asset Analytics:A(r,w,rd,wd,x)|Notifications:A(r,w,rd,wd,an)",
                "CategoriesString": "",
                "Template": "",
                "Database": "PI-Default-AF",
                "Path": "\\TestSDK",
                "VersionModifyDate": "1524123145099",
                "HasChildren": true,
                "VersionOwner": "TestSDK",
                "HasAnalyses": false,
                "DefaultUndirectedPort": "",
                "Type": "None",
                "AFAttributes": [],
                "VersionComment": ""
            }
        }
    },
    "piserver": "PI-Default",
    "func": "GetAFElementsConfig"
}xEOFx

CREATEPIPOINTS

Available at Lua: Version 0.3.0

Available at inmationPIBridge: Version 1.0.3

Extension at inmationPIBridge: Version 1.0.12.39 Extension at inmationPIBridge: Version 1.0.12.49

Creates one or multiple PI Points at the chosen AF server.

  • Variables

PB:CREATEPIPOINTS(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

PIPoints

table

yes

all attributes the new PI points should have

content of the table PIPoints if you are using Version 1.0.12.39 or higher we recommend to use the second parameter

parameter data type required meaning

tag

string

yes

creates a tag with this name

arc/archiving

number

yes

sets the archiving option 0 = don´t archive, 1 = archive tag

cdev/compdev

number

no

if the PI-Point should be compressed(interpolated) then this must be set with a fitting value

cmax/compmax

number

no

maximal time to wait after the compressing write the same value in PI if the value changed not as much as it should

cmin/compmin

number

no

minimal time to wait after the compressing write the same value in PI if the value changed not as much as it should(recommended = 0)

cpressing/compressing

number

no

disable 0 / enable 1 compressing

descr/descriptor

string

no

set a description

digset/digitalset

string

depends

optional and nessesary depending of the PI-Point. If a PI-Point with the pointtype digital is created this Parameter must be set otherwise not

disdigits/displaydigits

number

no

defines how much decimal places should be displayed (default = -5 ⇒ PI display five significat points)

engu/engunits

string

no

set an engeneering unit

edev/excdev

number

no

combined with cdev useable

emax/excmax

number

no

similar to cmax

emin/excmin

number

no

similar to cmin

edesc/exdesc

string

depends

if the PI-Point should be used as Performance Equation Tag, then here you must place the function which should be executed

instrtag/instrumenttag

string

depends

if the PI-Point should be linked with an OSIsoft PI Interface, then here you write in your instrumenttagname(accessing path on OPC Server)

loc1/location1

number

depends

set to the OSIsoft Interface ID

loc2/location2

number

yes

set the datahandling

loc3/location3

number

depends

set the type of receiving data (normal/Performance Equation)

loc4/location4

number

depends

set the time interval defined in the OSIsoft Interface

loc5/location5

number

no

set the deadband to reduce network load

ps/pointsource

string

yes

refer to a group (ex: OSI-OPC-DA_Interface) Default = L (Labor)

pt/pointtype

string & number

yes

set the pointsource of the PIPoint

ptclass/ptclassname

string

no

set the class, is used for default values if not set

scan

number

yes

if the PI-Point should get data set to 1 else 0

shut/shutdown

number

no

when the OSIsoft Interface is in an shutdown state, then write this in the tag value

source/sourcetag

string

no

needed for some OSIsoft calculations

span

number

no

maximal range. Attention! if value is less then zero you must add this value

zero

number

no

minimal range

loc2:

  • 0 = normal datahandling

  • 1 = String

  • 2 = Boolean

  • 3 = 4 Byte Integer

  • 4 = save Qualität instead of data

  • 5 = 8 Byte Integer

  • 6 = reading of Timestamps und convert to secondes

  • 7 = reading of TimeStamps and read as Timestamp or Sekunden

  • 8 = convert recieved data to the format defined in PI (ex: String to integer) Attention! can produce errors if the retrieved value can´t be converted

loc3:

  • 0 = Polled or Event / start calculation at the start of the event

  • 1 = Advise / start calculation at the end of the event

  • 2 = Output

  • 3 = Polled Watchdog

  • 4 = Advise Watchdog

loc4:

  • 1 = Scan Class 1

  • 2 = Scan Class 2

return values from function

returns data type meaning

1. value

table

the time it took to create the new PI point

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

local PIPoints = {
    {
        ["tag"] = "Testtag00001",
        ["arc"] = 1,
        ["cdev"] = 0,
        ["cmax"] = 28800,
        ["cmin"] = 0,
        ["cpressing"] = 1,
        ["descr"] = "Test",
        ["digset"] = "",
        ["disdigits"] = -5,
        ["engu"] = "°C",
        ["edev"] = 0,
        ["emax"] = 28800,
        ["emin"] = 0,
        ["edesc"] = "",
        ["filter"] = "",
        ["instrtag"] = "",
        ["loc1"] = 1,
        ["loc2"] = 0,
        ["loc3"] = 1,
        ["loc4"] = 1,
        ["loc5"] = 0,
        ["ps"] = "XXX",
        ["pt"] = "Int32",
        ["ptclass"] = "classic",
        ["scan"] = 1,
        ["shut"] = 0,
        ["source"] = "",
        ["span"] = 1000,
        ["step"] = 1,
        ["zero"] = 0
    },
    { -- only avaiable on Version 1.0.12.39 or higher
        ["tag"] = "Testtag00002",
        ["archiving"] = 1,
        ["compdev"] = 0,
        ["compmax"] = 28800,
        ["compmin"] = 0,
        ["compressing"] = 1,
        ["descriptor"] = "Test",
        ["digitalset"] = "",
        ["displaydigits"] = -5,
        ["engunits"] = "°C",
        ["excdev"] = 0,
        ["excmax"] = 28800,
        ["excmin"] = 0,
        ["exdesc"] = "",
        ["filtercode"] = "",
        ["instrumenttag"] = "",
        ["location1"] = 1,
        ["location2"] = 0,
        ["location3"] = 1,
        ["location4"] = 1,
        ["location5"] = 0,
        ["pointsource"] = "XXX",
        ["pointtype"] = "Int32",
        ["ptclassname"] = "classic",
        ["scan"] = 1,
        ["shutdown"] = 0,
        ["sourcetag"] = "",
        ["span"] = 1000,
        ["step"] = 1,
        ["zero"] = 0
    }
}

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultCREATEPIPOINTS, exceptionCREATEPIPOINTS = PB:CREATEPIPOINTS{
    ["piserver"] = "PI-Default",
    ["PIPoints"] = PIPoints
}

return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["CREATEPIPOINTS"] = {result = resultCREATEPIPOINTS, exeption = exceptionCREATEPIPOINTS}}
    }
)
  • Return Values

{
  "farg" : {
    "PIPoints" : [{
        "created" : true,
        "tag" : "Testtag00001"
      }, {
        "created" : true,
        "tag" : "Testtag00002"
      }]
  },
  "func" : "CreatePIPoints",
  "TimeProcessPerformance" : {
    "TotalTimeExecution" : 29.875499999999999,
    "TotalBytesOfMemoryUsed" : 88088576,
    "CallPISDKFunction" : 9.9400999999999993,
    "ReadTelegramArguments" : 0.023400000000000001,
    "ErrorHandle" : 19.1418
  },
  "sys" : "OSI",
  "piserver" : "PI-Default"
}
  • Failure in function call or connection

  • The given PI-Point already exists in the PI system

{
    "result": {
        "func": "CreatePIPoints",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 842756096,
            "ErrorHandle": 0.1,
            "ReadTelegramArguments": 0.0369,
            "TotalTimeExecution": 2.0895,
            "CallPISDKFunction": 1.9109
        },
        "sys": "OSI",
        "piserver": "PI-Default"
    },
    "exception": [
        "TesttagNET4.5_neu: System.ArgumentException: [-10550] Tag Already Exists in Table\r\nParametername: tag ---> OSIsoft.AF.PI.PIException: [-10550] Tag Already Exists in Table\r\n   --- Ende der internen Ausnahmestapelüberwachung ---"
    ]
}
// new response available at 1.0.12.49
{
    "exeption": [
        {
            "piserver": "CTSBGKPICOL",
            "T": 1554887767353,
            "CreateError": true,
            "ID": 1,
            "msg": "[-10550] Tag Already Exists in Table\r\nParametername: tag",
            "P": "Testtag00001"
        },
        {
            "piserver": "CTSBGKPICOL",
            "T": 1554887767383,
            "CreateError": true,
            "ID": 2,
            "msg": "[-10550] Tag Already Exists in Table\r\nParametername: tag",
            "P": "Testtag00002"
        }
    ],
    "result": {
        "farg": {
            "PIPoints": [
                {
                    "tag": "Testtag00001",
                    "created": false
                },
                {
                    "tag": "Testtag00002",
                    "created": false
                }
            ]
        },
        "piserver": "ctsbgkpi01",
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.025100000000000001,
            "TotalBytesOfMemoryUsed": 87904256,
            "ErrorHandle": 40.998800000000003,
            "TotalTimeExecution": 55.564300000000003,
            "CallPISDKFunction": 12.829700000000001
        },
        "func": "CreatePIPoints",
        "sys": "OSI"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "CreatePIPoints",
    "piserver": "PI-Default",
    "farg": {
        "PIPoints": [
            {
                "tag": "Testtag00001",
                "arc": 1,
                "cdev": 0,
                "cmax": 28800,
                "cmin": 0,
                "cpressing": 1,
                "descr": "Test",
                "digset":"",
                "disdigits": -5,
                "engu": "°C",
                "edev": 0,
                "emax": 28800,
                "emin": 0,
                "edesc": "",
                "instrtag":"",
                "loc1":1,
                "loc2":0,
                "loc3":1,
                "loc4":1,
                "loc5":0,
                "ps": "XXX",
                "pt": "Int32",
                "ptclass": "classic",
                "scan": 1,
                "shut":0,
                "source":"",
                "span": 1000,
                "step": 1,
                "zero": 0
            },
            {
                "tag": "Testtag00002",
                "archiving": 1,
                "compdev": 0,
                "compmax": 28800,
                "compmin": 0,
                "compressing": 1,
                "descriptor": "Test",
                "digitalset":"",
                "displaydigits": -5,
                "engunits": "°C",
                "excdev": 0,
                "excmax": 28800,
                "excmin": 0,
                "exdesc": "",
                "filtercode": "",
                "instrumenttag":"",
                "location1":1,
                "location2":0,
                "location3":1,
                "location4":1,
                "location5":0,
                "pointsource": "XXX",
                "pointtype": "Int32",
                "ptclassname": "classic",
                "scan": 1,
                "shutdown":0,
                "sourcetag":"",
                "span": 1000,
                "step": 1,
                "zero": 0
            }
        ]
    }
}xEOFx
  • Response

{
  "farg" : {
    "PIPoints" : [{
        "created" : true,
        "tag" : "Testtag00001"
      }, {
        "created" : true,
        "tag" : "Testtag00002"
      }]
  },
  "func" : "CreatePIPoints",
  "TimeProcessPerformance" : {
    "TotalTimeExecution" : 29.875499999999999,
    "TotalBytesOfMemoryUsed" : 88088576,
    "CallPISDKFunction" : 9.9400999999999993,
    "ReadTelegramArguments" : 0.023400000000000001,
    "ErrorHandle" : 19.1418
  },
  "sys" : "OSI",
  "piserver" : "PI-Default"
}xEOFx

CURRENTVALUES

Available at Lua: Version 0.4.0

Available at inmationPIBridge: Version 1.0.4

Returns the current values of the given PI tagnames, their timestamps and qualities.

There are three different return values depending on the response variable. You can set it to raw, inmation or bridge.

  • Variables

PB:CURRENTVALUES(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

tags

table

yes

all PI tagnames you want to know the current value

response

string

yes

the format in which the current values data is returne (raw, inmation, bridge)

return values from function

returns data type meaning

1. value

table

in a table the current values, PI tagnames and qualities of the PI tagnames sent to PIBridge

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultCURRENTVALUES, exceptionCURRENTVALUES = PB:CURRENTVALUES{
    ["piserver"] = "PI-Default",
    ["tags"] = {"Testtag10101", "Testtag10102"},
    ["response"] = "inmation"
}

return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["CURRENTVALUES"] = {result = resultCURRENTVALUES, exeption = exceptionCURRENTVALUES}}
    }
)
  • Return Values

  • Possibility 1: raw

[
    {
        "P": "Testtag00001",
        "v": "Bad",
        "t": "18.04.2018 09:40:14"
    },
    {
        "P": "Testtag00002",
        "v": "270",
        "t": "18.04.2018 09:40:14"
    },
    {
        "P": "Testtag00003",
        "v": "100",
        "t": "08.04.2018 06:36:51"
    }
]
  • Possibility 2: inmation

[
    [
        {
            "T": [
                1525668199558
            ],
            "Q": [
                0
            ],
            "V": [
                1.3695261579317
            ]
        }
    ],
    [
        {
            "T": [
                1525668199558
            ],
            "Q": [
                0
            ],
            "V": [
                97.552825814758
            ]
        }
    ]
]
  • Possibility 3: bridge

[
    {
        "P": "Testtag00001",
        "V": {
            "t": "1522720579000",
            "v": "1522720819000"
        }
    }
]
  • Failure in function call or connection

  • Missconfiguration concerning host or port or network error between the server running the PI-Bridge and the system trying to connect to the PI-Bridge

{
    "exception": {
        "tcp": "timeout",
        "msg": "Error during TCP connection"
    }
}
  • wrong response type

{
    "exception": {
        "msg": "Warning: no valid response type! Standard response was returned."
    },
    "result": {
        "farg": {
            "valuesToRead": [
                {
                    "v": 103,
                    "t": 1526379478000,
                    "p": "Testtag10101"
                },
                {
                    "v": 2,
                    "t": 1526379478000,
                    "p": "Testtag10102"
                }
            ]
        },
        "func": "CurrentValues",
        "TimeProcessPerformance": {
            "FindPIPointsinServer": 1.3573,
            "TotalTimeExecution": 0.9985,
            "CallPISDKFunction": 1.2611,
            "ReadTelegramArguments": 0.0146,
            "ErrorHandle": 0.023,
            "TotalBytesOfMemoryUsed": 129982464,
            "ReadDataFromPISer": 0.0538
        },
        "piserver": "PI-Default",
        "sys": "OSI"
    }
}
  • The function argument tags is empty (["tags"] = {})

{
    "exception": {
        "msg": "Error during TCP connection",
        "tcp": [
            {
                "msg": "No PI Points Retrieved!",
                "notdata": true,
                "piserver": "PI-Default"
            }
        ]
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "CurrentValues",
    "piserver": "PI-Default",
    "farg": {
        "ValuesToRead": [{
            "P": "Testtag00001"
        },
        {
            "P": "Testtag00002"
        },
        {
            "P": "Testtag00003"
        }]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "CurrentValues",
    "piserver": "PI-Default",
    "farg": {
        "valuesToRead": [{
            "P": "Testtag00001",
            "v": "Bad",
            "t": "18.04.2018 09:40:14"
        },
        {
            "P": "Testtag00002",
            "v": "270",
            "t": "18.04.2018 09:40:14"
        },
        {
            "P": "Testtag00003",
            "v": "100",
            "t": "08.04.2018 06:36:51"
        }]
    },
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.2105,
        "TotalTimeExecution": 0.2275,
        "TotalBytesOfMemoryUsed": 218804224
    }
}xEOFx

FINDPIBATCHES

Available at Lua: Version 0.7.4

Available at inmationPIBridge: Version 1.0.7

Looks for PI batches and returns them. You only need to specify the startime and endtime.

  • Variables

PB:FINDPIBATCHES(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

PIBatchUniqueID

string

no

unique ID every PI batch has. This parameter is optional but if wished there is the possibility to just look for a single PI Batch.

SearchStartTime

number

yes

the timestamp when to start searching for PI Batches in Unix Epoch Clock time

SearchEndTime

number

yes

the timestamp when to stop searching for PI Batches in Unix Epoch Clock time

BatchIDMask

string

no

this is for Filtering batches with the BatchID(BID)

ProductMask

string

no

this is for Filtering batches with the Product(Pro)

RecipeMask

string

no

this is for Filtering batches with the Recipe

return values from function

returns data type meaning

1. value

table

the PI Batches which occured between the thimestamps

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 1

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultFINDPIBATCHES, exceptionFINDPIBATCHES = PB:FINDPIBATCHES{
    ["piserver"] = "PI-Default",
    ["SearchStartTime"] =  inmation.now() - 360000,
    ["SearchEndTime"] = inmation.now()
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["FINDPIBATCHES"] = {result = resultFINDPIBATCHES, exeption = exceptionFINDPIBATCHES}}
    }
)
  • Return Values

[
    {
        "BID": "2,604202E+07",
        "PRO": "",
        "PRC": "",
        "ST": "26.04.2018 00:00:00",
        "ET": "27.04.2018 00:00:00",
        "UN": "Mon",
        "SubBatches": [
            {
                "BID": "WitchingHour",
                "ST": "26.04.2018 00:00:05",
                "ET": "26.04.2018 01:00:05",
                "ID": "c9911823-21b5-4533-b002-f1dcd49c31d6"
            },
            {
                "BID": "From",
                "ST": "26.04.2018 01:00:05",
                "ET": "26.04.2018 05:00:05",
                "ID": "979b4394-23fd-4cdd-ac15-ce6c606203c7"
            },
            {
                "BID": "Mon",
                "ST": "26.04.2018 05:00:05",
                "ET": "26.04.2018 11:00:05",
                "ID": "3a1f939d-a332-4cee-bf49-2403af9d1bda"
            },
            {
                "BID": "Es",
                "ST": "26.04.2018 11:00:05",
                "ET": "26.04.2018 13:00:05",
                "ID": "1671987e-7916-49e9-a4df-1dd227ba834e"
            },
            {
                "BID": "Mi",
                "ST": "26.04.2018 13:00:05",
                "ET": "26.04.2018 15:00:05",
                "ID": "fd2e22b9-3849-42e0-bee3-821750225a3a"
            },
            {
                "BID": "Na",
                "ST": "26.04.2018 15:00:05",
                "ET": "26.04.2018 18:00:05",
                "ID": "4621dc91-5ecd-4c33-aaef-30bd9dd349ac"
            },
            {
                "BID": "Ab",
                "ST": "26.04.2018 18:00:05",
                "ET": "27.04.2018 00:00:00",
                "ID": "ebbc0625-631e-4bc2-afe3-fa66bd2a4f1e"
            }
        ]
    },
    {
        "BID": "XYASF25",
        "PRO": "Che A",
        "PRC": "",
        "ST": "26.04.2018 13:17:50",
        "ET": "26.04.2018 14:28:50",
        "UN": "Reactor1",
        "SubBatches": [
            {
                "BID": "Pha2",
                "ST": "26.04.2018 13:27:20",
                "ET": "26.04.2018 13:33:50",
                "ID": "d4377cef-2dfb-4db6-8820-94a921f403c3"
            },
            {
                "BID": "Pha3",
                "ST": "26.04.2018 13:33:50",
                "ET": "26.04.2018 13:53:50",
                "ID": "194efa55-05a6-4912-9bc7-f29047fb867b"
            },
            {
                "BID": "Pha4",
                "ST": "26.04.2018 13:53:50",
                "ET": "26.04.2018 14:04:20",
                "ID": "4fd8c463-8d8a-4476-95e9-3b0bf1fb98bc"
            },
            {
                "BID": "Pha5",
                "ST": "26.04.2018 14:04:20",
                "ET": "26.04.2018 14:14:50",
                "ID": "cad9c4e5-a709-470a-9459-42ec1ba1fb91"
            },
            {
                "BID": "Pha6",
                "ST": "26.04.2018 14:14:50",
                "ET": "26.04.2018 14:20:21",
                "ID": "818e5191-937c-400d-8ffd-b47fe7cad6a5"
            },
            {
                "BID": "Pha7",
                "ST": "26.04.2018 14:20:21",
                "ET": "26.04.2018 14:28:50",
                "ID": "12a540cf-d9d4-4c75-8d24-167500ae9df7"
            }
        ]
    }
]
parameter data type meaning

BID

string

batch ID

PRO

string

product name

PRC

string

recipe name

ST

string

start time. When the PI batch started

ET

string

end time. When the PI batch ended

UN

string

Unique ID

SubBatches

string

sub batches

  • Failure in function call or connection

  • If SearchStartTime or SearchEndTime is nil

{
    "result": {
        "TimeProcessPerformance": {
            "ReadTelegramArguments": 0.0323,
            "TotalBytesOfMemoryUsed": 266952704,
            "TotalTimeExecution": 26.0147
        },
        "sys": "OSI",
        "func": "FindPIBatches",
        "piserver": "PI-APT.basf-ag.de"
    },
    "exception": [
        {
            "notdata": true,
            "piserver": "PI-APT.basf-ag.de",
            "msg": "Missing Start or Endtime!"
        }
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "FindPIBatches",
    "piserver": "PI-Default",
    "farg": {
        "PIBatchUniqueID": "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
        "SearchStartTime": "1525569615000",
        "SearchEndTime": "1527422372000",
        "BatchIDMask": "*",
        "ProductMask": "*",
        "RecipeMask": "*"
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindPIBatches",
    "piserver": "PI-Default",
    "farg": {
        "ValuesRetrieved": [{
            "BID": "2,604202E+07",
            "PRO": "",
            "PRC": "",
            "ST": "26.04.2018 00:00:00",
            "ET": "27.04.2018 00:00:00",
            "UN": "Mon",
            "SubBatches": [{
                "BID": "WitchingHour",
                "ST": "26.04.2018 00:00:05",
                "ET": "26.04.2018 01:00:05",
                "ID": "c9911823-21b5-4533-b002-f1dcd49c31d6"
            },
            {
                "BID": "From",
                "ST": "26.04.2018 01:00:05",
                "ET": "26.04.2018 05:00:05",
                "ID": "979b4394-23fd-4cdd-ac15-ce6c606203c7"
            },
            {
                "BID": "Mon",
                "ST": "26.04.2018 05:00:05",
                "ET": "26.04.2018 11:00:05",
                "ID": "3a1f939d-a332-4cee-bf49-2403af9d1bda"
            },
            {
                "BID": "Es",
                "ST": "26.04.2018 11:00:05",
                "ET": "26.04.2018 13:00:05",
                "ID": "1671987e-7916-49e9-a4df-1dd227ba834e"
            },
            {
                "BID": "Mi",
                "ST": "26.04.2018 13:00:05",
                "ET": "26.04.2018 15:00:05",
                "ID": "fd2e22b9-3849-42e0-bee3-821750225a3a"
            },
            {
                "BID": "Na",
                "ST": "26.04.2018 15:00:05",
                "ET": "26.04.2018 18:00:05",
                "ID": "4621dc91-5ecd-4c33-aaef-30bd9dd349ac"
            },
            {
                "BID": "Ab",
                "ST": "26.04.2018 18:00:05",
                "ET": "27.04.2018 00:00:00",
                "ID": "ebbc0625-631e-4bc2-afe3-fa66bd2a4f1e"
            }]
        },
        {
            "BID": "XYASF25",
            "PRO": "Che A",
            "PRC": "",
            "ST": "26.04.2018 13:17:50",
            "ET": "26.04.2018 14:28:50",
            "UN": "Reactor1",
            "SubBatches": [{
                "BID": "Pha2",
                "ST": "26.04.2018 13:27:20",
                "ET": "26.04.2018 13:33:50",
                "ID": "d4377cef-2dfb-4db6-8820-94a921f403c3"
            },
            {
                "BID": "Pha3",
                "ST": "26.04.2018 13:33:50",
                "ET": "26.04.2018 13:53:50",
                "ID": "194efa55-05a6-4912-9bc7-f29047fb867b"
            },
            {
                "BID": "Pha4",
                "ST": "26.04.2018 13:53:50",
                "ET": "26.04.2018 14:04:20",
                "ID": "4fd8c463-8d8a-4476-95e9-3b0bf1fb98bc"
            },
            {
                "BID": "Pha5",
                "ST": "26.04.2018 14:04:20",
                "ET": "26.04.2018 14:14:50",
                "ID": "cad9c4e5-a709-470a-9459-42ec1ba1fb91"
            },
            {
                "BID": "Pha6",
                "ST": "26.04.2018 14:14:50",
                "ET": "26.04.2018 14:20:21",
                "ID": "818e5191-937c-400d-8ffd-b47fe7cad6a5"
            },
            {
                "BID": "Pha7",
                "ST": "26.04.2018 14:20:21",
                "ET": "26.04.2018 14:28:50",
                "ID": "12a540cf-d9d4-4c75-8d24-167500ae9df7"
            }]
        }]
    },
    "TimeProcessPerformance": {
        "ReadTelegramArguments": 0.3791,
        "CallPISDKFunction": 24.1556,
        "ErrorHandle": 0.0088,
        "TotalTimeExecution": 52.4973,
        "TotalBytesOfMemoryUsed": 278634496
    }
}xEOFx

PITAGSEXISTS

Available at Lua: Version 0.5.0

Available at inmationPIBridge: Version 1.0.5

Checks if the given PI tagnames exist in the PI system. Returns true or false whether they exist or not.

  • Variables

PB:PITAGSEXISTS(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

tags

table

yes

the paths to the PI tags you want to check if existing

return values from function

returns data type meaning

1. value

table

a table with all the PI tagnames checked if existing and the time it took to check

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultPITAGSEXISTS, exceptionPITAGSEXISTS = PB:PITAGSEXISTS{
    ["piserver"] = "PI-Default",
    ["tags"] = {
        "Testtag00001",
        "Testtag00002",
        "Testtag0000354"
    }
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["PITAGSEXISTS"] = {result = resultPITAGSEXISTS, exeption = exceptionPITAGSEXISTS}}
    }
)
  • Return values

  • Possibility 1: multiple tags

{
    "E": [
        true,
        true,
        false
    ],
    "P": [
        "Testtag00001",
        "Testtag00002",
        "Testtag0000354"
    ]
}
  • Possibility 2: one tag

true
  • Failure in function call or connection

  • The given function argument tags must be a table, even if only one tag is specified

{
    "result": {
        "piserver": "PI-Default",
        "TimeProcessPerformance": {
            "ReadDataFromPISer": 0.0092,
            "TotalBytesOfMemoryUsed": 119078912,
            "ReadTelegramArguments": 1.2607,
            "ErrorHandle": 0.0026,
            "TotalTimeExecution": 2.252,
            "FindPIPointsinServer": 0.9204
        },
        "sys": "OSI",
        "func": "PITagsExists"
    },
    "exception": [
        {
            "piserver": "PI-Default",
            "notdata": true,
            "msg": "No PI Points Retrieved!"
        }
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "PITagsExists",
    "piserver": "PI-Default",
    "afserver": "PI-Default",
    "farg": {
        "P": ["Testtag00001",
        "Testtag00002",
        "Testtag0000354"]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "PITagsExists",
    "piserver": "PI-Default",
    "farg": {
        "E": [
            true,
            true,
            false
        ],
        "P": [
            "Testtag00001",
            "Testtag00002",
            "Testtag0000354"
        ]
    },
    "TimeProcessPerformance": {
        "FindPIPointsinServer": 1.1248,
        "ReadTelegramArguments": 0.0169,
        "ReadDataFromPISer": 0.0311,
        "ErrorHandle": 0.0142,
        "TotalTimeExecution": 1.2622,
        "TotalBytesOfMemoryUsed": 216834048
    }
}

RECORDEDVALUES

Available at Lua: Version 0.4.0

Available at inmationPIBridge: Version 1.0.4

Returns the historic values and qualities of the given PI tags. The StartTime and EndTime is user configurable and can be set differently for every pi tag in one call.

  • Variables

PB:RECORDEDVALUES(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

tags

table

yes

the tagnames in PI you want to get historical values as a table

response

string

yes

the format you want to get the response (raw, inmation, bridge)

StartTime

number

yes

the start time in Unix Epoch Clock time you want to start reading the historical values

Endtime

number

yes

the end time in Unix Epoch clock time you want to stop getting the historical values

count

table

optional

specifies the number of retrieved PI-Archive entries

DirectionConstants

number

optional

specifies the direction how the PI-Archive entries get retrieved

return values from function

returns data type meaning

1. value

table

the historical values of the PI archive of the tags wanted

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout, ["debugoption"] = false}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
-- get all PI-Archive entries within the given time borders
local resultRECORDEDVALUES1, exceptionRECORDEDVALUES1 = PB:RECORDEDVALUES{
    ["piserver"] = "PI-Default",
    ["tags"] = {"SINUSOID", "SINUSOIDU"},
    ["response"] = "inmation",
    ["StartTime"] = inmation.now() - 3600000 * 2,
    ["EndTime"] = inmation.now(),
    -- ["DirectionConstants"] = 0
}

-- get specific number of PI-Archive entries
local resultRECORDEDVALUES2, exceptionRECORDEDVALUES2 = PB:RECORDEDVALUES{
    ["piserver"] = "PI-Default",
    ["tags"] = {"SINUSOID", "SINUSOIDU"},
    ["count"] = {100, 90},
    ["response"] = "inmation",
    ["StartTime"] = inmation.now() - 3600000 * 2,
    -- ["DirectionConstants"] = 0
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["RECORDEDVALUES1"] = {result = resultRECORDEDVALUES1, exeption = exceptionRECORDEDVALUES1}},
        {["RECORDEDVALUES2"] = {result = resultRECORDEDVALUES2, exeption = exceptionRECORDEDVALUES2}}
    }
)

It is also possible to have different start and endtimes for every single PI tag:

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10
local pitagstime = {
    {
        ["tag"] = "SINUSOID",
        ["StartTime"] = inmation.now() - 3600000 * 2,
        ["EndTime"] = inmation.now()
    },
    {
        ["tag"] = "SINUSOIDU",
        ["StartTime"] = inmation.now() - 3600000 * 3,
        ["EndTime"] = inmation.now() - 3600000
    }
}

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout, ["debugoption"] = false}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultRECORDEDVALUES, exceptionRECORDEDVALUES = PB:RECORDEDVALUES{
    ["piserver"] = "PI-Default",
    ["tagstimes"] = pitagstime,
    ["response"] = "inmation",
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["RECORDEDVALUES"] = {result = resultRECORDEDVALUES, exeption = exceptionRECORDEDVALUES}}
    }
)
  • Return Values

  • Possibility 1: raw

[
    {
        "P": "SINUSOID",
        "V": [
            {
                "v": 86.35349,
                "t": 1528198397000
            },
            {
                "v": 99.18507,
                "t": 1528202357000
            },
            {
                "v": 99.83604,
                "t": 1528204157000
            }
        ]
    },
    {
        "P": "SINUSOIDU",
        "V": [
            {
                "v": 20.35813,
                "t": 1528195637000
            }
        ]
    }
]
  • Possibility 2: inmation

[
    [
        {
            "T": [
                1528198397000,
                1528202357000,
                1528204157000
            ],
            "Q": [
                0,
                0,
                0
            ],
            "V": [
                86.35349,
                99.18507,
                99.83604
            ]
        }
    ],
    [
        {
            "T": [
                1528195637000
            ],
            "Q": [
                0
            ],
            "V": [
                20.35813
            ]
        }
    ]
]
  • Possibility 3: bridge

--todo: make bridge response
  • Failure in function call or connection

  • StartTime or EndTime not specified

{
    "exception": {
        "msg": "Wrong table names! Check mandatory function parameters!"
    }
}
  • The function argument tags is nil (not given)

{
    "exception": {
        "msg": "Error call arguments"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "RecordedValues",
    "piserver": "PI-Default",
    "farg": {
        "ValuesToRead": [
            {
                "P": "SINUSOID",
                "T": {
                    "t1": 1533706908277,
                    "t2": 1533714108277
                }
            },
            {
                "P": "SINUSOIDU",
                "T": {
                    "t1": 1533706908277,
                    "t2": 1533714108277
                }
            }
        ]
    }
}xEOFx
  • Response

Response with found values

{
    "sys": "OSI",
    "func": "RecordedValues",
    "piserver": "PI-Default",
    "farg": {
        "ValuesToRead": [
            {
                "P": "SINUSOID",
                "V": [
                    {
                        "v": 14.3070288,
                        "t": 1533706266000
                    }
                ]
            },
            {
                "P": "SINUSOIDU",
                "V": [
                    {
                        "v": 96.342865,
                        "t": 1533699846000
                    },
                    {
                        "v": 75.90145,
                        "t": 1533704256000
                    }
                ]
            }
        ]
    },
    "TimeProcessPerformance": {
        "FindPIPointsinServer": 1.5333,
        "ReadTelegramArguments": 0.0685,
        "CallPISDKFunction": 1.233,
        "ReadDataFromPISer": 1.3519,
        "ErrorHandle": 0.0123,
        "TotalTimeExecution": 2.926,
        "TotalBytesOfMemoryUsed": 876793856
    }
}xEOFx

UPDATEPITAGSCONFIG

Available at Lua: Version 0.7.0

Available at inmationPIBridge: Version 1.0.7

Updates the configuration of one or multiple PI tags. If the configuration was not able to be updated at one or multiple tags, it returns false for this tag or multiple ones and an error message.

  • Variables

PB:UPDATEPITAGSCONFIG(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

PIPoints

table

yes

needs the PI tagname of the PI server and then additional information to be updated

return values from function

returns data type meaning

1. value

table

table with the single tagnames and if they could be updated as well as time information. If an error occured an error message is returned

2. value

table

if there was an error, you get a table exception here

content of the table PIPoints

parameter data type required meaning

tag

string

yes

creates a tag with this name

newtag

string

no

rename a tag with this name

archiving

number

yes

sets the archiving option 0 = don´t archive, 1 = archive tag

compdev

number

no

if the PI-Point should be compressed(interpolated) then this must be set with a fitting value

compmax

number

no

maximal time to wait after the compressing write the same value in PI if the value changed not as much as it should

compmin

number

no

minimal time to wait after the compressing write the same value in PI if the value changed not as much as it should(recommended = 0)

compressing

number

no

disable 0 / enable 1 compressing

descriptor

string

no

set a description

digitalset

string

depends

optional and nessesary depending of the PI-Point. If a PI-Point with the pointtype digital is created this Parameter must be set otherwise not

displaydigits

number

no

defines how much decimal places should be displayed (default = -5 ⇒ PI display five significat points)

engunits

string

no

set an engeneering unit

excdev

number

no

combined with compdev useable

excmax

number

no

similar to compmax

excmin

number

no

similar to compmin

exdesc

string

depends

if the PI-Point should be used as Performance Equation Tag, then here you must place the function which should be executed

instrumenttag

string

depends

if the PI-Point should be linked with an OSIsoft PI Interface, then here you write in your instrumenttagname(accessing path on OPC Server)

location1

number

depends

set to the OSIsoft Interface ID

location2

number

yes

set the datahandling

location3

number

depends

set the type of receiving data (normal/Performance Equation)

location4

number

depends

set the time interval defined in the OSIsoft Interface

location5

number

no

set the deadband to reduce network load

pointsource

string

yes

refer to a group (ex: OSI-OPC-DA_Interface) Default = L (Labor)

pointtype

string & number

yes

set the pointsource of the PIPoint

ptclassname

string

no

set the class, is used for default values if not set

scan

number

yes

if the PI-Point should get data set to 1 else 0

shutdown

number

no

when the OSIsoft Interface is in an shutdown state, then write this in the tag value

sourcetag

string

no

needed for some OSIsoft calculations

span

number

no

maximal range. Attention! if value is less then zero you must add this value

zero

number

no

minimal range

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10
local PIPoints = {
    {
        ["tag"] = "Testtag00001",
        ["newtag"] = "Testtag00001update",
        ["descriptor"] = "Testtag00001-28052018"
    },
    {
        ["tag"] = "Testtag00002",
        ["descriptor"] = "Testtag00002-28052018",
        ["archiving"] = 1,
        ["engunits"] = "°C"
    },
    {
        ["tag"] = "Testtag00003",
        ["descriptor"] = "Testtag00003-28052018",
        ["pointtype"] = "Int16",
        ["span"] = 50,
        ["location1"] = 1
    }
}

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultUPDATEPITAGSCONFIG, exceptionUPDATEPITAGSCONFIG = PB:UPDATEPITAGSCONFIG{
    ["piserver"] = "PI-Default",
    ["PIPoints"] = PIPoints
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["UPDATEPITAGSCONFIG"] = {result = resultUPDATEPITAGSCONFIG, exeption = exceptionUPDATEPITAGSCONFIG}}
    }
)
  • Return Values

{
  "piserver" : "ctsbgkpi01",
  "sys" : "OSI",
  "func" : "UpdatePITagsConfig",
  "farg" : {
    "PIPoints" : [{
        "updated" : true,
        "tag" : "Testtag00002"
      }, {
        "updated" : true,
        "tag" : "Testtag00004"
      }]
  },
  "TimeProcessPerformance" : {
    "FindPIPointsinServer" : 17311.0,
    "TotalTimeExecution" : 82474.0,
    "TotalBytesOfMemoryUsed" : 137875456,
    "CallPISDKFunction" : 3251.0,
    "ReadTelegramArguments" : 146.0,
    "ErrorHandle" : 119.0
  }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "UpdatePITagsConfig",
    "piserver": "PI-Default",
    "afserver": "af-server",
    "afdatabase": "af-databse",
    "farg": {
        "PIPoints": [{
            "tag": "Testtag00001",
            "newtag": "Testtag00001update",
            "descriptor": "Testtag00001-28052018"
        },
        {
            "tag": "Testtag00002",
            "descriptor": "Testtag00002-28052018",
            "archiving": 1,
            "engunits": "°C"
        },
        {
            "tag": "Testtag00003",
            "descriptor": "Testtag00003-28052018",
            "pointtype": "Int16",
            "typicalvalue": 20,
            "span": 50,
            "location1": 1
        }]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "UpdatePITagsConfig",
    "piserver": "ctsbgkpi01",
    "farg": {
        "PIPoints": [
            {
                "tag": "Testtag00002",
                "updated": true
            },
            {
                "tag": "Testtag00004",
                "updated": true
            }
        ]
    },
    "TimeProcessPerformance": {
        "FindPIPointsinServer": 1.7311,
        "ReadTelegramArguments": 0.0146,
        "CallPISDKFunction": 3.251,
        "ErrorHandle": 0.0119,
        "TotalTimeExecution": 8.2474,
        "TotalBytesOfMemoryUsed": 137875456
    }
}xEOFx

UPDATEVALUES

Available at Lua: Version 0.7.0

Available at inmationPIBridge: Version 1.0.7

Writes historized values of one or multiple inmation tags to the PI servers tags.

  • Variables

PB:UPDATEVALUES(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

inmvalues

table

yes

used to store the history (from timestart to timeend) of the mongodb in inmation alongside with the associated tag path in inmation

tags

table

yes

contains the names of PI Tags of the PI server

return values from function

returns data type meaning

1. value

table

time information how long it took to update the PI tags at the PI server

2. value

table

if there was an error, you get a table exception here

  • Function call example

Function do update Values in PI over the PI AF SDK. Sample code:

local V = require'esi-variables'
local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultUPDATEVALUES, exceptionUPDATEVALUES = PB:UPDATEVALUES{
    ["piserver"] = "PI-Default",
    --["AFUpdateOption"] = 0,
    --["AFBufferOption"] = 1,
    ["inmvalues"] =  inmation.gethistory({"/System/Core/zTest/Saw Wave", "/System/Core/zTest/Sine Wave"}, inmation.now() - 3600, inmation.now(), 1, {"AGG_TYPE_RAW"}),
    ["tags"] = {"Saw Wave", "Sine Wave"}
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["UPDATEVALUES"] = {result = resultUPDATEVALUES, exeption = exceptionUPDATEVALUES}}
    }
)

OR

local V = require'esi-variables'
local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultUPDATEVALUES, exceptionUPDATEVALUES = PB:UPDATEVALUES{
    ["piserver"] = "PI-Default",
    -- ["AFUpdateOption"] = 0,["AFBufferOption"] = 1,
    ["valuesToWrite"] = { {
        ["P"]="Testtag00111",
        ["V"]= {
            {
                ["t"]= tostring(inmation.now()),
                ["v"]= "HelloWorld",
            },
            {
                ["t"]= tostring(inmation.now()-1800000),
                ["v"]= nil,
            }
        }
    }}
}

return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["UPDATEVALUES"] = {result = resultUPDATEVALUES, exeption = exceptionUPDATEVALUES}}
    }
)
  • Return Values

{
    "result": {
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 57372672,
            "ErrorHandle": 0.0244,
            "ReadTelegramArguments": 0.0813,
            "FindPIPointsinServer": 2.1071,
            "TotalTimeExecution": 6.684,
            "CallPISDKFunction": 2.9773
        },
        "func": "UpdateValues",
        "piserver": "PI-Default",
        "sys": "OSI"
    }
}
parameter data type meaning

valuesToWrite

table

datatable which contains a collection of Tagnames in combination with a datatable which further on contains datetime - value binding data

V

table

attribute value with all timestamp value pairs v and t

P

string

PI Tagname relating to the timestamp value pairs v and t

v

string

historic (recorded) value connected to the timestamp t

t

string

timestamp in Unix Epoch Time connected to the recorded value

AFUpdateOption

number

Indicates how to treat duplicate values in the archive, when supported by the data reference

AFBufferOption

number

Updating data reference values with or without buffer.

  • AFUpdateOption

    • Replace 0 = Only replaces an existing value in the archive.

    • Insert 1 = Add the value to the archive. Any existing values at the same time are not overwritten.

    • NoReplace 2 = Add the value to the archive only if no value exists at the same time. If a value already exists for that time, the passed value is ignored.

    • ReplaceOnly 3 = Replace an existing value in the archive at the specified time. If no existing value is found, the passed value is ignored.

    • InsertNoCompression 5 = Add the value to the archive without compression. If this value is written to the snapshot, the previous snapshot value will be written to the archive, without regard to compression settings. Note that if a subsequent snapshot value is written without the InsertNoCompression option, the value added with the InsertNoCompression option is still subject to compression.

    • Remove 6 = Remove the value from the archive if a value exists at the passed time.

  • AFBufferOption:

    • DoNotBuffer 0 = Updating data reference values without buffer.

    • BufferIfPossible 1 = Try updating data reference values with buffer. If fails (e.g. data reference OSIsoft.AF.Data.AFDataMethods does not support Buffering, or its Buffering system is not available), then try updating directly without buffer.

    • Buffer 2 = Updating data reference values with buffer.

  • Failure in function call or connection

  • The function argument valuesToWrite is nil

{
    "exception": {
        "msg": "Error call arguments"
    }
}

TCP transfer protocol

  • JSON-Telegram

{
    "sys": "OSI",
    "func": "UpdateValues",
    "farg": {
        "valuesToWrite": [
            {
                "V": [
                    {
                        "v": "64.0",
                        "t": "1527662735173"
                    },
                    {
                        "v": "76.0",
                        "t": "1527662735773"
                    },
                    {
                        "v": "88.0",
                        "t": "1527662736373"
                    },
                    {
                        "v": "0.0",
                        "t": "1527662736973"
                    },
                    {
                        "v": "12.0",
                        "t": "1527662737573"
                    }
                ],
                "P": "Saw Wave"
            },
            {
                "V": [
                    {
                        "v": "99.114362536434",
                        "t": "1527662734799"
                    },
                    {
                        "v": "79.389262614624",
                        "t": "1527662735399"
                    },
                    {
                        "v": "43.733338321785",
                        "t": "1527662735999"
                    },
                    {
                        "v": "11.474337861211",
                        "t": "1527662736599"
                    },
                    {
                        "v": "0.098663578586422",
                        "t": "1527662737199"
                    },
                    {
                        "v": "15.772644703566",
                        "t": "1527662737799"
                    }
                ],
                "P": "Sine Wave"
            }
        ],
        "AFBufferOption": 1,
        "AFUpdateOption": 0
    },
    "piserver": "PI-Default",
    "afdatabase": "AF-Database",
    "afserver": "AF-Server"
}xEOFx
  • Response

{
    "sys": "OSI",
    "TimeProcessPerformance": {
        "CallPISDKFunction": 70.8688,
        "FindPIPointsServer": 145.7038,
        "TotalBytesOfMemoryUsed": 78147584,
        "ErrorHandle": 0.255,
        "Total": 229.2815,
        "AFvaluestoWriteInPISer": 9.81
    },
    "func": "UpdateValues",
    "piserver": "PI-Default"
}

GETPITAGSCONFIG

Available at Lua: Version 0.6.0

Available at inmationPIBridge: Version 1.0.6

Returns the whole configuration of one or multiple PI tags in the PI system.

  • Variables

PB:UPDATEVALUES(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

tagnames

table

yes

the names of the PI tags in the server you want to get the config from

return values from function

returns data type meaning

1. value

table

all the PI tagnames with their config

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultGETPITAGSCONFIG, exceptionGETPITAGSCONFIG = PB:GETPITAGSCONFIG{
    ["piserver"] = "PI-Default",
    ["tagnames"] = {
        "Testtag00001",
        "Testtag00002"
    }
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["GETPITAGSCONFIG"] = {result = resultGETPITAGSCONFIG, exeption = exceptionGETPITAGSCONFIG}}
    }
)
  • Return Values

{
     "PIPoints": [
        {
            "dataowner": "PIUserIncompatible",
            "pointtype": 6,
            "displaydigits": -5,
            "shutdown": 0,
            "filtercode": 0,
            "tag": "Testtag00001",
            "excmax": 28800,
            "location4": 1,
            "datasecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
            "compdev": 0.0,
            "location1": 1,
            "dataaccess": "o: g: w:",
            "userint1": 0,
            "totalcode": 0,
            "compdevpercent": 0.0,
            "excdevpercent": 0.0,
            "span": 50.0,
            "digitalset": "",
            "ptaccess": "o: g: w:",
            "recno": 581,
            "sourcetag": "",
            "srcptid": 0,
            "future": 0,
            "step": 1,
            "descriptor": "Testtag00001-28052018",
            "excmin": 0,
            "ptclassid": 2,
            "ptowner": "PIUserIncompatible",
            "scan": 1,
            "ptclassname": "classic",
            "location2": 0,
            "datagroup": "PIGroupIncompatible",
            "userint2": 0,
            "compmax": 28800,
            "convers": 1.0,
            "compressing": 1,
            "ptgroup": "PIGroupIncompatible",
            "userreal2": 0.0,
            "typicalvalue": 50.0,
            "pointid": 209218,
            "userreal1": 0.0,
            "changer": "CTSGMBH\\j.user",
            "compmin": 0,
            "ptsecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
            "creator": "piadmin",
            "archiving": 1,
            "excdev": 0.0,
            "location5": 0,
            "instrumenttag": "",
            "ptclassrev": 1,
            "zero": 0.0,
            "squareroot": 0,
            "location3": 1,
            "pointsource": "CTS",
            "changedate": "2018-06-06T11:09:23Z",
            "creationdate": "2018-05-29T10:20:18Z",
            "engunits": "??C",
            "exdesc": ""
        },
        {
            "dataowner": "PIUserIncompatible",
            "pointtype": 8,
            "displaydigits": -5,
            "shutdown": 0,
            "filtercode": 0,
            "tag": "Testtag00002",
            "excmax": 28800,
            "location4": 1,
            "datasecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
            "compdev": 0.0,
            "location1": 1,
            "dataaccess": "o: g: w:",
            "userint1": 0,
            "totalcode": 0,
            "compdevpercent": 0.0,
            "excdevpercent": 0.0,
            "span": 1000.0,
            "digitalset": "",
            "ptaccess": "o: g: w:",
            "recno": 684,
            "sourcetag": "",
            "srcptid": 0,
            "future": 0,
            "step": 1,
            "descriptor": "Testtag00002-28052018",
            "excmin": 0,
            "ptclassid": 2,
            "ptowner": "PIUserIncompatible",
            "scan": 1,
            "ptclassname": "classic",
            "location2": 0,
            "datagroup": "PIGroupIncompatible",
            "userint2": 0,
            "compmax": 28800,
            "convers": 1.0,
            "compressing": 1,
            "ptgroup": "PIGroupIncompatible",
            "userreal2": 0.0,
            "typicalvalue": 50.0,
            "pointid": 209219,
            "userreal1": 0.0,
            "changer": "CTSGMBH\\j.user",
            "compmin": 0,
            "ptsecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
            "creator": "piadmin",
            "archiving": 1,
            "excdev": 0.0,
            "location5": 0,
            "instrumenttag": "",
            "ptclassrev": 1,
            "zero": 0.0,
            "squareroot": 0,
            "location3": 1,
            "pointsource": "CTS",
            "changedate": "2018-06-06T11:04:22Z",
            "creationdate": "2018-05-29T10:20:18Z",
            "engunits": "??C",
            "exdesc": ""
        }
    ]
}
parameter data type meaning

dataowner

string

pointtype

number

the Point Type (Int16, Int32, Float16, Float32, Float64, String, Timestamp, Blob, Digital)

displaydigits

number

Disply Digits (positive value = amount/number of display digite behind the dot/comma; negative value = the amount of significant digits)

shutdown

number

shutdown of the tag (0 = no display of a interface shutdown; 1 = interface shutdown gets displayed)

filtercode

number

indicates the time constant of a first-order filter used to smooth incoming data. While it does impact the compressed data, it does not affect exception reporting

tag

string

name of the Tag

excmax

number

the time the PI system waits to record a similar value a second time 600=10min (compression)

location4

number

when configuring a PI Interface, it gets a Scan Class (mostly Scan Class 1)

datasecurity

string

this column is used to specify the security string for snapshot and event access. Controls which users can read or modify data stored for a PI point

compdev

number

the minimum change of value it takes that the PI System records the new value

location1

number

the Interface ID. You can find it in the ICU

dataaccess

string

userint1

number

32-bit integer number reserved attribute for user applications. Most PI System applications don’t use these attributes

userint2

number

32-bit integer number reserved attribute for user applications. Most PI System applications don’t use these attributes

userreal1

number

32-bit floating point number reserved attribute for user applications. Most PI System applications don’t use these attributes

userreal2

number

32-bit floating point number reserved attribute for user applications. Most PI System applications don’t use these attributes

totalcode

number

contains a code that specifies how the value is to be scaled. It is used in conjunction with the SquareRoot, Convers and ExDesc attributes

compdevpercent

number

the minimum change of value it takes that the PI System records the new value in percent

excdevpercent

number

change of value it needs to send a tag into the PI System in Percent

span

number

the maximum value of the Tag. If zero is lower than zero it has to be added to the maximum value in order to geht the correct one

digitalset

string

if the tag has a digital set it will be displayed here

ptaccess

string

recno

number

contains the point’s primary record number in the archive. Useful when using tools such as piratool -aw to examine the archives.RecNo is not confused with the PointID attribute

sourcetag

string

if a tag should be written to the SPS the PI Point that the value is taken from is here

srcptid

number

is a read-only attribute that represents the PI point number corresponding to the tag specified in the SourceTag attribute

future

number

when set to Allowed (1), it is intended to store future data. when Disallowed (0), the point is consideres historical. once created, attribute cannot be changed

step

number

step interpolation (0 = no interpolation; 1 = interpolation)

descriptor

string

description of the tag, additional information

excmin

number

minimum time it takes until the value is taken to the PI System

ptclassid

number

ptowner

string

used for security purposes to designate the name of a collection of users who may or may not access data from the attributes of the point

scan

number

the scan attribute is used to show if the point at the OPC Server is used or not

ptclassname

string

specifies the point class. The point class must be defined before the point is created!

location2

number

datahandling (0 = normal; 1 = string; 2 = boolean; 3 = 4 byte int; 4 = quality not data; 5 = 8 byte int; 6 = timestamp sec; 7 = timestamp VT_DATE; 8 = user format)

datagroup

string

compmax

number

time it takes until the PI System takes the same value again 600=10min (compression)

convers

number

Conversion Factor

compressing

number

turns compression when set to 1 on or off when set to 0. Set compression on for most points. Set it off for laboratory or manually entered tags because every snapshot is saved

ptgroup

string

Point’s Group

typicalvalue

number

example of a reasonable value for this point. For nummerical values it must be >= Zero attribute value and ⇐ Span. Some interfaces use it as initial or default value

pointid

number

the unique ID of the PI point (the PI System generates it automatically)

changer

string

last user to edit the point

compmin

number

minimum time to pass until a value is taken to the PI System (compression)

ptsecurity

string

used to specify the security string for point configuration. Controls which useres can retrieve configuration information and which can modify or delete a PI Point

creator

string

the name of the creator of the PI Point

archiving

number

archiving of a tag (0 = archiving disabled; 1 = archiving enabled)

excdev

number

change of value it needs to send a tag into the PI System

location5

number

can reduce the network load but is normally not used

instrumenttag

string

name of the OPC tag. This name is used by the PI Interface to get the data from the OPC

ptclassrev

number

Point Class Revision

zero

number

minimum value the tag can have

squareroot

number

some interafce programs use the square root code. Check manual for your interface.

location3

number

type of the point (0 = polled or event; 1 = advice; 2 = output; 3 = polled watchdog; 4 = advise watchdog) (performance equation: 0 = calc at event start; 1 = calc at event end)

pointsource

string

interface identification: the pointsource is configured in the interface. performance equation: c is written in the point source

changedate

string

the date when PI Point was last changed

creationdate

string

the date wehen the PI Point was created

engunits

string

the engineering unit of the PI Point

exdesc

string

here are additional commands for the PI Point. If the PI Point is a Performance Equation here is the formula for the calculation

  • Failure in function call or connection

  • If no tagnames are given to the function (["tagnames"] = {})

{
    "exception": [
        {
            "msg": "No PI Points Retrieved!",
            "notdata": true,
            "piserver": "PI-Default"
        }
    ],
    "result": {
        "piserver": "PI-Default",
        "sys": "OSI",
        "TimeProcessPerformance": {
            "TotalTimeExecution": 0.0481,
            "ReadDataFromPISer": 0.0003,
            "TotalBytesOfMemoryUsed": 125186048,
            "ErrorHandle": 0.0061
        },
        "func": "GetPITagsConfig"
    }
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "GetPITagsConfig",
    "piserver": "PI-Default",
    "afserver": "af-server",
    "afdatabase": "af-database",
    "farg": {
        "P": ["Testtag00001",
        "Testtag00002"]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "GetPITagsConfig",
    "piserver": "PI-Default",
    "farg": {
        "PIPoints": [
            {
                "tag": "Testtag00001",
                "pointtype": 6,
                "pointid": 209218,
                "step": 1,
                "future": 0,
                "descriptor": "Testtag00001-28052018",
                "exdesc": "",
                "typicalvalue": 50.0,
                "engunits": "??C",
                "zero": 0.0,
                "span": 50.0,
                "pointsource": "XXX",
                "scan": 1,
                "excmin": 0,
                "excmax": 28800,
                "excdev": 0.0,
                "shutdown": 0,
                "archiving": 1,
                "compressing": 1,
                "compmin": 0,
                "compmax": 28800,
                "compdev": 0.0,
                "creationdate": "2018-05-29T10:20:18Z",
                "creator": "piadmin",
                "changedate": "2018-06-08T07:32:56Z",
                "changer": "piadmin",
                "displaydigits": -5,
                "location1": 1,
                "location2": 0,
                "location3": 1,
                "location4": 1,
                "location5": 0,
                "filtercode": 0,
                "squareroot": 0,
                "totalcode": 0,
                "convers": 1.0,
                "srcptid": 0,
                "instrumenttag": "",
                "userint1": 0,
                "userint2": 0,
                "userreal1": 0.0,
                "userreal2": 0.0,
                "ptowner": "PIUserIncompatible",
                "ptgroup": "PIGroupIncompatible",
                "ptaccess": "o: g: w:",
                "ptsecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
                "dataowner": "PIUserIncompatible",
                "datagroup": "PIGroupIncompatible",
                "dataaccess": "o: g: w:",
                "datasecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
                "recno": 581,
                "ptclassname": "classic",
                "ptclassid": 2,
                "ptclassrev": 1,
                "sourcetag": "",
                "digitalset": "",
                "compdevpercent": 0.0,
                "excdevpercent": 0.0
            },
            {
                "tag": "Testtag00002",
                "pointtype": 8,
                "pointid": 209225,
                "step": 1,
                "future": 0,
                "descriptor": "Testtag00002-28052018",
                "exdesc": "",
                "typicalvalue": 50.0,
                "engunits": "??C",
                "zero": 0.0,
                "span": 1000.0,
                "pointsource": "XXX",
                "scan": 1,
                "excmin": 0,
                "excmax": 28800,
                "excdev": 0.0,
                "shutdown": 0,
                "archiving": 1,
                "compressing": 1,
                "compmin": 0,
                "compmax": 28800,
                "compdev": 0.0,
                "creationdate": "2018-06-08T07:27:54Z",
                "creator": "piadmin",
                "changedate": "2018-06-08T07:32:56Z",
                "changer": "piadmin",
                "displaydigits": -5,
                "location1": 1,
                "location2": 0,
                "location3": 1,
                "location4": 1,
                "location5": 0,
                "filtercode": 0,
                "squareroot": 0,
                "totalcode": 0,
                "convers": 1.0,
                "srcptid": 0,
                "instrumenttag": "",
                "userint1": 0,
                "userint2": 0,
                "userreal1": 0.0,
                "userreal2": 0.0,
                "ptowner": "PIUserIncompatible",
                "ptgroup": "PIGroupIncompatible",
                "ptaccess": "o: g: w:",
                "ptsecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
                "dataowner": "PIUserIncompatible",
                "datagroup": "PIGroupIncompatible",
                "dataaccess": "o: g: w:",
                "datasecurity": "piadmin: A(r,w) | piadmins: A(r,w) | PIOPCInterface: A(r,w) | PIWorld: A(r)",
                "recno": 684,
                "ptclassname": "classic",
                "ptclassid": 2,
                "ptclassrev": 1,
                "sourcetag": "",
                "digitalset": "",
                "compdevpercent": 0.0,
                "excdevpercent": 0.0
            }
        ]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 1.9492,
        "ReadingDataFromPIServer": 3.7099,
        "ErrorHandle": 0.0049,
        "Total": 5.8781,
        "TotalBytesOfMemoryUsed": 98263040
    }
}xEOFx

DELETEPITAGS

Available at Lua: Version 0.7.0

Available at inmationPIBridge: Version 1.0.7

Deletes one or multiple PI tags in the PI system according to the given name.

ATTENTION: Deleting a PI tag results in loss of their historized values! They can only restored in an very time consuming way.

Deleting PI-Tags is not recommendet! Only use it in a test environment, never in a productive system.

Must be enabled in the .config in order to delete PI-Tags

  • Variables

PB:DELETEPITAGS(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

tagsToDelete

table

yes

PI tagnames that should be deleted at the PI server

return values from function

returns data type meaning

1. value

table

the PI tags that were able to be deleted

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout,
        ["debugoption"] = false
    }
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultDELETEPITAGS, exceptionDELETEPITAGS = PB:DELETEPITAGS{
    ["piserver"] = "PI-Default",
    ["tagsToDelete"] = {
        "Testtag00001a",
        "Testtag00001b",
        "Testtag00001c"
    }
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["DELETEPITAGS"] = {result = resultDELETEPITAGS, exeption = exceptionDELETEPITAGS}}
    }
)
  • Return Values

[
    "Testtag00001a",
    "Testtag00001b",
    "Testtag00001c"
]
parameter data type meaning

[]

table

pitags that were deleted

Changed at version 0.7.8 to only return a table as return value.

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "piserver": "PI-Default",
    "afserver": "af-server",
    "func": "DeletePITags",
    "farg": {
        "P": [
            "Testtag00001a",
            "Testtag00001b",
            "Testtag00001c"
        ]
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "DeletePITags",
    "piserver": "PI-Default",
    "farg": {
        "PIPoints": [
            "Testtag00001a",
            "Testtag00001b",
            "Testtag00001c"
        ]
    },
    "TimeProcessPerformance": {
        "FindPIPointsServer": 160.4592,
        "CallPISDKFunction": 8.3553,
        "ErrorHandle": 0.2828,
        "Total": 171.2466,
        "TotalBytesOfMemoryUsed": 76648448
    }
}xEOFx

FINDPIBATCHHEADERS

Available at Lua: Version 0.6.0

Available at inmationPIBridge: Version 1.0.6

Returns PI batch headers between the starttime and endtime.

  • Variables

PB:FINDPIBATCHHEADERS(data) content of the table data

parameter data type required meaning

piserver

string

yes

the name of the PI server you want to connect to

PIBatchUniqueID

string

no

unique ID every PI batch has. This parameter is optional but if wished there is the possibility to just look for a single PI Batch.

SearchStartTime

table

yes

the timestamp to start searching for PI batches in Unix Epoch Clock time

SearchEndTime

table

yes

the timestamp when to stop searching for PI batches in Unix Epoch Clock time

BatchIDMask

string

no

this is for Filtering batches with the BatchID(BID)

ProductMask

string

no

this is for Filtering batches with the Product(Pro)

RecipeMask

string

no

this is for Filtering batches with the Recipe

return values from function

returns data type meaning

1. value

table

the PI Batches between the two timestamps and some additional information

2. value

table

if there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout, ["debugoption"] = false}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultFINDPIBATCHHEADERS, exceptionFINDPIBATCHHEADERS = PB:FINDPIBATCHHEADERS{
    ["piserver"] = "PI-Default",
    --["PIBatchUniqueID"] = "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
    ["SearchStartTime"] = "1525569615000",
    ["SearchEndTime"] = "1527422372000"
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["FINDPIBATCHHEADERS"] = {result = resultFINDPIBATCHHEADERS, exeption = exceptionFINDPIBATCHHEADERS}}
    }
)
  • Return Values

{
    "sys": "OSI",
    "func": "FindPIBatchHeaders",
    "piserver": "PI-Default",
    "farg": {
        "ValuesRetrieved": [{
            "BID": "17586",
            "Pro": "Che F",
            "Rec": "Recipe 123",
            "ST": "13170122900000",
            "ET": "13170129020000",
            "UNID": "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
            "UNB": [{
                "UID": "17581"
            }]
        }]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 5744.0408,
        "ResultAFvaluesFromPISer": 13.6492,
        "Total": 5766.3415,
        "TotalBytesOfMemoryUsed": 98369536
    }
}
parameter data type meaning

BID

string

Provides the batch identifier

Pro

string

Describes the product involved with this batch object

Rec

string

Recipe property provided as an link to the Recipe management system or batch execution systems

ST

string

The start time of a batch object as a reference to a PITime object

ET

string

The end time of a batch object, as a reference to a PITime object

UNID

table

A table of the unique IDs

UID

string

The unique ID assigned to the object

  • Failure in function call or connection

  • SearchStartTime or SearchEndTime is empty (e.g.: ["SearchEndTime"] = "")

{
    "result": {
        "func": "FindPIBatchHeaders",
        "piserver": "PI-APT.basf-ag.de",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 268439552,
            "TotalTimeExecution": 29.4281
        },
        "sys": "OSI"
    },
    "exeption": [
        {
            "msg": "Missing Start or Endtime!",
            "notdata": true,
            "piserver": "PI-APT.basf-ag.de"
        }
    ]
}
  • SearchStartTime or SearchEndTime is nil (e.g.: ["SearchEndTime"] = nil)

{
    "result": {
        "func": "FindPIBatchHeaders",
        "piserver": "PI-APT.basf-ag.de",
        "TimeProcessPerformance": {
            "TotalBytesOfMemoryUsed": 268439552,
            "TotalTimeExecution": 29.4281
        },
        "sys": "OSI"
    },
    "exeption": [
        {
            "msg": "Missing Start or Endtime!",
            "notdata": true,
            "piserver": "PI-APT.basf-ag.de"
        }
    ]
}

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "FindPIBatchHeaders",
    "piserver": "PI-Default",
    "farg": {
        "PIBatchUniqueID": "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
        "SearchStartTime": "1525569615000",
        "SearchEndTime": "1527422372000",
        "BatchIDMask": "*",
        "ProductMask": "*",
        "RecipeMask": "*"
    }
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindPIBatchHeaders",
    "piserver": "PI-Default",
    "farg": {
        "ValuesRetrieved": [{
            "BID": "17586",
            "Pro": "Che F",
            "Rec": "Recipe 123",
            "ST": "13170122900000",
            "ET": "13170129020000",
            "UNID": "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
            "UNB": [{
                "UID": "17581"
            }]
        }]
    },
    "TimeProcessPerformance": {
        "CallPISDKFunction": 5744.0408,
        "ResultAFvaluesFromPISer": 13.6492,
        "Total": 5766.3415,
        "TotalBytesOfMemoryUsed": 98369536
    }
}xEOFx

FINDPIUNITBATCHES

Available at Lua: Version 0.9.9

Available at inmationPIBridge: Version 1.0.9.9

Returns PI Unit batches between the starttime and endtime and within a specific definied Filter.

  • Variables

PB:FINDPIUNITBATCHES(data) content of the table data

parameter data type required meaning

piserver

string

yes

The name of the PI server you want to connect to

UnitBatchUniqueID

string

no

Unique ID every PI unit batch has. This parameter is optional but if wished there is the possibility to just look for a single PI Batch.

ModuleUniqueID

string

no

Unique Module ID for every PI unit batch has.

SearchStartTime

table

yes

The timestamp to start searching for PI batches in Unix Epock Clock time

SearchEndTime

table

yes

The timestamp when to stop searching for PI batches in Unix Epock Clock time

ModuleNameMask

string

no

This is for Filtering batches with the Unitname(Pro)

BatchIDMask

string

no

This is for Filtering batches with the BatchID(BID)

ProductMask

string

no

This is for Filtering batches with the Product(Pro)

ProcedureMask

string

no

This is for Filtering batches with the Procedure

return values from function

returns data type meaning

1. value

table

The PI Batches between the two timestamps and some additional information

2. value

table

If there was an error, you get a table exception here

  • Function call example

local J = require'dkjson'
local PB = require'esi-pibridge'
local host ="127.0.0.1"
local port = 5959
local timeout = 10

PB:SETCONNECTION{["port"] = port, ["host"] = host, ["timeout"] = timeout, ["debugoption"] = false}
local result, exception = PB:CONNECTTOPI{
    ["piserver"] = "PI-Default",
}
local resultFINDPIUNITBATCHES, exceptionFINDPIUNITBATCHES = PB:FINDPIUNITBATCHES{
    ["piserver"] = "PI-Default",
    --["UnitBatchUniqueID"] = "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
    --["ModuleUniqueID"] = "357a4f7a-1aa0-4c97-a4ff-aa00eb644389",
    ["ModuleNameMask"] = "Unit_01",
    ["SearchStartTime"] = "1525569615000",
    ["SearchEndTime"] = "1527422372000"
}
return J.encode(
    {
        {["CONNECTTOPI"] = {result = result, exeption = exception}},
        {["FINDPIUNITBATCHES"] = {result = resultFINDPIUNITBATCHES, exeption = exceptionFINDPIUNITBATCHES}}
    }
)
  • Return Values

{
    "sys": "OSI",
    "func": "FindPIUnitBatches",
    "piserver": "PI-Default",
    "farg": {
        "ValuesRetrieved": [
            {
                "UBID": "Stufe 200 18 0076",
                "UNID": "a20fec9e-d63b-4075-8ce1-be342b2e0047",
                "UBProd": "Ausgangsstoff1",
                "UBProc": "UnitProcedure",
                "ST": 1544848286819,
                "UBUnit": "Unit_01",
                "ET": 1544916395410,
                "PISubBatches": [
                    {
                        "SBName": "AnsatzTest",
                        "ST": 1544848286826,
                        "UNID": "e6695da9-918b-4e80-befc-a2464995f238",
                        "ET": 1544916395405,
                        "PISubBatches": [
                            {
                                "SBName": "Unit_01_GS_2_1",
                                "ST": 1544848287813,
                                "UNID": "6dd7c781-9f95-4ac4-8e9a-4deb82f8693b",
                                "ET": 1544916395405,
                                "PISubBatches": [
                                    {
                                        "SBName": "STARTING",
                                        "ST": 1544848287814,
                                        "UNID": "a9915bb4-d3b7-40ad-b34d-69b91439e65b",
                                        "ET": 1544848288811
                                    },
                                    {
                                        "SBName": "RUNNING",
                                        "ST": 1544848288811,
                                        "UNID": "dc4d6b2a-e0a7-48be-8282-85f231fae23a",
                                        "ET": 1544848950804
                                    },
                                    {
                                        "SBName": "COMPLETED",
                                        "ST": 1544848950804,
                                        "UNID": "c958ee36-50a3-491f-b0df-fa04fa4e288a",
                                        "ET": 1544848950805
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}xEOFx
parameter data type meaning

UBID

string

Provides the batch identifier

UBProd

string

Describes the product involved with this batch object

UBProc

string

Procedute of the current unit batch

ST

string

The start time of a batch object as a reference to a PITime object

ET

string

The end time of a batch object, as a reference to a PITime object

UNID

string

Unique IDs

UBUnit

string

Name of the Unit

PISubBatches

table

Table of all child unit batches with there childs

SBName

string

Name of the subbatch

TCP transfer protocol

  • Call

{
    "sys": "OSI",
    "func": "FindPIUnitBatches",
    "farg": {
        "SubBatchMask": "*",
        "SearchStartTime": 1544909714646,
        "SearchEndTime": 1544981714646,
        "BatchIDMask": "*",
        "ModuleNameMask": "C3200",
        "ProcedureMask": "*",
        "ModuleUniqueID": "",
        "UnitBatchUniqueID": "",
        "ProductMask": "*"
    },
    "piserver": "PI-Default"
}xEOFx
  • Response

{
    "sys": "OSI",
    "func": "FindPIUnitBatches",
    "piserver": "PI-Default",
    "farg": {
        "ValuesRetrieved": [
            {
                "UBID": "Stufe 200 18 0076",
                "UNID": "a20fec9e-d63b-4075-8ce1-be342b2e0047",
                "UBProd": "Ausgangsstoff1",
                "UBProc": "UnitProcedure",
                "ST": 1544848286819,
                "UBUnit": "Unit_01",
                "ET": 1544916395410,
                "PISubBatches": [
                    {
                        "SBName": "AnsatzTest",
                        "ST": 1544848286826,
                        "UNID": "e6695da9-918b-4e80-befc-a2464995f238",
                        "ET": 1544916395405,
                        "PISubBatches": [
                            {
                                "SBName": "Unit_01_GS_2_1",
                                "ST": 1544848287813,
                                "UNID": "6dd7c781-9f95-4ac4-8e9a-4deb82f8693b",
                                "ET": 1544916395405,
                                "PISubBatches": [
                                    {
                                        "SBName": "STARTING",
                                        "ST": 1544848287814,
                                        "UNID": "a9915bb4-d3b7-40ad-b34d-69b91439e65b",
                                        "ET": 1544848288811
                                    },
                                    {
                                        "SBName": "RUNNING",
                                        "ST": 1544848288811,
                                        "UNID": "dc4d6b2a-e0a7-48be-8282-85f231fae23a",
                                        "ET": 1544848950804
                                    },
                                    {
                                        "SBName": "COMPLETED",
                                        "ST": 1544848950804,
                                        "UNID": "c958ee36-50a3-491f-b0df-fa04fa4e288a",
                                        "ET": 1544848950805
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}xEOFx

Breaking changes

  • Not applicable


Conversion Tables

PI Quality to OPC Quality Translation Table

PI Reading State Number PI Reading State Name OPC Hex Value OPC Decimal Value OPC Description PI Writing State Number PI Writing State Name

193

No Alarm

0x00000000

0

Good

305

Good

194

High Alarm

0x80000000

2147483648

Bad

307

Bad

195

Low Alarm

0x80000000

2147483648

Bad

307

Bad

196

Hi Alarm/Ack

0x80000000

2147483648

Bad

307

Bad

197

Lo Alarm/Ack

0x80000000

2147483648

Bad

307

Bad

198

NoAlrm/UnAck

0x40000000

1073741824

Uncertain

308

Doubtful

199

Bad Quality

0x80000000

2147483648

Bad

307

Bad

200

Rate Alarm

0x40000000

1073741824

Uncertain

308

Doubtful

201

Rate Alm/Ack

0x40000000

1073741824

Uncertain

308

Doubtful

202

Dig Alarm

0x40000000

1073741824

Uncertain

308

Doubtful

203

Dig Alm/Ack

0x40000000

1073741824

Uncertain

308

Doubtful

210

AccessDenied

0x801F0000

2149515264

BadUserAccessDenied

210

AccessDenied

211

No Sample

0x80000000

2147483648

Bad

307

Bad

212

No Result

0x80000000

2147483648

Bad

307

Bad

213

Unit Down

0x808B0000

2156593152

BadDeviceFailure

215

Equip Fail

214

Sample Bad

0x80000000

2147483648

Bad

307

Bad

215

Equip Fail

0x808B0000

2156593152

BadDeviceFailure

215

Equip Fail

216

No Lab Data

0x80000000

2147483648

Bad

307

Bad

217

Trace

0x80050000

2147811328

BadCommunicationError

313

Comm Fail

218

GreaterMM

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

219

Bad Lab Data

0x809B0000

2157641728

BadNoData

248

No Data

220

Good-Off

0x00000000

0

Good

305

Good

221

Good-On

0x00000000

0

Good

305

Good

222

Alarm-Off

0x00000000

0

Good

305

Good

223

Alarm-On

0x00000000

0

Good

305

Good

224

Bad_Quality

0x80000000

2147483648

Bad

307

Bad

225

BadQ-On

0x80000000

2147483648

Bad

307

Bad

226

BadQ-Alrm-Of

0x80000000

2147483648

Bad

307

Bad

227

BadQ-Alrm-On

0x80000000

2147483648

Bad

307

Bad

230

Manual

0x00000000

0

Good

305

Good

231

Auto

0x00000000

0

Good

305

Good

232

Casc/Ratio

0x80000000

2147483648

Bad

307

Bad

233

DCS failed

0x80050000

2147811328

BadCommunicationError

313

Comm Fail

234

Manual Lock

0x80000000

2147483648

Bad

307

Bad

235

CO Bypassed

0x80000000

2147483648

Bad

307

Bad

237

Bad Output

0x808B0000

2156593152

BadDeviceFailure

215

Equip Fail

238

Scan Off

0x80890000

2156462080

BadConfigurationError

240

Configure

239

Scan On

0x80890000

2156462080

BadConfigurationError

240

Configure

240

Configure

0x80890000

2156462080

BadConfigurationError

240

Configure

241

Failed

0x80000000

2147483648

Bad

307

Bad

242

Error

0x80000000

2147483648

Bad

307

Bad

243

Execute

0x40000000

1073741824

Uncertain

308

Doubtful

244

Filtered

0x40000000

1073741824

Uncertain

308

Doubtful

245

Calc Off

0x80890000

2156462080

BadConfigurationError

240

Configure

246

I/O Timeout

0x800A0000

2148139008

BadTimeout

246

I/O Timeout

247

Set to Bad

0x80000000

2147483648

Bad

307

Bad

248

No Data

0x809B0000

2157641728

BadNoData

248

No Data

249

Calc Failed

0x80890000

2156462080

BadConfigurationError

240

Configure

250

Calc Overflw

0x81120000

2165440512

BadNumericOverflow

310

Overflow_st

251

Under Range

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

252

Over Range

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

253

Pt Created

0x80890000

2156462080

BadConfigurationError

240

Configure

254

Shutdown

0x800C0000

2148270080

BadShutdown

254

Shutdown

255

Bad Input

0x80000000

2147483648

Bad

307

Bad

256

Bad Total

0x80000000

2147483648

Bad

307

Bad

257

No_Alarm

0x00000000

0

Good

305

Good

258

Under LCL

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

259

Over UCL

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

260

Over WL

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

261

Under WL

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

262

Over 11 Sigma

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

263

Under 1Sigma

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

264

Over Center

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

265

Under Center

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

266

Stratified

0x40000000

1073741824

Uncertain

308

Doubtful

267

Mixtrue

0x40000000

1073741824

Uncertain

308

Doubtful

268

Trend Up

0x00000000

0

Good

305

Good

269

Trend Down

0x00000000

0

Good

305

Good

270

No Alarm#

0x00000000

0

Good

305

Good

271

Over UCL#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

272

Under LCL#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

273

Over WL#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

274

Under WL#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

275

Over 1Sigma#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

276

Under 1Sigm#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

277

Over Center#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

278

Under Centr#

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

279

Stratified#

0x40000000

1073741824

Uncertain

308

Doubtful

280

Mixture#

0x40000000

1073741824

Uncertain

308

Doubtful

281

Trend Up#

0x00000000

0

Good

305

Good

282

Trend Down#

0x00000000

0

Good

305

Good

289

ActiveBatch

0x00000000

0

Good

305

Good

290

Bad Data

0x80000000

2147483648

Bad

307

Bad

291

Calc Crash

0x80890000

2156462080

BadConfigurationError

240

Configure

292

Calc Timeout

0x800A0000

2148139008

BadTimeout

246

I/O Timeout

293

Bad Narg

0x80000000

2147483648

Bad

307

Bad

294

Inp OutRange

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

295

Not Converge

0x40000000

1073741824

Uncertain

308

Doubtful

296

DST Forward

0x40000000

1073741824

Uncertain

308

Doubtful

297

DST Back

0x40000000

1073741824

Uncertain

308

Doubtful

298

Substituted

0x40000000

1073741824

Uncertain

308

Doubtful

299

Invalid Data

0x80090000

2148073472

BadUnknownResponse

299

Invalid Data

300

Scan Timeout

0x800A0000

2148139008

BadTimeout

246

I/O Timeout

301

No_Sample

0x40000000

1073741824

Uncertain

308

Doubtful

302

Arc Off-line

0x40000000

1073741824

Uncertain

308

Doubtful

303

ISU Saw No Data

0x80000000

2147483648

Bad

307

Bad

305

Good

0x00000000

0

Good

305

Good

306

_SUBStituted

0x80000000

2147483648

Bad

307

Bad

307

Bad

0x80000000

2147483648

Bad

307

Bad

308

Doubtful

0x40000000

1073741824

Uncertain

308

Doubtful

309

Wrong Type

0x80890000

2156462080

BadConfigurationError

240

Configure

310

Overflow_st

0x81120000

2165440512

BadNumericOverflow

310

Overflow_st

311

Intf Shut

0x80050000

2147811328

BadCommunicationError

313

Comm Fail

312

Out of Serv

0x808D0000

2156724224

BadOutOfService

312

Out of Serv

313

Comm Fail

0x80050000

2147811328

BadCommunicationError

313

Comm Fail

314

Not Connect

0x808A0000

2156527616

BadNotConnected

314

Not Connect

315

Coercion Failed

0x80000000

2147483648

Bad

307

Bad

316

snapfix

0x80000000

2147483648

Bad

307

Bad

317

Invalid Float

0x80630000

2153971712

BadTypeDefinitionInvalid

317

Invalid Float

318

Future Data Unsupported

0x80230000

2149777408

BadInvalidTimestamp

318

Future Data Unsupported

OPC Quality to PI Quality Translation Table

OPC Hex Value OPC Decimal Value OPC Description PI State Number PI State Name

0x80000000

2147483648

Bad

307

Bad

0x80DA0000

2161770496

BadAggregateConfigurationRejected

240

Configure

0x80D60000

2161508352

BadAggregateInvalidInputs

255

Bad Input

0x80D40000

2161377280

BadAggregateListMismatch

290

Bad Data

0x80D50000

2161442816

BadAggregateNotSupported

290

Bad Data

0x81150000

2165637120

BadAlreadyExists

307

Bad

0x80580000

2153250816

BadApplicationSignatureInvalid

210

AccessDenied

0x80760000

2155216896

BadArgumentsMissing

307

Bad

0x80350000

2150957056

BadAttributeIdInvalid

299

Invalid Data

0x80D70000

2161573888

BadBoundNotFound

307

Bad

0x80D80000

2161639424

BadBoundNotSupported

307

Bad

0x804D0000

2152529920

BadBrowseDirectionInvalid

240

Configure

0x80610000

2153840640

BadBrowseNameDuplicated

240

Configure

0x80600000

2153775104

BadBrowseNameInvalid

240

Configure

0x810D0000

2165112832

BadCertificateChainIncomplete

210

AccessDenied

0x80160000

2148925440

BadCertificateHostNameInvalid

240

Configure

0x80120000

2148663296

BadCertificateInvalid

299

Invalid Data

0x801C0000

2149318656

BadCertificateIssuerRevocationUnknown

240

Configure

0x801E0000

2149449728

BadCertificateIssuerRevoked

210

AccessDenied

0x80150000

2148859904

BadCertificateIssuerTimeInvalid

242

Error

0x80190000

2149122048

BadCertificateIssuerUseNotAllowed

210

AccessDenied

0x81140000

2165571584

BadCertificatePolicyCheckFailed

242

Error

0x801B0000

2149253120

BadCertificateRevocationUnknown

240

Configure

0x801D0000

2149384192

BadCertificateRevoked

210

AccessDenied

0x80140000

2148794368

BadCertificateTimeInvalid

242

Error

0x801A0000

2149187584

BadCertificateUntrusted

210

AccessDenied

0x80170000

2148990976

BadCertificateUriInvalid

314

Not Connect

0x80180000

2149056512

BadCertificateUseNotAllowed

210

AccessDenied

0x80050000

2147811328

BadCommunicationError

313

Comm Fail

0x80980000

2157445120

BadConditionAlreadyDisabled

307

Bad

0x80CC0000

2160852992

BadConditionAlreadyEnabled

307

Bad

0x80D10000

2161180672

BadConditionAlreadyShelved

307

Bad

0x80CF0000

2161049600

BadConditionBranchAlreadyAcked

307

Bad

0x80D00000

2161115136

BadConditionBranchAlreadyConfirmed

307

Bad

0x80990000

2157510656

BadConditionDisabled

307

Bad

0x80D20000

2161246208

BadConditionNotShelved

307

Bad

0x80890000

2156462080

BadConfigurationError

240

Configure

0x80AE0000

2158886912

BadConnectionClosed

314

Not Connect

0x80AC0000

2158755840

BadConnectionRejected

210

AccessDenied

0x80480000

2152202240

BadContentFilterInvalid

240

Configure

0x804A0000

2152333312

BadContinuationPointInvalid

240

Configure

0x80380000

2151153664

BadDataEncodingInvalid

240

Configure

0x80390000

2151219200

BadDataEncodingUnsupported

240

Configure

0x809D0000

2157772800

BadDataLost

248

No Data

0x80110000

2148597760

BadDataTypeIdUnknown

309

Wrong Type

0x809E0000

2157838336

BadDataUnavailable

248

No Data

0x808E0000

2156789760

BadDeadbandFilterInvalid

299

Invalid Data

0x80070000

2147942400

BadDecodingError

290

Bad Data

0x80E30000

2162360320

BadDependentValueChanged

290

Bad Data

0x808B0000

2156593152

BadDeviceFailure

215

Equip Fail

0x80CD0000

2160918528

BadDialogNotActive

307

Bad

0x80CE0000

2160984064

BadDialogResponseInvalid

299

Invalid Data

0x80AD0000

2158821376

BadDisconnect

314

Not Connect

0x80510000

2152792064

BadDiscoveryUrlMissing

314

Not Connect

0x80E10000

2162229248

BadDominantValueChanged

290

Bad Data

0x80660000

2154168320

BadDuplicateReferenceNotAllowed

210

AccessDenied

0x80060000

2147876864

BadEncodingError

290

Bad Data

0x80080000

2148007936

BadEncodingLimitsExceeded

250

Calc Overflw

0x80B00000

2159017984

BadEndOfStream

313

Comm Fail

0x809F0000

2157903872

BadEntryExists

307

Bad

0x80470000

2152136704

BadEventFilterInvalid

240

Configure

0x809A0000

2157576192

BadEventIdUnknown

307

Bad

0x80BB0000

2159738880

BadEventNotAcknowledgeable

307

Bad

0x80B40000

2159280128

BadExpectedStreamToBlock

307

Bad

0x80C40000

2160328704

BadFilterElementInvalid

240

Configure

0x80C50000

2160394240

BadFilterLiteralInvalid

240

Configure

0x80450000

2152005632

BadFilterNotAllowed

240

Configure

0x80C30000

2160263168

BadFilterOperandCountMismatch

240

Configure

0x80490000

2152267776

BadFilterOperandInvalid

240

Configure

0x80C10000

2160132096

BadFilterOperatorInvalid

240

Configure

0x80C20000

2160197632

BadFilterOperatorUnsupported

240

Configure

0x80710000

2154889216

BadHistoryOperationInvalid

240

Configure

0x80720000

2154954752

BadHistoryOperationUnsupported

240

Configure

0x80C60000

2160459776

BadIdentityChangeNotSupported

307

Bad

0x80200000

2149580800

BadIdentityTokenInvalid

210

AccessDenied

0x80210000

2149646336

BadIdentityTokenRejected

210

AccessDenied

0x80360000

2151022592

BadIndexRangeInvalid

299

Invalid Data

0x80370000

2151088128

BadIndexRangeNoData

240

Configure

0x807C0000

2155610112

BadInsufficientClientProfile

307

Bad

0x80020000

2147614720

BadInternalError

307

Bad

0x80AB0000

2158690304

BadInvalidArgument

299

Invalid Data

0x80670000

2154233856

BadInvalidSelfReference

240

Configure

0x80AF0000

2158952448

BadInvalidState

299

Invalid Data

0x80230000

2149777408

BadInvalidTimestamp

318

Future Data Unsupported

0x80BD0000

2159869952

BadInvalidTimestampArgument

299

Invalid Data

0x810E0000

2165178368

BadLicenseExpired

210

AccessDenied

0x810F0000

2165243904

BadLicenseLimitsExceeded

210

AccessDenied

0x81100000

2165309440

BadLicenseNotAvailable

210

AccessDenied

0x80700000

2154823680

BadMaxAgeInvalid

307

Bad

0x80B70000

2159476736

BadMaxConnectionsReached

312

Out of Serv

0x807B0000

2155544576

BadMessageNotAvailable

307

Bad

0x80750000

2155151360

BadMethodInvalid

299

Invalid Data

0x80430000

2151874560

BadMonitoredItemFilterInvalid

240

Configure

0x80440000

2151940096

BadMonitoredItemFilterUnsupported

240

Configure

0x80420000

2151809024

BadMonitoredItemIdInvalid

299

Invalid Data

0x80410000

2151743488

BadMonitoringModeInvalid

240

Configure

0x80310000

2150694912

BadNoCommunication

313

Comm Fail

0x804B0000

2152398848

BadNoContinuationPoints

240

Configure

0x809B0000

2157641728

BadNoData

248

No Data

0x80B10000

2159083520

BadNoDataAvailable

248

No Data

0x80620000

2153906176

BadNodeAttributesInvalid

240

Configure

0x805F0000

2153709568

BadNodeClassInvalid

240

Configure

0x805E0000

2153644032

BadNodeIdExists

240

Configure

0x80330000

2150825984

BadNodeIdInvalid

240

Configure

0x805D0000

2153578496

BadNodeIdRejected

210

AccessDenied

0x80340000

2150891520

BadNodeIdUnknown

240

Configure

0x80690000

2154364928

BadNoDeleteRights

210

AccessDenied

0x804E0000

2152595456

BadNodeNotInView

313

Comm Fail

0x80A00000

2157969408

BadNoEntryExists

307

Bad

0x806F0000

2154758144

BadNoMatch

307

Bad

0x80240000

2149842944

BadNonceInvalid

210

AccessDenied

0x80790000

2155413504

BadNoSubscription

313

Comm Fail

0x808A0000

2156527616

BadNotConnected

314

Not Connect

0x81110000

2165374976

BadNotExecutable

240

Configure

0x803E0000

2151546880

BadNotFound

240

Configure

0x800F0000

2148466688

BadNothingToDo

307

Bad

0x80400000

2151677952

BadNotImplemented

307

Bad

0x803A0000

2151284736

BadNotReadable

313

Comm Fail

0x803D0000

2151481344

BadNotSupported

307

Bad

0x80C80000

2160590848

BadNotTypeDefinition

240

Configure

0x803B0000

2151350272

BadNotWritable

313

Comm Fail

0x80590000

2153316352

BadNoValidCertificates

210

AccessDenied

0x81120000

2165440512

BadNumericOverflow

310

Overflow_st

0x803F0000

2151612416

BadObjectDeleted

307

Bad

0x80B30000

2159214592

BadOperationAbandoned

307

Bad

0x80030000

2147680256

BadOutOfMemory

312

Out of Serv

0x803C0000

2151415808

BadOutOfRange

294

Inp OutRange

0x808D0000

2156724224

BadOutOfService

312

Out of Serv

0x805B0000

2153447424

BadParentNodeIdInvalid

307

Bad

0x80BE0000

2159935488

BadProtocolVersionUnsupported

240

Configure

0x806E0000

2154692608

BadQueryTooComplex

250

Calc Overflw

0x80680000

2154299392

BadReferenceLocalOnly

240

Configure

0x805C0000

2153512960

BadReferenceNotAllowed

210

AccessDenied

0x804C0000

2152464384

BadReferenceTypeIdInvalid

240

Configure

0x80970000

2157379584

BadRefreshInProgress

307

Bad

0x802C0000

2150367232

BadRequestCancelledByClient

242

Error

0x805A0000

2153381888

BadRequestCancelledByRequest

307

Bad

0x802A0000

2150236160

BadRequestHeaderInvali

240

Configure

0x80840000

2156134400

BadRequestInterrupted

246

I/O Timeout

0x80E40000

2162425856

BadRequestNotAllowed

290

Bad Data

0x81130000

2165506048

BadRequestNotComplete

290

Bad Data

0x80850000

2156199936

BadRequestTimeout

313

Comm Fail

0x80B80000

2159542272

BadRequestTooLarge

252

Over Range

0x80530000

2152923136

BadRequestTypeInvalid

240

Configure

0x80040000

2147745792

BadResourceUnavailable

312

Out of Serv

0x80B90000

2159607808

BadResponseTooLarge

252

Over Range

0x80860000

2156265472

BadSecureChannelClosed

313

Comm Fail

0x80220000

2149711872

BadSecureChannelIdInvalid

210

AccessDenied

0x80870000

2156331008

BadSecureChannelTokenUnknown

313

Comm Fail

0x80130000

2148728832

BadSecurityChecksFailed

210

AccessDenied

0x80E60000

2162556928

BadSecurityModeInsufficient

240

Configure

0x80540000

2152988672

BadSecurityModeRejected

210

AccessDenied

0x80550000

2153054208

BadSecurityPolicyRejected

210

AccessDenied

0x80520000

2152857600

BadSempahoreFileMissing

240

Configure

0x808C0000

2156658688

BadSensorFailure

215

Equip Fail

0x80880000

2156396544

BadSequenceNumberInvalid

307

Bad

0x807A0000

2155479040

BadSequenceNumberUnknown

307

Bad

0x800E0000

2148401152

BadServerHalted

213

Unit Down

0x806A0000

2154430464

BadServerIndexInvalid

240

Configure

0x80500000

2152726528

BadServerNameMissing

240

Configure

0x800D0000

2148335616

BadServerNotConnected

314

Not Connect

0x804F0000

2152660992

BadServerUriInvalid

314

Not Connect

0x800B0000

2148204544

BadServiceUnsupported

240

Configure

0x80260000

2149974016

BadSessionClosed

314

Not Connect

0x80250000

2149908480

BadSessionIdInvalid

210

AccessDenied

0x80270000

2150039552

BadSessionNotActivated

242

Error

0x80D30000

2161311744

BadShelvingTimeOutOfRange

313

Comm Fail

0x800C0000

2148270080

BadShutdown

254

Shutdown

0x80640000

2154037248

BadSourceNodeIdInvalid

240

Configure

0x80BF0000

2160001024

BadStateNotActive

307

Bad

0x80460000

2152071168

BadStructureMissing

240

Configure

0x80280000

2150105088

BadSubscriptionIdInvali

240

Configure

0x80B60000

2159411200

BadSyntaxError

307

Bad

0x80650000

2154102784

BadTargetNodeIdInvalid

240

Configure

0x80830000

2156068864

BadTcpEndpointUrlInvalid

314

Not Connect

0x80820000

2156003328

BadTcpInternalError

313

Comm Fail

0x80800000

2155872256

BadTcpMessageTooLarge

313

Comm Fail

0x807E0000

2155741184

BadTcpMessageTypeInvalid

299

Invalid Data

0x80810000

2155937792

BadTcpNotEnoughResources

313

Comm Fail

0x807F0000

2155806720

BadTcpSecureChannelUnknown

313

Comm Fail

0x807D0000

2155675648

BadTcpServerTooBusy

313

Comm Fail

0x800A0000

2148139008

BadTimeout

246

I/O Timeout

0x80A10000

2158034944

BadTimestampNotSupported

307

Bad

0x802B0000

2150301696

BadTimestampsToReturnInvalid

242

Error

0x80E50000

2162491392

BadTooManyArguments

250

Calc Overflw

0x806D0000

2154627072

BadTooManyMatches

250

Calc Overflw

0x80DB0000

2161836032

BadTooManyMonitoredItems

250

Calc Overflw

0x80100000

2148532224

BadTooManyOperations

250

Calc Overflw

0x80780000

2155347968

BadTooManyPublishRequests

313

Comm Fail

0x80560000

2153119744

BadTooManySessions

307

Bad

0x80770000

2155282432

BadTooManySubscriptions

312

Out of Serv

0x80630000

2153971712

BadTypeDefinitionInvalid

317

Invalid Float

0x80740000

2155085824

BadTypeMismatch

307

Bad

0x80010000

2147549184

BadUnexpectedError

307

Bad

0x80090000

2148073472

BadUnknownResponse

299

Invalid Data

0x801F0000

2149515264

BadUserAccessDenied

210

AccessDenied

0x80570000

2153185280

BadUserSignatureInvalid

210

AccessDenied

0x806B0000

2154496000

BadViewIdUnknown

240

Configure

0x80CA0000

2160721920

BadViewParameterMismatch

240

Configure

0x80C90000

2160656384

BadViewTimestampInvalid

240

Configure

0x80CB0000

2160787456

BadViewVersionInvalid

242

Error

0x80320000

2150760448

BadWaitingForInitialData

238

Scan Off

0x80B20000

2159149056

BadWaitingForResponse

313

Comm Fail

0x80B50000

2159345664

BadWouldBlock

307

Bad

0x80730000

2155020288

BadWriteNotSupported

307

Bad

0x00000000

0

Good

305

Good

0x00A90000

11075584

GoodCallAgain

305

Good

0x00300000

3145728

GoodClamped

305

Good

0x00A70000

10944512

GoodCommunicationEvent

305

Good

0x002E0000

3014656

GoodCompletesAsynchronously

305

Good

0x00D90000

14221312

GoodDataIgnored

305

Good

0x00E00000

14680064

GoodDependentValueChanged

305

Good

0x00DC0000

14417920

GoodEdited

305

Good

0x00A20000

10616832

GoodEntryInserted

305

Good

0x00A30000

10682368

GoodEntryReplaced

305

Good

0x00960000

9830400

GoodLocalOverride

305

Good

0x00A60000

10878976

GoodMoreData

305

Good

0x00A50000

10813440

GoodNoData

305

Good

0x00AA0000

11141120

GoodNonCriticalTimeout

305

Good

0x002F0000

3080192

GoodOverload

305

Good

0x00DD0000

14483456

GoodPostActionFailed

305

Good

0x00BA0000

12189696

GoodResultsMayBeIncomplete

305

Good

0x00A80000

11010048

GoodShutdownEvent

305

Good

0x002D0000

2949120

GoodSubscriptionTransferred

305

Good

0x40000000

1073741824

Uncertain

308

Doubtful

0x40A40000

1084489728

UncertainDataSubNormal

290

Bad Data

0x40E20000

1088552960

UncertainDependentValueChanged

290

Bad Data

0x40DE0000

1088290816

UncertainDominantValueChanged

305

Good

0x40940000

1083441152

UncertainEngineeringUnitsExceeded

294

Inp OutRange

0x40920000

1083310080

UncertainInitialValue

290

Bad Data

0x40900000

1083179008

UncertainLastUsableValue

290

Bad Data

0x408F0000

1083113472

UncertainNoCommunicationLastUsableValue

313

Comm Fail

0x40C00000

1086324736

UncertainNotAllNodesAvailable

313

Comm Fail

0x40BC0000

1086062592

UncertainReferenceNotDeleted

240

Configure

0x406C0000

1080819712

UncertainReferenceOutOfServer

312

Out of Serv

0x40930000

1083375616

UncertainSensorNotAccurate

215

Equip Fail

0x40950000

1083506688

UncertainSubNormal

294

Inp OutRange

0x40910000

1083244544

UncertainSubstituteValue

308

Doubtful


Common errors

No connection to the PI server: XXX

{
    "exception": [
        "No connection to the PI server: XXX"
    ],
    "result": false
}

Check if you have the right PI-Server namme

No connection to the PI AF server: XXX

{
    "result": false,
    "exception": [
        "No connection to the PI AF server: asdfasdf"
    ]
}

Check if you have the right AF-Server name.

"Functionname" No OSI PI databse Found

{
    "result": {
        "sys": "OSI",
        "errors": [
            "AFElementsExists No OSI PI database Found"
        ],
        "func": "AFElementsExists",
        "TimeProcessPerformance": {
            "Total": 0.3105,
            "TotalBytesOfMemoryUsed": 103686144
        },
        "piserver": "PI-Default"
    },
    "exception": [
        "AFElementsExists No OSI PI database Found"
    ]
}

Check if you have the right AF-Database name.

Socket is not connected

/System#esi-pibridge: 135: {
    "exception": {
        "Error": "Socket is not connected"
    },
    "tcpconfig": {
        "host": "127.0.0.1",
        "timeout": 10,
        "port": 5959
    }
}

Try starting the service or the .exe Console Application of the PI-Bridge. Or look if your tcpconfig has the correct connection parameters.

Timeout

/System#esi-pibridge: 135: {
    "exception": {
        "Error": "timeout"
    },
    "tcpconfig": {
        "port": 5959,
        "host": "127.0.0.1",
        "timeout": 10
    }
}

Increase the timeout variable. You might have a far remote endpoint, a really bad network connection or just a to low timeout setting.

Attempt to index a nil value

/System#esi-pibridge:148: attempt to index a nil value (local 'args')

You probably forgot the args or data field while trying to call a esi-pibridge method. Find the desired function above and try to match the data parameters.

Current OSI PI configuration does not allow Delete PI Points

{
    "result": {
        "piserver": "PI-Default",
        "errors": [
            "DeletePITags: Current OSI PI configuration does not allow Delete PI Points!"
        ],
        "func": "DeletePITags",
        "TimeProcessPerformance": {
            "Total": 0.7537,
            "TotalBytesOfMemoryUsed": 114409472
        },
        "sys": "OSI"
    },
    "exception": [
        "DeletePITags: Current OSI PI configuration does not allow Delete PI Points!"
    ]
}

If you want to enable the function DELETEPITAGS you have to enable it first in the .exe.config file. Set the parameter ballowtodelete to true in order to enable deleting PI-Points.