LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues in understanding parallel computing in Labview

Solved!
Go to solution

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?

 

Labview Learner
0 Kudos
Message 1 of 11
(2,992 Views)

Sounds like you have something wrong in your code. If you can post some code, maybe we can point you in a better direction.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(2,988 Views)

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. 

Labview Learner
0 Kudos
Message 3 of 11
(2,978 Views)

@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.

 

0 Kudos
Message 4 of 11
(2,970 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(2,967 Views)

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. 

Labview Learner
0 Kudos
Message 6 of 11
(2,959 Views)
Solution
Accepted by topic author Ashaironix

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 11
(2,954 Views)

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. 

Labview Learner
0 Kudos
Message 8 of 11
(2,942 Views)

 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. 

Labview Learner
0 Kudos
Message 9 of 11
(2,937 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 11
(2,936 Views)