1998 pi system users’ conference pi on the web: a primer for pi users omicron consulting 1998 pi...

27
1998 PI System Users’ Conference PI on the Web: A Primer for PI Users Omicron Consulting 1998 PI System Users’ Conference

Upload: ruth-mcdonald

Post on 27-Dec-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

1998 PI System Users’ Conference

PI on the Web: A Primer for PI Users

Omicron Consulting

1998 PI System Users’ Conference

1998 PI System Users’ Conference

Why Put PI Data on Web Pages?

Cheap seats for occasional usersQuick access net-wideGet closer to your customers

1998 PI System Users’ Conference

Plain Vanilla vs. Rich Presentation

Plain VanillaAny browser, any platformNo special configuration at the clientAd hoc static slice of data

Rich PresentationRich features of PI & COMMore muscle on the clientConfiguration and licensing

1998 PI System Users’ Conference

Plain Vanilla HTML

1998 PI System Users’ Conference

How Does the User Get There?

1998 PI System Users’ Conference

Tools

Microsoft FrontPage for the gateway pageWYSIWYG editing of the table, form controls

Visual InterDev for the serverTools for managing data sourcesCode editor features for scripts

1998 PI System Users’ Conference

Forms 101

Start a form: specify an action<!-- Create a form. The action is to POST the form to scripts/pi_gate.asp. -->

<form action="scripts/pi_gate.asp" method="POST">

<div align="center"><center>

The values of the form fields are passed to the ASP page as <name, value> pairs

1998 PI System Users’ Conference

Forms 101 (cont’d)

Use an HTML table to align input fields<table border="0" cellspacing="4" width="40%" ><tr>

<td width="50%"><font size="3" face="Arial"><strong>User ID:</strong></font></td>

<td width="50%" ><input type="text" size="20” name="UID" value="pidemo"></td></tr>

<tr>

<td width="50%"><font face="Arial"><strong>Password:</strong></font></td>

<td width="50%"><input type="password" size="20” name="pwd" value="pidemo"></td></tr>

<tr>

<td width="50%"><font size="3" face="Arial"><strong>Specify Tag:</strong></font><font face="Arial"> </font></td>

Other options: pick source names for different servers, views

1998 PI System Users’ Conference

Forms 101 (cont’d)

End the table, add a button to submit the form

</table>

</center></div><p align="center"><input type="submit"

name="B1" value="Retrieve Avgs"></p>

</form>

1998 PI System Users’ Conference

Browser

ReturnHTML

RequestHTML

HTML and ADO

HTTP

PI

WWW Server

IIS

Files

*.ASP

ADO

PI-ODBC

OLEDB

1998 PI System Users’ Conference

ASP: COM meets PI-ODBC

• Use Active Data Objects (ADO) to manipulate ODBC on the server

• Include SQL utilities

<!--#include file="ADOVBS.inc"-->

<!--#include file="IASUtil.asp"-->

• Make a connection to an ODBC DSN

ConnectionString = "dsn=PISource;UID=" & Request("UID") & ";pwd=" & Request("pwd")

Set Connection = Server.CreateObject("ADODB.Connection")

Connection.Open ConnectionString

1998 PI System Users’ Conference

ASP - ADO (cont’d)

Format and execute a querytag = SQLEncode(Request("tag"))

start_time = SQLEncode(Request("start"))

end_time = SQLEncode(Request("end"))

SQLStmt = "SELECT value, pctgood "

SQLStmt = SQLStmt & "FROM piavg "

SQLStmt = SQLStmt & "WHERE tag = '" & tag & "' AND time >= DATE('" & start_time & "') "

SQLStmt = SQLStmt & "AND time <= DATE('" & end_time & "') AND timestep =RELDATE(""1h"") "

Set RS = Connection.Execute(SQLStmt)

1998 PI System Users’ Conference

ASP - ADO (cont’d)

Create table cells as you step through the data

<table border="4"><caption align="top"><strong>Hourly Averages</strong></caption>

<% CurrentRecord = 0

Do While CheckRS(RS)

If CurrentRecord = 0 Then %>

<tr>

<th><b>Value</b></th>

<th><b>Percent Good</b></th>

</tr>

<% End If %> <tr><td><%= RS("value") %></td>

<td><%= RS("pctgood") %></td></tr><% RS.MoveNext

CurrentRecord = CurrentRecord + 1

Loop %></table>

1998 PI System Users’ Conference

Plain Vanilla Part II: Displays

PI-ProcessBook 2.0 adds VBA scripting and the ability to save displays to Web related formats

Server-side app periodically saves a live display to a static-format file

ASP page generates a page with a link to the requested image

1998 PI System Users’ Conference

Tools

FrontPage to layout the gateway pageVisual InterDev

No visual component to the ASP, just scripts

PI-ProcessBook to configure display files, run the script

1998 PI System Users’ Conference

Plain Vanilla Displays: The Code<body>

<%

Rem Derive the proper PNG filename

imgname = "../pbimgs/" + Request("Display") + ".png"

Rem Save the filename for use outside this script scope

Session("PNGname") = imgname

%>

<p><img src="<%=Session("PNGname")%>"> </p>

</body>

1998 PI System Users’ Conference

Rich Presentation

1998 PI System Users’ Conference

You Are There!

Self-contained Starting parameters are defined in the pageDisplays are linked into the page

InteractiveScripts may allow users to modify page

parametersDisplays may update within the page

1998 PI System Users’ Conference

Requirements

WindowsInternet ExplorerPI-ProcessBook

1998 PI System Users’ Conference

Getting ProcessBook

Install from a self-extracting executableLarge fileLicensing issues

Add a link<a href="pb20b2.exe">Install PI-ProcessBook

2.0</a>

Make sure the .exe is not in a directory with execute permissions

1998 PI System Users’ Conference

Tools

Microsoft FrontPageWYSIWYG layout of the pageSyntax for embedded objects handled for you

PI-ProcessBook to configure display files

1998 PI System Users’ Conference

Embedding Displays in HTML

First embed an instance of the “PI Display Document”

<object id="Display" name="Display” classid="clsid:4F26B906-2854-11D1-9597-00A0C931BFC8” border="0" width="590" height="273></object>

1998 PI System Users’ Conference

Get the Component

Allow for component download<object id="Display" name="Display"

classid="clsid:4F26B906-2854-11D1-9597-00A0C931BFC8"

codebase="pbdctrl.ocx" border="0" width="590" height="273"></object>

1998 PI System Users’ Conference

Specify a Display

Provide the URL of a PI-ProcessBook display file

<object id="Display" name="Display"

classid="clsid:4F26B906-2854-11D1-9597-00A0C931BFC8"

codebase="pbdctrl.ocx" border="0" width="590" height="273"><param

name="DisplayURL" valuetype="ref" value="demo.pdi"></object>

1998 PI System Users’ Conference

Automate the Display

Two PropertiesDisplayURL to change display filesDisplay to access the display object model, e.g.,

MyDisplay.Display.SetTimeRange “*-4h”, “*-1h”

1998 PI System Users’ Conference

Security Issues

Plain vanillaSecurity is controlled on the serverASPs must have script or execute permissionISAPI DLLs must have execute permissionNo special requirements for the client

Rich PresentationOpen the PI port number in the firewall to

update a display outside the firewall

1998 PI System Users’ Conference

Summary

Pick a Suitable ModelCreate ASPs or HTMLSupport configuration

PI-ProcessBook network installationDisplay component downloadSecurity Issues

Create display files if needed