PI System
Connection Settings
Token
The connection token used by the PI System AF SDK Agent to authenticate the Intelligence Hub connection.
Connect Timeout (seconds)
The maximum amount of time to wait for successful connection to the agent. If this time is exceeded the connection fails with an error return.
Request Timeout (ms)
The maximum amount of time to wait for a read or write response. If this time is exceeded the read or write fails with an error return.
Compression
When enabled, communication between the Intelligence Hub and the PI Agent is compressed using GZip. This improves read times in cases where returned payloads are large. For smaller payloads, there may be little or no performance improvement.
PI Agent Authentication
In cases where the PI Agent and the PI Server are on the same Windows Domain, leave this as Windows. In Windows mode the PI Agent authenticates with the PI Server using the Windows credentials used to run the Agent. In cases where the Agent and Server are on different domains use Credentials mode. This mode passes the provided username/password to the PI Server for authentication.
Input Settings
Types
Specifies the type of data to read. The different types are described below.
| Read Type | Description |
|---|---|
| Asset | Reads the values for one or more assets in AF given an AF query. This includes current value, historical, and more. |
| Asset Metadata | Reads the metadata for one or more assets in AF given an AF query. Metadata includes template definitions, attribute data types, point mappings, and more. |
| Event Frame | Reads one or more event frames from AF given an AF query. |
| Point | Reads point data from the archive. This includes current, historical data, raw data, averages, and more. |
| Point Change | Creates a DataPipe for one or more points, and returns new values, changed values, deleted, and more. |
| Point Browse | Returns point names and metadata given a PI point query. |
| Digital State Table | Returns the digital state sets defined on the PI Data Archive, including the numeric value and label of every state in each set. |
Type: Asset
The following settings are available for Asset reads. See the Time Settings below for details on historical queries.
| Setting | Description |
|---|---|
| Database | The AF Database to read from. |
| Query | The AF query to run against the AF Database. This supports the full PI AF syntax used in PI System Explorer. For example PlantB\\Boilers returns all Assets under this part of the tree. Template:Boiler returns all Assets backed by the Boiler template. |
| Query Paging | Enable paging of the query results. By default all assets in the query are returned. Paging allows you to return part of the result, improving performance. For example, a Page Index of 0 and Page Count of 10 returns the first 10 Assets in the query. An Index of 10 and Count of 10 returns the next 10. If there are no assets in the page, the input returns good no data. |
| Get | The type of query to make. Options include Current Value, Interpolated, and Raw Values. Current Value returns the current value of the assets, including all attributes. Interpolated returns the interpolated values over time, and raw values returns the values at different periods of time. See below for details on the start/end time settings. |
| Attributes | For asset reads, select a subset of attributes to return in the results. When left blank all attributes are returned. This is helpful to speed up queries when assets have many attributes and only a few are required. |
| Include Metadata | Enable this to include information for each asset like the template name, timestamp, etc. |
| Include Children | Enable this to recursively include all child assets in the result from the Query and Query Page settings. |
Type: Asset Changes
Subscribe to asset changes from the AF Server. This includes new data, changed data, deleted, and late arriving data. The first read browses the assets and all their attributes, and creates a subscription on the PI Agent for each attribute. Sub-sequent reads return point changes since the last read was performed.
| Setting | Description |
|---|---|
| Database | Same as the Asset read. |
| Query | Same as the Asset read. |
| Subscription ID | A unique ID used to track the subscription on the PI Agent. This way the PI agent knows how to update the subscription if the point list changes. The ID should be unique per input and should not be shared across installations. |
Type: Asset Metadata
The following settings are available for Asset Metadata reads.
| Setting | Description |
|---|---|
| Database | The AF Database to read from. |
| Query | The AF query to run against the AF Database. This is the same as the Asset Query. |
Query Paging, Include Children, and Include Attributes work the same as the Asset input. See the Asset input for details.
Type: Event Frame
The following settings are available for Event Frame reads.
| Setting | Description |
|---|---|
| Database | The AF Database to read from. |
| Query | The AF query for the Events. This supports the full AF query query syntax available in System Explorer. For example \* returns all events, and name:Boiler\* returns all events named Boiler. |
Query Paging, Include Children work the same as the Asset input. See the Asset input for details.
Type: Point
The following settings are available for Point reads. See the Time Settings below for details on historical queries.
| Setting | Description |
|---|---|
| Points | A list of PI points to read. |
| Use Reference | When enabled, PI points are read from another data source like a CSV file or an Asset Meta Query. For example, a PI Point read can be setup to read all PI Points referenced under a given branch of the AF Hierarchy. The reference must return an array of strings, where each string is a point name (ex. ['point1', 'point2']). An example of a Custom Condition is included below to read points from an Asset Metadata Query. |
| Get | The type of query to make. Options include Current Value, Raw Values, and Aggregates. |
| Format | Controls the format of the incoming data. JSON is the default. Use Parquet when working with memory-heavy payloads. This setting does not apply when Get is set to Current Value. |
| Include Metadata | Includes the following metadata for a point in the read result: pointID, descriptor, pointtype, engunits, span, zero, ptclassname, pointsource. |
| Additional Properties | Allows additional user defined metadata to be included in the read result when the read type is set to Current Value. |
Type: Point Changes
Subscribe to point changes from an archive. This includes new data, changed data, deleted, and late arriving data. The first read creates a subscription on the PI Agent for the points, and sub-sequent reads return point changes since the last read was performed.
| Setting | Description |
|---|---|
| Points | Same as the Point read. |
| Use Reference | Same as the Point read. |
| Subscription ID | A unique ID used to track the subscription on the PI Agent. This way the PI agent knows how to update the subscription if the point list changes. The ID should be unique per input and should not be shared across installations. |
| Max Per Read | The maximum number of changes to read per read operation. If not specified, a maximum of 100,000 changes will be read. Valid range is 1 to 100,000. |
| Format | Controls the format of the incoming data. JSON is the default. Use Parquet when working with memory-heavy payloads. |
Type: Point Browse
The following settings are available for Point Browse read types.
| Setting | Description |
|---|---|
| Query | The PI syntax query used to retrieve one of more points. For example SIN* returns everything that starts with “SIN”. This is the same syntax supported in native PI tools. |
| Include Metadata | When disabled, the browse result is an array of point names. When enabled, information like the description, data type, unique ID, etc are returned per point. |
| Additional Properties | Allows additional user defined metadata to be included in the browse result. |
Type: Digital State Table
Reads the digital state sets (digital state tables) defined on the PI Data Archive. Digital points store an integer that maps to a state in one of these sets, so reading the sets themselves is useful when the raw values are sent to a system that has no access to the PI server. As an example, publish the state sets to a data warehouse alongside digital point data so the numeric values can be resolved to their labels.
The following settings are available for Digital State Table reads.
| Setting | Description |
|---|---|
| State Sets | The digital state sets to read. Use Find to browse the state sets available on the server, or type the names in directly. When left empty, all state sets on the server are returned. |
The result is an object keyed by state set name. Each value is the list of states in that set, where value is the integer stored on the point and name is the label assigned to it.
{
"Modes": [
{ "value": 0, "name": "Manual" },
{ "value": 1, "name": "Auto" }
],
"Phases": [
{ "value": 0, "name": "Idle" },
{ "value": 1, "name": "Running" }
]
}
Time Settings
These settings apply to Asset and Point reads, and allow for running queries over a large time range and reading the data in chunks.
| Setting | Description |
|---|---|
| Start Time | Specifies the start time for the query. This uses the standard PI time syntax. Relative and absolute times are supported (ex. *-1h). Absolute times must include a Z at the end to be treated as UTC. |
| End Time | Specifies the end time for the query. The supported formats are the same as Start Time. |
| Interval | Specifies the interval to interpret data samples. For example, 5m means every 5 minutes. Use this setting to break reads into chunks. As an example, get the average value of a point every 5 minutes over a 1-hour period. When left blank the interval defaults to the time range between Start and End Time. See Interval Values below for the full list of valid units and formats. |
| Time Index | When enabled, reads are performed from the Start to the End Time, in window intervals. After each successful read, the last read index is updated and stored to disk so that in the case of a system restart the reads start from where they last ended. Indexing is useful when querying a large amount of historical data. |
| Index Window | Used when indexing is enabled. This is the window size to read on each read request. As an example, with the following settings each read gathers one days' worth of data in 5 minute intervals and reads stop after the full 100 days is read. |
Interval Values
Interval field accepts the PI/AVEVA time-span syntax.| Unit | Symbol | Full words |
|---|---|---|
| Millisecond | ms | millisecond, milliseconds |
| Second | s | second, seconds |
| Minute | m | minute, minutes |
| Hour | h | hour, hours |
| Day | d | day, days |
| Week | w | week, weeks |
| Month | mo | month, months |
| Year | y | year, years |
The following rules govern which forms are accepted:
- All forms are case-insensitive —
dorD, andhourorHOUR, all work. - Fractional values are allowed only on the clock units (
ms,s,m,h) — for example1.5h(1h 30m),0.25h(15m),2.75m, or1.5s(1s 500ms). The calendar units (d,w,mo,y) must be whole numbers — values such as1.5d,0.5d,1.5w,1.5mo, and1.5yare invalid.
The following additional forms are also accepted:
- Clock format
HH:MM:SS— for example1:30:00or01:00:00. - A bare number is interpreted as hours — for example
60means 60 hours. - Signed values are supported for relative offsets — for example
+60mor-1h. - A space between the number and unit is tolerated — for example
1 h.
Below is an example configuration. This reads data from 100 days ago until now, in 5 minute intervals, where each read returns one day of data.
Start Time = \*-100d
End Time = \*
Interval = 5m
Time Index = true
Window Size = +1d
Read Points from an Asset Meta Query
Below is an example of Custom Condition code that converts an Asset Meta query into a point list that can be used in a Point read. Using this technique you can read all the points referenced in an AF query, and detect new points when they are added. Note that asset queries are slower than point queries, so it’s recommended to enabled input caching on the Asset Meta query. This avoids making Asset queries for every raw read.
Create a custom condition that references the Asset Meta query, and run it through this condition.
var assets = {{this.currentValue}}
var pointsOut = new Set();
// Get the point name for all attributes assigned to a point.
for (asset of assets){
if ('attributes' in asset){
for (attribute of asset.attributes){
if ('point' in attribute){
pointsOut.add(attribute.point.name)
}
}
}
}
Array.from(pointsOut);
Output Settings
Types
Specifies the type of write; options include Asset and Points.
Type: Point
Point writes write data as PI points. Arrays and simple types are not supported. Hierarchy is flattened using the parent.child.attribute syntax.
| Setting | Description |
|---|---|
| Path | Specifies a prefix for the PI points. For example, “myPrefix” will write points as “myPrefix.pointName” |
| Point Name | The point name. If left blank, the point name is derived from the keys in the data. |
| Timestamp | Provides a way to set the timestamp of the write. When left blank, the timestamp will be taken from _timestamp in the outgoing payload. If no timestamp is provided and the payload doesn’t contain _timestamp, the timestamp is set to the time of the write. This setting is used to pull the timestamp from the payload. As an example, {{this.mytimestamp}} pulls the timestamp from a mytimestamp attribute in the data. The timestamp must be in ISO8601 format. |
| Point Delimiter | Sets the delimiter used when flattening point names. By default it’s “.” |
| Update Option | Controls the API call made to insert data into the archive. All PI options are available. |
| Create | When enabled, points are created if they are not found. |
| Point Source | The source assigned to created points. By default this is HB. |
Type: Asset
Asset writes data as PI points, and then builds the templates and element hierarchy inside of PI’s Asset Framework.
| Setting | Description |
|---|---|
| Database | The Database to write the AF Assets to. |
| Path | Specifies the AF path to write to. For example Portland\Shipping writes to the shipping branch. |
| Asset Name | Overrides the element name assigned to elements. By default, when left blank, the element name is taken from the data (ex. Instance name). |
| Timestamp | Same as Point writes. |
| Point Delimiter | Same as Point writes. |
| Update Options | Same as Point writes. |
| Create | When enabled Assets are created in AF. |
| Point Source | Same as Point writes. |
Note that if Create is enabled the output updates existing Elements and Templates if there are schema change. All updates are additive, meaning that renaming an attribute will keep the old attribute and add the new one.