Main Content

piclient

Create PI Data Archive client

Since R2022a

Description

The PI client object provides access to an AVEVA® PI Data Archive so that you can search tags and read their data.

Creation

Description

piClient = piclient(piServer) creates a PI client object piClient, and connects to the AVEVA PI Data Archive specified by piServer.

example

piClient = piclient(piServer,Username="WinUserID",Password="WinPwd") uses Windows® credentials if required by the PI Data Archive. WinUserID and WinPwd are your Windows login name and password, specified as strings. Credential information is used only to connect to the PI Data Archive, and is not retained in the piClient object properties.

piClient = piclient(piServer,Username="WinUserID",Password="WinPwd",Domain="WinDomain") specifies the domain name, as a string, associated with the user credentials, if required by the PI Data Archive.

If an invalid argument is specified or the connection to the server cannot be established, the object is not created.

example

Input Arguments

expand all

Host ID of AVEVA PI Data Archive server, specified as a string or character vector, indicating host name or IP address.

Example: "pi-host-55"

Data Types: string | char

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: piClient = piclient("pi-host", Username="MyUserID", Password="MyPassword", Domain="MY-NET3")

Name-value arguments can specify the Domain property; and the following options:

Windows login name if required for connection to the PI Data Archive server, specified as a string or character vector.

Data Types: char | string

Windows login password if required for connection to the PI Data Archive server, specified as a string or character vector. Use the setSecret and getSecret functions to securely store and retrieve the password from your MATLAB® vault.

Data Types: char | string

Properties

expand all

This property is read-only.

Name of connected AVEVA PI Data Archive, returned as a string. This is the value provided as the piServer input argument to the function.

Example: "pi-host-55"

Data Types: string

This property is read-only.

Name of domain associated with user credentials, returned as a string. This is the value provided as the Domain input argument to the function.

Example: "MY-NET3"

Data Types: string

Object Functions

tagsList tags from PI Data Archive
readRead data from PI Data Archive
viewerVisualize data from PI Data Archive

Examples

collapse all

Construct a PI client object and connect to the AVEVA PI Data Archive on host pi-host-55.

piClient = piclient("pi-host-55");

Secure connection with a PI Data Archive requires Windows credentials. Use the setSecret and getSecret functions to securely store and retrieve the Windows login password from your MATLAB vault.

setSecret("LoginPassword")

password prompt for PI

Create a client object and connect to the AVEVA PI Data Archive server on host pi-host-55 using Windows credentials.

p = piclient("pi-host-55",Username="myID",...
              Password=getSecret("LoginPassword"));

For releases prior to R2024a, specify password as a string.

Version History

Introduced in R2022a

See Also

Functions