LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with school project

Solved!
Go to solution

Hi, I'm a beginner in LabVIEW and I am doing a project where I have a water pump that need to be activated when the water level sensor gets 0,244V and be deactivated when the sensor gets 4,88V, when the water level gets 4,88V, the water pump gets deactivated an waits the level gets 0,244V again to re-activate, my problem is, after the water pump gets deactivated in the higher level and the water level starts to get down, the water pump re-activates, but it needs to stay deactivated until the water level gets 0,244V.

I also put some LEDs to indicate the water level, they work normally

Here is the Block Diagram:

(The Pin8 is the water pump)
Block Diagram.PNG

I hope you understand my problem, thanks for helping me.

0 Kudos
Message 1 of 8
(3,879 Views)

Read the description of the behavior you're seeking, and then look at your code again.  
If the output is less than 0,244, turn ON.

Stay on until output is greater than 4,88.  Then turn OFF.
Stay off until output is less than 0,244.

So there's a powered on state, and a waiting state.
The current VI only has one state.

Maybe you'd be interested in a state machine?

http://www.ni.com/tutorial/7595/en/

0 Kudos
Message 2 of 8
(3,872 Views)

What you are looking for is something called hysteresis.  I created a subVI that does this and have posted on the forum, but I don't have the time to look for it now.  You might learn more by coding it yourself anyway.

 

You need a shift register with a boolean value that maintains the status of what the pump is doing now.  If you are above 4.88 V, you turn that shift register false, otherwise do nothing to it.  If you are below 2.44 V, turn the boolean true otherwise do nothing.  Send that boolean value to the pump.  So in that in between zone of 2.44 to 4.88, the  boolean value and thus the pump will be in whatever value/state comes out of the shift register.

0 Kudos
Message 3 of 8
(3,842 Views)
Solution
Accepted by topic author DarioSam

I found the thread.  Actually I called it Deadband.vi

 

https://forums.ni.com/t5/LabVIEW/refrigerator-temperature-control/m-p/1095955

0 Kudos
Message 4 of 8
(3,823 Views)

@RavensFan wrote:

What you are looking for is something called hysteresis.


Or actually anti-hysteresis Smiley Very Happy.

0 Kudos
Message 5 of 8
(3,792 Views)

RavensFan escreveu:

I found the thread.  Actually I called it Deadband.vi

 

https://forums.ni.com/t5/LabVIEW/refrigerator-temperature-control/m-p/1095955


Thank you! It's working fine, but the pump is being activated when the tank is full, and deactivated when empty. It's possible to change the "off below" to "on below", and the "on above" to "on below"?

0 Kudos
Message 6 of 8
(3,772 Views)

Yes.  Study the code and understand how it works.  You just need to flip some constants to the opposite value.

 

And edit the labels in the cluster control so they mean the new definition.

 

PS:  "Below"

0 Kudos
Message 7 of 8
(3,768 Views)

Thank you very much guys for helping me with this project, It's working perfectly now.

0 Kudos
Message 8 of 8
(3,747 Views)