AnsweredAssumed Answered

Timezone in AF SDK

Question asked by Bhikadiya Champion on Jul 12, 2017
Latest reply on Jul 13, 2017 by rdavin

Hi,

 

We have a data ingestion service built using AF SDK, writing values directly to PI Data Archive. The Interface machine (where the AF SDK based ingestion service is running) is in different Time Zone than the PI Data Archive Time Zone.

 

Interface Machine Time Zone:

PI Data Archive Machine Time Zone:

  

The data source is sending data in Interface Machine Time Zone (UTC +01:00). Below is snippet of AF SDK code,

 

1. Connection to PI Server

vPIServer = PIServers(QA_PI_SERVER)

 

2. Prepare the AF Values collections

Dim vTagValue As AFValue

Dim vTagValuesList As List(Of AFValue) = New List(Of AFValue)

Dim vDateTime As DateTime = Nothing

 

vDateTime = CType(''Local Time stamp From Interface Machine', DateTime)

 

vTagValue = New AFValue()

vTagValue.PIPoint = "pi point object'

vTagValue.Timestamp = New Time.AFTime(vDateTime)

vTagValue.Value = 10.5

 

vTagValuesList.Add(vTagValue)

 

3. Make UpdateValues call to write data to Data Archive

Try

   vTagWriteErrors = vPIServer.UpdateValues(vTagValuesList, Data.AFUpdateOption.Insert, Data.AFBufferOption.Buffer)

   Console.WriteLine(Now.ToString() & ", Processed " & vTagValuesList.Count & " of Events into PI")

Catch Ex As Exception

    Console.WriteLine(Now.ToString() & ", Exception while Writing to PI Data Archive: " & Ex.StackTrace)

End Try

 

No exception or errors showing. Also when checking the data in PI SMT from Interface Machine ( Archive Editor with 'Use Client Timezone' setting' ), No values showing up means no values recorded into PI Data Archive.

 

Also checked the PI Data Archive Message Log, nothing logged there.

 

seems like needs to pass the Timezone information in AF SDK code as PI Data Archive is rejecting UpdateValues call, because of considering as future data. any thoughts ?

 

- Thanks, Mukesh

Outcomes