LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing Value of Cluster Element Within an Array

I have cleaned up what I have. Now how do I limit the increment and/or decrement so that it does not go below zero or above four?  The way I have it written it will achieve 5 or -1 and then it won't increment or decrement any longer.  So if it increments up to five and then my level increases, it will not decrement the number of pumps needed anymore.

0 Kudos
Message 11 of 18
(1,266 Views)

You still have several major program errors.

 

1.  Your initial while loop will either run one time or run infinitely.  The Call for Vacuum control gets read a single time at the beginning of the program.  If false, your while loop runs a single time.  If true, it will run forever and the only way to stop your program is to abort it.

 

2.  In the case structures after your loop, you are comparing values with the numbers 1, 2, 3, 4.  But those values are floating point numbers.  You can't guarantee that 1 will equal 1 exactly.  Only rely on integers when comparing for equality

 

3.  Your case structures look like they should be running in parallel code.  But they are dependent on the output of the while loop.  And as we established in point 1, that will run once, or you'll never get to the case structures because you'll have to abort the program to stop the while loops.

0 Kudos
Message 12 of 18
(1,263 Views)

I don't think there is much I can do about relying on the output of the while loop.  I have changed the pump positions to bytes.  I don't really understand why the while loop would only run once or run infinitely.  How does the toggle switch differ from a boolean stop button?

0 Kudos
Message 13 of 18
(1,258 Views)

Your terminal is outside the while loop.  It is read once.  That value is passed into the loop.  The loop executes all the code in the while loop.  Because the terminal is not inside the while loop, it isn't read again.

 

Turn on highlight execution and watch how the code runs.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 14 of 18
(1,253 Views)

Okay, it is all starting to make a little bit more sense now.  I still have not found a good way to increment the hour timer and put it back into the array to be sorted.  Thank you guys for the help so far.  I told you it was a mess!

0 Kudos
Message 15 of 18
(1,247 Views)

The array wire should go to a shift register.  Use replace array subset to replace elements in the array.  Or use Build Array to build back up from scratch.

0 Kudos
Message 16 of 18
(1,245 Views)

So I increment a float in another case structure within the while loop, and use that to replace the array subset?

 

I tried that in the attached file but it is not putting the incremented hour back into the unsorted array.

0 Kudos
Message 17 of 18
(1,243 Views)

I got it working the way I want it to.  Thanks again for all of the help!

0 Kudos
Message 18 of 18
(1,234 Views)