26
© Copyright 2012 OSIsoft, LLC. Presented by How Can R Enhance Analytics on PI System Data? Ahmad Fattahi, OSIsoft, LLC Marcos Vainer Loeff, OSIsoft, LLC

How Can R Enhance Analytics on PI System Data?

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

© Copyr i gh t 2012 OSIso f t , LLC.

Presented by

How Can R Enhance Analytics

on PI System Data?

Ahmad Fattahi, OSIsoft, LLC

Marcos Vainer Loeff, OSIsoft, LLC

© Copyr i gh t 2012 OSIso f t , LLC.

What Is R?

2

© Copyr i gh t 2012 OSIso f t , LLC.

The R Project for Statistical Computing

3

• R-project.org: R is a free software environment for statistical

computing and graphics. It compiles and runs on a wide

variety of UNIX platforms, Windows and MacOS.

• Effective data handling

• A suite of operators for arrays and matrices

• Graphical facilities for data analysis and display

• A well-developed, simple and effective programming language

© Copyr i gh t 2012 OSIso f t , LLC.

R Popularity

4

Source: Revolution Analytics

Books sold

2011 over 2010

© Copyr i gh t 2012 OSIso f t , LLC.

R Adoption

• Among top 5 open source platforms for Big Data

(TechCrunch)

• Statistics and data science schools

• Big companies for R&D

• Commercial version in production

• Revolution Analytics

5

© Copyr i gh t 2012 OSIso f t , LLC.

What Can R Do Best?

• Number Crunching

• Statistical Analysis

• Data Binning

• Regression Analysis

• Correlation Analysis

• Machine Learning

• Great Visuals!

6

© Copyr i gh t 2012 OSIso f t , LLC.

Example - Correlogram

7

• Correlation in an

effective visual way

© Copyr i gh t 2012 OSIso f t , LLC.

Example - Distribution

8

• Distribution analysis

© Copyr i gh t 2012 OSIso f t , LLC.

Example - Binning

• Binning data into

categories

9

© Copyr i gh t 2012 OSIso f t , LLC.

Example - Correlation

• Descriptive Statistics:

Correlation

10

© Copyr i gh t 2012 OSIso f t , LLC. 11

© Copyr i gh t 2012 OSIso f t , LLC.

Why Integrating With the PI

System?

12

© Copyr i gh t 2012 OSIso f t , LLC.

Perfect Synergy

• PI System is the Enterprise Data Infrastructure

• R can make sense of lots of data

• PI System Data Access allows efficient

integration – Results can be put back

• R can be hooked to Hadoop and other

unstructured databases (RHadoop)

13

© Copyr i gh t 2012 OSIso f t , LLC.

Possible Architectures

14

AF Server

PI Server

R.NET

RJDBC

PI/AF SDK

PI OLEDB

PI Web Services

PI JDBC

Flat Text File Power Shell – PI

DataLink - UFL

© Copyr i gh t 2012 OSIso f t , LLC.

Integration with the PI

System and Examples

15

© Copyr i gh t 2012 OSIso f t , LLC.

Transferring Data Through Files

1. Export data

from PI Server

to txt files

2. Transfer data to R

3. Do some

calculations and/or

plot some graphics

PowerTemp.df <- read.csv(file='C:\\Data\\SL - Power - Temp - 1year - Cleaned.csv', header=TRUE)

© Copyr i gh t 2012 OSIso f t , LLC.

How to install R.NET?

• Version 1.4

Download from: http://rdotnet.codeplex.com

Many known issues detected

• Version 1.5

Available in NuGet Gallery

Requires Package Manager Console.

© Copyr i gh t 2012 OSIso f t , LLC.

Classes in R.NET R R.NET .NET Framework

character vector RDotNet.CharacterVector System.String[]

integer vector RDotNet.IntegerVector System.Int32[]

real vector RDotNet.NumericVector System.Double[]

complex vector RDotNet.ComplexVector System.Numerics.Complex[]

raw vector RDotNet.RawVector System.Byte[]

logical vector RDotNet.LogicalVector System.Boolean[]

character matrix RDotNet.CharacterMatrix System.String[, ]

integer matrix RDotNet.IntegerMatrix System.Int32[, ]

real matrix RDotNet.NumericMatrix System.Double[, ]

complex matrix RDotNet.ComplexMatrix System.Numerics.Complex[, ]

raw matrix RDotNet.RawMatrix System.Byte[, ]

logical matrix RDotNet.LogicalMatrix System.Boolean[, ]

list RDotNet.GenericVector

data frame RDotNet.GenericVector

data frame RDotNet.DataFrame

function RDotNet.Function

NumericVector NumVec = engine.Evaluate("1:20 + 0.4354").AsNumeric();

double[] double_array = engine.Evaluate("1:20 + 0.4354").AsNumeric().AsArray();

© Copyr i gh t 2012 OSIso f t , LLC.

Windows Application

1. Get values

from PI Server 2. Convert PI

System

objects to R

objects

3. Transfer data to R 4. Plot some

graphics

© Copyr i gh t 2012 OSIso f t , LLC. 20

© Copyr i gh t 2012 OSIso f t , LLC.

PI ACE Project

3. Transfer data to R

4. Do some

calculations

5. Transfer results

back to PI ACE

7. Sends calculated

values to PI Points

2. Convert PI

SDK to R

objects

6. Convert R to

PI SDK objects

1. Get values

from PI Server

Input tags:

sinusoid

cdt158

Output tags:

Sd_sinusoid

Sd_cdt158

Cor_cdt158_sinusoid

© Copyr i gh t 2012 OSIso f t , LLC.

Using R.NET

Initialization

Converting objects

© Copyr i gh t 2012 OSIso f t , LLC.

Concluding Remarks

23

© Copyr i gh t 2012 OSIso f t , LLC.

What to Take Home?

• R is a powerful programming environment

• R can do statistics and visuals

• R is free

• PI System handles all enterprise data

• PI System and R are good matches to marry!

• The marriage can be very fruitful

24

© Copyr i gh t 2012 OSIso f t , LLC.

Ahmad Fattahi

vCampus Team Member

OSIsoft, LLC

[email protected]

25

Marcos Loeff

vCampus Rotational

Engineer

OSIsoft, LLC

[email protected]

THANK YOU

© Copyr i gh t 2012 OSIso f t , LLC.