LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variation between local variables

Hello, I use version 7.1 for developing a scada application for seeing liquid tanks levels, and  I need to see the flow depicted at tank indicator from one to another in this way.

  1. The first tank increase it liquid level only when an electrovalve is activated, the level is writen in a numeric indicator.
  2. The liquid flows from a second tank only when a second electrovalve is activate.
  3. When both electrovalves are activated the level variation must be saw both indicator and controls.

I fail in third point, Is it possible to make it as I madeor anything similar? The vi I made became crazy when I turn on.

 

Thank you very much.

 

levels.jpg

 

 

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

1.  Your VI is designed to only run one time.  It runs once. Then it stops.  My guess is your are using the Run Continuously button.  Don't.  It is only intended for special situations like if you want to debug a VI.  If you want your VI to keep running, then use a while loop around it and a stop button.

 

2.  You need a wait statement in your loop.  Without a wait statment,  your VI will run as fast as the CPU allows.

 

3.  Local variables are almost always used incorrectly by new LabVIEW users.  Read this thread Why some people say Local Variables are bad... for some reasons why.

 

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

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

Paul,

 

How are you running this VI? Are you using Continuous Run?  If so, STOP!  That is only for use during development.  To cause code to run repeatedly put it inside a while loop.

 

Once you have a loop, add shift registers for the Tank levels.  Get rid of the local variables.  They may be contributing to race conditions.  Wires are always better.

 

Your conditions are not clear. You specify that Tank 1 should increase when EV 1 is on but you only write the value of the control to the tank. Your code shows a decrease on Tank 1 when EV 2 is on, but your words do not say that.  Similarly if EV 2 is on and EV 1 has never been on, Tank 2 will have a negative value.

 

Please try again to explain what you want.  Perhaps a small table showing values of EV 1, EV 2, Level1, Tank 1, Level2, and Tank 2 over time would help.

 

Lynn

Message 3 of 6
(2,572 Views)

 I think so I must rethink the problem. First of all, I need to design a hysteresis cycle for the system.

I explain you, When the tank is empty or has a low liquid level, automatically the switch  must be turned on, untill the liquid fill the tank up.

And when the tank is filled, automatically the switch is turned off despite of the liquid go down under the maximum value. After, the second switch is turned on and must repeat the same while it is turned  the first tank down.

But I don't know how to do it, untill now I only did something similar as an inverter comparator.

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

Paul,

 

Hysteresis is what you need.

 

In your loop have two thresholds.  One is near the top of the tank (Upper).  When Level > Upper, then open the drain valve and close the fill valve. The other is near the bottom of the tank (Lower). When Level < Lower, close the drain valve and open the fill valve.  When the Level is between Upper and Lower, do nothing.  Keep the current state of the valves in shift registers.

 

Lynn

Message 5 of 6
(2,529 Views)

I think that I get it, I guess...Smiley Wink

 

Well, this is only the begining but I post it the other parts of the problems.

 

Thank you

 

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