V
V
Victor Umansky2019-08-21 07:19:16
Database
Victor Umansky, 2019-08-21 07:19:16

How from *.dat file -> to *.sql?

Good morning everyone!
two files on mega
They gave me two files in *.dat format and asked me to put them into sql. I opened the file and saw

spoiler

PDA20 beginheader: clk:0.01 typ:real starttime:19.02.2017 08:55:11.050000 frames:0003600000 starttrigger:0000000000 stoptrigger:0000000000 $PDA_RefTimestamp:00063623091316040000 Module_name_0:Generic unicast UDP Module_name_1:Generic unicast UDP Module_name_2:Generic unicast UDP Module_name_3:Generic unicast UDP Module_name_4:Bits01 Module_name_5:Bits02 Module_name_6:Bits03 Module_name_7:Bits04 version:ibaPDA 6.24.6 PDAKeyInfo:0168b02050020302060068a4280021018b0c246a842850a2008114154880800023040918106880804080040d101068a08040800205001028008040800201081028200040800207 PDAKeyInfo2:0140008114520001040000040904700081141002040914700081040140000004700001040040000104700001041040000104300041041041008104600001040041200104600001114000011450000104104004090470008104104204091470008104114000010470000104104000010470000104104102050c70204184104100010c602001041040000104702041 channel_offset:O32877DC88C8C3070 endchannel: beginchannel:31 name:UNC1 Spd Fbk unit:mpm $PDA_comment1:IBA[32] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-327.68 maxscale:327.67 xoffset:000000000000 channel_offset:O7D8C6B96B8B87F39 endchannel: beginchannel:1073741856 name:UNC1 Trq Fbk unit:% $PDA_comment1:IBA[33] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O649C4F021C1C66EF endchannel: beginchannel:1073741857 name:UNC1 Diameter unit:mm $PDA_comment1:IBA[34] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O78AC2886F3F37A9D endchannel: beginchannel:1073741858 name:UNC1 Strip Width unit:mm $PDA_comment1:IBA[35] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O08570B8CEFEF0AB8 endchannel: beginchannel:1073741859 name:UNC1 Strip Thick unit:mm $PDA_comment1:IBA[36] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-327.68 maxscale:327.67 xoffset:000000000000 channel_offset:O03BE1D7B12120113 endchannel: beginchannel:1073741860 name:UNC2 Spd Ref unit:mpm $PDA_comment1:IBA[37] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-327.68 maxscale:327.67 xoffset:000000000000 channel_offset:O110166B05656136A endchannel: beginchannel:1073741861 name:UNC2 Trq Ref unit:% $PDA_comment1:IBA[38] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O2779616588882550 endchannel: beginchannel:1073741862 name:UNC2 Spd Fbk unit:mpm $PDA_comment1:IBA[39] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-327.68 maxscale:327.67 xoffset:000000000000 channel_offset:O426225B301014085 endchannel: beginchannel:1073741863 name:UNC2 Trq Fbk unit:% $PDA_comment1:IBA[40] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O1B580687222219FD endchannel: beginchannel:1073741864 name:UNC2 Diameter unit:mm $PDA_comment1:IBA[41] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O15420964C2C21721 endchannel: beginchannel:1073741865 name:UNC2 Strip Width unit:mm $PDA_comment1:IBA[42] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O4B2F7929EBEB490E endchannel: beginchannel:1073741866 name:UNC2 Strip Thick unit

and thought cool, I'll parse with PHP. But when I started scrolling down, I saw this
spoiler

6AE endchannel: beginchannel:492 name:Welder S1 Prox digchannel: $PDA_Tbase:0.01 xoffset:000000000000 channel_offset:O5A7E786DC1C186F2 endchannel: beginchannel:493 name:Welder S2 Prox digchannel: $PDA_Tbase:0.01 xoffset:000000000000 channel_offset:O4EFE5393161692B4 endchannel: beginchannel:494 name:Exit AS Enable digchannel: $PDA_Tbase:0.01 xoffset:000000000000 channel_offset:O377565912C2CEB7D endchannel: beginchannel:495 name:Exit AutoStop digchannel: $PDA_Tbase:0.01 xoffset:000000000000 channel_offset:O6F1F76E64949B3D9 endchannel: endASCII: NZ

I saw at the end, where it is still clear that something is "endchannel: endASCII:" and immediately I thought that it was encoding in asci or just usually encrypted (CORRECT ME).
How can I extract data without loss .... I don’t remember what program created it, I know that the program records data from some equipment!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-08-21
@Rsa97

The PDA2 descriptor comes first, then some binary data.
The header starts at offset 0x20. All fields are text, separated by the end of the line (0xD 0xA). At the beginning of each field is the name, then a colon and the value of the field.
At the beginning of the header is a general description of the data

spoiler
beginheader:                            // признак начала заголовка
clk:0.01                                // скорее всего, частота дискретизации данных
typ:real                                // тип данных
starttime:20.02.2017 09:24:07.100000    // время начала 
frames:0003600000                       // количество кадров данных
starttrigger:0000000000
stoptrigger:0000000000
$PDA_RefTimestamp:00063623161262590000  // таймстамп с устройства ??
Module_name_0:Generic unicast UDP       // названия модулей
Module_name_1:Generic unicast UDP
Module_name_2:Generic unicast UDP
Module_name_3:Generic unicast UDP
Module_name_4:Bits01
Module_name_5:Bits02
Module_name_6:Bits03
Module_name_7:Bits04
version:ibaPDA 6.24.6                    // версия прошивки ??
PDAKeyInfo:0168b02050020302060068a4280021018b0c246a842850a2008114154880800023040918106880804080040d101068a08040800205001028008040800201081028200040800207
PDAKeyInfo2:0140008114520001040000040904700081141002040914700081040140000004700001040040000104700001041040000104300041041041008104600001040041200104600001114000011450000104104004090470008104104204091470008104114000010470000104104000010470000104104102050c70204184104100010c602001041040000104702041
PDADongleId:0100000010400000000000040800600080000002040810600080000100000000600000000000000000200000000000000000200000000000000000200000000000000000200000
endheader:                               // признак конца заголовка

Then come the channel descriptors
spoiler
beginchannel:0                     // начало канала и его номер
unit:                              // единица измерения
$PDA_comment1:IBA[1]               // комментарий с устройства
$PDA_Tbase:0.01                    // ??
$PDA_Typ:int16                     // тип данных
minscale:-32768                    // минимальное значение
maxscale:32767                     // максимальное значение
xoffset:000000000000               // ??
channel_offset:O6E6B36E540406460   // смещение данных
endchannel:                        // признак конца описателя

At the end comes endASCII, after which the binary channel data received from the device begins. Here it is already necessary to understand seriously, especially considering that about 500 channels were recorded and having no idea what should be the result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question