From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurment of water lever in a tank.

Solved!
Go to solution

Hi, I'm completely new to LabVIEW. I am trying to make a program that measures the water level in a tank, I have a tank loses water to a resrvoir tank. The tank has a pressure gauge that turns the pressure into a voltmeter. Then I also have a pump that pumps up water from the reservoir gauge wich is controlled via a power supply. The program should be able to have a max and a min height in the tank, if then tank is at min the pump should start and at max the pump should stop. I also want to monitor this in a sweep chart. And last i want to have a lamp that goes red if tank is below min height and green if at max height. I will attach what i have done and happily take suggestions or if im even doing anything right.     

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

What you have looks like it is almost there, at least once you use block diagram cleanup to get rid of those backwards running wires.

 

But since you only want the power supply to turn off in once situation, and turn on in the other, those GPIB write functions belong in case structures that are connected to the same booleans that connect to the LED's.

0 Kudos
Message 2 of 18
(1,679 Views)

How would I go about that? Can't really figure out how those case structures work, is it just to take it from for exampel  <= and wire it to a case structure and then have the GPIB write inside or?

 

Thanks for the response.

0 Kudos
Message 3 of 18
(1,658 Views)

Yes.  Put the write inside the Case structure.

 

If you don't understand case structures, then back up and take some LabVIEW tutorials.  How to Learn LV

0 Kudos
Message 4 of 18
(1,646 Views)

So maybe more like this then?

0 Kudos
Message 5 of 18
(1,640 Views)

Close.  But you wired the boolean wires to a tunnel of the case structure.

 

They are supposed to be wired to the Case Selector  (green ?) like the tutorials show you.

 

If you click on the broken run arrow, it will give you a list of the errors in your VI.

 

You also seem to have the GPIB read and write for the voltmeter in parallel.  Should those be in series (wire the error terminal from one to the other) so that you can write a command first then proceed to read the response?

0 Kudos
Message 6 of 18
(1,635 Views)

Aha okay, well I think I got it now, can you make a last check and see if you can see anything wrong, at least I don't have a broken arrow anymore.

Thanks for all the help! Really appreciate it!

0 Kudos
Message 7 of 18
(1,631 Views)

Hi kalwet,

 


@kalwet wrote:

can you make a last check and see if you can see anything wrong, at least I don't have a broken arrow anymore.


Are you sure about the address strings for all those GPIB calls? The LabVIEW help describes them in a different way…

Do you really need to use those old GPIB functions? Why not use the "modern" VISA functions instead?

You should only send commands to the "Power supply" when the boolean values (Tank full, Tank tom) change: read the help for PtByPt-BooleanCrossing…

You don't need two indicators (Tank, chart) to show the very same value: show the numeric display of the chart!

The constant "5" should be of DBL datatype…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 18
(1,623 Views)
Solution
Accepted by topic author kalwet

@kalwet wrote:

... check and see if you can see anything wrong, at least I don't have a broken arrow anymore.


 

A few more tips:

 

  • Several of your diagram constant have the wrong representation, giving you red coercion dots. (e.g. the mode defaults to zero so you don't even need that constant. The "5" should be orange.)
  • Unless this tank can fill in nanoseconds, you probably should define a reasonable loop rate. A few times per second is probably plenty, so place a small wait and also define dx for the chart (once before the loop!) so the scaling is correct. Do you know how long the instrument IO typically takes?
  • I would match the style of the two LEDs (both should be modern). You can change the color using the coloring tool.
  • Fill all controls with reasonable typical defaults. A max and min of zero is not reasonable.
  • Avoid duplicate code. You have two string constants with a value of "power supply". One is sufficient. you can branch the wire.
  • ...

 

0 Kudos
Message 9 of 18
(1,610 Views)

Those are the ones we are supposed to use, the old GPIB. Regarding the GBIP address string, I don't have it for the moment, will add them later. And regarding the graph, I want to show how much there is in the tank during a time span. It should be a "sweep chart" but I'm not sure if I've done it right. 

 

Can't really understand the PtbyPt-BooleanCrossing, I will read about it tomorrow.

 

Thanks for the feedback!

0 Kudos
Message 10 of 18
(1,605 Views)