I'm writing a vb.net app to read a few pi tags from my server, is there any code examples I can use/view ?
sure would help...
The nice thing about the PI namespace is you do not have to have an AF database to work with it. Sadly, depending upon your calculation, it might be possible to use Asset Analytics, but that would only help you in 2 of the 5 plants. Humor me while I extend this thought: if your calcs don't require looping, they could be done in Analytics and the results persisted back to a PI tag. Then using the PI Interface for Relational Database (RDBMS via ODBC), you could write the persisted results from PI to your SQL table.
You say your are reading a record. I read that as A record with implication that there is only 1. Well, that is 1 for a given plant. There are lots of methods to review in the PIPoint class, and some have async counterparts. For a time range, the two to first check out would be RecordedValues and Summary but it wouldn't hurt for you to review all the members in that class.
I have a C# app on GitHub that strictly uses the PI namespace, including RecordedValues and Summary. Not an AF Server or AFDatabase is referenced.. It is called Timestamp Inspector. To help follow along with C# examples, there is also the CSharp Cheat Sheet for VB.NET Developers.
I have been vocal to the Technology Enablement team, the Learning Dept, and others who will hear me, that any AF SDK training, especially any beginners level training, should include VB.NET projects alongside C#. And I would like to see more beginners level training on tag-based AF SDK using the PI namespace, rather than using asset-based training where an attribute happens to use the PI Point data reference.
There are a few VB.NET examples here on PI Square and fewer on GitHub, but most of the examples may be asset-based rather than tag-based. That is to say you seem to be expressly interested in examples of the OSIsoft.AF.PI namespace. I have some C# examples using the PI namespace. How comfortable are you at reading C# examples?
Live Library does have code snippets available in VB. Example PIPoint.RecordedValue.
What exactly are you wanting to do? There's a difference between reading tags as in PI point definition versus reading data from tags. The more you can share what you are doing, the better the answer can be. How many tags are you wanting to read? If it's data, will you be reading the current value or historical data, and if it's historical, how many values are you expecting to read per tag?
I have been working on an un-official VB.NET solution to the "AF SDK Getting Started Guide". It's almost ready, though I realized I need to change my AF SDK reference off of AF SDK 2.10 RC1 and downgrade it to 2.9.5. However, the GSG is mostly asset-based as well.
I can read C# ok enough. I've just been using vb.net for so long. Ok on your suggestions and thanks for your direction too.
The mission is to calculate some results and store the results into SQL table.
Basically I'm reading a record from SQL that holds an Item-Name with a date/time IN and a date/time OUT. The Item has an associated pi tag as well. I need to query pi using the date/time ranges and perform some calculations on the values returned. After which I update the SQL record with the results and get the next record to process.
I will perform the routine every 30 minutes as new records come in from the production floor.
One other thing, I have 5 plants with pi servers but only 2 have AF (at this time).
Thank you Rick. I looked into the pioledb access to pi data and that looks good. I wrote a small test app and that seems to do just what I'm looking for. I will be doing some looping too.
Retrieving data ...