coding for ocs - osisoft · 2018. 4. 30. · #osisoftuc #piworld ©2018 osisoft, llc planned agenda...

82
#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Coding for OCS Derek Endres Software Developer Research [email protected] 1

Upload: others

Post on 16-Sep-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Coding for OCSDerek Endres

Software Developer – Research

[email protected]

1

Page 2: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Planned Agenda

• Intro (~20 min)• Presentation formalities

• Intro to OCS

• Detail of what I am going to do

• Building the app (~55 min)

• Ending (~15)• Wrap-up

• Questions

2

Page 3: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Who am I

• 6+ years at OSI

• Role • Research Software Developer

• Previous Roles• AF UI developer

• Tech Support Escalation Engineer

• Tech Support Engineer/Field Service Engineer

• Mechanical Engineer by degree

• Numerous programming languages

3

Page 4: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Who I am not

• Not an OCS Software Developer/Product Manager• I am knowledgeable on OCS

• I might defer to other people with specific questions

• Not connected or related to Google at all

4

Page 5: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Questions?

• Will have time at the end

• Reach out to me: [email protected]

5

Page 6: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Comments on OCS

• http://feedback.osisoft.com• There is an area for OSIsoft Cloud Services

6

Page 7: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Want OCS?

• https://cloud.osisoft.com/• Request to join preview

7

Page 8: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

OCS Introduction

8

Page 9: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Edge Data

Edge Data

Enterprise Data

PI Server

On Premises

Page 10: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 10

OSIsoft Cloud Services

Ingress

Context

Ad

min

istr

ati

on

Community

Storage REST A

PIs

OSIsoft Messaging Format (OMF)

Visualization

OMF

ApplicationsOpen

Source

Edge Data

Store

PI

ConnectorsPI

Systems

Page 11: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Remote Operations Monitoring

Connected Community

Data Science Enablement

OSIsoft Cloud Services (OCS)

11

Initial Customer Scenarios

Page 12: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 12

OSIsoft Cloud Services (OCS) Overview

• Managed, secure, data platform• Multi-tenant

• PaaS & SaaS

• High speed, scalable, elastic

• Flexible, resilient, data storage

• Modern, secure REST APIs

• Security based on Windows Azure Active Directory (WAAD)

• Operated & maintained by OSIsoft

• Built and deployed in Microsoft Azure public cloud

• …

OSIsoft Cloud Services

https://cloud.osisoft.com/

Page 13: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Ingress Overview

• RESTful ingress

• OSIsoft Message Format• OMF v1.0

• High throughput

• Low maintenance

• Distributed storage layer• CRUD

• “Open Access”• Almost any language

• Security based on WAAD

• Redundancy

• High fidelity

• Scalable & elastic

13

Storage Overview

Page 14: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

OCS Data Storageis a (Time) Series Database

14

Page 15: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Ingress & Storage: How to Represent Data?

{ "temperature":"30.43","timestamp":"2016-04-..." }

{ "pressure":"101.5","timestamp":"2016-04-..." }

{ "heart-rate":"143","timestamp":"2016-04-..." }

{ "latitude":"29.7817","timestamp":"2016-04-..." }

{ "longitude":"-95.6112","timestamp":"2016-04-..." }

{ "heading":"42","timestamp":"2016-04-..." }

{ "latitude":"29.7817","longitude":"-95.6112","heading":"42","heart-rate":"143","temperature":"30.43","pressure":"101.5","timestamp":"2016-04-..." }

Individual sensors “Fitness band”

If you like… You might also enjoy…

15

Page 16: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Organizing data… Namespaces / Types / Streams / Events

16

Account: Annual Analytics

Namespace: Drilling Data Namespace: Meters

Type: Simple measurement

Stream: Platform 432-NStream: Platform 432-N

Stream: Platform 432-N

New eventNew eventNew eventNew eventNew event

Type Type

Type Type

Page 17: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Data Structure: Types – Simple Cases

17

Type: Simple Double

Timestamp: DateTime

Value: Double

Quality info: Boolean

Type: Simple Integer

Timestamp: DateTime

Value: Integer

Quality info: Boolean

Page 18: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Data Structure: Types – Complex Cases

18

Type: Platform pressure

Timestamp: DateTime

Pressure: Double

Edited: DateTime?

Depth: Double

Area code: Integer

Quality info: String

Type: Batch measurement

Lot number: Integer

pH: Single

Tested: DateTime?

Color: String

Weight: Double

Quality info: String

Page 19: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Stream: Platform 434-E

Type: Complex type

Name: Platform 432-N

Description: Fronts…

Tags: Drilling, EU,…

Indexes: Depth, Time…

Stream: Platform 433-S

Type: Complex type

Name: Platform 432-N

Description: Fronts…

Tags: Drilling, EU,…

Indexes: Depth, Time…

Data Storage: Streams (instances of a Type)

19

Type: Platform pressure

Timestamp: DateTime

Pressure: Double

Edited: DateTime?

Depth: Double

Area code: Integer

Quality info: String

Stream: Platform 432-N

Type: Platform pressure

Name: Platform 432-N

Description: Fronts…

Tags: Drilling, EU,…

Indexes: Depth, Time…

Page 20: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

End of High level OCS Overview

• More detailed questions? Contact me and I can help get you to the right person

20

Page 21: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

What we are going to do Today

• Explore the OCS APIs for retrieving and sending data

21

Page 22: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Goals:

• I want get data from OCS• I need to understand and be able to interact with namespaces and

streams to get to the data.

• I want to send data to OCS• I need to be able to create the type and streams to be able to send

data

22

Page 23: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Assumptions

• Already Have:• Tenant

• Client Key

• Namespace

23

Page 24: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Details

• In this session we use Google Sheets as our way to view and get the data

24

Page 25: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Coding in Google Scripts

• .GS file – Javascript run Server side (Google Cloud)• Once saved it works automatically

• Functions can be called directly in spreadsheet • Can be made private and can add some help to function pop up in spreadsheet

• Can put in .HTML files • Run client side (local browser)

• Must refresh spreadsheet if you add or update these files

• Not being used in this

25

Page 26: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Coding in Google Scripts pt 2

• UrlFetchApp(url, options) – Easiest way to interact with a URL• Options includes: post/put/get, headers

• A Cell reference in function call brings the values into the function like sending it in via double quotes

• Output of function goes to cells. • Array of strings (ints, doubles) goes in a column

• 2-D array gives you rows and columns

• Console.log sends to Stackdriver Logs

26

Page 27: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Code Time

• Auth

• Namespaces

• Streams

• Data

• Send Data

• Send Stream

• Send Type

27

Page 28: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

First Need to get OAuth Bearer Token

• Given in samples (Next Slide)

• Headers• Authorization

• Bearer {token}

28

Page 29: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 29

Page 30: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 30

Page 31: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 31

Page 32: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Now we can get Namespaces

32

Page 33: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 33

Page 34: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 34

Page 35: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 35

Page 36: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Streams

36

Page 37: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 37

Page 38: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 38

Page 39: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 39

Page 40: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 40

Page 41: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Time For Data!!!

• Will do First Data first.

41

Page 42: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 42

Page 43: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 43

Page 44: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 44

Page 45: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 45

Page 46: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Get Last Value

• Follows the same format as get first value

46

Page 47: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Not too bad, lets move on to a harder one

• Get Range Values

47

Page 48: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 48

Page 49: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 49

Page 50: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 50

Page 51: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 51

Page 52: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 52

Page 53: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 53

Page 54: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Awesome we have more data in Sheets

• Can extrapolate what I have out to the other data reading functions pretty easily

• Just add the function call

• Create the URL

• Add the parameters if they are entered and then let the magic work

54

Page 55: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Possible calls for data

• Get Value

• Get First Value

• Get Last Value

• Get Distinct Value

• Find Distinct Value

• Get Values

• Get Range Values

• Get Window Values

• Get Intervals

55

Page 56: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Now lets send data back into OCS

• Note these examples show the function quoted out because if you keep the function running in Google Sheets it sends it multiple times

• It also becomes Hidden because Sheets just displays the result of the function call

56

Page 57: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 57

Page 58: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 58

Page 59: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 59

Page 60: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 60

Page 61: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 61

Page 62: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 62

Page 63: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Awesome we have data going to OCS

• Note sending the data is interesting this way

• You have to be careful it gets called every time the page refreshes (OCS gives an “error” if you try to insert a value at an index that already has values, so it doesn’t overwrite it or put another one there).

63

Page 64: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Next Thing?

• Create a Stream

64

Page 65: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 65

Page 66: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 66

Page 67: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 67

Page 68: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 68

Page 69: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Next Thing??

• Ok, we can create a Type

69

Page 70: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 70

Page 71: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 71

Page 72: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 72

Page 73: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 73

Page 74: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 74

Page 75: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 75

Page 76: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 76

Page 77: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Recap

• Can send • Data

• Stream

• Type

• Data and type both need a table in order to form the data, can we send all together?

77

Page 78: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC 78

Page 79: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Awesome

79

Page 80: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Final Thoughts

• This is just an introduction• For more details try it and let us know and we can build a deeper dive

• Get OCS• Help shape the data APIs with the calls you need to get the data you

need

80

Page 81: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

Questions

Please wait for the

microphone before asking

your questions

State your

name & company

Please remember to…

Complete the Online Survey

for this session

81

Page 82: Coding for OCS - OSIsoft · 2018. 4. 30. · #OSIsoftUC #PIWorld ©2018 OSIsoft, LLC Planned Agenda •Intro (~20 min) •Presentation formalities •Intro to OCS •Detail of what

#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC#OSIsoftUC #PIWorld ©2018 OSIsoft, LLC

[email protected]

Thank You

Merci

Grazie

82