10-10-2014 10:26 AM
I have a database (sample attached, mdf sql server localdb ) file (170 mb max) and would like to analyse it in Diadem. What is the best way? One thought is to create a Labview exe converter (mdf to tdms). What do you suggest? Thanks.
database
https://www.dropbox.com/s/eb3cydanshrokx3/M2004%202013_04_18%2013_22_16%20WNM-6141-MG_Post.zip?dl=0
An example of our data
,
The two Definitions above are known/fixed.
[Log Event Definition] below
Event Name Event Number
Flow Evt 0
DirSnsr Evt 1
Pulse Evt 2
Gamma Evt 3
Vibration Evt 4
Temperature Evt 5
Power Evt 6
Extreme Vib Evt 7
Extreme Shock Evt 8
Config Change Evt 9
Set Time Evt 10
Reset Evt 11
Snsr Com Evt 12
PC Com Evt 13
Int FLASH Evt 14
Int EEPROM Evt 15
INA Evt 16
EM Pulse Evt 17
Tilt Snsr Evt 18
[Log Field Definition] 145 lines; removing seconds, ms about 130
Event Number Field Name Field Index Unit Format Offset From Last Byte Offset Bit Offset Element Length Raw Datatype Scale Offset
0 Seconds 0 Time 1 0 0 32 1 1 0
0 Milliseconds 1 TimeOffset%0.3f 1 0 0 16 2 0.001 0
0 Flow 2 %d 1 0 0 8 0 1 0
0 Temp 3 °C %d 1 0 0 8 2 1 30
0 Flow Confirm Dly 4 secs %d 1 0 0 8 2 1 0
Rest in the attachement. Ignore the size mentioned in the docx
10-10-2014 08:54 PM
You can use the database toolkit in LabVIEW to fetch data from database and then save as TDMS file that is readable for DIAdem.
10-10-2014 08:55 PM
This might be helpful:
http://digital.ni.com/public.nsf/allkb/60786875B7C1131A86256C080052324C
10-13-2014 03:45 AM
ADO itself can potentially be used to access the data from DIAdem. The following script can be used to create the ADO connection string.
Option Explicit
ADOConStrGet() msgbox AdoConString
potentially your script will somehow look like this one
option explicit dim mdfFile : mdfFile = "C:\temp\MyDataBaseFile.mdf" dim conStr : conStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=localhost;Initial File Name=" & mdfFile dim ado : Set ado = CreateObject("ADODB.Connection") ado.Open conStr dim getResult : set getResult = ado.execute("SELECT * from [MyTableName];") dim chNames : chNames = Array : redim chNames(getResult.Fields.count - 1) dim i : for i = 1 to getResult.Fields.count chNames(i - 1) = getResult.Fields.Item(i - 1).name Next dim rowVals : rowVals = getResult.GetRows(-1, 0, chNames) data.root.Clear ArrayToChannels rowVals, chNames
Afterwards the result of your select command can be found in DIAdem channels.
10-13-2014 12:15 PM
Thanks. guys. The AE suggested VBS DataPlugins too. So what is the best way? I need to create an exe out of the converter and it needs to be efficient.
I appreciate your help.
10-14-2014 08:12 AM
Hi pavan_b,
If you need a converter that runs as an *.exe, then you should probably go the LabVIEW DataBase Connectivity Toolkit route. A VBScript DataPlugin would have to use ADO commands the same as a DIAdem VBScript, only it would be constrained to load the whole data base at once, which could easily be too much. Using a LabVIEW *.exe to send the data base records to multiple TDMS files sounds like the right approach.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
10-14-2014 10:18 AM - edited 10-14-2014 10:19 AM
Thanks Brad. I thought what the AE suggested was a little off but email communication doesn't help either.