Quantcast
Channel: All LabVIEW posts
Viewing all articles
Browse latest Browse all 202581

Re: filling one tank from two separate tanks.

$
0
0

In your VI the 5 loops run in parallel. Nothing wrong with that in general but here it does no do exactly what you want.

 

Let's make a little table. (You can do something similar on the VI by making the Digital Display visible on the tanks.)

 

Time    Removed       Removed         Removed                     Total in (desired)    (actual)

             from Tank1    from  Tank 2      from Tank n                     Tank 3

0                 0                        0                           0                                     0                              0

200 ms      5                        5                           5                                   15                              5

400 ms      5                        5                           5                                   30                             10

600 ms      0                        5                           5                                   40                             15

800 ms      0                        0                           5                                   45                             20

1000 ms    0                        0                          5                                    50                             25

1200 ms    0                        0                           0                                   50                             30

1400 ms    0                        0                           0                                   50                             35 .....

 

You can see that the bottom tank does not get the amount removed from each of the other tanks in any time interval. It does end up with the correct amount but not until much later.  This is because the tank being filled does not get information from the other loops about how much was removed from those tanks during each interval. Try running the VI with Highlight Execution (the light bulb on the block diagram toolbar) turned on. 

 

The prefered way to communicate between parallel loops is via queues.

 

However, as I pointed out earlier, this can be done with a single loop. By working with arrays and possibly subVIs it could be done in a single loop and the number of source tanks could be changed arbitrarily. You could also allow different flow rates from each tank.  By doing everything in one loop the amounts flowing out of the source tanks can be wired to and Add to represent the amount flowing into the destination tank on each iteration.

 

Because all the time intervals are the same, everything can be in one loop. I used a while loop and determined the exit condition by  waiting for all the booleans representing the flow to be false.  You could probably determine the number of iterations from the maximum of the N values fed to the source tank loops (in your VI) and use that as the N value for a single for loop. With either type of loop you will need to keep track of the number of dispense iterations for each tank (or the total amount dispensed) since not all tanks will dispense on every iterations. Use case structures and shift registers.

 

Lynn


Viewing all articles
Browse latest Browse all 202581

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>