09-08-2022 09:44 AM
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?
Solved! Go to Solution.
09-09-2022 12:32 AM
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
09-09-2022 11:06 AM
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