Update of existing points by the PI APS Synchronization Engine
- Last UpdatedSep 28, 2022
- 7 minute read
- PI System
- PI AutoPointSync 1.2.8
- Interfaces
The first phase of synchronization compares the existing points with the data source tags to identify attributes that are inconsistent or points that belong in the deleted points category. This phase is skipped if the rule for handling attribute differences is set to do nothing. A consequence of skipping this phase is that deleted points are not discovered. Therefore, the do nothing rule for handling attribute differences overrides the actual rule for handling deleted points, and the synchronization behaves as if the rule for handling deleted points is also do nothing.
Update existing points
The flowchart in the following figure shows the steps taken by the PI APS Synchronization Engine in this phase:

The following paragraphs contain details of the corresponding numbered steps in the preceding figure:
-
PI APS Synchronization Engine obtains a list of the PI points associated with the interface instance being synchronized. PI APS must use the same procedure for identifying the points associated with an interface instance as the interface instance itself.
-
For the PI APS Synchronization Engine to identify the set of PI points associated with a registered classic interface instance, three pieces of information are needed. The actual PI attribute used as the Interface ID is obtained from the PI APS Connector. The PointSource strings and instance number used by the interface instance are obtained from the PI ICU configuration settings for the interface instance. For each PointSource string, a query string of the following form is constructed by replacing the italicized placeholders with actual values from the interface instance configuration:
-
-
The Synchronization Engine requests PI Server to return a list of points that satisfy this query string. If the interface instance is configured with multiple PointSource strings, separate queries are made for each PointSource string and the point lists returned by each query are concatenated into a single list of all existing points.
-
To identify the set of PI points associated with a registered PI COM Connector, only the program ID of the PI COM Connector is needed. The program ID is obtained from the PI APS Connector. A query string of the following form is constructed by replacing the italicized placeholder with the actual program ID for a specific PI COM Connector:
-
-
The Synchronization Engine requests the PI Server to return a list of points that satisfy this query string.
-
The Synchronization Engine obtains the list of key attributes by calling the PI APS Connector.
-
The Synchronization Engine assembles a group of existing points with master synchronization enabled from the full list of existing points obtained from the PI Server in step 1. On the first iteration of this step, the Synchronization Engine begins with the first point in the list. On subsequent iterations, the Synchronization Engine resumes where the preceding iteration ended:
-
The Synchronization Engine gets the next point in the list. If the end of the list is reached, proceed to step 4.
-
If the point is a UniInt Performance, Health, or Failover point, the point is excluded from synchronization. The Synchronization Engine skips the point and returns to step 3a.
-
The Synchronization Engine gets the per-point synchronization settings from the APSPoints database for the point.
-
If the master synchronization setting is enabled for the point, the Synchronization Engine proceeds to step 3e. Otherwise, it skips the point and returns to step 3a.
-
The Synchronization Engine gets the key attributes for the point from PI Server and adds the point to the group being assembled.
-
If the group contains fewer points than the configured group size, the Synchronization Engine returns to Step 3a. If the group size is reached, the Synchronization Engine proceeds to step 4.
-
-
The Synchronization Engine calls the PI APS Connector function to obtain data source tag attributes for the group of points assembled in step 3. The key attributes for all points in the group are a parameter to this function. Using the key attributes, the PI APS Connector calls the data source programming interface to get the current attribute values for each tag. The PI APS Connector returns either the syncable attributes for the tag or an indication that the tag does not exist in the data source. The PI APS Connector returns both the syncable attribute names and values to the Synchronization Engine, which uses the names to determine the specific attributes provided by the PI APS Connector.
-
The Synchronization Engine examines the returned data from the PI APS Connector to determine the names of the syncable attributes and how to extract the current data source attribute values returned for each point in the group from step 3. Then, the Synchronization Engine enters a loop to process each point, beginning with the first returned point:
-
The Synchronization Engine gets the status indicator for the next point in the results from the PI APS Connector. If no more points, the Synchronization Engine proceeds to step 6.
-
If the PI APS Connector indicates that the point is associated with an existing data source tag, the Synchronization Engine goes to step 5d. Otherwise, the rule for handling deleted points is applied:
-
The store for review rule adds the point to the APSPoints database and optional point log.
-
The automatic rule deletes the point from PI Server. All attribute values for the point are written to the synchronization log for auditing and recovery purposes.
-
The turn scan off rule writes the current Scan attribute value to the synchronization log and then changes the Scan attribute to 0 (off).
-
The remove point rule writes the current PointSource and InterfaceID attribute values to the synchronization log and then changes these attributes to configured values, which must not be used by any interface instance.
-
-
The Synchronization Engine returns to step 5a.
-
The PI APS Connector returned new data source attribute values for the tag. The Synchronization Engine gets the current values for the corresponding attributes for the PI point and gets the per-point synchronization settings for the existing point. If per-point synchronization settings do not exist for the point, the Synchronization Engine sets the per-point synchronization settings from the default settings for existing points. See Initial Sync Masks tab.
-
The Synchronization Engine assembles a list of attributes to edit for the point. For every syncable attribute, if the individual attribute synchronization setting is disabled or the corresponding PI and data source attribute values are equal, skip the attribute. Otherwise, the Synchronization Engine adds the PI attribute name and current data source value to the list of attributes to edit for the point.
-
If the list of attributes to edit is not empty, the Synchronization Engine applies the rule for handling attribute differences:
-
The store for review rule stores the new attribute values in the APSPoints database and optional point log.
-
The automatic rule writes the current values for the attributes with new values to the synchronization log and then changes these attributes to match the data source.
-
-
The Synchronization Engine returns to step 5a.
-
-
If the end of the list of existing points was not reached in step 3, the Synchronization Engine suspends itself for the time interval specified in the configuration settings. After the suspension interval elapses, the Synchronization Engine returns to step 3.
The reason for processing groups of points (instead of one point at a time) is to reduce the total overhead of calling the PI APS Connector to obtain data source tag attributes (step 4) by making fewer calls. The overhead in this function call is a consequence of having to structure the parameters to accommodate lists of key attributes and syncable attributes where both the names and order are unknown until run time. Before calling the PI APS Connector for current data source attribute values, the Synchronization Engine must encode the key attributes in a way that allows the PI APS Connector to determine how to extract them. Similarly, the PI APS Connector must encode the syncable attributes and the Synchronization Engine must dynamically determine how to extract them.
The number of points in a group is configurable and the default is 1000. See APS Connector tab .
After processing each group of points, the Synchronization Engine suspends itself for a configurable time to reduce competition with other programs for resources. The default suspension time is 10 milliseconds. See Sync Engine tab. After the suspension time elapses, the Synchronization Engine processes the next group of existing points.
The configurable group size and pause time between groups provides some control over aspects of the synchronization process that affect performance and resource consumption. While processing each group, the Synchronization Engine requires several types of resources:
-
CPU time and memory on the local computer
-
Responses from the PI Server, which might be on a remote computer
-
Responses from the data source, which may be on a remote computer
Every existing point in PI Server must be reviewed in each synchronization scan. If the number of existing points is large (as a rough guideline, more than 1000), the resource usage can be significant and extend over a long enough time period to adversely affect other programs using the PI Server and/or data source. The default settings for group size and the pause interval between groups allow the Synchronization Engine to maximize its throughput, possibly at the expense of other programs. Decreasing the group size and increasing the pause interval between groups cause the Synchronization Engine to suspend itself more frequently and for longer times. As a result, a synchronization scan takes longer to complete, and the required resources are distributed over a longer interval. Resource usage occurs in bursts as each group is processed, but decreasing the number of points per group setting correspondingly reduces the duration of each burst. Since decreasing the number of points per group inversely increases the number of groups, the number of pauses increases, too.
The Synchronization Engine reduces its priority for local CPU time, which allows the Synchronization Engine to run only when the computer would otherwise be idle. If PI APS is on the same computer as either the PI Server or data source, the priority reduction feature allows the PI Server or data source application to preempt the Synchronization Engine and, thus, indirectly prevents the Synchronization Engine from overwhelming the PI Server or data source. However, the priority reduction feature of the Synchronization Engine does not necessarily reduce the usage rate of a remote PI Server or data source. For example, if PI APS is the only application on a computer, the priority reduction feature has no effect and the Synchronization Engine makes calls to the remote PI Server and data source as fast as it can. Decreasing the group size and increasing the pause interval is the only certain method of reducing the usage rate of remote resources.