02-01-2019 07:37 AM
Just looking for any ideas on how to implement a target stop into this VI. Possibly with the ability to continue counting from the last number it stopped at. Your help is much appreciated.
Solved! Go to Solution.
02-01-2019 07:45 AM
What are you trying to stop? What is this VI even supposed to be doing? You have what appears to be a lot of data dependencies that you really want running in parallel.
02-01-2019 07:51 AM
Hi JRyno,
Just looking for any ideas on how to implement a target stop into this VI. Possibly with the ability to continue counting from the last number it stopped at. Your help is much appreciated.
Which "target" do you want to reach? What are the conditions to calculate that "target"?
Why do you use so much Rube-Goldberg code in your VI? (Why go to DBL values when all you need is a boolean in each loop's shift register?
What do you want to achieve with placing 4 loops in 4 frames of a sequence? Why having another loop calling a DAQAssistent after all those other loops? (Why have a wait function in each of the first 4 loops?)
What do you want to achieve by adding all the loop iterator values after placing them in arrays?
You really should draw your algorithm on a sheet of paper - before starting to code…
Hint: when you want to store a value for using it in subsequent calls of your VI you should think about saving it to a file…
02-01-2019 08:02 AM
Learn proper use of Data Flow. "An Error Line Runs Through It" (the name of a famous film about LabVIEW). Repetetive things = For (or While) Loops and Arrays. Clusters of similar indicators (such as Low PSI, Med PSI, High PSI, Motor Drive) suggest Clusters. There is almost never (notice the "almost") a need for a Sequence Structure, and even less need for the Stacked Sequence (which I think now is missing from the Structure Palette, yay!).
Get used to thinking "What do I want to do", and paying less attention to "How do I want to do it". Use sub-VIs to "encapsulate" tasks (a.k.a. "hide the details"). Give your sub-VI a simple 3-word Text Icon ("Open Files", "Get On/Off Settings") so when you look at the VI that uses them, you can "see what it's supposed to do" just by reading the 32x32 pixel sub-VIs sitting there linked by the Error Line running through their lower corner connectors.
Bob Schor
02-01-2019 08:02 AM
Hi crossrulz, I need this VI to run until the sum of all the iterations is equal to 21376. This VI is as the title states a "practice code" to get an idea of how to control a pressure test that needs to run a low psi for 28 cycles then switch to medium psi for 1 cycle and so on with the high loop and the motor control. If there is an easier way to do it I am open to your suggestions this is just the first revision I made to get the VI to do what I want. Also while I understand that it is a very backwards way of doing so I made the for loops in each sequence generate a series of 0's and 1's to turn the LED's on and off. Again I'm open to suggestions on how to make it simpler but this was the best way I could figure out how to turn the LED's on and off in the specific sequence that I want.
02-01-2019 08:10 AM
Hi Bob,
I have spent the past two weeks or so doing research on ways to get something similar to this without having to do it the way I did. However, this VI is currently the only way I have been able to execute the control of one LED then move on to the second one after the first reached its required number of iterations. I am open to suggestions on how to make this less repetitive but I currently do not know how. I already know what I want to do, I've spent weeks understanding the requirements of what I am doing, I am on the stage of trying to figure out how and this was the easiest way for me to make the VI do what I want it to with the very limited LabVIEW experience I have.
02-01-2019 08:36 AM - edited 02-01-2019 08:38 AM
@JRyno wrote:
This VI is as the title states a "practice code" to get an idea of how to control a pressure test that needs to run a low psi for 28 cycles then switch to medium psi for 1 cycle and so on with the high loop and the motor control.
That is NOT what you have coded up. The code will spend nearly 1 minute creating arrays that are then fed into a FOR loop where you write the data to the digital lines as fast as the software will allow. And due to autoindexing and FOR loops being lazy, you will only get 2 writes in.
You can simplify this A LOT with just a single FOR loop, a case structure, and some shift registers.
EDIT: I just noticed the autoindex tunnel from the Initialize Array. That should be a normal tunnel.
02-01-2019 08:46 AM
Would you mind explaining the code you wrote just so I can begin to understand what it means? I'll begin working on something like what you have there and come back when I think I have it or if I have issues. However, I did forget to mention that I would like to have different timings for each pressure cycle which is why I had different wait controls in each loop. I'm not sure if that is possible with what you have provided me but again I will attempt it on my own and come back with my results.