cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MII Pco: Querying multiple tags for Multiple time stamp

Former Member
0 Kudos

Hi Everyone,

I am using Pco 2.3 SP4 on MII 14.0. I have a requirement to get data from Historians for multiple tags at different time stamp. I know we can get multiple tags values by passing tags name separated by comma in selected tag parameter but this will give values for all the tags for the single time stamp. My requirement is to get multiple tags values for different time stamps without hitting the historian for multiple time.

In a nutshell i am passing multiple tags seperated by comma in selectedtags parameter but at the same time i want to pass different time stamp for each tags.

I think we cannot pass XML structure to Pco the only way i can see is to hit historian via Pco for different time stamps.

Please share your ideas if any so that Tags values can be obtained for different time stamps for each tags in one go.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member202228
Active Participant
0 Kudos

You need to use a PCo query. Open your workbench and start a PCo query template.

In the "DataSource" tab, select "TagRetrieveQuery" mode, and point it to the PCo data server.

In the "General" tab, update the "Row Count" with the desired number of rows (i.e.10) to retrieve.

In the "DateRange" tab update "Start Date" and "End Date" fields, between which you want the data to be extracted from.

The "Duration", "Duration Units" and "interval count" fields have to be updated .. for example if you have "60", "minutes" and "1", you get 1 value per hr between the start-date and end-date, as you picked them in certain situations .. see below:

In the "TagRetrieveQuery" tab, at the very top you have a "View" dropdown. The options are:

current

event

interpolate

pointplot

If you select "current" you will receive the last value recorded in the historian, no matter what the DateRange settings are.

If you select "event" you get all the historian recorded values, as they are recorded in the historian between the date-start and date-end timestamps.

If you select "interpolated", you'll get the intervalcount averaged values for each interval defined between the date-start and date-end timestamps.

if you select "pointplot", you get the same as above, but with normalized timestamps.

Play with those fields described above until you obtain what you want.

NOTE: the historian records data with milliseconds precision. The PCo query return data by the second. When you read "current" values over an interval, browse the data at the beginning of the second for "what was before" and at the beginning of the "next" second, to catch the value after it was changed

Former Member
0 Kudos

Hi Paul, Thanks for the reply.

Please find the below scenario

I want value of tag Test1, Test2,Test3,Test4 exactly at 2014-08-05T18:45:11,2013-08-05T18:45:11,2014-08-05T14:45:11.

Option 1: To get tags values for exact time is to pass the tag value and keep date start and date end time same, then exactly one single value will be obtained. If i put different date start and date end time then all the values updated in historian in that time interval is displayed.

So, at present i need to hit historian via Pco query everytime for different dates, where as my requirement is to get the tags values for different dates in one hit only. Hitting the historian everytime will affect the performance.

So, i was just wondering that do we have any other way to get various Tags Values for different time in one hit.

former_member196557
Active Contributor
0 Kudos

Hi Mahesh,

Some questions:

1.  How do you know that there will be a historian sample for each tag at the exact date/time you request?

2. Which historian(s) do you currently connect or plan to connect to?

3. Do you have the ability to do this type of query outside of PCo/MII currently?

Regards, Steve

former_member202228
Active Participant
0 Kudos

so,

You do a query for

      Test1,Test2,Test3 and Test4 at exactly 2014--08-05T18:45:11

then you do a second query for the same tags but for the different timestamp

      Test1,Test2,Test3 and Test4 at exactly 2014-08-05T14:45:11

in the "General" tab, update the row-count to 2.

In the "DateRange" tab, update the

        start timestamp to 2014-08-05T18.45:11

        end timestamp to 2014-08-05T18:45:12

Duration should be set up to 1

Duration units, should be "seconds"

Interval count should be 1

In the "TagRetrieveQuery" tab, select Interpolate view so that you make sure the historian will return a value, even interpolated.

You'll have to do a second call for the second timestamp.

If you run the query above, what you'll get is a set of two values for each tag. One at the beginning of the 18:45:11 second and one at the beginning of the 18:45:12 second, that is, before and after the historian recorded the values during that second you're interested in. If no value is recorded by the historian, the two values obtained via PCo will be the same.

Now, the historians are not relational databases. You can't do "join" or "union" queries grouped together by various "where" parameters. Some of the historians in fact "are" based on the SQL server, but in order to be able to log 5000 point per second, they use a lot of curious configurations with data files one cannot access directly.

If you're worried about performance, you can't go over 2000 queries per second, provided that the infrastructure supports those query rates. The Osisoft-PI  SDK limits you to about 100 queries per second workable rate. Wonderware and SimaticIT, as SQL based historians are way lower (about 20 / second) using 32Gb RAM and dual xeons & 10k drives for about 5000 tags dedicated SQL server environments.

I'd update the functional requirements so that you have to do less queries per second than your maximum is (as found during stress testing). You need to leave the historian to do what it's supposed to do (i.e. record the data), before you start reporting on it.

Former Member
0 Kudos

Hi Steve,

Thanks for asking questions,please find the answers

1.  How do you know that there will be a historian sample for each tag at the exact date/time you request?

Ans: At shop floor we have various tanks used in Manufacturing, Blending etc. Attributes(Net Mass, Temperature, Volume of material) of this tanks changes with time. User completes the process through different interfaces by capturing values of these tanks, Manufacturing steps takes time so situation arise that something has been completed 1-2 days back but user wants to close the steps today, in these type of scenarios we need to get the exact values of tags at the exact time when that tank was being used.

2. Which historian(s) do you currently connect or plan to connect to?

Ans : Its the PHD

3. Do you have the ability to do this type of query outside of PCo/MII currently?

Ans: At present we can pass the XML structure with different tags with different times to PHD via web service call request and we get the values of all the tags in one XML structure in response

Former Member
0 Kudos

Thanks for the reply Paul.

At present we are sending large number of tags with different time stamps , appended in an XML structure and sending the whole structure to the Historian and getting the response in some XML structure. Now we are trying to do the same thing with Pco query but i guess we need to call the query again and again for different time stamp as its not possible to send the whole structure to Historian via Pco and get the response in one hit for all the tags.

former_member196557
Active Contributor
0 Kudos

Hi Mahesh,

Can you just implement the web service request directly in MII? What is the requirement to go through the PCoQuery template?

Regards, Steve

0 Kudos

Hey Paul,

Just a clarification on the point of the data being normalized for PI Point Plot, this is not always the case as it depends on the variability in the dataset that is captured in the historian.  For this function it's meant to avoid the smoothing out of peaks and valleys in the dataset as this is what happens when you use "Interpolate" or "History".  The function is explained in more detail in the OSI Help and also here:

OSIsoft PI SDKs Getting Started - Part 4, Getting Plot Values - YouTube

Sam