Data storage in PI points
- Last UpdatedMay 10, 2023
- 3 minute read
To send data to PI points, use the StoreInPI action. To create PI points for storing data, use the StoreInPIPoints action.
StoreInPI
The StoreInPI action sends the following data to a specified PI point:
-
Timestamp
-
Value
-
Status
-
Questionable flag
-
Annotation
The syntax for this action is as follows:
StoreInPI (Tag, Alias, TimeStamp, Value, Status,Questionable[,Annotation])
StoreInPI function parameters
Parameters for the StoreInPI action.
|
Parameter |
Description |
||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Tag |
Specifies the name of the target PI point |
||||||||
|
Alias |
Alias for target point. Must match the InstrumentTag of the given PI point. The Tag and Alias parameters are mutually exclusive. Either specify the Tag or the Alias. Example: Result = StoreInPI(,Alias, Timestamp, Value,,) |
||||||||
|
Timestamp |
The timestamp to be recorded with the value. Must be a valid DateTime value. If the incoming data does not contain the timestamp information, use the NOW() function, which represents the instant when the data is read by the interface. If you omit this parameter, the timestamp is the current time when the StoreInPI() gets executed. |
||||||||
|
Value |
The value to be recorded in the target PI point. For digital points, you can specify the state as a string or its corresponding numeric value as an integer. According to the data type of the target point, the value can be String, Number or DateTime. |
||||||||
|
Status |
PI point status specified as a Number corresponding to an entry in the PI System digital set. Use 0 or empty status for valid Values, any non-zero Status will show corresponding string from the PI System digital set. |
||||||||
|
Questionable |
0 for valid values, 1 if there is an issue with the quality of the value being sent. |
||||||||
|
Annotation |
Optional: Annotation to be recorded with this value. The annotation is stored using the PI variant data type that best corresponds to the type declared for the field, as follows:
|
||||||||
|
Return Value |
Returns 0 if the operation was successful, otherwise it returns an error code from the corresponding PI API or PI SDK call. Example: Result = StoreInPI( Tag,, TimeStamp, Value,,) |
If you attempt to write a NULL value to a PI point, the "No Data" system digital state is used instead. If you require different handling for NULL values, define the desired logic in the configuration file using the IF/THEN operator.
For more information about StoreInPI usage, see the topic Learn about UFL examples.
StoreInPIPoints
The StoreInPIPoints action creates a PI point of a given point class and data type using the following parameters:
-
PI tag (PI point name)
-
Point class
-
Data type
-
Digital Set or Name-Value collection
Using this function, you can create points based on names and data types taken from the input data.
Note: StoreInPIPoints cannot update an existing PI Point, it only creates new ones.
The syntax for creating a PI point using the StoreInPIPoints action is:
StoreInPIPoints (Tag, PtClass, DataType [,Digital Set])
StoreInPIPoints (Tag, PtClass, DataType [,Name-Value Collection])
Parameters for the StoreInPIPoints action.
|
Parameter |
Description |
|---|---|
|
Tag |
Specifies the name of the target PI point |
|
Point Class |
An existing point class. The default point class is Classic. |
|
Data Type |
PI point data type. Supported input types are:
|
|
Digital Set or Name-Value Collection |
If the data type of this parameter is String, it is interpreted as the name of the desired Digital Set for the to-be-created digital PI points. If the data type is Collection, it is expected to contain the name value pairs specifying the individual PI point attribute names and their desired values. Example: FIELD(1).Name = "Tag" |
|
Return Value |
Returns 0 if the operation was successful. Otherwise returns an error code from the corresponding PI SDK call. Example: FIELD(1).Name = "Tag" |
Note: To create a point capable of storing future timestamps, include the "future" attribute in the Name-Value collection and activate the attribute by setting its value to 1. Alternatively, you could create a point capable of storing future data using EPC_Inherit to reference a point which has the "future" attribute activated.
For more information about StoreInPI usage, see the topic Learn about UFL examples.