Hello,

I'm struggling with AF-Analysis to get milliseconds from the timestamp of a snapshot value.

In AF-analysis there is year, month,... second functions but nothing to get the milliseconds !

Anyone knowing how to do such simple function ?

Hello,

I'm struggling with AF-Analysis to get milliseconds from the timestamp of a snapshot value.

In AF-analysis there is year, month,... second functions but nothing to get the milliseconds !

Anyone knowing how to do such simple function ?

Hi Dan,

I implemented the solution that you suggested, however I am having an issue with timestamp with 5 point of precision, if I have 5 trailing zeros in the sub-second part, it is converting it into scientific notation with E-05 appending to it. I have tried to use RoundFrac function as well but no luck. Have you encountered with this problem? and what could be possible solution to avoid the scientific notation for Millisecond timestamp?

Thanks,

Gaurav

- 3 people found this helpful
I never had to use it for the precision you require. I believe you are fighting .NET standard double formatting and a two line .NET program will show similar formatting for a number (double) such as .00001. In .NET you can specify a custom format for displaying the digits and you can apply a similar idea here using the Format PE function.

Quite honestly, I have not had to use it before, but I will share.

Format(Convert(Float(difference), "s"),"%10.6f"). I used 6 decimals but you can play around with it. What type of tag are you storing this in?

Dan

Thanks so much for your valuable inputs Dan. This solution worked as expected.

We have Feeder Breaker Switch Position tags which are digital tags in PI and because sometimes, the switch is operating very fast due to momentary operation we want to have a higher level of precision for time of operation to make sure the sequence of events is maintained in specific order.

It can be done, but it is not a simple function! Below, I obtain the timestamp, and the timestamp with the seconds removed. Next, I subtract the two and then obtain the seconds.

Also, note that the precision of time in the PI Data Archive is 1/65536th of a second.

Regards,

Dan