1 / 27

PI on the Web: A Primer for PI Users

PI on the Web: A Primer for PI Users. Omicron Consulting 1998 PI System Users’ Conference. Why Put PI Data on Web Pages?. Cheap seats for occasional users Quick access net-wide Get closer to your customers. Plain Vanilla vs. Rich Presentation. Plain Vanilla Any browser, any platform

issac
Download Presentation

PI on the Web: A Primer for PI Users

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Why Put PI Data on Web Pages? • Cheap seats for occasional users • Quick access net-wide • Get closer to your customers

  3. Plain Vanilla vs. Rich Presentation • Plain Vanilla • Any browser, any platform • No special configuration at the client • Ad hoc static slice of data • Rich Presentation • Rich features of PI & COM • More muscle on the client • Configuration and licensing

  4. Plain Vanilla HTML

  5. How Does the User Get There?

  6. Tools • Microsoft FrontPage for the gateway page • WYSIWYG editing of the table, form controls • Visual InterDev for the server • Tools for managing data sources • Code editor features for scripts

  7. 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

  8. 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

  9. 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>

  10. ReturnHTML RequestHTML PI HTML and ADO WWW Server Browser *.ASP IIS HTTP ADO OLEDB PI-ODBC Files

  11. 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

  12. ASP - ADO (cont’d) • Format and execute a query tag = 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)

  13. 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>

  14. 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

  15. Tools • FrontPage to layout the gateway page • Visual InterDev • No visual component to the ASP, just scripts • PI-ProcessBook to configure display files, run the script

  16. 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>

  17. Rich Presentation

  18. You Are There! • Self-contained • Starting parameters are defined in the page • Displays are linked into the page • Interactive • Scripts may allow users to modify page parameters • Displays may update within the page

  19. Requirements • Windows • Internet Explorer • PI-ProcessBook

  20. Getting ProcessBook • Install from a self-extracting executable • Large file • Licensing 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

  21. Tools • Microsoft FrontPage • WYSIWYG layout of the page • Syntax for embedded objects handled for you • PI-ProcessBook to configure display files

  22. 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>

  23. 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>

  24. 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>

  25. Automate the Display • Two Properties • DisplayURL to change display files • Display to access the display object model, e.g., MyDisplay.Display.SetTimeRange “*-4h”, “*-1h”

  26. Security Issues • Plain vanilla • Security is controlled on the server • ASPs must have script or execute permission • ISAPI DLLs must have execute permission • No special requirements for the client • Rich Presentation • Open the PI port number in the firewall to update a display outside the firewall

  27. Summary • Pick a Suitable Model • Create ASPs or HTML • Support configuration • PI-ProcessBook network installation • Display component download • Security Issues • Create display files if needed

More Related