LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate istant flow?

Goodmorning, this is my first experience in the labview world and i have a problem:

 

I have a sensor which measures the volume entered in a container that stops when it reaches a liter! Now I should calculate the flow rate DeltaV/Delta t..I fix Delta t at 0.1 microseconds, my problem is how I have to calculate Delta V in a range of time of 0,1 ms?

I should store in a variable A, the value of V at the instant 0 and store in B the value at the instant 0.1, do the difference, divide by 0.1 and plot it on a graphic. The next stop is storing in A the value at the instant 0.1 and in B that at 0.2 and making calculations, - and / How ?I just cannot store in any array or variable a datum at a specific time set!
Thanks a lot for your advices

0 Kudos
Message 1 of 6
(2,926 Views)

Use a shift register to keep track of the previous volume reading.

 

The VI you posted has several other problems.

1. The style guides recommend that the size of panels and block diagrams be no larger than one screen.

2. The use of sequence structures should be avoided. LabVIEW uses data flow to determine the order of execution. Simply wiring the error in and error out clusters is completely sufficient to allow elimination of the sequence structure.

3. Repeated code should be in a subVI or in a loop or both.  You have VISA Write (command character) - VISA Write (numeric data) - Time Delay (0.1 s) seven times.  This will fit nicely in a for loop with the commands and numeric data in arrays.

4. The while loop never stops because a false constant is wired to the stop terminal.  If you are using the Abort button (red octagon on toolbar) to stop the program, STOP.  The Abort button is intended to be used by the programmer to abort execution of a program during development. The user should be given a Stop button on the Front panel.  Someone on this Forum has likened stopping a VI by using the Abort button to stopping a car by hitting a tree - it works but has unintended consequences.  In your program the VISA Close will never execute if you stop the while loop with the Abort button.

5. While not a problem, using Search/Split String and a string input to the case select terminal will simplify the case structure inside the while loop.

 

Lynn

Flow.png

0 Kudos
Message 2 of 6
(2,916 Views)

Could you please send me the modified file?

0 Kudos
Message 3 of 6
(2,901 Views)

I added a few notes. I did not check it in LV 8.5.  Some things may not work exactly the same as in my newer version.

 

Lynn

 

 

0 Kudos
Message 4 of 6
(2,885 Views)

Hello, I tested your project with labview 8.6 and does not work and gives me error:

Code: -1073807339

VISA Read in datamed_b.2.vi

Now I have modified the original project by putting the shift register but it works badly, I see only some peaks in the graph and it is always 0 .. can you modified original project in the first message with shift register?

 

 

Flow chart

0 Kudos
Message 5 of 6
(2,855 Views)

i've resolved.. thanks for help..

0 Kudos
Message 6 of 6
(2,850 Views)