06-16-2020 02:38 AM
Recently, working with the FPGA Timekeeper 1.1b0.zip library I detected an error up to hundred of nanoseconds, in my case I detected a maximum of 119ns but it can be higher, in the "LabVIEW Time to FPGA Time.vi" VI of the library.
This VI is used in the RealTime block diagram to convert labview time to FPGA time (TAI format based, referenced to 1/1/1970):
The problem seems that comes from an incorrect type conversion that introduce some error in the precisión of the data. Using the next block diagram, if you enter a labview time of 1st January 1970 at 00:00:00 the number of nanoseconds from 1/1/1970 00:00:00 returned is correct and equal to 0, but if you enter the same date plus 1 second and 1 nanosecond this VI must return a value of 1E+9 (for 1 second) plus 1 nanosecond, that is 1000000001 and the VI return a value of 1000000000, missing the nanosecond. Testing different dates and times I get a maximum error of 119ns in the conversion. This is the code used to test this error:
In the frontpanel you can see the error conversion. Take into account that for my time zone, CET, for a UTC time of 00:00:00 I had to enter 01:00:00 as the time, so you can see in the fractional seconds fields and in the FPGA time (ns) fields the difference between the real UTC datetime entered, the time in nanoseconds from the VI of the library and the good time conversion done with my modification of the code of the vi of the library:
The block diagram of the "LabVIEW Time to FPGA Time.vi" is the following:
The data conversion from LabVIEW time to double is not enough to mantein the precision of the data, so replacing these "To double precision format" converters for "To extended precision format" converters solve the problem, as I see you in the following block diagram:
I told with National Instruments support department but they reject to modify the library to correct this issue so I post the issue here hoping this solution can help to the community.
06-16-2020 10:43 AM
Thanks jlgalin for posting your findings!
Kudos
06-22-2020 09:27 AM
Hello jlgalin
Thanks for your time, I hope that this forum will me useful for ther users
I suggest you to also post this on https://forums.ni.com/t5/LabVIEW-Idea-Exchange/idb-p/labviewideas
Good day
03-08-2024 01:55 AM
Thank you for raising this issue. Did they give a reason why they reject the modification?