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: 

Smart farm

Hi all,

I am a student, working on a smart farm project.

I need help with my project is there anyone who can help me out with few bugs I am having in my VI.

Info about project:

The vi senses the moisture from the soil and start water supply automatically if moisture level is below set the limit

0 Kudos
Message 1 of 4
(2,681 Views)

I'm sure someone can help.

 

But first you need to tell us what the bugs are you are having problems with.

Second, attach your VI!

 

You wouldn't call your mechanic asking about car problems without telling him what's wrong, and without bringing the car in to look at, would you?

 

Help Us Help You When Posting New Topics

Posting Basics and Tips

Message 2 of 4
(2,661 Views)

yes, indeed, Thanks for your quick reply RavensFan

I have attached my vi and bugs I am facing are as below.

Description:

The program does the simulation of smart farm in labview, initially it takes values by using moisture sensors and based on that it takes further decision. If the moisture values are below the limits given then water pump should start automatically and feed soil/soils, as a student project I need to work on only real moisture sensors but there is no water pump provided to work on thus I just have to show water level is increasing only in vi.

I am working on ELVIS II to get analog signals from moisture sensors

issues I am having:

-- My vi runs fine when there is only one soil needs watering, in other case when both soils need watering then water level in water tank does not match at the end when it finished watering the soils.

(Ex: If initially both soils have 0 moisture level then water tank should feed water to both soil and according to soil capacities 300 liters water should be pumped but water tank goes only 200 liters down in this case)

-- Secondly my vi has many while loops and it runs slow because of that, is there any other way I can do the same work?

-- Next I want to add a physical button on Elvis board and by pressing it I should be able to reset the water tank value.

(Ex: by pressing the button water level should reset and go to 0% and after well pump will start to fill the tank to the full)

-- Lastly I want to use 7-segment LEDs in my project to show same values of water level on ELVIS board, how do I do it? I cannot find it too.

 

 

 

0 Kudos
Message 3 of 4
(2,598 Views)

You have a serious architecture problem and a severe case of "localitis", the abuse of local variables.  Perhaps you don't fully grasp the rules of dataflow. 

 

A structure won't complete until all the code inside of it completes.  The problem is you have so many while loops buried in case structures, and your outer while loop will not iterate until you happen to have all of those inner while loops stop.  I wouldn't be surprised if that never happens.

 

You need to flatten out that VI.  You should only have 1 outermost while loop.  On every iteration, read the inputs and make decisions on what needs to be done.  Keep values such as water levels in a shift register and add to or subtract from them throughout the loop.  There is no need for local variables.  It is very likely you have race conditions where the update of a water level in one spot by way of the local variable gets overwritten in another spot.

 

Also, in many places you are comparing doubles for equality such as seeing if a value equals 100.  Computers can't represent all numbers precisely, and the act of incrementally adding or subtracting may cause you to have a value that is "nearly" 100, but is never exactly 100.  You should probably stop pumps when a value is >=100,  not when it equals 100 because it may never exactly equal it.

0 Kudos
Message 4 of 4
(2,592 Views)