A few years back, a colleague asked if a fixed reference curve could be created in PI. He was working with performance curves for wind turbines and wanted to be able to show manufacturers reference curve and the production at various wind speeds at the same time. He even provided a PI ProcessBook display to show what he was looking for; his solution, however, was less than optimal.
To generate the fixed curve, he had taken the manufacturer's data showing production as a function of wind speed and had generated the curve in Excel. He took a screen shot of the curve, edited it and saved it as a bitmap image. In the PI ProcessBook display, the bitmap was placed in the background, and, for a single turbine, he could plot the wind speed and actual power generated over time. Great...for one turbine. For a single site with a single manufacturer, he could add some VBA code to allow the end user to pick the turbine in question and then modify the tags on the plot accordingly.
But, what happens when there is more than one site or more than one vendor for a given site? The model quickly falls into disarray...
I looked at vCampus (at the time) and found solutions that allowed the fixed values to be stored in an Access database. So, I populated the Access database with the data by site, by vendor, by turbine range, added some VBA code to dynamically create an ODBC connection, create the select statement, force a refresh and modify the production tags.
The next iteration was to update the display to use AF for the production tags and labels and make it element relative - I was unable to get the fixed reference values to load from AF, however.
- Then... we moved from XP based machines to Windows 7 based machines and security got locked down... general users were no longer able to create dynamic ODBC connections.... the new model had fallen into disarray.
Fast forward to early Summer of 2015...
Question: when is a fixed reference curve not a fixed reference curve?
Answer : when it is a time series based repeating curve.
Does that make sense? It soon will...
To create a fixed reference x-y plot in PI ProcessBook using only PI based tools - no VBA, no add-ins, no externally sourced tables - make the curve a set of time reference values, and then repeat the values for a given time reference.
Moving forward, I will provide an example using real-life data and AF; AF is used because it lends itself well to an element relative display that provides the ability to add other elements on an as-needed basis.
Consider this wind turbine manufacturer's curve where the values are wind speed in meters/second, then expected power:
Using AF, create a template for the wind site with the following attributes: site, table wind speed, table expected power, reference table maximum, output wind speed, output expected power, and wind speed power index output.
The site is a string fixed value by element; the table attributes and the reference table maximum will be loaded from an AF table (defined below) and the last 3 are asset analytic output tags. Create the tags with archiving so that analysis recalculation can be performed if necessary.
Create an AF table with the site, wind speed, expected power and an incrementing index value. For example:
All the pieces are now in place to create the analyses for the output tags.
The reference table maximum is a table lookup with the following SQL statement:
SELECT Index FROM [Wind Power Curve] WHERE Site = @Site ORDER BY Index DESC
The first output tag will be the wind speed power index output with an expression of:
if (BadVal('Wind Speed Power Index')) then 1 else if 'Wind Speed Power Index' > 'Reference Data Maximum' then 1 else 'Wind Speed Power Index' + 1
The analysis is executed every 5 minutes.
When the wind speed power index output tag is first created, it will have a value of ‘Pt Created’. The analysis will detect a bad value (non-numeric) and force a value of 1; subsequently, the value will increase by 1 every 5 minutes until it reaches the last index value, then cycle back around to 1 again.
The table wind speed and table power are also table lookups:
SELECT WindSpeed FROM [Wind Power Curve] WHERE Index = @[Wind Speed Power Index]AND Site = @Site;RWM=0;RWN=0 and
SELECT [Expected Power] FROM [Wind Power Curve] WHERE Index = @[Wind Speed Power Index] AND Site = @Site;RWM=0;RWN=0
The index value ensures the wind and power values stay in lock step with each other.
Now, the wind and power values can be written to PI.
Modify the analysis created to write the wind index value and add expressions for the wind and power:
The speed and power will also be written every 5 minutes.
For this particular site, there are 27 wind speed / expected power pairs, so the reference table repeats every 2 hours and 15 minutes.
Now, create a template for the turbine with the following attributes: site, turbine number, reference wind speed, reference expected power, actual wind speed and calculated expected power (this is calculated whenever the wind speed tag receives a snapshot value).
Populate the site, reference wind speed and reference expected power as desired; if the turbine element is a child element from the site element, it may be possible to pull the values from the parent.
Since each turbine will have its own wind speed and expected power tags, these must be defined individually by turbine. Depending upon the tag naming convention, it may be possible to define the pattern in the originating turbine template.
Finally, we can create an element relative display.
The display will consist of two x-y plots: one for the fixed reference curve and one for the production values.
For the fixed reference curve, select the reference values from the element and use a fixed, single Y scale. Set the max/min values to be the maximum power and 0. The data retrieval method is record for both x and y. The plot time is ‘y’ to ‘t’ – this is a relatively ‘fixed’ range, but… it works!
The second curve will be similarly defined by selecting the actual wind speed and expected power, but will use a truly relative time range.
Please note: both x-y plots have the same scale... this will provide the overlay affect.
Set the background colour on each x-y plot to -1 so they are transparent.
Arrange both x-y plots so they overlay and group them together.
You should now have a working ProcessBook display with a fixed reference curve.
Here is the one I used as a reference for this document.
After solving the fixed reference issue, another project came up that required 6 overlapping x-y plots.
PI Square is a community... and when we share, we all benefit.