LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Min & Max PybyPt Doesn't Find Max Value?

Hi everyone,

 

I am having trouble getting the maximum value of a continous waveform signal... Basically, I want the display the cumulative max value from a strain gauge signal AND reset the max value when the signal value drops below 5N whilst sending the max value to an array indicator. A copy of my code is below (see lower part of while loop)...

 

First, I convert the waveform signal (dynamic data) to a single scalar; then I feed the single scalra values to the Array Max & Min PtByPt.vi; send the Max value to an indicator and case structure to build the array of max value... I also have the guage signal wired to a trigger and gate wth a 5N threshold st to "falling sense".... The "data availble" from the trigger and gate controled the case structure to build the array of value AND to a shift register which is used to re-initalize the Array Max & Min PtByPt.vi ready for the next max value..

 

The code works in terms of function; but the max value are frequently submax (small errors of ~ 2-3N?)  when I view the data on the chart//

 

Any suggestions? I am on a tight timelime with this... Any and all help much appreciated.

 

Thanks,

Jack

 

Max.png

 

 

0 Kudos
Message 1 of 13
(3,598 Views)

Here is a copy of my front panel with the chart waveform and the max indicator..

 

Thanks.

 

Max1.png

0 Kudos
Message 2 of 13
(3,588 Views)

Near the top and bottom of the mess of dynamic data type wires, you are converting that first DDT wire to a single scalar value.  That might be giving you either the first or last value of the signal in the blue wire consists of multiple data points.  So you'd be looking at the max value of a bunch of single values, throwing away the rest of the data that is in each segment of data coming through the blue wire.  The true max is somewhere in the data that you are throwing away in the covnersion to a scalar value.

 

You probably need to convert the blue wire to a 1-D array.  Also since the conversion is doing the same thing near the top and bottom of the mess of wires, why not just do it once and split the wire after the conversion rather than before the conversion.

0 Kudos
Message 3 of 13
(3,579 Views)

@RavensFan wrote:

Near the top and bottom of the mess of dynamic data type wires, you are converting that first DDT wire to a single scalar value.  That might be giving you either the first or last value of the signal in the blue wire consists of multiple data points.  So you'd be looking at the max value of a bunch of single values, throwing away the rest of the data that is in each segment of data coming through the blue wire.  The true max is somewhere in the data that you are throwing away in the covnersion to a scalar value.


This is why I wish they'd take DDT out of LabVIEW. Sure it makes it "easy"...but then it makes it harder in the long run. It just causes more problems because it makes it a big mystery as to what's running on the wire. If it was explicity waveform data, this issue probably would be resolved already. Get waveform components, array max & min on the y  data, and boom, you're done. This is nothing against the OP; I have used DDT in the past as have many LabVIEWers that started using LabVIEW around or after the time DDT was introduced. But, I just felt the need to get on my soapbox. Easier at first isn't always better (note: shared variables). Ok, off topic rant done.

Message 4 of 13
(3,571 Views)

Hi RavensFan,

 

Thanks for the reply... You are correct... I must be missing data points the max value from an Array Min&Max.vi (NOT PtbyPt) gives the correct max value... However, I don't know to reset the Array Min&Max.vi when the signal drops below given threshold... Any ideas? I could toggle it using a case structure, but is probably not the most correct option.

 

Any suggestions?

 

Regards,

Jack

0 Kudos
Message 5 of 13
(3,564 Views)

Hi Greg,

 

I kind of agree with you.  The DDT works great if you are working with something quick and easy.  Throw together a few things in 2 minutes to get some basic functionality working.  As soon as you need to do something more than a VI with a few nodes, and you to connect the blue wire to real LabVIEW primitives, they become harder to use rather than easier.

0 Kudos
Message 6 of 13
(3,562 Views)

@jcannon wrote:
However, I don't know to reset the Array Min&Max.vi when the signal drops below given threshold... Any ideas? I could toggle it using a case structure, but is probably not the most correct option.

 

Any suggestions?

 

Regards,

Jack


If toggling it in the case structure works, and your'e in a time crunch, then it's the most correct option :)! I am a little confused about what the reset is you're trying to do (but it's been a long day for me already!), so maybe you can code it up and get it working and then post a this-is-how-it-should work version, and we can give feedback as to a different method to accomplish the same thing. 

0 Kudos
Message 7 of 13
(3,545 Views)

Hi Greg,

 

Basically, I am sampling muscle force data from human arm contractions... Each time the person performs a maximal effort contraction, I want to find the max value from that specific contraction and it send to an array indicator... So, if the person contracts, then relaxes, I will have the max force value in an indicator (using 5N as the onset threshold)... So if the person does 3 contractions with 3 rest periods (above 5N, less than 5N three times); I will have 3 max values, each one corresponding to each of the the contractions...

 

Still working on the code... This is actually proving to be quite difficult!

 

Regards,

Jack

0 Kudos
Message 8 of 13
(3,535 Views)

Don't be too hard on yourself...I wouldn't exactly call this trivial. I didn't test this, so I can't be sure if it works for all cases. But this may be one way to do it. The false case just wires things straight through. I did just notice, I never checked for it to go over 5 first, before resetting/storing a value. I may go back and try and rework this later, but this should give you a starting point.

 

 

Message 9 of 13
(3,522 Views)

Not much of a doubt in my mind this will end up in the Rube Goldberg Thread. But this one is more close to what you want. The image at the bottom is just to show the other case of the case structure. If this doesn't work, I will leave it for someone else to try (or do correctly Smiley Tongue). Basically, you set a boolean when you are in contraction. While you are still in contraction you keep checking for a new max. Then if you drop out of contraction, you store the current max value in an array and reset the max value. Now, while you are below 5 no max value calculation will be done. When you get a number above 5 again, it will start the calculations. I think this is more in line with what you want. 

 

Edit: sorry for all the edits, I noticed a couple small mistakes.

 


0 Kudos
Message 10 of 13
(3,510 Views)