I am a new Labview user and I am not familiar with this program, so you might be suprised with the question, I am gonna ask.
So far I have done the project that I attached to this post. I made the program which filling the tank and warns the user when the level of water is under 100 liters (by a diode) and above 900 liters.
But I want to enrich my program by setting an additional function: when the level of water exceeds 970 liters then the flow in is automatically set 0, and be 0 until the level of water won't drop below 970 liters and then the value of "flow in" will get back on the previous level(before reset) I don't know how obtain such a effect. I was trying to use the "Case" loop but without success, maybe I don't know how to use this loop...
Does anybody can help me? I would like somebody to show me how accomplish my requirements that I described above. I will be grateful when somebody would use "Case" loop, it's preferable method to me, I would like to learn how use this loop in my example. Any other form of solving my problem is also highly awaited by me.
Thanks in advance, and I am looking forward to your response
Solved! Go to Solution.
I don't know what you mean by a diode which is an electrical component and has nothing to do with LabVIEW code.
I recommend using block diagra cleanup so that you can fix some of the backwards running wires.
A simple fix for your question is to add another comparison with the flow to check when it is >970. For the True input of the select function, put a constant of 0. For the False input, put your flow rate control. Now the value that goes out will either be 0 or your control's value.
I also have no idea what you mean by "Case" loop. A loop and a case structure are two different entities with two different purposes.
Thank you for your time,
I meant case structure obviously, sorry for confusion. And this "diodes" are simple boolean indicators. I am begginer in Labview, so I probably mislead the terms.
I know, that I should add another comparisor, but I do not know how to activate the "constant 0" (>970 liters case) or "flow in" , by using which loop or structure?
Maybe I would ask a lot now, but I want to ask you for making it in Labview and send it me. I think that it is the simpliest way to teach me what do you mean and how manage in such cases.
In this case, you really mean LED indicator.
Here is how you do it with Select and with a case structure. You have a good start so far, but both are basic concepts you'll learn once you take the tutorials.
Thank you, I have followed your advice and the program runs when I implemented "True or False".
But that solution doesn't meet my requirements at all. My teacher insisted that we should use the case structure to solve this assignment and I still don't know how to do it.
I know that you probably loose your patience to me, but I ask you again for a help. In the attachement there's a file with my project. If you can, please, finish it in LV or give me some more tips.
First, your case structure is backwards. You have 0 flow in in the False case. Notice I have it in the True case.
Second, you have two different feedback nodes now. That means you effectively have two different tank levels you are storing. You need one feedback node that belongs outside of the case structure. I woudl actually recommend that you make it a shift register rather than a feedback node. Especially for beginners, the shift register is easier to understand as it maintains a left to right data flow.
Third, you've duplicated a lot of code between the two cases of that case structure. Example. Why have a wait of 1000 in both cases? Just move that outside the case structure and you only need 1 wait function. Not two. Likewise for the math that determines how much water should be in the tank. The only things that belong in a case structure are those things that actually are different between the two cases.
Forth, get rid of the feedback node for boolean. I don't think it is actually causing you a problem at the moment, but it makes the code harder to understand. If you just do the comparisons on the wire that represents tank level as soon as it comes out of the shift register on the left hand side, you won't need to have a feedback node on that boolean.
Fifth, go to Tools >> Options >> Block Diagram. Near the top is a section called "General" and an item "Auto-insert Feedback Node in cycles". Uncheck that. I think it is a poor choice by NI to have that enabled. Experienced users don't like it because it will insert feedback nodes automatically while we might be just trying to reorder our wiring. For new users, it is a problem because it automatically creates feedback nodes to "fix a problem" of a broken wire, and they wind up with numerous feedback nodes that make the VI runnable, but without understanding the code they just generated. The addition of a feedback node or a shift register should be a deliberate choice be a programmer because they know they need a value from the previous iteration.
Thanks once again! I have already implemented the majority of your advices and the result is shown in the attachement, but I still dont know how to wire up the case stucture with its surrounding or perchance use shift register.
I have to admit, that I am highly resistive and refractory student, but sometimes I won't understand something untill I see it. So, if you can (and if you have any patience left), please show me the way of wiring my whole "program".
"resistive and refractory student". I'm not sure what brick ovens have to do with students.
You are so close, but I can't do your homework for you. If you click on your broken run arrow, you'll see what your error is. You did not complete your wire between the comparison and the case structure. Go back and look at the image in message #4.
Be sure to click the block diagram cleanup button before saving and turning your work in.
My English sometimes isn't good, sorry, words called "false friends" and other borrowings from native language may sometimes distract reader.
I connect the "question mark" from case structure as you said, and it works! Thanks a lot!
The homework is done indeed, but I want to broaden my knowledge and ask you another question. I want to set another condition - when the level of water drops under 40 liters, the flow out becomes 0.
I know that solution is connected with some rearrangements, such as accession the "flow out" and substract inside the case structure and defining the cases "de novo" and also adding the new comparisor (<40). My question is about connection this comparisor with the case structure.
Since you are acting on a different control (the outlfow valve as opposed to the inflow valve), create a similar comparison and case structure in parallel with the first. Then the value you feed into the subtraction node will be either 0 or the control's value.