Skip to Content
author's profile photo Former Member
Former Member

Wrong DateTime value returned from Tag Query

Dear gurus,

I have a quite simple tag query that targets an Yokogawa PIMS implementation. I am using SAP UDS Server to connect MII to PIMS (DA).

The tag query configuration is:

- Query mode: Current

- Date interval: none

Below you can see an exemple of XML returned from the query:

<?xml version="1.0" encoding="UTF-8"?>
<Rowsets DateCreated="2010-01-25T13:36:45" EndDate="2010-01-22T22:07:50"
	StartDate="2010-01-22T22:07:36" Version="12.0.8 Build(24)">
	<Rowset>
		<Columns>
			<Column Description="DateTime" MaxRange="0" MinRange="0"
				Name="DateTime" SQLDataType="93" SourceColumn="DateTime"></Column>
			<Column Description="Perda de Produção do Branqueamento 1"
				MaxRange="100" MinRange="0" Name="Root.PocMII.Mii_Branq1_Producao.Value"
				SQLDataType="8" SourceColumn="Root.PocMII.Mii_Branq1_Producao.Value"></Column>
		</Columns>
		<Row>
			<DateTime>2010-01-25T13:36:41</DateTime>
			<Root.PocMII.Mii_Branq1_Producao.Value>0</Root.PocMII.Mii_Branq1_Producao.Value>
		</Row>
	</Rowset>
</Rowsets>

The datetime field returned by the query is matching the date/time the query is executed. I was expecting the datetime field to match the tag value timestamp (the time the tag value is added to PIMS) from the PIMS datastore.

For example. If a tag value "1" was created on PIMS on 12:10:10, when I ask for the current value using MII tag query I get the expected value "1" but the timespamp doesn't match "12:10:10". The timespamp always match the current date/time. I understand current value as the newest value added to PIMS for that tag, am I right?

I think this is a MII behavior because when I run the query for the current tag value using other tool (MS Excel based) I get the expected date time.

Is this the expected behavior? Do I need to change something in the tag query configuration to get the actual tag timestamp?

Thank you,

--

Wilson Freitas

Vetta Technologies

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 06:50 PM

    I think what you want to do is a HistoryEvent query and set your rowcount to 1. This will give you the actual timestamp that is in the historian.

    Be mindful though if your data source allows for storing of "Bad" data, this last value might be a bad value, unless you select the option in your UDS to ignore these.

    Edited by: Doug Holtke on Jan 25, 2010 7:50 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Doug,

      Changing from History to HistoryEvent mode solved the problem.

      I also had to set the row count to 1 and the duration to a short interval: 1 minute in my scenario.

      If someone else have the same problem these are the steps to solve it:

      - Change the tag query mode to HistoryEvent

      - Set row count to 1

      - Set duration to a short value. I think the duration must not be greater than the frequency that new tag value are generated in the tag datastore.

      Thank you all you guys for your help.

      Best regards,

      --

      Wilson Freitas

      Vetta Technologies

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 06:52 PM

    I get my XML from OPC through PCo. Don't remember having a problem with datetime. Can you give us the XPath expression and any other relevant details that you are using to extract the information that you need?

    Chanti.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 08:33 PM

    Hi,

    when you use the selection option as current for the tag query, it returns the value with current datetime stamp. To get the value of a particular datetime stamp, you can modify the query and you can set your date time stamp.

    Hope this helps !!

    Thanks,

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.