1998 PI System Users’ Conference 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
1998 PI System Users’ Conference 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
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 page WYSIWYG editing of the table, form controls Visual InterDev for the server Tools for managing data sources Code editor features for scripts
1998 PI System Users’ Conference Forms 101 Start a form: specify an action The values of the form fields are passed to the ASP page as pairs
1998 PI System Users’ Conference Forms 101 (cont’d) Use an HTML table to align input fields User ID: Password: Specify Tag: 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 <input type="submit" name="B1" value="Retrieve Avgs">
1998 PI System Users’ Conference Browser Return HTML Request HTML 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 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 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)
1998 PI System Users’ Conference ASP - ADO (cont’d) Create table cells as you step through the data Hourly Averages <% CurrentRecord = 0 Do While CheckRS(RS) If CurrentRecord = 0 Then %> Value Percent Good <% RS.MoveNext CurrentRecord = CurrentRecord + 1 Loop %>
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 page Visual 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 <% Rem Derive the proper PNG filename imgname = "../pbimgs/" + Request("Display") + ".png" Rem Save the filename for use outside this script scope Session("PNGname") = imgname %> ">
1998 PI System Users’ Conference Rich Presentation
1998 PI System Users’ Conference 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
1998 PI System Users’ Conference Requirements Windows Internet Explorer PI-ProcessBook
1998 PI System Users’ Conference Getting ProcessBook Install from a self-extracting executable Large file Licensing issues Add a link Install PI-ProcessBook 2.0 Make sure the.exe is not in a directory with execute permissions
1998 PI System Users’ Conference Tools Microsoft FrontPage WYSIWYG layout of the page Syntax 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”
1998 PI System Users’ Conference Get the Component Allow for component download <object id="Display" name="Display" classid="clsid:4F26B D A0C931BFC8" codebase="pbdctrl.ocx" border="0" width="590" height="273">
1998 PI System Users’ Conference Specify a Display Provide the URL of a PI-ProcessBook display file <object id="Display" name="Display" classid="clsid:4F26B D A0C931BFC8" codebase="pbdctrl.ocx" border="0" width="590" height="273"><param name="DisplayURL" valuetype="ref" value="demo.pdi">
1998 PI System Users’ Conference Automate the Display Two Properties DisplayURL to change display files Display to access the display object model, e.g., MyDisplay.Display.SetTimeRange “*-4h”, “*-1h”
1998 PI System Users’ Conference 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
1998 PI System Users’ Conference 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