# DIAdem

cancel
Showing results for
Search instead for
Did you mean:

Solved!
Go to solution

## Formula for finding channel value

Hi all,

Assumption : Dat file containing time and acceleration value. NOw there are only two channles.  Channel 1 is time . Channel 2 is Acceleration.

Step 1: Create two more channels. channel 3 and channel 4

Step 2:  go to analysis and search in accleration channel where its value is reached 1.xxxxxxxx

Step 3: Where ever it has reached 1.xxxxxxxx in accleration channel from that point in channel 3 and 4, Paste all the std values. Std values are in the attached excel file.

How do i do this?? what is the formula or script to do this?

Thanks in advance.

Message 1 of 23
(5,141 Views)

## Re: Formula for finding channel value

Hi Rash.patel,

We're definitely getting closer.  I can load your Time and Acceleration channels from the DAT file you attached, and I can see the 2 columns of data values in the Excel file you attached.  It would be simple enough to load the 2 columns from the excel file into 2 new channels in DIAdem, or it would be simple enough to copy the Time and Acceleration channels to 2 new channels in the Data Portal.  It's also easy enough to find all the rows where the Acceleration channel exceeded a certain threshold value.  The part that still confuses me is how to correlate the Acceleration channel (10000 values) with the Excel columns (1587 values).  The maximum peak in your Acceleration channel is 30.091495513916, located at Time 0.1268 on row 3537.  Let's say I want to look up the corresponding value in your Excel value, well.... there are only 1587 of them... row 3537 in the Excel file is empty!  So how do you know which Excel column value to pick for any given Acceleration value?

Brad Turpin

DIAdem Product Support Engineer
National Instruments
.

Message 2 of 23
(5,123 Views)

## Re: Formula for finding channel value

Hey,

Here's something else that u can try as well:-

1. Save the DAT file as a .LVM file using DIADEM.

2.  Read the lvm file in labVIEW using read (file I/O).

3. Split the signals at the output SPLIT SIGNALS.

4. Then for the acceleration channel compare the array with the value u want (1.xxxxx) using the function SEARCH 1D ARRAY. This will give u the index value at which ur element is present.

5. Then insert ur values (channel 3/4 values) in an array starting from the index value u calculated in the earlier step.

6. Now u have all the 4 channels which can be written back in a tdms file.

7. Convert it back to a DAT format.

Message 3 of 23
(5,098 Views)

## Re: Formula for finding channel value

Hi Brad,

Thank you very much for working with my dat file. I posed the same question to my engineer. So many empty cells exist after copying 1587 values from excel files. but I wonder they use the same strategy for testing their dat file.

Now I have to create a script for that. I have recored a script for that. I am sending it in attachment.

1. After copying the values 1587 values from excel file to channel table , from the beginning, it gives report in 2nd attachment format. ( All 3 curves overlapp on each other)

2. After copying the values 1587 values from excel file to channel table ( 3 and 4) , 5 or 6 rows before , where ever the acceleration value of 2nd channel has reached 1.xxxxxx , it gives report in 3rd attachment format. (expected report format)

3. Now I have to create a script to generate report in the 2nd format. What are your comments on this?? Whether it is a correct metrhod of checking the correctness of a test or not?

4. HOw will i make script more interactive(If possible)?

Message 4 of 23
(5,096 Views)

## Re: Formula for finding channel value

Hi Sahil,

I have no idea on Lab view. Am a software  engineer from Computer science bg. New bee to DIadem also.

Any way thanks fro your answer. I wil try using labview in my free time.

Message 5 of 23
(5,094 Views)

## Re: Formula for finding channel value

Hi Rash.patel,

OK, now we're just down to a few pesky details.  You say that you want the limit curve from Excel to start at the point that the measureed acceleration data channel exceeds "1.xxxxxxx", but what IS this threshold value?  I need a number for the threshold if I'm actually going to find the point that your acceleration data channel crosses this threshold.  I'm going to guess that 1.0 will work, based on the shape of the one acceleration curve you've sent me.  I've edited your VBScript to find the data row on which the acceleration data channel exceeds 1.0 and add 0s to the 3rd and 4th channels up to that row.  Now you can manually paste data columns from Excel to those new channels in VIEW, if you wish.  Then just manually refresh the REPORT graph <F5> to show the envelope curves there.

We can make the envelope curve import automatic, but for that I need to know how reliable your Excel files are.  Does the first data envelope always start in cell D1 on the first Excel sheet?  Does the second envelope curve always start in cell E1 on the first Excel sheet?  Will the Excel sheet in question always be called "curve linear final limits  ECE-AIS.xls"?  Reading those 2 columns from Excel is not hard if we know where the data is in the Excel file and the file path of the Excel file.  Are the limits always the same?  If so, why don't we save them to a TDM or DAT file to make things even easier?

Here's what I have so far,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 6 of 23
(5,078 Views)

## Re: Formula for finding channel value

Hi Brad,

To answer your question, Yes the name of the excel file will always be called "curve linear final limits  ECE-AIS.xls". Its contents will not be modified.

I tried to create TDM/DAt file out of that excel file. But all my other excel files I could load. But not this excel sheet. I dont know whats wrong with it. But am trying.

Now keeping this "curve linear final limits  ECE-AIS.xls" as standard, If i want to load any other dat file, how do i do that?

1 way is to change the name of .dat file in script .

2nd way is to have a msg box/user form to load dat file and to load std excel file and plot the graph. Does it works??

Thank You

Message 7 of 23
(5,041 Views)
Solution
Accepted by topic author Rash.patel

## Re: Formula for finding channel value

Hi Rash.patel,

You still didn't tell me where to find the Excel file, so I assumed it would be in the same folder as the VBScript.  I used DIAdem's Excel Import Wizard to create a *.stp file which can be passed as a parameter in the ExcelImport() command to load those 2 envelope curves programmatically.  I also added a file dialog so you can select the desired *.DAT file to process.

I think this does it,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

Message 8 of 23
(4,994 Views)

## Re: Formula for finding channel value

Hi Brad,

Sorry for confusion. Yes it liesin the same folder as VBscript.

I was not knowing about importing data as I am new to DIAdem. Its an input for me to learn this importing wizard now.

Its working.. Great!! Thank u so much.

Rash

Message 9 of 23
(4,987 Views)

## Re: Formula for finding channel value

Hi Brad,

A small confusion after using the acceleration envelop curve for some other dat files. attached is the snapshot of the error.

The idea was to make this accleration curve inside the standard curves. But for some files it is not working. Can you help me how can i  modify this script to fit the curve inside the standard curves.

In the attachment 1, the dat files C100227-6 and C100402-4 which works correctly as expected. But for C100227-7 and C100402-5 only 1 curve could be seen and xxx-3 behaves still more differently. I gave refresh after loading the .tdr. But no changes.

In attachment 2, the other dat files I am trying to fit them in the standard curve using the same autosequence. Event 1 and event 2 channels are of no interest for me. I am cooncentrating only on Time, Acclerationn , channel 1 and channel 2.

Please give me an idea to load and fit these dat files inside the standard curves using the same autosequence.

Thanks in advance.

Patel

Message 10 of 23
(4,510 Views)