Академический Документы
Профессиональный Документы
Культура Документы
Version 2015
User manuals, Learning workbooks, and other materials used in class can be downloaded
from http://techsupport.osisoft.com . Login to an OSIsoft technical support account is
required.
Page i
ii
Software
Version
PI DataLink
2015
Microsoft Excel
2013
PI ProcessBook
2014
PI OLEDB Enterprise
2012
Microsoft SQL
2008R2, 2012
PI Data Archive
2015
PI Asset Framework
2015
PI Coresight
2014
Contents
1.
Welcome ................................................................................................................................ 5
1.1 Course Environment ...................................................................................................... 5
1.2 Review PI System Architecture ..................................................................................... 6
1.2.2
1.3
Assets and Tags The Basic Building Blocks in the PI System ............................. 7
10
11
12
14
PI AF Tables ....................................................................................................................... 18
3.1 Table Options................................................................................................................ 18
3.2 Table Creation .............................................................................................................. 19
23
27
28
29
32
37
41
43
46
50
Introduction
52
52
60
62
65
69
72
76
78
82
84
88
89
94
96
97
100
103
105
107
109
114
115
116
118
120
127
130
135
9.3 Adding calculated columns using Data Analysis Expression Language (DAX) .... 136
9.4 Where to Use Formulas ............................................................................................. 137
138
139
144
148
152
156
Introduction
164
167
169
171
172
13.7.1
173
13.7.2
173
1. Welcome
Welcome to the Advanced Client Tools Course!
Since you are attending this class, you should have some experience with OSIsoft Client
Tools (PI ProcessBook, PI DataLink, PI WebParts and PI Coresight), either using displays,
reports or webpages previously created to analyze your data, or creating these displays,
reports and webpages so that others in your organization have access to all the powerful data
that resides in the PI Data Archive and data external to the PI System.
The basic tasks within these tools (as building a PI ProcessBook display or a PI DataLink
report) are presumed to be understood; what you will experience here can be seen as a factory
of ideas, a space for OSIsoft customers to realize how powerful existing data can be when
analyzed with the advanced options of our tools and additional third party tools.
Hope you enjoy!
Introduction
PI Server
PI System User
Data PI Interface
Buffer
Source
Table
Lookup DR
PI AF
Relational
Database
Data is collected from the source by the PI Interface program hosted by the acquisition node.
The data is sent to the PI Data Archive and asset data can be contained in the PI AF server. It
is read from the PI/AF Servers by the client tools, such as PI ProcessBook.
1.2.2
Sometimes the architecture can be very simple. Some customers have as few as one or two
interfaces feeding data to a single PI Data Archive. Access to data is through the single PI
Data Archive.
In many cases there are many PI Data Archives in an organization, aggregating data from
lower levels. Some corporations have PI Data Archives dedicated to servicing their clients
with restricted company data.
1.3 Assets and Tags The Basic Building Blocks in the PI System
Objectives
Introduction
Introduction
Template Definitions
Attribute
Gross Generation
Net Generation
Operator
Technology
Hourly Capacity
Generating Efficiency
Engineering Units
Megawatts
Megawatts
Megawatt Hours
Percent
Generation companies often compare sites, and perform analyses site-by-site or region-by-region.
Not every company will be this clear-cut. Some sites will have a hierarchy that matters but which cannot
as easily be described by one universal diagram as above. Other sites wont have as much of a logical
hierarchy, but perhaps there is a hierarchy of organization (Research departments), function (Type of
bioreactor), or location (Which building/room/benchtop/position a reactor is in). It all depends on type of
analysis to be conducted. Perhaps the ambient temperature is thought to be causing growth differences in
different bioreactors, in which case the latter physical location could help sort the reactors into rooms,
proximity to a window, etc.
10
The gas turbine and steam turbine derived templates define additional attributes specific to each type of
turbine. Both gas and steam turbines inherit the same attributes from the base generation unit.
Building good template hierarchies is perhaps the single most important AF concept.
11
Introduction
Capacity, Net Generation, Gross Generation, and Technology can all participate together in a report of
overall demand and average gross generation. The devices are physically very different, but functionally
all generate power, and this is a valuable similarity for the power generation business.
1.4.3 Element metadata (Static Table Data)
Attributes can be flexible holding numeric values or enumeration values and often already exist as
part of the model.
Static attributes (where the value is persisted directly, not coming from a data reference) can be indexed
to support efficient searching and filtering. Creation of indices is not free, but used sparingly, bring great
efficiency to queries like Show me all of my GE-made turbines. Categories would be a hassle here
since Manufacturer is not a true or false thing; it is a value-from-a-set. However, the turbines already have
an attribute-showing manufacturer, so that could be made static and indexed.
(flag set in the template)
12
So, we will add some additional data aggregates to the Generating Unit template.
13
Introduction
Objectives:
Add a child attribute to Gross Generation, and name it Daily Average Gross Generation.
Configure the new attribute as follows, being sure to set UOM, type, and configuration fields of the
data reference.
14
Go ahead and check in the changes. Now, we will have access to this attribute, which calculates an
average daily gross generation, whenever a user makes a query for the value in any element that utilizes
the UNIT element template.
15
Introduction
2 Business Intelligence
Business intelligence (BI) tools offer solutions to quickly analyze raw, un-normalized,
multidimensional data. In concert with historical values from the PI Data Archive, metadata
and calculations from PI Asset Frameworks, and business intelligence tools, users can
quickly create interactive reports to gain insight on business and operational processes.
Throughout the rest of the class, we will explore the process of preparing the Asset
Framework model to add additional dimensions of information to our AF database, extracting
desired information (process data, metadata, and event frame data) from the PI System
through PI Data Access tools, consuming the data inside a data cube, and constructing
interactive reports with Microsoft PowerPivot that allow us to slice and dice our data and
bring meaning to our multidimensional data cube.
16
In the next several chapters in the course, we will expand on the Fleet Generation database to
include meaning data that will help management and engineers make better, more informed
decisions. Specifically we will add value through the following:
1. Pull meaningful rate data into AF from external relational databases.
2. Develop analytics to calculate efficiencies of the Fleet Generation units.
3. Calculate summary statistics over the generation units for each substation.
4. Detect downtime events and thermal anomalies.
Once all this data is centralized in the Fleet Generation database, we will develop queries
using PI OLEDB Enterprise to extract pertinent data so that this information can be
consumed inside of Microsofts Business Intelligence tools, PowerPivot and PowerView.
These BI tools will allow for dynamic, interactive reports.
17
Introduction
3 PI AF Tables
The Fleet Generation database has a simple hierarchy. Additional information can be brought
into the database through the use of tables. Listed below are several terms associated with PI
AF table definition. In each case, the tables can be accessed by PI AF elements though a
table lookup data reference.
Imported Table:
An imported table is a PI AF table created by importing a table in a non-PI relational database
or spreadsheet. Once imported, the table data is stored in the PI AF database and has no
further connection to the non-PI source table. Imported tables are read/write tables.
It is a good practice to limit your imported tables to 10,000 rows of data or less. Imported
tables are not designed for storing very large databases. If you need to access a lot of data in
PI AF tables, use external tables.
Internal Table:
An internal table is any table maintained entirely in PI AF. Internal tables are either imported
tables or tables that are entirely defined and maintained in PI AF. In contrast, linked tables
are external tables because the table data resides outside PI AF.
18
In the PI System Explorer, navigate to the Library in the Fleet Generation database.
Table's time zone Date/Time values are displayed depends on whether the Convert
To Local check box is selected.
19
Introduction
o
o
Note:
To convert the DateTimes to the local time, select the Convert To Local
check box.
To always display the DateTimes in the time zone selected in the Time Zone
field, clear the Convert To Local check box.
In the Cache Interval field, enter the amount of time until the table's cached data is
automatically refreshed. In the drop-down menu, choose whether the value is in
seconds, minutes, hours, or days. The default value is zero and designated as
Manual Refresh.
Automatic refreshing is disabled if the table has changes that have not been saved to the server.
Note:
The Persistence Type and Query fields are read-only. PI AF populates these fields when you link
to or import an external table.
20
Select the Define Table tab to define the columns of the table.
Right click in the white space on the display and select the Insert option.
Give each column a name; define the value type and unit of measure.
21
Introduction
Once the table is defined, select the Table tab and manually enter the data.
After completing the table definition, Check In the table to save the information.
o A small red check with an asterisk will appear to the left if Check In is
required.
22
Objective:
The engineering team currently has a SQL Server table of generation rates for different types
of generation sources. They would like to have this information stored inside of PI Asset
Framework as they will want to use these rates in later calculations. Since these rates may
change over time, they would prefer not to have static values stored inside of the PI Asset
Framework database and instead have a link to this relational database.
Approach:
In the PI System Explorer, navigate to the Library in the Fleet Generation database.
Right-click the Tables collection and select New Table.
Select the General tab for preliminary table definition. Define and populate the
table through the creation of a link to a table outside the PI AF server
Once the data is imported, verify the data and check the Units of Measure (UOM)
Check In the table to save the information.
23
Introduction
Step 4: From the Provider tab, select Microsoft OLE DB Provider for SQL Server
24
Step 5: Switch to the Connection tab. Set the server name to PISRV1. Select Use
Windows NT Integrated security for the log on information and select the
FleetGeneration SQL Server database. Test the connection.
25
Introduction
Step 8: Verify that the table data is pulled into PI System Explorer.
Step 9: Set the Unit of Measure of the Rate column to the Energy Costs => $ / kWh
26
Objective:
Because of environmental purposes, management needs to report on the total carbon dioxide
generation for each of the generating units within Fleet Generation. This information is
currently stored in SQL Server under the Fleet Generation database. As this data does not
change frequently, this data can be imported directly into PI AF. Build a connection to bring
these values into the Fleet Generation AF Database.
Which technologies have the highest generation rate? Which are the lowest?
Approach:
Create a new table, called Carbon Footprint, and connect to the existing SQL Server
database table called Emission Rates.
Import existing data.
Verify UOMs. Emission rate column should be g/kWh.
Check-in the table.
27
Introduction
One requirement is identifying the field in the table that relates to the attribute being
created.
A definite advantage of using a PI AF hierarchy is the ability of reference
components of the hierarchy.
o The components that can be reference include elements, attributes, database,
server, etc.
o Using these components as a reference is called substitution parameters.
Substitution Parameters
PI AF does a direct substitution of the substitution parameter for whatever that particular
parameter represents. The format to use a substitution parameter is %referenceditem%.
For example, %Element% is a substitution parameter that represents the element name.
Item Referenced
Attribute
Value of Attribute
Root Element of Attribute
Syntax
%Attribute%
%@Attribute%
%\Element%
28
.
Objective: Add a data reference to the Unit Element Template associated with the
Generation Rates table to enable calculating the cost of generation.
Approach:
Select Settings.
29
Introduction
Note:
Select the Stepped check box for the value to be stepped when plotted in a trend. With this setting,
there is no interpolation between the table values.
30
Only columns with a value type of DateTime appear in the menu. The
WHERE clause is not required when you choose this option.
In the Where section, use the menus and buttons to build the table query.
Note:
You can manually type the entire clause into the Complete WHERE Clause text field. The
construction/syntax of the WHERE clause will be reviewed later in this course.
In the Column box select the column of the table to use in the query.
In the Operator box select the relational operator to use in the query. The
interpolation option will return an estimated (interpolated) value for the result column
based on the values contained in the referenced input columns.
In the Attribute or Value box select an attribute or a literal value to use in the query.
Click Add And or Add Or to write the WHERE clause into the Complete Where
Clause box with an AND / OR operator.
Note that the Add And or Add Or buttons in the dialog box automatically generate
the necessary syntax, UOM, and time zone conversions when possible.
31
Introduction
Objective:
Regulations on carbon emissions is continually growing tighter. The amount of carbon
emissions must be reported by all power companies based on the type of technology.
Which units have the highest generation rate? Which have the lowest?
Approach:
32
4 PI Analysis Service
PI Asset Framework is a powerful tool to help model the infrastructure of a company, region,
or division. Through PI Asset Framework Formula Data References, you can create simple,
on-the-fly calculations. PI Asset Framework also comes packaged with the PI Analysis
Service, for more advanced analyses. The analytic capabilities include three analyses types,
Expressions, Rollups, and Event Frame Generation, which allow for calculations to be
applied at the template level as well as the ability to persist the results back to the PI Data
Archive.
There are alternate methods of calculation to the PI Analysis Service. These calculation
methods can be on the PI Asset Framework (PI Analysis Service, PI AF Data References),
the PI Data Archive (PI PE tags, PI Totalizer tags) or on dedicated hardware (PI ACE). It
should be noted that only the PI Analysis Service and PI ACE allow for complex
calculations, but only the PI Analysis Service can develop the calculations thorough
configuration of an object, without requiring developer level technical expertise. This is in
addition to the other benefits of PI Asset Framework, such as templatization and inclusion of
non-PI data. A comparison table is below.
CREATION
METHOD
TECHNICAL SKILL
LEVEL
PERSISTENCE/
HISTORIZE
ASSET BASED
CALCULATION
TEMPLATES
SUPPORT
INCLUSION OF
NON-PI DATA
PI HA SUPPORT
RECALCULATION
BACKFILLING
HANDLES
COMPLEX
CALCULATIONS
PI ANALYSIS
SERVICE
Configuration
PI AF DATA
REFERENCES
Configuration
PI ACE
PI PE TAGS
Programmed
Configuration
PI TOTALIZER
TAGS
Configuration
Basic
Basic
Developer
Basic
Basic
No
Yes
Yes
Yes
Yes
Yes
Yes (MDB)
No
No
Yes
Yes
Yes*
No
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes*
Yes
No
No
No
Yes
Manual
Manual
Yes
No
Manual
Manual
No
No
No
No
No
* Complex calculations are limited to PI PE syntax and cannot be called recursively. For
more advanced functions including calling external libraries, PI ACE must be used.
33
Introduction
Expressions:
Expressions allow for multi-lined calculations that utilize mathematical operators and functions, ifconditions, and PI time-based functions to perform advanced analyses. Expressions, created for a given
asset type (element template), are automatically applied to all elements of that type. Results can be written
directly back to the PI Data Archive.
Rollups:
Rollups allow for the calculation of summary statistics (averages, maximums, minimums) of values from
a set of AF attributes. Current statistical values can be written directly to the PI Data Archive.
Event Frame Generation:
PI Analysis Service allows for the automatic detection of events that occur. These events are bookmarked
and information for any event type can be retrieved for further analysis.
Scheduling:
Expressions and Rollups can be scheduled to run whenever a new event arrives into the PI Data Archive
or calculated on a periodic basis.
Backfilling:
Results from all three types of analyses can be backfilled into the PI System.
4.2 Expressions
With Expressions, you can implement calculations through a set of built-in functions that take values of
attributes in PI Asset Framework as inputs, and outputs results to other PI AF attributes. Expressions can
be scheduled to run periodically or scheduled to run whenever the input parameters of the expressions
receive a new value.
34
Multi-line calculation dependency allows for each expression to be written to different output attributes as
well as re-using calculated results in subsequent expressions.
Function Category
Archive Value Statistics
Date and Time
Logical
Math
Operators
PI Data Archive Digital States
Point Attributes
Search and Retrieval
Statistical
Status
String
TagAvg, PctGood
Bod, Hour
And, If
Abs, Sqr
>, <>, *
DigState, DigText
TagSpan, TagType
TimeEq, NextEvent
Rand, Total
NoOutput, TagBad
Len, Text
A set of built-in performance equation-like syntax allows for access to a range of functions.
The available options include mathematical and logical operators and functions, date and time
functions, PI-specific performance equation functions, and string manipulation functions.
35
Introduction
36
Objective:
The capacity utilization is a percentage that represents the amount of electrical power that a
unit produced against its theoretical capacity. Configure, test, run, and validate analyses to
calculate the percent utilization of all generating units.
Approach:
In the PI System Explorer, navigate to the Library in the Fleet Generation database.
Under Element Templates, select the UNIT element template.
Select the Analysis Templates tab to configure the multi-lined expression for
Utilization:
Utilization = Total Hourly Gross Generation / Hourly Capacity
Specify and configure an attribute template to store the results.
Schedule the calculation to run periodically every hour.
Backfill unit GAO01 for the past seven days.
37
Introduction
Step-by-step approach
Step 1: From the Unit Template, found in the Library plug-in of the Fleet Generation database,
select the Analysis Templates tab.
Step 2: Configure a new analysis. Name the analysis Utilization and set the analysis type to
Expression.
Step 3: Configure the expressions for the hourly total of Gross Generation and Utilization.
HourlyTotal = TagTot('Gross Generation','*-1h','*') * 24
Utilization = HourlyTotal / 'Hourly Capacity' * 100
Note: The HourlyTotal must be multiplied by 24, as the Performance Equation function TagTot assumes
the units of the input attributes are per day. Conversion factors should not be used elsewhere with PI
Asset Framework, as UOM conversions occur automatically.
Step 4: Define two new output attribute templates, Total Hourly Gross Generation and
Utilization, to store the calculated results. Define the UOM to be MWh and %.
38
Step 6: Switch back to the Unit Template Analysis Templates tab to schedule the Analysis
Template to run periodically at the top of each hour.
Step 7: Drill down to GAO01 from the element hierarchy. Select the Analysis
tab and the Utilization analysis. Click on the Evaluate button to validate the
expressions.
39
Introduction
Step 8: Prior to backfilling data into the PI Data Archive, right-click on the analysis to preview
the results over the past 7 days.
Step 9: Right-click on the analysis and select Backfill. Specify the start and end time of *-7d
and *, respectively to begin the backfill process.
Step 10: Once data has been backfilled, observe the current value of
the Utilization attribute. Right-click on the attribute and select Time
Series Data to validate the backfilling.
40
Objective: By now, all the analyses for event frame generation have been set up for all the
units of Fleet Generation. In order to perform deeper analysis over the data during the past
week, backfilling needs to be performed.
Approach:
Step 1: From PI System Explorer, select the Analyses plugin.
Step 2: From the filter dropdown selection, select Analysis Template. Select all analyses tied to the
Utilization analysis template.
Step 3: Select the Backfill operation and set the start time to *-7d
41
Introduction
42
Objective:
Power generators require electricity to operate. The net generation is defined as the amount of
gross generation, or the amount of electricity that a generator produces, less the electricity
required to operate the unit. Calculate the generating efficiency, or the ratio between the net
generation to the gross generation, expressed as a percentage.
Which unit is performing with the greatest efficiency?
Approach:
In the PI System Explorer, navigate to the Library in the Fleet Generation database.
Under Element Templates, select the UNIT element template.
Select the Analysis Templates tab to configure the expression for generating
efficiency.
Specify and configure an attribute to store the results.
Schedule the calculation to run periodically every hour.
Backfill all generating efficiency analyses for the past seven days.
43
Introduction
4.3 Rollups
The second analysis capability of the PI Analysis Service Analytics is known as rollups.
Rollups allow for the calculation of summary statistics for a set of attribute values.
The types of summary statistics that are allowed are:
Sum
Average
Minimum
Maximum
Count
Median
44
The general process to properly configure and backfill an analysis template is:
1)
2)
3)
4)
5)
6)
7)
8)
45
Introduction
Objective: Management would like to have visibility over the average percent utilization of
all generating units for each substation. Roll up the average utilization to the substation level.
Approach:
46
Open up the Station Element Template from the Fleet Generation Database Library.
Add a new analysis called Average Utilization with analysis type of Rollup.
Select Central\Albertsville as the example element.
Specify the criteria to select the attributes used for the rollup calculation.
Select the summary statistic function for the average.
Specify the output attributes (be sure to create the tags).
Schedule the calculation to be event-triggered.
Verify data.
Backfill for the past 7 days.
Step-by-Step Approach
Step 1: From PI System Explorer, select the Fleet Generation Library plugin. Then select the
Station Element Template. From the Analysis Templates tab, create a new Analysis called
Average Utilization.
Step 3: Set the attribute name field to utilization. This mask will automatically select all
Utilization attributes from the child elements of the Albertsville station.
Step 4: Set the scheduling to be event-triggered. Each time the Utilization analysis finishes
calculating each hour, the rollup analysis will run.
Step 5: Select Average as the rollup function and create a new Output Attribute called
Average Utilization. Set the default UOM of this new attribute.
47
Introduction
Step 6: Click on the Evaluate button to verify the result of the rollup function.
48
Step 9: From the Analysis pane, backfill your Average Utilization rollup analyses for the past seven days.
49
Introduction
Objective:
Management would like to gain more insight into the total gross generation at each station.
Create a rollup analysis to totalize the hourly gross generation at the station level.
Which station produces the most power?
Approach:
50
Open up the Station Element Template from the Fleet Generation Database Library.
Add a new analysis called Total Hourly Gross Generation with analysis type of
Rollup.
Select Central\Albertsville as the example element.
Specify the criteria to select the attributes used for the rollup calculation.
Select the summary statistic function for the summation.
Specify the output attributes (be sure to create the tags).
Schedule the calculation to be event-triggered.
Verify data.
Backfill for the past 7 days.
Downtime tracking
Environmental monitoring
excursions
Process excursions
Operator shifts
The following table presents some of the features and advantages of PI Event Frames:
Reference multiple elements within the same
event.
Flexibility
Powerful search
Scalability
51
Introduction
There are different use cases for the methods, so care must be taken to ensure the correct method is used.
METHOD
SINGLE VALUE
APPLICATION SUPPLIED
TIME RANGE
NOT SUPPORTED
52
53
Introduction
Objective:
The gas turbines in the Fleet Generation database each have three temperature sensors. Create
an Event Frame template with appropriate attributes to help monitor and analyze potential
issues with gas turbines. The event frame should capture the real-time data specific to gas
turbines and the current status and duration of the gas turbine.
Approach:
54
Create a template called Gas Turbine Temperature Anomaly, none of the additional
fields on the General Tab are required.
Select the Attribute Templates tab. Right click in the white space to create an
attribute.
The attribute name is in the format .\Elements[.]|Unit Status. The Event Frame
references a PI AF Element. The [.] syntax points to this PI EF Templates primary
referenced PI AF element within the Elements collection.
Note: Each parent object has a default collection type. For example, a PI System has a default collection
of databases, and an AF database has a default collection of elements.
Note: Substitution parameters cannot be used to make a reference to an attribute from the Element
Template that is not a PI Tag.
Upon completing the definition, click OK. The Settings will be completed as seen
below:
55
Introduction
56
Create a third attribute to store the Technology. For the Value Type, select String and
for the Data Reference, select String Builder.
Note: When the event frame attributes data reference is set to PI Point, the syntax .\Elements[.]|Attribute
only allows for the reference to PI Point Data Reference attributes. Element attributes configured as
formulas and table lookups cannot be passed to event frames using a PIPoint Data Reference. Instead, for
attributes configured as formulas or table lookups, select String Builder as the data reference.
57
Introduction
Continue to create the following additional attributes. Make sure units are properly
set. Hint: You can start by copying and pasting these attributes templates from the
Gas Turbine element template.
1.
2.
3.
4.
5.
58
Note: %attribute% will substitute in the name of the event frame attribute template. This will then point
to the corresponding attribute in the referenced element. You can also select multiple attributes when
making modifications to the attribute configuration.
59
Introduction
Objective:
Generating units sometimes trip or go down. Management would like to understand these
downtimes, and determine how much demand was not serviced. Event frames can help
capture and bookmark these events for future analysis. Develop an Event Frame template,
called Inactivity, with fields required to track the desired plant information to create reports
for management. Specifically, management would like to know the following:
1. Demand Real-time
2. Operator Metadata
3. Technology Metadata
4. Carbon Emissions Metadata
5. Total Demand Real-time, Aggregation of Demand
6. Duration in seconds
7. Hours Down in hours
8. Status Real-time
Hints:
1) For metadata, use String Builder as the Data Reference.
2) For Total Demand, configure the attributes By Time as Not Supported and By
Time Range as Total
3) Verify correct event frame template configuration through the creation of a test event
frame.
60
Some notable features of Event Frame Generation in the PI Analysis Service include the following:
Generate events: Easily configure event generation and automatically generate your events from the
trigger tags that are already collecting data in the PI Data Archive.
Handle multiple event types: Generate all your different event types, such as downtime, excursions,
batches, and other events, on the same asset with no restrictions on overlapping events.
Standardize using event frame templates and populate event attributes: Different event types have
different attributes and information that are important for analysis. Standardize your events using event
frame templates, and use the PI Analysis Service to automatically populate events attributes with data
from the PI Data Archive and PI Asset Framework.
Backfill events: PI Analysis Service enables you to define your history backfill time window, then it
backfill the events from previous time periods automatically.
Using PI AF element attributes as event triggers or event attribute values: Trigger conditions for
event frames can be linked to element attributes.
Configure using PI AF element templates: Apply the configuration of event frame detection and
generation to PI AF element templates. The same event detection automatically applies to newly created
assets of the same asset type. There is no need to configure the event frame generation again.
Root Cause: Event frames are great for capturing events that have occurred. However, often
times, the time period prior to the event provides more information on the cause of the event.
PI Analysis Service allows for root cause analysis and will capture a fixed time period
(default five minutes) before the event start time for further analysis. This will be recorded as
a Child Event Frame.
Time True: The trigger condition for event frames could potentially be noisy. PI Analysis
Service allows for the specification of a minimum time true period before an event frame will
generate.
Event Frame Generation in PI Analysis Service does not have the following capability at this time:
Child Event Frames: Generation of child event frames. Interestingly, event frames can contain child
event frames to capture sub-events that have occurred during the time period of the main event frame.
61
Introduction
Objective:
Each gas turbine has multiple temperature sensors. If any temperature reading deviates more
than 20% from the average, then servicing is required. Use the Gas Turbine Temperature
Anomaly Event Frame Temperature to help define these types of events.
Approach:
Step 1: From the Fleet Generation Library, select the Gas Turbine Element Template and
select the Analysis Templates tab. Create a new analysis template called Gas Temperature
Anomaly.
62
Step 3: Define new expressions called AvgTemp and DeltaTemp. Set the expressions to:
Avg('Exhaust Gas Temperature - #1 Probe','Exhaust Gas Temperature - #2 Probe')
'Exhaust Gas Temperature - #1 Probe' - 'Exhaust Gas Temperature - #2 Probe'
Step 5: Enable the generation of a child root cause event frame. Set the duration to 30 minutes.
63
Introduction
Step 7: From the Analyses plug-in, backfill event frames for the past seven days for all Gas Turbine
Temperature Anomaly analysis templates.
64
Objective:
Engineering would like to perform a deeper analysis into events over the past week in which
the generating units are inactive. They would like to examine the 5 minutes prior to the event
to understand the cause. Configure the event frame generation to automatically capture new
events and detect historical events.
How many inactive events have been occurring?
Approach:
Open up the Unit Element Template from the Fleet Generation Database Library.
Add a new analysis called Inactive Units with analysis type of Event Frame
Generation.
Specify the event frame template: Inactivity.
Define the trigger condition to automatically detect inactive events.
Verify data.
Backfill for the past seven days.
65
Introduction
6 Analyzing Events
6.1 Objectives
PI Event Frames are stored in a relational database on the SQL Server hosting the AF
databases. These event frames can be viewed, filtered, analyzed using PI tools such as PI
System Explorer, PI Coresight, and PI DataLink.
From the properties of an Event Frame Search, you can specify the following search
parameters for the time of the event frame, and the properties of the event frame:
Search type: Specify how to perform an event frame search. Find all event frames that are
entirely between a start and end time? Starting or ending between a start and end time?
Search start: Specify the start time for event frame search.
Search end: Specify the end time for event frame search.
Include descendants: Search for all child event frames in addition to parent event frames.
Event Frame Name: Filter based on the name of an event frame. Can use wildcards.
Element Name: Filter based on the name of the referenced element. Can use wildcards.
Template: Filter based on the event frame type.
66
Additional Criteria: Ability to filter based on duration, attribute value, event frame search
root, and specify how many results to return.
The resulting search query is combined into a string within the search field. This allows for
direct manipulation of the data fields without using the menu options.
The default search results brings back fields detailing the duration, start time, end time,
description, category, template, and a Gantt chart. Any of these fields can be hidden by using
the settings cog on the top right corner of the search results. Additionally values from the
event frame attributes can be pulled back into the search results through this same option list.
67
Introduction
Because PI Event Frames are essentially bookmarks that reference data from elements, tables,
and itself through formulas, whenever you perform a search for event frames and their
attribute values, the search can take a while. Fortunately, built into PI Asset Framework is the
ability to capture or persist the event frame attribute values. These values are stored in a
relational database on the SQL Server.
You will notice that there is a blue pin icon to the left of many event frames. That basically
means that the values are persisted or captured. Any event that PI Analysis Service
automatically detects will have its values captured.
If you do update the event frame template, however, you may need to recapture the values as the existing
event frame attribute values will not automatically update to the new changes. To recalculate, right-click
on a set of event frames and select recapture.
68
Objective:
Find all Inactive events for the unit GAO01 and GAO02 over the past 24 hours. Examine the
technologies that are involved in these inactive events.
Approach:
Step 1: Click on the event frame plug-in. Right-click on Event Frame Search 1 and select Properties.
69
Introduction
Step 2: From the Event Frame Search screen, specify the search start to *-1d, end to *, and uncheck
the All Descendants checkbox. For the Element Name textbox, specify GAO0? and set the Template to
Inactivity.
Step 3: The search will return several inactive event frames. Select all of them and click on OK.
Step 4: Click on the gear icon to the right of the fields, and remove the description and category fields.
Then click on Select Attributes.
70
Step 5: Select the Technology attribute from the Select Attributes wizard.
Step 5: Examine the Technology that is leading to the downtime for these Inactive Units.
71
Introduction
Objective:
Find all temperature anomaly events for the gas turbines over the past 48 hours that last for
more than one hour. Pull back the temperatures for each of the two gas temperature sensors.
Which unit has the highest starting Gas Fuel Pressure during a temperature anomaly, and when
was it?
Approach:
Perform an event frame search and format results for the desired attributes.
72
There are two retrieval methods for Event Frames inside of PI DataLink:
Explore: Find Event Frames that meet the specified criteria and display them in a
hierarchical format, which is useful to analyze events sharing the same EF template.
Compare: Find Event Frames that meet the specified criteria and compare their attributes in
a flat format. This allows a flat list of events with attributes relating to child events all within
a single row.
For either the Compare or Explore Events, you can specify parameters to search for specific
event frames. You can specify the following:
Database: AF Database to search against.
Event Name: Search pattern to search for specifically named event frames.
Search Start: Search for all event frames that occurred after this time.
73
Introduction
Search End: Search for all event frames that occurred before this time.
Event Template: Search for specific types of events.
Element Template: Search based off of the type of referenced element.
Element Name: Search pattern for the name of the event frame.
More search options: Search based on attribute values, duration, and category.
Number of child event levels: Only for Explore Events and allows for the hierarchical
display of events.
74
When searching with Explore Events, the results can be displayed hierarchically based on the
relationships between child and parent event frames.
75
Introduction
Objective:
Temperature deviations could potentially mean damaged machinery. Engineering is interested
in analyzing the Natural Gas units. Find out how many instances of temperature deviations
occurred for gas turbines that lasted for more than 30 minutes.
Approach:
Step 1: From PI DataLink inside of Excel, specify the Database as \\PISRV1\Fleet Generation,
Event name as gas turbine*, Search start as *-1d, and Event template as Gas Turbine
Temperature Anomaly.
Step 2: From the more search options, set the minimum duration to 30 minutes and the technology to
Natural Gas.
76
77
Introduction
Objective:
Inactivity events can be costly as the generating units are not generating any power. Analyze
with PI DataLink the total number of Inactivity events as well as the total amount of time the
units were in an Inactive state.
Which generating unit had the most downtime events? Which generating unit had the largest
total downtime?
Approach:
Use PI DataLink to search for PI Event Frames and specify which attributes to return. Use Excel to
aggregate the events.
78
Symbols available
Trend: Add multiple attributes from assets onto a trend for easy visualization of process
changes.
Table: Display attribute values onto a table for easy comparisons. Allows for summary
statistics.
Value: View the current or historical value for any metric or process.
Horizontal Gauge: Horizontal gauge to view current levels within a range.
Vertical Gauge: Vertical gauge to view current levels within a range.
Radial Gauge: Radial gauge to view current levels within a range.
79
Introduction
Related Assets
Element templates are powerful at defining and
normalizing all similarly-typed assets. Templates also
allow for easier searches. With Related Assets in PI
Coresight, you can create one display for a particular
asset such as a turbine and reuse this display for other
turbines.
Events
Found in the same section as Related Assets, the
Events section displays all PI Event Frames that are
associated with the asset that is visualized in the PI
Coresight display.
80
81
Introduction
Objective:
Visualize a temperature deviation event for GAO01 using PI Coresight.
Approach:
Step 1: Create a new PI Coresight display. Drill down to asset GAO01.
Step 2: Trend the Exhaust Gas Temperature Probes for the past 24 hours.
82
Step 3: Click on Related Assets/Events and view the events that have occurred for GAO01. Select the
most recent Gas Temperature Anomaly event and drag the event onto the display as a table.
83
Introduction
Objective:
Engineering is interested in analyzing the process values 30 minutes before GAO01s
temperature values deviated. Use PI Coresight to create an ad-hoc display to quickly analyze
this data.
Approach:
Use PI Coresight to manipulate the start and end times to help analyze root cause.
84
85
Introduction
SELECT column1, column2, column3 FROM tablename retrieves all data for the 3 columns of
tablename.
The WHERE command contains criteria to filter the data being retrieved.
The conditional operators include:
equal (=)
greater than (>)
less than (<)
greater than or equal (>=)
less than or equal (<=)
not equal to (<>)
LIKE (which is a pattern matching operator)
Note: If the conditional clause is set to compare to text, the text value is encased in single quotes (text).
SELECT * from tablename WHERE column1 = 5
Retrieves only rows where column1 has a value equal to the number 5.
AND indicates both statements must be TRUE for the row to be returned when the
query is executed.
o
Retrieve only rows where column1 has a value equal to the number 5 and
column2 value equals junk.
86
The LIKE operator is used to search for a specific pattern in a column. In conjunction with the LIKE
operator a wildcard of % is used for comparison. The % can represent a single character or multiple
characters. Another wildcard is the underscore (_) which can be used to represent a single character.
SELECT * from tablename WHERE column2 LIKE %unk
Retrieves rows from tablename where column2 values end with the letters unk
SELECT * from tablename WHERE column2 LIKE %un%
Retrieves rows from tablename where column2 values contain the letters un
SELECT * from tablename where column2 like _un_
Retrieves rows from the tablename where column 2 values only contains 4 characters and
the middle two characters are un.
SELECT * from tablename WHERE column2 LIKE j%
Retrieves rows from tablename where column2 values start with the letter j
To work with column/table names which have special characters, such as a space, use square brackets:
If you wish to SELECT a column called Product Orders, enclose it in square brackets: [Product Orders]
If youre referring to a table whose full path is Fleet Generation, Region, Station, Unit, that must be
written as [Fleet Generation].[SouthEast].[Brick Canyon].[PLT02]
Any name may be wrapped in square brackets, so when in doubt as to what constitutes a special character,
wrap the name in square brackets.
87
Introduction
88
Objectives:
Review predefined queries associated with the tables defined in PI SQL Commander.
Approach:
Launch PI SQL Commander Click Start > All Programs > PI System > PI SQL Commander.
In PI SQL Commander, verify that your PI SQL Object Explorer is visible. If it is not, click View >
PI SQL Object Explorer.
From within the PI SQL Commander Object Explorer, connect to your AF Server, in this
example, PISRV1, by right-clicking Select Connect then select Windows Integrated Security.
89
Introduction
Right-click an object in the catalog that represents a table, view or function, and then select
Execute Predefined Query.
PI OLEDB Enterprise includes one sample SQL query for each table in the catalogs for PI AF
server.
90
The PI SQL Commander is shown below. The right side consists of the query editor on top
and the results grid below.
This is the environment for building and testing PI OLEDB Enterprise queries. Queries,
written in the editor, can be executed with their results shown in the grid.
Upon selecting Execute Predefined Query, a query window will appear with a Select statement for the
ElementHierarchy will be developed.
SELECT *
FROM [Fleet Generation].[Asset].[ElementHierarchy]
WHERE
Path = N'\' -- root elements
The above query does not yield all elements, just the elements at the Region level.
(Note: the N declares the path string to be Unicode, which permits lots of different characters. It will
be omitted throughout this document since normally we are only dealing with standard ASCII characters.)
91
Introduction
OR
SELECT *
FROM [Fleet Generation].[Asset].[ElementHierarchy]
7.3 Aliases
Sometime table name or columns are lengthy or lack clarity. Using an ALIAS can simplify typing and
clarify table field names that are otherwise unclear. The AS command defines an ALIAS for the item
prior to the AS with the abbreviation following the command.
SELECT eh.* FROM [Fleet Generation].[Asset].[ElementHierarchy] as eh
In the above statement, EH can be used to identify the table instead of the full [Fleet
Generation].[Asset].[ElementHierarchy] table name. Aliases become more significant when creating
joins.
92
Even though both tables have columns called names, they do not identify identical fields.
Note: Columns named the same are not necessarily referring to the same item. For example, id is a
column that is frequently found in tables representing a unique identifier for the row, but rarely do they
refer to the same item from table to table.
However, the columns named ElementID in both tables are actually the same and return a listing of all
attributes for all elements defined.
SELECT *
FROM [Fleet Generation].[Asset].[ElementHierarchy] AS EH join [Fleet
Generation].[Asset].[ElementAttribute] AS EA
on eh.elementid = ea.elementid
93
Introduction
94
The above statement illustrates a case for the use of ALIASes; making the statement much
easier to type and read.
95
Introduction
96
Compare the different tables and see how they can be joined together as a class
What is the Exhaust Gas Temperature of Probe #1 on GAO01? Where does this asset
reside?
What type of asset is GAO01, along with its parent and grandparent, up the
hierarchy?
Execute the Predefined Query associated with the Element Hierarchy modify to
obtain all elements.
Review the fields in the Element table.
Determine potential relationships between the tables to create joins.
Modify the Element Hierarchy query to add the appropriate join information to
extract the description of the elements.
Locate the Element Hierarchy within SQL.
Execute the Predefined Query.
SELECT *
FROM [Fleet Generation].[Asset].[ElementHierarchy]
WHERE
Path = N'\'
Review the ElementHierarchy table, which gives us the Path and Name (among other
things) of the elements in the hierarchy, but no description:
Review the Element table. Is there a link between the Element and Element
Hierarchy table?
97
Introduction
Each element pointer within the hierarchy (i.e. each row in the ElementHierarchy
table) corresponds to an element object from the overall set of Elements (i.e. a row in
the Element table). Behind the scenes, these objects are linked by GUIDs (Globally
Unique Identifiers). The purpose of a GUID is to give individual objects an identifier
guaranteed to be unique. Meaningless to the human eye, they look like:
9abd6084-6c74-4645-a7a0-833f6c25de3d
GUIDs (often contained in table columns ending in ID) are how each table relates
each row (element pointer) in ElementHierarchy to each row (element) in Element:
Modify the Element Hierarchy table to include the description from the Element
table.
SELECT eh.path, eh.name, e.description
FROM [Fleet Generation].[Asset].[ElementHierarchy] eh INNER Join [Fleet
Generation].[Asset].[Element] E on eh.elementid = e.id
98
Note: In the above statement, the tables have ALIASes, but the word AS is not in the statement as it is
understood.
The results of the above query yields the name of the element and the description
associated with the element.
99
Introduction
100
Execute the Predefined Query associated with the Element Hierarchy modify to
obtain all elements.
Review the fields in the Element Templates table.
Determine potential relationships between the tables to create joins.
o Hint: The Element table has a field called ElementTemplateID
Append a WHERE clause to filter based on the Path and Element Template.
Determine the fields to return and the tables associated to each field.
101
Introduction
Description
Archive
Snapshot
ft_InterpolateDiscrete
ft_InterpolateRange
ft_Plot
Note: Similar tables exist for data from Event Frame attributes. Typically, only the Event Frame Snapshot
table is queried against as each Event Frames contain individual start and end times.
102
Objective: Create a query to extract real-time values for the Gross Generation and Net
Generation attributes of all units. The fields in the result set should contain Element Name,
Station Name, Region Name, Attribute Name, Timestamp, and Value.
Approach:
The creation of this query requires several steps.
1) Run the predefined query of the Element table to obtain all elements.
2) Remove the WHERE clause that filters the results to all root elements.
SELECT *
FROM [Fleet Generation].[Asset].[Element] e
3) Apply an INNER JOIN to the Element table.
SELECT *
FROM [Fleet Generation].[Asset].[Element] e
INNER JOIN [Fleet Generation].[Asset].[ElementHierarchy] eh
ON e.ID = eh.ElementID
4) Apply an INNER JOIN to the ElementTemplate table.
Hint: Use aliases.
5) Add a WHERE clause to return only elements that are Units.
SELECT *
FROM [Fleet Generation].[Asset].[Element] e
INNER JOIN [Fleet Generation].[Asset].[ElementHierarchy] eh
ON e.ID = eh.ElementID
INNER JOIN [Fleet Generation].[Asset].[ElementTemplate] et
ON e.ElementTemplateID = et.ID
WHERE et.Name = 'Unit'
6) Apply an INNER JOIN to the ElementAttribute table.
7) Append to the WHERE clause to return only attributes that are either Gross
Generation or Net Generation.
103
Introduction
SELECT *
FROM [Fleet Generation].[Asset].[Element] e
INNER JOIN [Fleet Generation].[Asset].[ElementHierarchy] eh
ON e.ID = eh.ElementID
INNER JOIN [Fleet Generation].[Asset].[ElementTemplate] et
ON e.ElementTemplateID = et.ID
INNER JOIN [Fleet Generation].[Asset].[ElementAttribute] ea
ON ea.ElementID = e.ID
WHERE et.Name = 'Unit' and (ea.Name = 'Gross Generation'
OR ea.Name = 'Net Generation')
8) Apply an INNER JOIN to the Data Snapshot table.
9) Specify the fields for the result set.
SELECT
eh.Name [Unit]
, ParentName(eh.Path,0) [Station]
, ParentName(eh.Path,1) [Region]
, ea.Name [Attribute]
, s.Time
, s.Value
FROM [Fleet Generation].[Asset].[Element] e
INNER JOIN [Fleet Generation].[Asset].[ElementHierarchy] eh
ON e.ID = eh.ElementID
INNER JOIN [Fleet Generation].[Asset].[ElementTemplate] et
ON e.ElementTemplateID = et.ID
INNER JOIN [Fleet Generation].[Asset].[ElementAttribute] ea
ON ea.ElementID = e.ID
INNER JOIN [Fleet Generation].[Data].[Snapshot] s
ON s.ElementAttributeID = ea.ID
WHERE et.Name = 'Unit' and (ea.Name = 'Gross Generation'
OR ea.Name = 'Net Generation')
104
Objective:
Create a query to extract hourly interpolated data for the Demand attribute of all units over
the past four hours. The fields for the result set should include Element Name, Attribute
Name, Timestamp, and Value.
At what time does the demand tend to be high over all units?
Approach:
The creation of this query requires several steps.
1) Run the predefined query of the ft_InterpolateRange table.
2) Remove the portion of the WHERE clause that filters the results to all root elements.
3) Modify the Start Time, End Time and TimeStep.
4) Apply an INNER JOIN to the Element table.
5) Apply an INNER JOIN to the ElementTemplate table.
6) Add a WHERE clause to return only elements that are Units.
7) Append to WHERE clause to return only the Demand attribute.
8) Restrict the SELECT to return the desired fields.
105
Introduction
which is, in many senses, a dumb way to look at the data. It is much more legible to the human eye if
we rotate or transpose the values as:
PI OLEDB Enterprise can generate transpositions similar to what is above. A wizard walks
you through the process of creating a transpose function for any Element Template of your
choosing.
106
The Tables folder under Data shows the tables and columns that provide access to
snapshot and historical data from the PI System.
107
Introduction
Under both the Assets and Data folders there are two additional folders called Views
and Functions. These folders are initially empty and provide places for you to organize the
views and functions you create.
In general, creating and editing queries and views is a restricted activity. The changes are contained in
the PI AF SQL Database and access will be controlled by the database administrator.
The DataT branch of the hierarchy is for working with transpose functions.
108
Objective: Create a transpose function for the Fleet Generation database to be used in
analyzing plant generation data.
Approach:
There are four transpose functions available. Each transpose function returns a
dataset made up of columns for every attribute of an element template, where each
row returns values based on a different time basis.
Function
Snapshot or Archive
Rows/element returned
Transpose Snapshot
Snapshot
Transpose Archive
Archive
Transpose Interpolate
Discrete
Interpolated
Transpose Interpolate
Range
Interpolated
109
Introduction
Step 1
Access the Transpose Function Wizard by right-clicking on the DataT folder under the AF
Database catalog you wish to build a transpose function for, and select New Transpose
Functions Asset
Step 2
Select the PI AF template(s) you want to
create transpose function for. You can select
as many as you want, the wizard can build
multiple transpose functions per pass. Here,
we will select UNIT and click Next.
Step 3
If the element template has sub-attributes, they
will appear in this dialog and you can select
the ones you want included. The UNIT
template has no child attributes, so do not
select include subtree then click Next.
110
Step 4
Select the type of transpose functions you want
the wizard to create. Notice that there are
actually two sets of functions. Those starting
with the letter v allow you to specify the
version of the element template (based on its
effective date) you wish to build the transpose
function from.
In this example, we will not use the versioning
capability of PI AF, so select the
TransposeSnapshot and
TransposeInterpolateRange functions. These
functions will be created for each of the element templates selected in the previous step. Then
click Next.
Step 5
The wizard will provide names for the functions.
For PowerPivot, its best to clear the Values as
VARIANT check box. In this example, we will
be working with transpose function tables, so
check the Create functions tables check box.
The wizard will now create the transpose
functions and their associated transpose table for
the Transformer template. Click Next.
Step 6
Review the summary and click Next.
111
Introduction
Step 7
After the wizard processes your request, click
Done. The Transformer transpose functions and
tables are now ready to use.
Step 8
From the PI SQL Commander hierarchy, the
transpose tables and functions created by the wizard
should appear under the DataT folder of the Fleet
Generation PI AF database.
112
As for how to use your newly-created Function, examine the snapshot function it in
Object Explorer:
The default query retrieves no values. Modify the query to return all Units.
Remove WHERE eh.Path = N'\'
113
Introduction
Objective:
Attributes from the generation units and the event frames will be used to analyze production
data from the plants.
Approach:
Use the transpose function wizard to create a snapshot event frame function using the
Inactivity and Gas Turbine Temperature Anomaly template.
Verify the results of the transpose function through the execution of the pre-defined query.
Hint: The steps are almost identical to the ones used when creating an Asset transpose
function.
114
At this point, it is a matter of naming the View by replacing <view name> and copy pasting
the query by into <query> placeholder.
115
Introduction
Objective: Create a view, Unit Performance, using previously created asset interpolated
range transpose functions for frequently changing process data (Transpose Interpolate
Range).
Approach:
Run the Unit Interpolated Range transpose function using the Execute Predefined
Query. Note that no INNER JOIN to the ElementTemplate table is necessary as the
transpose function was created against the UNIT template.
Modify query to obtain all unit information by removing the Path portion of the
WHERE clause.
WHERE eh.Path = N'\' AND tc.StartTime = DATE('*1h') AND tc.EndTime = DATE('*') AND tc.TimeStep = '30m'
116
Refresh the View section and verify the Unit Performance View is present.
The definition for the view can be seen by selecting the Alter option in the View
folder.
117
Introduction
Objective:
Create an additional view, Unit Specifications, containing slow changing Unit metadata, for use in
managing PowerPivot reports.
What else could you add to this view? What sort of data would you like to extract from this
view?
Approach:
Create a view that returns metadata using the query from the TransposeSnapshot_Unit.
The result query set should contain the following fields:
1) Unit Name
2) Unit ID
3) Station Name
4) Region Name
5) Carbon Emissions
6) Hourly Capacity
7) Operator
8) Technology
Approximate time: 20 minutes
118
119
Introduction
Objective: All the pre-work is complete, now it is time to start building the report.
Approach:
Open MS Excel
Select the PowerPivot tab to access the PowerPivot ribbon shown below. Clicking
on the Manage button will launch the PowerPivot window shown in the next step.
Clicking on the
icon for From Other Sources will start the dialog for
importing data from other data sources, like PI OLEDB Enterprise. (From Other
Sources icon is
120
in Excel 2010.)
Select Others(OLEDB/ODBC)
121
Introduction
Select the All tab and then edit the Integrated Security
value by selecting this item from the list, clicking Edit
Value and typing SSPI in the edit dialog. This tells the
provider PowerPivot is going to attempt authentication via
Windows Integrated Security.
122
123
Introduction
124
The imported data will now appear in the PowerPivot window. Each dataset will have its
own worksheet and can be accessed by selecting the appropriate tab at the bottom of the
PowerPivot window.
125
Introduction
126
Technology
Rate
Coal
0.034
Biomass
0.054
Geothermal
0.069
Natural Gas
0.078
Wind
0.12
SQL table
Nuclear
0.083
Select the PowerPivot tab to access the PowerPivot ribbon. Within Get External Data, this
time select From Database and From SQL Server.
The profitability numbers for each generation technology have been
entered into the GenerationRates within the FleetGeneration SQL
database. Alternatively, the data can be brought in through an Excel
spreadsheet.
Within the table import wizard, the local SQL server and the target FleetGeneration database
can be specified. A default name of SqlServer PISRV1 FleetGeneration is built from the
connection type, SQL host server and the database name. This can be changes to something
more friendly, like Generation Rates
127
Introduction
Click next and choose to select from a list of tables to import the data. If we had a large
dataset, it would be preferable to write a query so that the input data can be filtered and joined
with any relevant tables, similar to our created Views within PI SQL Commander. That way
Excel does not need to parse an excessively large result file. As this table only has 6 rows,
we can bring in the entire table.
From the table selection, we have the option to bring in tables EmissionRates and
GenerationRates. The single connection can field requests to any list of tables within the
database, simplifying the data source establishment to be SQL database specific. Currently
we only want the GenerationRates table, so only select that row. Filtering conditions can also
be added here if we wanted to reduce the same set. A friendly name for the table can also be
used, such as Generation Rates
Once imported, the table will then be visible within the data model.
128
Excel Table
A similar process can be used to grab data from within an Excel worksheet, and create a linked table.
The profitability numbers for each generation technology have been entered into a separate
worksheet of the Student Starter spreadsheet named OtherTables. Copy the table into our
existing workbook. (The rate is $/KWh located under the Energy Cost under the Unit of
Measures.)
From the Insert Ribbon, select Table and specify the cells containing our generation rate data.
Give the table a meaningful name, such as GenerationRate, since the default is Table# where # is the
number in the sequence of table addition.
Place the cursor in any cell of the table, select the PowerPivot menu ribbon. From the PowerPivot
menu, select Add to Data Model.
This will link the data you have entered into Excel with the data in PowerPivot. Like the datasets we
already imported, each linked table will have its own tab at the bottom of the PowerPivot window. Since
the table in Excel does not support spaces, you may rename the table in PowerPivot to include a space.
129
Introduction
Objective:
Bring static data into Excel for use in creating production data cube.
Which method of importing data do you prefer? What the advantages and disadvantages of
each?
Approach:
Zip Code
Albertsville
55301
Beryl Ridge
52403
Carbondale
26241
Ebbitt
14605
Greenlawn
11740
Madison
28269
New Bedford
95115
Brick Canyon
26330
Carter
30627
Octavia
34470
Stampton
29684
Vicksberg
39180
Wolverine Station
35990
130
You can refresh data from the PowerPivot window using the Home ribbon and selecting
Refresh for the displayed table, or Refresh All for every table.
131
Introduction
Relationships can be created by dragging and dropping your cursor from one table field to
another.
132
The arrow will point in the direction of the table that has the fewer references. Note that in
the example above, we can create a relationship either on the Unit ID fields or Unit
Name fields. If the Unit Name is not unique in the Fleet Generation database, then the
relationship should be created using the unique Unit ID identifier.
If you want to verify the fields the relationship was built upon, the relationships can be
reviewed in greater detail through the Manager Relationship option under the Design tab in
PowerPivot.
133
Introduction
Relationships can also be configured directly from any PowerPivot table by right-clicking on
any column header and choosing Create Relationship from the menu.
134
Objective: Complete the relationships between tables within PowerPivot in order to add
dimensions to complete the data cube.
Approach:
Determine the fields to relate the remaining "Zip Codes and Generation Rates
tables.
135
Introduction
The (DAX) language is a new formula language that allows users to define custom
calculations in PowerPivot tables (calculated columns) and in Excel PivotTables (measures).
136
Like Excel formulas, to create a DAX formula, you type an equal sign, followed by a function name or
expression, and any required values or arguments.
DAX cannot reference only a few cells or a range of cells; DAX always works with
complete columns or tables.
If you want to use only particular values from a table or column, you can add filters
to the formula.
If you want to customize calculations on a row-by-row basis, PowerPivot provides
functions that let you use the current row value or a related value to perform
calculations that vary by context.
DAX includes a type of function (measure) that returns a table as its result, rather
than a single value. These functions can be used to provide input to other functions,
thus calculating values for entire tables or columns.
Some DAX functions provide time intelligence, which lets you create calculations
using meaningful ranges of dates, and compare the results across parallel periods.
You can use formulas in calculated columns, by adding a column and then typing an expression
in the formula bar. You create these formulas in the PowerPivot window. Applied to every row
in a column, but varies based on context.
You can use formulas in measures. You create these formulas in Excel, by clicking Add Measure
in an existing PowerPivot PivotTable or PivotChart. The design of the PivotTable and the choice
of row and column headings affects the values that are used in calculations.
Where DAX formulas differ from Excel formulas is that DAX functions work with tables and columns,
not ranges, and let you do sophisticated lookups to related values and related tables.
137
Introduction
Objective:
Create a Total Hourly Emissions calculation in the Unit Performance table.
Approach:
The RELATED function is required when you are including columns from another
table in your DAX equation.
DAX calculations follow a simple syntax. To specify a table column use, Table
Name[Column Name].
Table names can be omitted if they refer to columns in the same table, similar to
omitting worksheet names in Excel when creating calculated cells.
138
Objective: Add the cost calculation column to your PowerPivot Unit Performance table
using DAX. The RELATED function is required when you are including columns from
another table in your DAX equation.
Do you prefer having the calculations within AF as a formula data reference, or within
PowerPivot? What are some advantages and disadvantages of each?
Approach:
139
Introduction
140
141
Introduction
The Column Labels and Row Labels labels areas are for
specifying which items are to be used for the column and row
headers of the table, commonly known as dimensions.
Drag and drop the Region field from Unit Specifications to the
Rows field and Station from the Unit Specifications to the
Rows Field underneath the Region field.
If you place more than item into the Rows Labels or
Column Labels areas, they become nested in the report as
sub headings for either columns or rows. You can change the
nesting order by dragging items up and down within the area to reorder them. PowerPivot
will take care of changing the report.
142
Upon definition, the slicers consisted of a set of buttons that users can select, or multi-select
to set the report filters, and they can either be oriented vertically or horizontally on the
worksheet.
Slicers can be oriented vertically or horizontally. The option to insert slicers is located under
the Analyze tab of the PowerPivot Tools menu.
After some dragging and dropping, we can quickly configure the report shown below to
summarize generation by region and station. You will notice that the table is configured
dynamically as you drop items into different areas. Feel free to play around to get things
right, the way that is most useful for you.
143
Introduction
Objective:
Throughout the company, reports are generated and reviewed at meetings. You have been
requested to generate a report that all regions can use for production meetings so all managers
are referencing data in similar context.
Which region is producing the most power? How does this change for different operators?
Approach:
1. Review production management requirements.
2. Verify all 4 tables are in PowerPivot and the relationships are built.
3. Create a PowerPivot table that details the Stations and Regions and the power
being generated.
4. Add Slicers to the report for Technology and Operator.
Estimated time 20 minutes.
Table with Slicers:
144
145
Introduction
146
From the Number Format button, you can also specify the
precision of the aggregation.
147
Introduction
Objective:
Modify the layout of the report to reduce the adjustments required by the viewers of the
report.
Approach:
Review the report by selecting different slicing options observe how the
report changes. Is it visually appealing?
Modify report to reduce the adjustments the eyes have to make based on
filtering, collapsing of rows and columns, number format, etc.
148
149
Introduction
Captions and
filter drop downs
can be removed
through the
PivotTable
Options.
150
Format
d
dd
ddd
dddd
M
MM
MMM
MMMM
h
hh
m
mm
Description
Displays the day as a number without a leading zero.
Displays the day as a number with a leading zero.
Displays the day as an abbreviation.
Displays the day as a full name.
Displays the month as a number without a leading zero.
Displays the month as a number with a leading zero.
Displays the month as an abbreviation.
Displays the month as a full month name.
Displays the hour as a number without leading zeros.
Displays the hour as a number with leading zeros.
Displays the minute as a number without leading zeros.
Displays the minute as a number with leading zeros.
Description
Returns the number identifying the day of the week.
Returns the week number within a year.
Returns the date given integer representations for the year, month, and day.
More date formats and DAX functions can be found at the link below:
http://office.microsoft.com/en-us/excel-help/custom-date-and-time-formats-for-the-formatfunction-dax-HA102837261.aspx
http://technet.microsoft.com/en-us/library/ee634550.aspx
151
Introduction
Approach:
Create two DAX calculations to determine the weekday and hour from the time field.
Create two PivotCharts for the total gross generation segmented by the day of week
and by the hour of the day for all the operators.
152
153
Introduction
10.6 Slicers
As previously mentioned, slicers make selecting report filters an intuitive experience for
users. Slicers are created by PowerPivot whenever an item is dragged into the vertical or
horizontal Slicers areas in the PowerPivot Field List dialog. One feature of slicers that
makes them particularly useful is that they are aware of the relationships behind them. As
users make their sections in one slider group, buttons on the associated slicer groups will be
disabled if their selection will result in an empty dataset. This feature helps lead user to
successful analytic results and avoids wasted time in making selections that result in an
empty pivot table.
Slicers are always initially connected to the pivot table or chart from which they were
created. However, we often need to have a combination of several pivot tables and charts
within the same workbook to make our report effective. In many cases we need to have one
slicer act as a filter for more than one of these charts or tables.
The chart needs to be filtered by the Technology slicer.
If we were to configure the slicers for the chart, like we did for the PivotTable, PowerPivot
would generate two additional slicers in the report. These slicers would only control the chart
and the previously configured slicers would only control the table.
The existing slicers need to be configured to filter either the table and/or the chart.
Select the slicer to edit, then right click on box. Select the Report Connections option to
edit the items controlled by the selected slicer.
The dialog will display the options associated with the slicer and contained within the
working spreadsheet.
154
For our report, the Technology slicer will only connect to the table. However, for the
Operator slicer, we want to filter both the table and chart.
For pivot charts, PowerPivot actually creates a pivot table on another worksheet to support
the chart. In this example, the worksheet named Data for Weekday Gen Chart has been
created in the spreadsheet. This is where we need to connect the slicer to filter the chart. We
could select any of the other report tables, even though they are on other worksheets in the
spreadsheet.
If you are not sure what the name of your pivot table is, you can access it from the
PivotTable Tools menu, which appears anytime you select a cell in the pivot table. The
table name is shown at the far left of the ribbon. A good rule of practice is to give all of your
pivot tables and charts meaningful names so you can locate them easily when configuring
slicer connections.
155
Introduction
Approach:
1. Review the set-up of the slicers.
2. Connect the Technology slicer to the Chart.
Estimated time: 10 minutes
156
All visualizations start with a table which can be started by simply dragging and dropping
fields to the table area.
157
Introduction
In PowerView, you can quickly create a variety of data visualizations, from tables and matrices to bar,
column, and bubble charts, and sets of multiple charts. For every visualization you want to create, you
start on a Power View sheet by creating a table, which you then easily convert to other visualizations, to
find one best illustrates your data.
158
To create a table, click a table or field in the field list or drag a field from the field list
to the view. Power View draws the table in the view, displaying your actual data and
automatically adding column headings.
To convert a table to other visualizations, click a visualization type on the Design tab.
Depending on the data in your table, Power View enables and disables different
visualization types to give you the best visualization for that data.
TIP To create another visualization, start another table by clicking the blank view before selecting fields
from the fields section of the field list.
With a data item specified, a map can be added in PowerView use Bing map tiles, so you can zoom and
pan as you would with any other Bing map. Adding locations and fields places dots on the map. The
bigger the value, the bigger the dot. When you add a multi-value series, you get pie charts on the map,
with the size of the pie chart showing the size of the total.
159
Introduction
In a way, configuring reports in Power View is similar to PowerPivot. The tables and
columns of the PowerPivot database you are reporting against are shown in the list on the
upper right. Dragging down in to the fields below allow you to configure the report.
To add a second view to this report, select Power View under the
Power View or Insert ribbons. You should be brought to a blank
Silverlight canvas, ready to configure.
160
161
Introduction
The table below contains sample geospatial information for all units in Fleet
Generation. The full table of data is located in the OtherTables Excel Workbook
inside the Student Files folder. This data will need to be imported into the data cube.
Hint: This step can be accomplished through AF Tables or Linked Table in Excel.
City
Albertsville
Albertsville
Beryl Ridge
Beryl Ridge
Brick Canyon
Brick Canyon
Carbondale
Carbondale
Wolverine Station
162
Unit
Longitude
Latitude
45.267102
-93.742036
GAO02
45.267820
-93.741779
GAO01
41.955105
-91.542975
BCU02
41.957673
-91.542685
BCU01
39.317543
-80.163257
PLT02
37.722195
-89.225657
PLT01
37.723976
-89.224662
TCB06
34.066253
-86.303215
TCB05
45.267102
-93.742036
ALX01
From within SQL Commander, create a View for Inactivity and Temperature
Anomaly Event Frame data. (Hint: Create an Event Frame transpose function against
the Inactivity and Gas Turbine Temperature Anomaly templates. You will also need
to find the UnitID field for the event frames for the PowerPivot table relationships.
Look for PrimaryReferencedElementID)
Insert a map within PowerView to display the region of each of the units and the associated total
hourly carbon emissions.
Create a new spreadsheet and insert two PowerPivot charts for the number of event frames and
average duration of event frames.
Customize the display to make it more user friendly for later use and report generation.
You want to be able to use a calendar dropper to select start and end times for a trend. Since
PI ProcessBook does not have this functionality, you will have to use an ActiveX control
object to do this.
163
Introduction
Objective:
Allow the time range of a trend to be changed by date and time picker control objects.
Approach:
1. Create a new PI ProcessBook display file
2. Verify the display is in build mode
3. Add a trend for tag CDT158
4. Create two ActiveX controls
of type Microsoft Date and Time Picker Control
6.0
5. Create a Button with action set to Macro.
6. Create a Macro names SetTimeRange
7. Within the Microsoft Visual Basic editor, insert the following code:
Sub SetTimeRange()
Dim StartTime As Variant
Dim EndTime As Variant
StartTime = ThisDisplay.DTPicker1.Value
EndTime = ThisDisplay.DTPicker2.Value
164
Here is the primary property, method, and event you need to know:
Value_DataUpdate. This event triggers when a new value is received from the PI Data Archive for the
PI tag used in the "Value" object.
The Value object raises a DataUpdate event. This will serve as the trigger for the script.
To enable the symbols for scripting, select the Enable Scripting item in the menu. (In the
above item, the EnableScript option is grayed out since it is already set to TRUE as seen in
the Properties screen.)
166
Objectives:
Approach:
1. Open Alarm.pdi from the C:\StudentFiles\03-ProcessBook\Alarm\Alarm.pdi
2. Verify the display is in build mode.
3. Open the Visual Basic Editor
4. Create a break point in the code in the trend data update routine. To create a
breakpoint, select a line in the code, other than a Dim statement, by clicking in the
column to the left of the line.
5. Trace code within the routine use the debug application and step through the
program.
Note: While the code window is active, push F8 to step through the code.
167
Trend1
Trend2
Here are the properties, methods, and events you need to know:
Trend_TimeRangeChange. The TimeRangeChange event of the Trend object triggers when the user
changes the timerange of the trend. It returns two string variables (starttime and endtime) that
represent the new start and end time of the trend.
Object.SetTimeRange. This method sets the time range of the object. The object is typically a trend, a
bargraph, a value, or a display.
168
Objective:
Multiple Trends are contained in a display used by the control room. When reviewing the
trends, the operators must manually update their time ranges. Complaints regarding the
display need to be stopped by calling the TimeRangeChange routine when a trends time
range is changed.
Approach:
Note: It may be necessary to Enable Scripting on the symbol before it is seen in the code.
End Sub
Note: The name of the Symbol could vary, so double check the names. There is also a
programmatic way to find all trend symbols in a display, as shown in the next section.
169
Value
Value1
Value2
Value3
Value4
Trend
Here are the properties, methods, and events you need to know:
Trend_DropCursor. This event triggers when a user drops a cursor on a trend. It returns the string
variable newtime that is the timestamp of the location of the cursor.
Symbols.item(i).Type. ProcessBook has many types of symbols. They are defined in the library
PBObjLib. In this example, we test the symbol type against the Class ID pbSymbolValue, a constant
that represents type 7, the Value symbol. (See the online help for VBA in PI ProcessBook at
\\program files\pipc\help\EN\pipbvb.chm for more information. This is also available from inside the
VBA editor in ProcessBook. Open a code page, highlight a ProcessBook VBA property or method,
and press F1 to launch the help file.)
170
171
Exercise Objectives
Open DropCurs_Blank.PDI and add the code that allows the dynamic values to keep in sync with the
trend.
Note: This answer can be found in the file dropcurs1.pdi in the course files. The file dropcurs2.pdi
illustrates an alternate way of selecting the dynamic values, and dropcurs3.pdi illustrates how to use
multiple trends.
172
173
appX
pbkY
tndZ
tag1
As
As
As
As
PBObjLib.Application
PBObjLib.ProcBook
PBSymLib.Trend
String
AppX, pbkY, and tndZ are variables that will be used as stand ins for PI
ProcessBook objects. As such they are defined as the proper object types from the PBObjLib
and PBSymLib type libraries.
Use an if/then statement to determine whether or not ProcessBook is running. In either event,
set a reference to ProcessBook Application object in the variable appX.
On Error Resume Next
Set appX = GetObject(, "piprocessbook.application.2")
On Error GoTo errHandler
If appX Is Nothing Then
Set appX = CreateObject("piprocessbook.application.2")
End If
The set command is a keyword used to create a new instance of an ActiveX Automation
object. In this case, the variable appX is being created as an instance of a PI ProcessBook
object. We will later use appX to drill down through the entire ProcessBook object model.
Notice that if the GetObject fails, the CreateObject is invoked. We do this so that we can
determine first if ProcessBook is already running by using GetObject. If GetObject fails, we
can be certain that ProcessBook is not running, so we launch ProcessBook using
CreateObject.
174
Note: You may wonder what the phrase PIProcessBook.application.2 means. This is a
reserved phrase that OSI has chosen to represent the PI ProcessBook class. It is stored in the
Windows registry. Any program that needs to manipulate PI ProcessBook objects must use
this phrase with the GetObject or CreateObject command to locate the proper DLL associated
with PI ProcessBook objects. This is a standard ActiveX Automation technique. For example,
if you want to manipulate Excel objects you also use GetObject with a specific reserved
phrase:
Set xlobj = GetObject(, "Excel.Application")
Create a Display to Trend Selected Tags
The previous two examples used existing ProcessBook displays. This example creates a new
display. When the user clicks on the Create a Display button, PI ProcessBook will
launch (if it is not already launched) and create a new display named MyNewDisplay. The
Visual Basic script generates a new trend using the tag name selected from the cell by the
user.
This is new to the example:
Displays.Add. The method to create a new display. If you intend to keep the display you
should invoke the Display.Save or .SaveAs method.
Note: You can use the file PBExtScr_blank.xlsx in the course files as a template. This file that contains all
the objects (like trends, command buttons etc.) but no VBA code. Use this to try to complete the exercise
without looking at the solution. This example is Button1_Click() in Module1
175
Solution
Private Sub Button1_Click()
Dim appX As PBObjLib.Application
Dim disY As PBObjLib.Display
Dim tndZ As PBSymLib.Trend
Dim tag1 As String
' If ProcessBook is not already open, launch it.
On Error Resume Next
Set appX = GetObject(, "piprocessbook.application.2")
On Error GoTo errHandler
If appX Is Nothing Then
Set appX = CreateObject("piprocessbook.application.2")
End If
'Add a new display to the displays collection.
Set disY = appX.Displays.Add("MyNewDisplay")
'Copy the tag name from the active cell in the spreadsheet.
tag1 = ActiveCell.Value ' Take tag name from the active cell.
' You have the option to concatenate the node name to the tag name.
' using the \\servername\tagname format. Use this if you want to
' trend a tag that is not on the default PI Data Archive.
'tag1 = "\\localhost\" & tag1
'Add a new symbol of the appropriate type (trend) to the symbols collection.
'Note: we can use pbSymbolTrend because we made reference to the
'PBSymLib and PBObjLib libraries in Tools>References.
Set tndZ = disY.Symbols.Add(pbSymbolTrend) ' Adds a trend symbol to the display.
'Change the shape and location of the new trend to fit the display.
tndZ.Top = 15000
tndZ.Left = -15000
tndZ.Height = 200
tndZ.Width = 1000
tndz.Maximize True
'Add a trace to the trend.
tndZ.addtrace (tag1) ' Add the tag to the trend created above.
disY.Modified = False
' Bring Processbook to foreground
AppActivate ("PI ProcessBook")
Exit Sub
errHandler:
MsgBox ("Error occurred: " & Err.Description)
End Sub
Note: This answer can be found in the file PBExtScr.xlsx in the course files under the Button1_Click
event.
176
Parameter
%..\Element%
%..|Attribute%
%@Attribute%
%\Element%
%<Environment Variable>%
%Analysis%
%Attribute%
%AttributeId%
%Database%
%Description%
%Element%
%ElementDescription%
%ElementId%
%EndTime%
177
%Model%
%Server%
%StartTime%
%System%
%Time%
%UtcEndTime%
%UtcStartTime%
%UtcTime%
.\
[.]
[@filter=text]
[@Index=#]
178
179
Syntax Requirements
Examples
Numbers
Tagnames
(none)
In single quotes
PI Time Expressions
Strings
Functions
In single quotes
In double quotes
Must be a Performance
Equation function
Math Functions
Name
Description
Abs
Asin
Acos
Atn
Atn2
Cos
Cosh
Exp
Absolute value
Arc sine
Arc cosine
Arc tangent
Arc tangent (two arguments)
Cosine
Hyperbolic cosine
Exponential
Float
Frac
Int
Log
Log10
Poly
Round
Sgn
Sin
Sinh
Sqr
Tanh
Tan
Trunc
Tangent
Truncate to next smaller unit
180
Aggregate Functions
Name
Description
Avg
Max
Median
Min
PStDev
Average
Maximum
Median selector
Minimum
Population standard deviation
SStDev
Total
Miscellaneous Functions
Name
Description
BadVal
Curve
DigState
IsDST
StateNo
TagBad
IsSet
PI Archive Retrieval
Name
Description
NextEvent
NextVal
PrevEvent
PrevVal
TagVal
PI Archive Search
Name
Description
FindEq
FindGE
FindGT
FindLE
FindLT
FindNE
TimeEq
TimeGE
TimeGT
TimeLE
181
TimeLT
TimeNE
PI Archive Statistics
Name
Description
EventCount
PctGood
Range
StDev
TagAvg
TagMean
TagMax
TagMin
TagTot
Event-weighted average
Maximum value in a period
Minimum value in a period
Time integral over a period
Point Attributes
Name
Description
TagDesc
TagEU
TagExDesc
TagName
TagNum
TagSource
TagSpan
TagType
TagTypVal
TagZero
Time Functions
Name
Description
Bod
Bom
Bonm
Day
DaySec
Hour
Minute
Month
Noon
ParseTime
182
Second
Weekday
Year
Yearday
String Functions
Name
Description
Ascii
Char
Compare
DigText
Format
InStr
LCase
Len
Left
LTrim
Mid
Right
RTrim
Trim
UCase
String Conversion
Name
Description
Concat
String
Text
183
184