12-30-2013 04:46 AM
Hello,
I am new in the Diadem analysis. I have a TDMS file which contains curve. I would like to separate that part of the curve which is graeter than 3000OHM and 2ms wide. The curve contain more than 5 peak. And I would create a report which contains this 3sec environment (before and after) of the 3000Ohm spike. I can not attach the tdms file because it is huge. 😞
How can I do it?
Thank You in advance!
01-03-2014 06:32 AM
Hi Forrest and welcome to NI forums!
Finding peaks in analysis is fairly straightforward, you just have to set up the maximum amount of peaks (I suppose it is 5 in our case), and the minimum value for a peak (3kΩ) to get the peaks you're interested in. This will give you two channels, one for X coordinates, and one or Y. Based on them, you'll want to select values in the original channel for every peak on a [PeakX-3sec, PeakX+3sec] interval. This can be done either interactively in VIEW or by using script commands.
As for the 2ms width part, that's a little more elaborate. You can eliminate peaks based on width either before or after the search. I think the easiest way woulld be checking the minimum value of the [PeakX-1ms, PeakX+1ms] interval, andif it is below 3kΩ, eliminate the peak. For this, there is no precreated function, so you will have to eitwer use the Calculator or a script.
Let me know if you have additional questions or some help with a certain part.
Kind regards:
01-06-2014 12:16 PM
Hi Forrest,
Here is a script that is similar to what you're asking for. If you want help adapting it, you'll need to post your data file to NI's incoming ftp site and let us know it's there:
ftp.ni.com/incoming/
OPTION EXPLICIT Dim i, k, StartPos, EndPos, StartRows, CountRows, ChStr, NewChStr, ChNum, ChArray Call DataDelAll Call DataFileLoad(AutoActPath & "Event Groups.TDM") L1 = CNo("[1]/ENG_SPD") L2 = CNo("[1]/Throttle") R1 = 2100 ' Speed threshold R2 = 20 ' Speed uncertainty/jitter Call FormulaCalc("Ch('[1]/Events'):= (Ch(L1)>(R1-R2))*(Ch(L2)=100)") L3 = CNo("[1]/Events") ReDim StartRows(0) ReDim CountRows(0) Do i = Find("Ch(L3)=1", i+1) StartPos = i : IF i = 0 THEN Exit Do i = Find("Ch(L3)=0", i+1) EndPos = i : IF i = 0 THEN Exit Do k = k + 1 ReDim Preserve StartRows(k) ReDim Preserve CountRows(k) StartRows(k) = StartPos CountRows(k) = EndPos - StartPos Loop Until i = 0 ' end of channel reached FOR i = GroupCount TO 2 Step -1 Call GroupDel(i) NEXT ' i ChStr = "" FOR i = 1 TO GroupChnCount(1) ChStr = ChnStrAdd(ChStr, CNoXGet(1, i)) NEXT ' i FOR k = 1 TO UBound(StartRows) Call GroupCreate("Speed = " & R1 & " Event " & k) Call GroupDefaultSet(GroupCount) NewChStr = "" FOR i = 1 TO GroupChnCount(1) ChNum = CNoXGet(1, i) Select Case ChnFormat(ChNum) Case "Numeric", "Time" ChArray = ChnAlloc(ChnName(ChNum), CountRows(k), 1, DataTypeFloat64, ChnFormat(ChNum)) Case "String" ChArray = ChnAlloc(ChnName(ChNum), CountRows(k), 1, DataTypeString, "Text") End Select ' channel type ChnDim(ChArray(0)) = ChnDim(ChNum) NewChStr = ChnStrAdd(NewChStr, ChArray(0)) NEXT ' i Call DataBlCopy(ChStr, StartRows(k), CountRows(k), NewChStr, 1) NEXT ' k Call View.LoadLayout(AutoActPath & "Event Groups.TDV") Call WndShow("VIEW")
Brad Turpin
DIAdem Product Support Engineer
National Instruments
01-07-2014 01:39 PM
Dear Brad and Andrew
Thank You your answer. I will try it tomorrow. Now I don't have the tdms file.
Regards
Forrest