LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing multiple elements within a single array

Solved!
Go to solution

Hello everyone,

 

I am fairly new to LabVIEW but I am trying to learn.

I have some recorded measurement data. The measurement was conducted on a device that can be best described with a Bouc-Wen hysteresis model. To have a proper Bouc-Wen model I need to have a maximum force and stiffness. The measurement was conducted in a way that for every 10 ms a force and a displacement was recorded. I have this data stored in a .lvm file. I have added the graph of the hysteresis.

What I want to do is to go through this data and compare individual measurement points in a way that if 5 points in a row that don’t have a difference of more then 5% (it has to be a certain number of points since a pure max function would give the value of an overshoot) then LabVIEW calculates the average of those five points and stores it as one of the values for max. force. After it goes through the data it takes the average of all the values for max. force and gives the average max. force.

The other thing would be to find the stiffness in a way that if the sign of the force is changed, then LabVIEW takes a few (3 to 5) points on each side of the sign change (where the graph crosses the x-axis) and stores it as one value of stiffness. Further procedure is the same as for max. force.

If am thinking properly this procedure would require comparing individual elements within an array multiple times and then based on the described criteria select a few data points in the vicinity. I think I should go about this with multiple for loops but I don't know how to do this.

 

I would be very grateful if someone could help me with this problem directly or suggest a thread where something like this has already been solved since I can’t find it on my own.

 


Bouc-Wen_test.PNG

0 Kudos
Message 1 of 5
(3,702 Views)

Dear turky_g,

 

I hope I can help you with this code:

The input is a random number. Each time step, there is one new. I am saving the old values in the shift registers.

In every loop, the program checks the max and the min values and calculates the ratio of the last five random numbers. I put them in an array to be able to use the min/max VI.

If the ratio is smaller than 30%, the program jumps in the TRUE case:

1) Adding the last 5 values together

2) Calculating the average

3) And puts this value at the end of another array.

 

Is this what you are looking for?

Download All
0 Kudos
Message 2 of 5
(3,646 Views)

Hello kicker08,

 

thank you very much for your reply.

I have attached a snippet of the VI I made following your picture. I think this would mostly solve the first part of my problem which is finding the maximum force.

Do you have any suggestions on how I could go through an array of data points instead of having a random number generator? I have attached an rough example of the .txt file I need to process (first column is time, second is displacement, and the third is force).

After I have the array of average values I can get a single (average) value for the max force by having another for loop that ads all the elements together and divides them with the total number of elements. Am I thinking correctly?

 

Best regards

Download All
0 Kudos
Message 3 of 5
(3,613 Views)
Solution
Accepted by topic author turky_g

hi turky_g

 

i modified the code a bit

the program extracts the second column of your text file

furthermore, i changed the percentage to 5% and i setup a stop condition when the array is at the end

 

you should consider that your values are somtimes positive and negative.

the program only checks if the ratio is smaller than 0,05. this is true for every negative ratio

i think this is not what you want, right?

 

Message 4 of 5
(3,568 Views)

Hello kicker08,

 

thank you again.

I used your suggestion and modified the code bit more.

The for loop in the end that gives a single value for the maximum force.

In this case, the positive and negative values of the force are “equivalent” in their importance so I just used their absolute values.

I have to figure out how to get stiffness out of this data using my original idea.

If I get stuck, I’ll ask.

 

Best regards

0 Kudos
Message 5 of 5
(3,518 Views)