DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Millisecond Precision when Converting Numeric channels to Time channels for CAN Data

Solved!
Go to solution

Hello,

 

I have CAN data that I am importing into DIAdem. I want to line the CAN data up with data from external NI DAQ's as well so I was hoping to use the absolute timestamp. My issue at the moment is that when converting the numeric channel for each channel group (ie. [1]/Time, [2]/Time, etc.) to a time channel I can only go down to the nearest whole second.

 

When bringing the CAN over to DIAdem, each channel group has a custom property named "CANDateTimeStamp" and for the example I'm working on it is 09/01/2022 15:48:08.940000000. When I try to enter 8.94 for the seconds column it reverts back to 8 seconds and then all of the data is shifted 0.94 seconds. 

 

Is there an easy solution to this? 

0 Kudos
Message 1 of 3
(1,577 Views)
Solution
Accepted by topic author TW_Test

Hi TW_Test,

 

Here is an example for your request.

 

dim oStartDateTime, oRelTimeChn

set oStartDateTime = CreateTime(2022,09,01,15,48,08,940)
set oRelTimeChn    = Data.GetChannel("My relative time channel")

' add a date/time property for example
call Data.Root.ActiveChannelGroup.Properties.Add("www", oStartDateTime, DataTypeDate)

' create a date/time channel based on a start time and a relativ (numeric) time channel
call ChnNumericToTime(oRelTimeChn, oStartDateTime.VariantDate, True)

 

Greetings

Walter

Message 2 of 3
(1,557 Views)

Thanks Walter, that worked just how I wanted it to. It is an easy solution to my question. This answer also helped me figure out the next part of my script, to automatically pull the timestamp from the channel group and use that for the CreateTime command.

 

This command converts the timestamp to string and keeps the milliseconds too. Should make for a slick way to automate the whole thing.

 

dStartTime = ConvertTimeType(Data.Root.ChannelGroups(7).Properties("CANDateTimeStamp").Value,eConvertStringDateTime)

Thanks,

Tyler

 

 

0 Kudos
Message 3 of 3
(1,535 Views)