11-13-2013 07:50 AM
Hello
The following lines are an output from a data log of an automotive mass air flow sensor:
Ch Len Typ Delta t Time Data
00 08 00 00:00:00.000.819.200 00:00:00.428.572.160 C3 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.429.391.360 03 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.430.210.560 03 EB DD 41
00 08 00 00:00:00.000.816.640 00:00:00.431.027.200 03 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.431.846.400 03 EB 9D 40
00 08 00 00:00:00.000.819.200 00:00:00.432.665.600 03 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.433.484.800 03 EB DD 41
00 08 00 00:00:00.000.816.640 00:00:00.434.301.440 03 EB ED 48
00 08 00 00:00:00.000.819.200 00:00:00.435.120.640 83 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.435.939.840 83 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.436.759.040 03 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.437.578.240 03 EB DD 41
00 08 00 00:00:00.000.816.640 00:00:00.438.394.880 03 EB ED 48
00 08 64 00:00:00.000.000.000 00:00:00.438.394.880 0C 000 25
00 08 00 00:00:00.000.821.760 00:00:00.439.216.640 83 EB DD 41
00 08 00 00:00:00.000.816.640 00:00:00.440.033.280 83 EC 2D 4A
00 08 00 00:00:00.000.819.200 00:00:00.440.852.480 C3 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.441.671.680 83 EB AD 49
00 08 00 00:00:00.000.816.640 00:00:00.442.488.320 83 EB DD 41
00 08 00 00:00:00.000.819.200 00:00:00.443.307.520 83 EC 2D 4A
00 08 00 00:00:00.000.819.200 00:00:00.444.126.720 03 EB DD 41
Importing this into DIAdem shows several obstacles:
a) Data delimiter is not <Space> but <Space><Space><Space>. Is it possible to use more than 1 character in the delimiter definition in File.Formatter?
b) Time format is hh:mm:ss.fff.fff.fff and will try to track down 10 ns.
c) Data are string literal hex numbers separated by <Space>.... :-((
I do fear that those of you who work in automotive industry are likely to come past the "single edge nibble transmission" protocol some day or other.
Once the data have been imported correctly, the next step will be to split the Data DWord into nibbles to get the 2 channels, one 14 bit one 10 bit length, out of the data. They are hidden according to following rule:
Bit
1 2 3 4|5 6 7 8 |9 10 11 12|13 14 15 16|17 18 19 20|21 22 23 24|25 26 27 28|29 30 31 32
STatus |MSN Ch1 |2ndN Ch1 |3rdN Ch1 |LSN/2|LSN/2|MidN Ch2 |MSN Ch 2 |CRC N
1 nibble= Status
2-4 nibble = Bit 14 - 3 of Channel 1
5 nibble = 2 bit of Ch 1, bits 2 and 1 follwed by 2 bits of Ch 2, bits 2 and 1
6 nibble = Bit 6-3 of Ch 2
7 nibble = Bit 10 - 7 of Ch 2
8 bit = Checksum
The last bit of extracting a 14 and 1 10 bit channel are independent of the file format. If the data came in decimal, it would still need covnersion to Byte and nibble resorting.
Awkward, isn't it?
Anyway, I am sure DIAdem can do it, given that a number of bit- and byte-manipulating functions are available.
Thanks for contributions to this thread.
Michael
11-14-2013 06:34 AM
Well, after reading some post regarding hex strings, I found the following solution:
'gather bytes from 4 channels and convert to LONG (Thanx to Brad Turpin...)
Call Calculate("CH(""Data"")=CLng(""&H"" & Mid(Ch(""[1]/Byte1"")&Ch(""[1]/Byte2"")&Ch(""[1]/Byte3"")&Ch(""[1]/Byte4""),2,6))",NULL,NULL,"") '.
' Extract fast channel 1: Logical AND for 14 bit from start and shift 10 bit to right
Call Calculate("CH(""Flow"")=SHR(AndB(Ch(""[1]/Data""),16776192),10)",NULL,NULL,"") '
' Extract fast channel 1: Logical AND for 2 bit from the middle, 4 bit from nibble 4 and 4 bit from nibble 5 and rearrange
' convert to temperature with gain 0.25 and offset 53.15
Call Calculate("CH(""Temp"")=(SHR(AndB(Ch(""[1]/Data""),768),8) + + SHR(AndB(Ch(""[1]/Data""),240),2) + SHL(AndB(Ch(""[1]/Data""),7),6))/4-53.15")
11-14-2013 02:07 PM
Hi Michael,
First off, DIAdem 2012's datetime channels use a DBL representation and can only store down to a 10th of a millisecond, so even if you could write the DataPlugin to parse the unusual "ss.fff.fff.fff" format, DIAdem couldn't accept the last "ff.fff" fractional second information. I think your best bet is to declare the datetime channels and also the Hex channels as DirectAccessChannels of data type = eString and then use DIAdem commands to transform these string channels into numeric/datetime channels. You've already found the Hex-->Integer approach with the Calculator. You will probably need to break the datetime information into 2 new data channels. I would recommend one datetime channel with resolution down to "ss.ffff" plus another numeric channel with elapsed relative time in seconds.
If this is a standard Bus Log (CAN) file, perhaps you could use the Bus Log Converter to handle these onerous issues better.
Brad Turpin
DIAdem Product Support Engineer
National Instruments