11-01-2016 03:24 PM
Hi,
This is my first interaction with LabVIEW so the solution to my problem might be very obvious. I want a nested loop structure. The outer loop is to run for a defined amount of time during which it switches to the inner loop at regular intervals of time. The inner loop itself runs for a defined period.
For example the outer loop runs for 36 hours (basically it keeps a feed solenoid valve open), then after every 30 minutes in this 36 hrs the inner loop is started (this closes feed solenoid valve and opens backwash solenoid valve for 1 minute).
Now I can keep track of elapsed time for each loop using the elapsed time sub vi but what I am not able to accomplish right now as to how to check for the 30 minute time interval.
Here I have attached a vi inwhich the outer loop runs for 300 seconds and then I check whether the elapsed time is a multiple of 30 seconds or not, if yes and the elapsed time is not zero then switch to the inner loop. But the loop never switches.
Please suggest suitable way out.
Solved! Go to Solution.
11-01-2016 04:33 PM
This (homework?) problem sounds very much like one that was discussed here within the last week (or maybe 10 days). Not sure what you should search for, but I'm 90% certain this was recently answered ...
Bob Schor
11-01-2016 04:36 PM
I only posted the previous problem but since it did not get resolved I posted again. The solutions given were a little out of my reach.
11-01-2016 04:37 PM
@Bob_Schor wrote:Not sure what you should search for, but I'm 90% certain this was recently answered ...
11-01-2016 04:40 PM
@kunal7505 wrote:I only posted the previous problem but since it did not get resolved I posted again. The solutions given were a little out of my reach.
It is incosiderate to simply start a new thread for an old problem. If you don't understand the answer, reply in the original thread and ask for clarification. There is no need to start a new thread for a problem that is already under discussion.
11-01-2016 04:42 PM - edited 11-01-2016 04:44 PM
I didn't mean to be inconsiderate but I didn't want to bother the people with the studpid questions owing to my inexperince with LabVIEW. I apologize!!
Now you have the vi as well. Can you help. Maybe a workaround to the problem. This is just the first phase, I still need to figure out regarding the working with solenoid valves. Once the vi is done I would be able to move to the next stage.
11-01-2016 05:13 PM
The key word or the solution given was "state machine", which can be done with less code than what you currently have. Search the forum. look at the LabVIEW tutorials, look at the shipping examples, and look at the design templates that come with LabVIEW.
11-01-2016 05:16 PM
Thanks for considering my request. I'll try the suggested materials and prepare a vi based on the same and then update. This time on the same post.
11-02-2016 01:29 PM
Hi,
I tried to create a state machine, what I have done is defined two cases each for feed valve and backwash valve, within the case structures for each case I have defined while loops which run for the specified time required for each valve to be open. But what I am not able to understand as to how do I make sure that the cases switch based on the time intervals, the tutorial on ni basically switches case based on a manual input of a coin.
11-02-2016 01:43 PM
No, you only need the outer loop, but have a case for each possible state. there is no need for inner loops. Keep the state variable (e.g. an enum) in a shift register and initiate transitions to a new state at the required points in time.