02-27-2015 04:18 PM
In my data acquisistion project, I use case strructres in while loops to navigate through my entire project. Some of the while loops are:
Producer loop
Consumer loop
Acquistion loop
Logging loop and so on...
My procuder loop usually contains buttons which link to the appropriate case structure in the consumer loop via Enqueue message.vi Everything works fine untill I preform some "parallel computing".
For example, If I press run button which activates a case structure in Producer loop and later activates a case structure in consumer loop and goes on untill it ends up in an appropriate loop and continues to run in that loop.
Now, if I press log button it goes through all the loops and ends up in the loop where it is intended to be. It all works fine.
Now the issue, Sometimes these loops just hang up at a spot. They dont send message queues. They just continue the loop that was last run. Further pressing of any buttons on the GUI does nothing in the vi. I have no clue why labview behave like this. Sometimes it works if I press the button in certain sequence and that sequence does not make any sense, it was all just trail and error. The error is not even on the hardware side, as I have tested it with the simulated devices in MAX. I believe that this mostly happens when i try to run two case structures in the same loop, but I though labview can do parallel computing. what are your views on this situation?
Solved! Go to Solution.
02-27-2015 04:29 PM
Sounds like you have something wrong in your code. If you can post some code, maybe we can point you in a better direction.
02-27-2015 04:40 PM
The code is really extensive and you would need additional drivers to make it run. But for your understanding I am posting a screenshot and the program. There are more loops to this. basic question is will labview be able to handle running two case structures parallely within a same while loop.
02-27-2015 04:49 PM
@Ashaironix wrote:
Further pressing of any buttons on the GUI does nothing in the vi. I have no clue why labview behave like this.
Check for events that lock the front panel until the event completes (the default setting), but they cannot complete for some reason.
@Ashaironix wrote:
I believe that this mostly happens when i try to run two case structures in the same loop, but I though labview can do parallel computing. what are your views on this situation?
You probably need to be more specific. Of course the loop can only go to the next iteration once both case structures complete. Do they?
The image you attached does not really show anything helpful (we cannot see what's in the other cases and events, we cannot see how the events are configured, etc.). Please attach the actual VI, even if it is broken and drivers are missing.
02-27-2015 04:51 PM
@Ashaironix wrote:
basic question is will labview be able to handle running two case structures parallely within a same while loop.
Two different case structures? Yes. Two cases inside the same case structure? No.
From your description earlier, it sounds like you are having loops inside of your case structure. If that is the case, then you are blocking your loop with the case structure from being able to check for messages. Everything inside of a While loop must complete before it can iterate to run again. If you have a repetitive case to run, reenqueue that state so that you can check for messages and run again when it gets dequeued.
02-27-2015 05:04 PM
Well it is case structures within loops if you take a look at the image tat I posted. And I am trying to run " Two cases in a single case structure in the same loop" and thats when everything hangs up.
*** My company regulations does not allow me to upload the project file. Sorry for the inconvenience.
02-27-2015 05:07 PM
@Ashaironix wrote:
Well it is case structures within loops if you take a look at the image tat I posted. And I am trying to run " Two cases in a single case structure in the same loop" and thats when everything hangs up.
And that is your problem. Why would two of your cases need to run at the same time? If they truely need to run in parallel, then they should be in different loops.
02-27-2015 05:11 PM
Well when I was building the vi and did not realise that and thought that labview can handle such scenario and now I am so deep into the project and then realised that this is happening. Well it will be easire to navigate through the program if you put them under same while loop. Well I guess we have to split it into different loops and case structures.
02-27-2015 05:13 PM
why would I needtw cases at the same time?
Well one case just monitors the data and sends it to plot and the other case at trhe same time logs it. so I may have to split these functionalities.
02-27-2015 05:13 PM
I would also contend that you might be trying to do too much inside of your cases. If they take a long time, you should split up the work and enqueue the states to run to continue that work. That will allow you to process other commands as well. There is nothing wrong with the consumer loop enqueueing more states for it to run.