DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calc RMS in band Cursor

Is it possible to calculate RMS using the band cursor?  ie, the user selects the band cursor and range and RMS values are given

0 Kudos
Message 1 of 18
(6,749 Views)

More on my need for RMS via the band cursor...  My data has multiple "data periods" where I need an RMS value and in between there are periods I am not concerned about.   Using the band cursor to select the individual areas of interest and getting the single RMS value is what I'm after. (Data flucuates in the areas of interest).

 

I've used the ChRMS() but that gives me a waveform.  I want a value.  

0 Kudos
Message 2 of 18
(6,744 Views)

Hi Tweedy,

 

Here is an application that calculates several statistical properties for the region defined by the band cursors.  I added the overall RMS calculation and made it the first column for you.  When you run the script it also adds a "Sigma" icon to the end of the top VIEW icon bar so that you can easily run the script again.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

Download All
0 Kudos
Message 3 of 18
(6,696 Views)

That works and I learned some more about DIADEM VBS (using eval).

 

I noticed the StatClipCopy property and thought that would be perfect for what I need to do.  Get the points directly into the clipboard so I can paste to Excel.  I made it TRUE and I get a 20x1 column of what appears to be properties and not the StatSel() properties just enabled.  Also need to have the Time between the bands and no StatSel available for that. 

 

If there is a direct way to get Time, Avg, RMS for the band (each channel) directly to the clipboard that would be the ideal for me. 

 

I've been pushing to purchase DIADEM by demonstrating how easily it processes data and am hoping I can do that by shortening the time it will take us to go through a warehouse full of data gleaning out just the data we need.  Unfortunately every time I need to use the VBS I get bogged down.  I appreciate the help you have/can/will provide.

0 Kudos
Message 4 of 18
(6,662 Views)

Tweedy

 

Here is some code that might help.

 

It will open a excel file and put some data into a specific cell. Then close and save the workbook.

 

Maybe you can see how it works and directly write the data into Excel.

 

Paul

 

ps. Writting to excel directly is quite powerful, but also difficult at same time( as are kind of blind as to how the commands will operate) Sometimes I will output a file that is in CSV format that will be easy for Excel to read in.

 

Version:0.9 StartHTML:00000107 EndHTML:00008452 EndFragment:00008412 EndFragment:00000000
'-------------------------------------------------------------------------------
' Description : Writes to a Excel file 
'-------------------------------------------------------------------------------
sub WriteExcel(strFilename)
  dim objExcel, objWorkbook
  dim intRow
  dim intCol
  dim strOut
  dim strColTerminator
  dim workSheetCount
  dim counter
  dim currentWorkSheet
  dim j,k
  dim iNumCmds
  dim outValue
  
  dim strDataSource,strUnit
  dim strTestNum,iNumTest
  
  strOut = ""
  iNumCmds = 0
  
  Set objExcel = CreateObject("Excel.Application")
  Set objWorkbook = objExcel.Workbooks.Open (strFilename)
  
  objExcel.Application.DisplayAlerts = False

  intCol = iColStart
  
  strTestNum = ""
  
  workSheetCount = objExcel.Worksheets.Count

  For counter = 1to workSheetCount
   
    Set currentWorkSheet = objExcel.ActiveWorkbook.Worksheets(counter)
    
    if CurrentWorksheet.Name = "Hwy"then
      intRow = 2
      intCol = 3
      objExcel.Cells(intRow , intCol).Value = outValue' sets a cell in worksheet     
      
    endif  
  next    
  
  objExcel.ActiveWorkbook.Saveas strFilename
  objExcel.Workbooks.Close'Close the workbook then finally quit excel 
  objExcel.Quit

  set objExcel = nothing
  set objWorkbook = nothing
endsub

0 Kudos
Message 5 of 18
(6,657 Views)

Hi Tweedy,

 

The usual approach to sending data from DIAdem to Excel is to accumulate all the data into new data channels in the Data Portal, then exports those channels at the end to a CSV file or a TDM file that imports right into Excel.  As the other poster outlined, it is also possible to push data values through ActiveX to an Excel workbook.

 

Alternatively, you should be able to copy the values in the pop-up table and paste those to Excel.  It's just an extra step of highlighting the table cells and hitting the <Ctrl-C> keys.

 

How many regions within one data file do you typically analyze?  Would it be possible to programmatically determine the regions of interest?

 

What do you do with the statistics in Excel?  It's possible DIAdem could help you with more of your task.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 18
(6,646 Views)

Brad,

My original intent was to copy the pop-up table data to the Excel template we have but when I saw the "StatClipCopy" I thought I could easily/more directly get the data to Excel after the user selects the band. This would eliminate the extra step of copying the pop-up table.  Keep in mind that this process will need to be repeated 100's of times -thank god for interns 🙂 -

 

Here is the complete process I am attempting to automate as much as possible:

Data was collected as csv file with 1 data set being 10 operations with idle time between. Think of it as a square wave with zero reference.

Engineer ported data to SIGMAPLOT

Several weeks of data collected/consolidated

Engineer wants specific data from each of the 10 operational sections : Time span, Average values and RMS values for Torq, Speed, Amps, Volts

    Possible to automate the selection but for now we will just manually pick.  No time to program/debug in timely manner but I would like to carry it all the way for future use.

    It would be great if all 10 operations could be automatically shot off to excel!

We've exported all the SIGMAPLOT data to csv

Excel MACRO written to organize/consolidate data needed.

Dataplugin created to bring in data to DIADEM

Use band cursor to get specific data. 

Post data to Excel template as final output.

Engineer uses data to make major breakthrough in problematic area.

Engineer/management gives high praise for quick turnaround of data and gives blank check to purchase the marvel software that did it!

 

As I said, I recognize the power that DIADEM has for processing huge amounts of data and down-the-road would like to automate the complete process.  Even by semi-automating the process for our current need (today actually I need to start) I want my leadership to see that power and finally let me purchase DIADEM.  We do currently own LABVIEW and are seeing its benefits. 

 

I appreciate all the help I've been given here!!

 

Ray

0 Kudos
Message 7 of 18
(6,640 Views)

Thank you Paul.  I will certainly keep this for use in my final version.

 

0 Kudos
Message 8 of 18
(6,639 Views)

Brad,

So is it possible to use "StatClipCopy" or something similar to get the Time span of the band, along with waveform RMS and Average values into the clipboard so I can paste it elsewhere (Excel)

For now it would be my best solution.

 

Using the pop-up table would work but I need to add the time span of the band and just need Average and RMS values of each waveform. (Not Min and Max)  The StatSel package doesn't have time in it???

I can subtract P2 & P1 to get it however.  Not sure how to get that to the table though.

 

I'm trying to learn the SUD editor but haven't figured out yet how you got the fields built.  Admittingly I am not the best at programming but I am my only resource at this point besides all the gurus here.

 

Tweedy

0 Kudos
Message 9 of 18
(6,637 Views)

Hi Tweedy,

 

It sounds like you could automate the identification of those 10 regions and save yourself and your interns a whole lot of time and effort.  Any chance you could post or email me (brad.turpin@ni.com) a data set to work with?

 

Wouldn't it be better to past the stat results for ALL of the 10 (or however many) regions to the clipboard at once?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 10 of 18
(6,622 Views)