1 / 52

PI Software Development Kit

PI Software Development Kit. PI-SDK. Agenda. The expanded class hierarchy Data access with the PI-SDK The PITimeServer library Multi-threading and the PI-SDK OSI and the PI-SDK Troubleshooting tips Coming attractions Questions. Class Hierarchy. PI-SDK 1.0 The current release

efuru
Télécharger la présentation

PI Software Development Kit

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 Software Development Kit PI-SDK

  2. Agenda • The expanded class hierarchy • Data access with the PI-SDK • The PITimeServer library • Multi-threading and the PI-SDK • OSI and the PI-SDK • Troubleshooting tips • Coming attractions • Questions

  3. Class Hierarchy • PI-SDK 1.0 • The current release • PI-SDK 1.1 • PI-Batch and the Module Database • PI-SDK 2.0 • Data Access

  4. PI-SDK 1.0

  5. PI-SDK 1.1

  6. PI-SDK 2.0

  7. Data Access with the PI-SDK • PIData and ListData • The access paths • Value Format • What do values look like now? • PIValues capabilities • What can I do with the values? • Writing Values

  8. PIData

  9. Data.RecordedValues() • Start time and end time as Variant • Boundary type • Filter expression • Show filtered • Asynchronous • Returns a PIValues collection

  10. What’s in a PIValue?

  11. PIValues – More than a datatype

  12. Writing values to PI • UpdateValue and UpdateValues • RemoveValues

  13. Demo • Retrieving PIValues

  14. Advanced Topics • Event pipes • Using asynchronous calls

  15. Problem: Alarm Application • Your app must catch every event • But you can’t listen all the time • Polling may miss an event Oops

  16. The EventPipe Object • Get from a PIPoint or a PointList • Collects value changes • Count property • Take, Peek methods • First In, First Out (FIFO). • OnNewValue event • Can be throttled to avoid event overload

  17. Problem: Long Queries • Long blocking calls inhibit user response and slow down your application • But breaking the query into small chunks may reduce efficiency • Server does redundant work • More network calls

  18. PIAsynchStatus Object • Lets you monitor the status of a query • Sends an event when done • Provides for progress bar • Many calls can be asynchronous • PIPoint.Data archive retrieval • PointList.Data archive retrieval • PIValues.RecordSet • Server. GetPoints, GetPointsSQL • PISDK.GetPoints • MessageLog.List

  19. Using PIAsynchStatus Dim WithEvents asy As PIAsynchStatusSet asy = New PIAsynchStatus Dim pv As PIValuesSet pv = MyPoint.Data.RecordedValues (“*-1h”, “*”, , , , asy)Rem pv.Count should be zero... Private Sub a_OnStatusChange If asy.Status = csCompleted Then ...

  20. Time in the SDK • Classic problems: summer time, time zones, clock drift • The solution: PITimeServer

  21. Time—The Problems • Summer time (DST) • What are the rules for this location? • What were the rules last year? • We must track historic changes • Does my computerfollow the rules? • It probably doesn’t even know them. • Even if it does (NT), it may not follow them.

  22. Time—The Problems • Time zones • Servers can be in various time zones • Clients can be in a different time zone from any server • Queries must be interpreted in the time zone of the server

  23. Time—The Problems • Clock drift • Even in the same time zone, the client clock may not be exactly the same as the server clock • Real-time data inputs to a server should be timestamped with the server clock, i.e. adjusted for clock drift • Historical inputs should not be adjusted for clock drift

  24. Time—The Problems • Time intervals (days, months, shifts) • Is 1day = 24hours? • Not always, if you observe summer time • On March 30, what does this mean?“*-1month” • Can I define my plant shift schedule?

  25. Time—The Solutions • PITimeServer • Independent COM server DLL • Does not require PISDK.DLL for support • Defines these objects: • PITime, PITimeFormat, DynamicTime • PITimeZoneInfos, PITimeZoneInfo • DeviceTimeZones • TimeIntervals, ITimeInterval

  26. PITimeZoneInfo object • Encapsulates time zone information • Offset from UTC • Summer/winter time change rules • Historical changes in rules • Every device is assigned one • Server, client, instrument • PITimeZoneInfos collection • All known time zones on this client • User can add or remove zones

  27. Time Objects: PITime • Lightweight, server-independent • Translates wallclock to UTC using client-node time zone information • Operations: • UTCSeconds property • UTCFileTime property • LocalDate property • SetToCurrent method

  28. Time Objects: PITimeFormat • Superset of PITime • Knows its time zone • TimeZoneInfo property • Parses time strings • Microsoft format (localized) or PI format • Formats output strings • Works with time intervals • “subtract 3 weeks”

  29. Time Objects: DynamicTime • Superset of PITimeFormat • Represents a moving time, such as “*” or “*-4.5 hours” • Property values change constantly • Referenced to a known clock source • Server clock • Client clock • Device clock, user-defined

  30. ITimeInterval Object • Represents a kind of interval • Name, ShortName: month, mo • MemberLo, MemberHi: 1, 12 • Member(Short)Name: January, Jan, … • Operations: given a time— • What month is it? • When did that month start? • Add or Subtract n months • How many months between two times?

  31. TimeIntervals Collection • Contains all intervals known on the client • Interval servers • Installed via registry entry • Standard: year, month, day, week, weekday, yearday, hour, minute, second • User-defined: whatever you want • Shift, Plant day • Fiscal year/month/week/quarter

  32. Threading • Release 1 was apartment-threaded • Release 2 will be free-threaded • Apartment-neutral • Uses the Free-Threaded Marshaler (FTM)

  33. If It Ain’t Broke… • Apartment-threading works correctly • But performance is unacceptable

  34. Why Should I Care? • Multi-threaded design is natural for many applications • Interfaces—thread per scan class • Displays—thread per graphic • Today, this mostly affects C++ developers • VB7 will support free-threading

  35. OSI and the PI-SDK • Redesigns of existing products • New products in development • Existing products

  36. Redesigns for the PI-SDK • PI-ProcessBook • PI-DataLink • Sigmafine • PI-BatchView • PI-Profiles

  37. New Applications • PI-PointBuilder • PI-AlarmView • Real-time SQC Point Manager • PI-AutoPointSynch These are demonstrated Tuesday afternoon.

  38. Controls and Libraries • PI-BatchView 3.0 • Module Database Controls • Tag search

  39. New Interfaces • PI-Perfmon • OPC • ICCP

  40. Existing Products • Embedded PI systems • Point creation • User/Group management • Batch Event File Interface • Integration with batch systems • UNIINT 3.2.0 • Flexible attribute retrieval • PIlog32.dll and sdkreg.dll

  41. Troubleshooting Tips • After the setup • Read the setuppisdk.log • Run AboutPI-SDK • The new apisnap

  42. AboutPI-SDK Hidden Connect Button Version Info Timeout Info

  43. Connecting Manage your Servers Here

  44. Server Management

  45. Communication Layers • What’s a pinetmgr and do I need one? • What’s a redirector and how is it configured? • ~\pipc\dat\pisubsys.cfg

  46. Pisubsys.cfg • Redirected • Generic_local hostname:portnumber For example: Generic_local bilbo:5450 • Local pinetmgr • Generic_local \\.\pipe\rendevouz file path For example: Generic_local \\.\pipe\e:\PI\dat\piv3.rdz

  47. What if? • Remember AboutPI-SDK = apisnap • Can’t run AboutPI-SDK • Check error message • Check setup

  48. What if? • Can’t connect • Is server running? • Client side • Ping, apisnap, ProcessBook • Server side • Check services.(Net start, or services applet) • Does piconfig work? • Does pisnap work? • Is the local pinetmgr service running? • Try using a redirector

  49. What if? • Err.Description • Often includes server specific errors • Intermittent errors • If it used to work, suspect the server • PI-SDK web page • Reported Problems • http://support.osisoft.com/progtools/pisdk/

  50. Coding Problems • Try the examples in the help file • Try the sample applications on the web • Isolate the problem • Send small examples that demonstrate the problem to tech support.

More Related