DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnPeakFind error

I'm using ChnPeakFind in a script.  The script completes without error, but fails to calculate for all the channels.  The script loops through 56 channels, designed to find min and max.  All but two of the channels calculates just fine.  2 of the last 4 channles don't calculate.  No messages.  When I use the "Peaks Find..." in the ANALYSIS menu on those 2 channels, it warns me "Preview aborted due to general error.".  But, i have no idea what the error is. 

 

So my question is, "What can cause this general error message knowing that it works for 54 channels, but fails for 2?"

 

Here's the loop

 

 for each oGroup in oMyGrps
      if oGroup.Properties.Exists("Include") then exit for
      'if oGroup.Channels.Exists(oMyGrps(1).Channels(i).Name) then
      if oGroup.Channels.Exists(sChnNames(i)) then
         j = oGroup.Properties("Index").Value

         iStartRow = ChnFind("Ch(""[" &j& "]/Time "") >= " & iLowTrim)  
         if iStartRow < 1 then iStartRow = 1
         if (oGroup.Channels("Time").Size - iStartRow) < iTotalPoints(j) then iTotalPoints(j) = (oGroup.Channels("Time").Size - iStartRow)
         if oGroup.Channels("Time").Size > oGroup.Channels(i).Size then iTotalPoints(j) = (oGroup.Channels(i).Size - iStartRow)
         if iTotalPoints(j) < 1 then exit for

         'Move time and data to temp channels (so you don't damage existing data)
         Call DataBlCopy("'[" & j & "]/Time'",iStartRow,iTotalPoints(j),"'Temp/Time'",1)

         Set oTempChn(1) = oTempGrp.Channels.add(oMyGrps(j).Name,DataTypeFloat64)
         Call DataBlCopy("'[" & j & "]/" & sChnNames(i) & "'",iStartRow,iTotalPoints(j),"'Temp/" & oTempChn(1).Name & "'",1)
      
         ''''''''''''''''''''''''''''''''''''      
         'Find min and max of curve
         '''''''''''''''''''''''''''''''''''
         Call ChnPeakFind("Temp/time", "Temp/" & oTempChn(1).Name, "Temp/TimeatPeak", "Temp/Peak", 1, "Min.Peaks", "Amplitude" )
         CHD(j,sStatsChnMin(0)) = CHV(1,"Temp/Peak")
         CHD(j,sStatsChnTimeMin(0)) = CHV(1,"Temp/TimeatPeak")
         Call ChnPeakFind("Temp/time", "Temp/" & oTempChn(1).Name, "Temp/TimeatPeak", "Temp/Peak", 1, "Max.Peaks", "Amplitude" )
         CHD(j,sStatsChnMax(0)) = CHV(1,"Temp/Peak")
         CHD(j,sStatsChnTimeMax(0)) = CHV(1,"Temp/TimeatPeak")
         CHT(j,sStatsChnName2(0)) = oMyGrps(j).Name  ' & "-" & sChnNames(i)
   
      end if
   next

 

0 Kudos
Message 1 of 9
(3,467 Views)

Hi,

 

Have you tried to monitor any "hidden" error with the Err object : http://zone.ni.com/reference/en-XX/help/370858M-01/vbs/objects/vbs_objects_errobj/ ?

 

Are the two failing channels longer than the other ones ?

 

In the meantime, can you share a demo TDMS with which we can reproduce that behavior ?

 

Thanks,

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 9
(3,460 Views)

I have not tried to monitor the error.  I do that now.

 

The files are all 1500 long. 

 

I'll gladly share, but how do I create the demo TDMS file and how do I share it?

 

Thanks,

Jhn

 

0 Kudos
Message 3 of 9
(3,458 Views)

Saving a TDMS in DIAdem (last part) : http://zone.ni.com/reference/en-XX/help/370858N-01/concepts/diadem_2_03/

 

To share your file, just attach it, below the text box when replying to the topic.

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 4 of 9
(3,450 Views)

My data files

0 Kudos
Message 5 of 9
(3,446 Views)

Thanks.

 

What are the curves for which you get an error ? The 4 last ones in the first group seem to work pretty fine here.

 

Can you also share you whole VBS script maybe ? That would help reproducing.

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 6 of 9
(3,407 Views)

Hi,

 

The displacement and velocity curves.  They work for maximum, but not minimum. 

Attached is the .vbs.  Ignore the name, it's a misnomer. 

0 Kudos
Message 7 of 9
(3,405 Views)

After reviewing you data, it seems to me that it might be a "bug"...

 

In my understanding, when looking for Max and Min, DIAdem usually looks for local Max and Min, which mean that he compares each point with both the points around him (the one on the left and the right). The problem in your case is that your Min is the last point of the curve, meaning that he is "missing" another point after it to actually find the Min...

 

To confirm, I created curves from scratch and couldn't find the Min either. And you can do the same analysis on the Time curve on which you cannot find the Max nor the Min (which both are on a side of the curve).

 

I hope my explanation is clear enough.

 

As far as I am concerned, that might be subject to a Corrective Action from NI side, so you should contact your local NI Support to discuss it with them. Point them to your post if needed so that they can have your data (no need for the script) 🙂

 

Sorry for not being able to help you more...

CLAMaxime -- Kudos are a great way to say thank you
Message 8 of 9
(3,402 Views)

Don't be sorry, this is a fantastic revelation!   Thanks for your help!

0 Kudos
Message 9 of 9
(3,398 Views)