Main Content

piclient

Create OSIsoft PI client

Description

The OSIsoft® PI client object provides access to a PI Server so that you can search the server tags and read their data.

Creation

Description

example

piClient = piclient(piServer) creates an OSIsoft PI client object piClient, and connects to the OSIsoft PI server specified by piServer.

piClient = piclient(piServer,Username="WinUserID",Password="WinPwd") uses Windows® credentials if required by the OSIsoft PI server. WinUserID and WinPwd are your Windows login name and password, specified as strings. Credential information is used only to connect to the PI server 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 OSIsoft PI server.

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

Input Arguments

expand all

Host name of OSIsoft PI server, specified as a string or character vector.

Example: "pi-host-55"

Data Types: string | char

Properties

expand all

This property is read-only.

Name of connected OSIsoft PI server, 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 OSIsoft PI server
readRead data from OSIsoft PI server
viewerVisualize data from OSIsoft PI Server

Examples

collapse all

Construct a client object and connect to the OSIsoft PI server named pi-host-55.

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

Create a client object and connect to the OSIsoft PI server named pi-host-55 using Windows credentials.

p = piclient("pi-host-55",Username="myID",Password="myPwd");

Version History

Introduced in R2022a