LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Previous Max Values and Min and Max Condensed Layout

Hello,

 

I am working on this program to display the Max value from a waveform graph and display the previous 4 values. Some issues I am having is displaying the previous values on the front panel and getting the values to hold/stay until the program is ran again. I have played around with arrays and strings but could not get the value to hold or display the previous value. Some examples I have seen use the array Max and Min or the Waveform Max and Min, not sure which one wires everything correctly to do what I want it to do. I have tried multiple different ways to go about this but I feel I must be missing something ever so important. I have displayed below what my block diagram looks like and what each case structure is wired to. This is all in a While Loop just fyi. 

 

Also, if there is any suggestions in simplifying this program please let me know! I am open to trying different things as I am beginning to learn LabVIEW more in depth. 

 

Thank you. 

 

0 Kudos
Message 1 of 13
(1,332 Views)

Please attach your VI instead of pictures. To retain data between runs, you need e.g. an uninitialized shift register.

 

What do you mean by "previous 4 values"? The last four max values? The last four values in general? A chart with a 4 point history? How does the front panel look like?

 

I don't think you need any case structures!

0 Kudos
Message 2 of 13
(1,307 Views)

Here's a quick draft to show data, min and max on a chart. Maybe it can give you some ideas.

 

If you want to retain data between calls (only meaningful during debugging!) You can use an uninitialized shift regsiter and some extra code.

 

altenbach_0-1696279426546.png

 

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

I have attached the VI below. Let me know your thought! I am looking over your other min and max suggestion. Yes, the previous 4 max values is what I would like to display. Preferably in a value form instead of a graph.

0 Kudos
Message 4 of 13
(1,256 Views)

Wow, your code is convoluted!!!

 

Why use local variables if you could connect to the terminal right there??? Completely pointless. Why are there terminals without labels?

 

altenbach_1-1696622428014.png

 

Where is the array with the max values? Why not label is as such?

Don't wire a +inf for the sample length of the ptbypt minmax.  Look at the help and wire a zero if you want what you apparently want. There is no "inf" for integers so it will get coerced to 2^32 and you'll eventually run out of memory!

 

Correctly done, you code should fit on a postcard!

 

I am not going to even try to debug your code, but here's a "code miniature" that keeps an array of the last four max values seen.

 

altenbach_2-1696623217914.png

 

The shift register should be anchored on the toplevel loop. There is no need for inner loops!

 

(Note that the code could be slightly simpler if you want the maxes in a different order. We can't really tell how you want it)

 

0 Kudos
Message 5 of 13
(1,237 Views)

Thank you for helping. I did say I was a beginner and just starting out in this program. I will do some more work to see what I can do to condense it as well as make it more efficient. 

 

0 Kudos
Message 6 of 13
(1,187 Views)

So I took your suggestion and rewired by code to fit the previous max values. However, the two issues I keep running is 1.) When the While loop is outside of the main while loop, the averaging graphs and max values do not generate, 2.) When I make the while loop to a for loop, the max values keep resetting to zero and do not store the previous values. Please let me know your thoughts. I've attached my new VI below. 

0 Kudos
Message 7 of 13
(1,163 Views)

@A1777 wrote:

So I took your suggestion and rewired by code to fit the previous max values. However, the two issues I keep running is 1.) When the While loop is outside of the main while loop, the averaging graphs and max values do not generate, 2.) When I make the while loop to a for loop, the max values keep resetting to zero and do not store the previous values. Please let me know your thoughts. I've attached my new VI below. 


No, this is still all wrong! For example why would you take a waveform, make it into an array of waveforms, get the fire waveform (getting you back to square one!) You still have these silly local variables. Wiring [i] to N is completely pointless.

 

You array of maxes needs to be anchored on the outer while loop, of course. 

0 Kudos
Message 8 of 13
(1,129 Views)

See if this simulation gets you any closer.

 

 

0 Kudos
Message 9 of 13
(1,124 Views)

Okay, I have simplified my program and made it more efficient. It's doing what I would like it to however, is there a way to get the last 4 max values to hold until the next value without putting a while loop? For example, when I bring the while loop outside of the while loop I am working in, the values do not generate but when the while loop is inside the other while loop it does not run at all. So what I have done is gotten rid of the while loop and just left the for loop and its working properly. I just want to know how to not reset the last 4 max values. 

0 Kudos
Message 10 of 13
(1,008 Views)