Is there any way to get access to a trend object using PI SDK?
Like the trend you can add to a ProcessBook view, but for implementing in my own application.
The PI-SDK does not provide a method of visualising data, only accessing it. the Trends that you see in ProcessBook and DataLink exist in the libraries for those applications.
The Trend object in ProcessBook is actually an OLE Object. If your application exposes an OLE Container, you may be able to use this to display a functional trend for the user.
Alternatively, you might want to use a charting control, such as Microsoft's Chart controls for .Net 3.5 (http://code.msdn.microsoft.com/mschart). You can then use the PIData.PlotValues (or PIData.RecordedValues) to query the PI server for data. Of course, if you want the functionality of the ProcessBook controls, you will need to implement it yoruself, which is not always that straight forward.
There are some other options available, but it depends on the technology you plan to use. Are you implementing a winforms app? Asp.Net? WPF/Silverlight?
Thanks for your answer - I found the Trend object. It should be a web app.
But - our customer has this vision of a solution which doesn't need any sort of plugins or 3rd party applications, just a pure OS-independent, browser-independent, natively supported web application. Personally, I don't think they'll achieve the neccessary level of interactivity in order for PI to be a value as a web application.
The closest thing, which I have adviced them to, would be a server side application generating JPG images from a ProcessBook graphic, when needed by the web application. They want to use some sort of AJAX functionality to load new JPG images.
And they don't have Sharepoint (yet).
Depending upon what your customer views as 3rd parth applications/plugins, you may be able to get away with using MSChart, as it is a .Net 3.5 (or 2.0) library provided by Microsoft. This will essentially do the hard-work for you, generating the JPG's, performing caching and making your like so much easier! Rendering a PB Trend to a JPG and throwing it down the line is not going to be overly straight-forward and will probably require OLE & Automation. Whilst this may work for a small-scale (few visits a day) app, you will quickly run into performance issues. As a general rule, I try and keep my ASP.Net pages as light as they can be and even enforce strict limits on the performance of the systems they interract with. Most people these days are used to WebPages returning quite quickly.
Whilst not as feature-rich as a PB trend would be, these charts are relatively easy to implement, look nice and should cover the basic functionality your client is lookign for. These charts render as Images, so it's close to what you have suggested.
In terms of dynamic, updating charts, the MSCart samples have a simple AJAX-powered updating line chart that updates in real-time without full-page postbacks. If you don't want to go down the Ajax path, you could probably get away with an I-Frame with an embedded page that pulls tag(s), start time and end time from a query string and returns an image. Using a HTTP-refresh Meta tag, you can force this I-Frame to update regularly without affecting the host page.
For more information on MSChart, Check out these links:
Download Page: Binaries VS2008 Support
Sample environment (Includes the AJAX-enabled demo's you may be interested in)
"Getting Started with the ASP.Net 3.5 Chart Control
Let me know if you want me to knock up a simple demo showing the AJAX-enabled chart pulling data from PI. (I had intended to do this anyway, but ran out of time )
Thanks a lot Sam!
As this customer have their own developers, they want to create the solution themselves. They'll soon have a vCampus subscription, so I'll point them in the direction of this thread when they're in :)
As a demo, I created a ProcessBook PDI file with this small VBA code snippet inside:
Private Sub Display_DataUpdate() SaveAs ("c:\inetpub\wwwroot\webapp\trend.jpg")End Sub
This takes care of providing updated images to the web application, but requires ProcessBook to be running on the server. All PDI files needed for the web app, have to be open in this instance of ProcessBook, in order to generate the images. The best option would possibly be to run ProcessBook from Visual Studio (with no GUI if possible) and generate trend-setups and saving as images on the fly.
Thanks for your help so far, you'll probably be asked more questions when they start programming :)
I am with your earlier comment in that it would be very difficult to provide a truly independent web app - what is the end goal, real time data or statistical analysis of data (i.e. you don't need to see rapidly updating values)? I am presuming real time as you want to use the PI trend object.
Will the data only come from PI or other vendors too? OPC?
Personally, I would not like the ProcessBook memory footprint on the web server/farm.
On the line of "other" charting, I have worked on projects linking to Dundas, ZedGraph (Open Source) with PI data (PI-OLEDB), both just produce images. Lots of flexibility in this area but it would take a lot of coding to get anything as interactive as a RtTrend - unless of course they have some talented Silverlight developers.
Of course, I agree with you :)
I think I have convinced them to restrict this kind of image generation to a web portal for access at the holding company level, and to use more interactive tools for the factorys department specialists - like RtWebparts or ProcessBook.
They can push necessary plugins through Windows Update in their AD, so that shouldn't really be a problem. They just don't like it! That's why :)
Do you have more details on the Dundas/ZedGraph and PI-OLEDB linking btw?
If all they are trying to do is view a PDI through the web, why don't they just use ActiveView?
I have to admit I've never really tested ActiveView - but when checking out the details on that product, I can see that it could be an option.
It still requires an ActiveX for the users though, but I think they've realized that they'll need at least one browser plug-in / ActiveX / etc. in order to achieve the level of interactiveness they need for their users.
They have no intention at all to create their web portal(s) in Sharepoint, but we're going to try installing Sharepoint and creating SP web part pages (with RtWebparts) which they can use in an IFrame - for their web portal. It's not perfect, believe me - I'd shure like to see them going for Sharepoint all the way, but it's a start.
Another option: with just PB installed, you can view a PDI file in IE and PB will launch as a OLE server and the PDI will display embedded in the web browser. Not sure what the security implications of that are ...
Asle Frantzen @ AmitecDo you have more details on the Dundas/ZedGraph and PI-OLEDB linking btw?
Well both charting engines were used for dashboards rather than PI WebParts (for similar reasons your client has stated) so only real concern for users was Adobe Flash player for some Dundas charts. Personally something like ZedGraph is perfect but Dundas does give a bit of eye candy for users (the licence cost is pretty big though).
Essentially one system relied on data from multiple sources of which PI was one, so I used a SQL Server Linked Server using PI-OLEDB and got at PI data that way. As far as the dashboard was concerned it didn't talk to PI just SQL Server, so you treat it like a typical ASP.Net project using ADO.Net.
I am quite the fan of PI-OLEDB in these scenarios and looking forward to the System OLEDB provider so AF data can be accessed.
Retrieving data ...