LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

avoid execution of event cases in parallel

Hello all,

I have an event structure.

I need to make sure that, while an event case block is executing, another can't start being executed until the first one finishes. (So, if events A and B happen almost simultaneously, event case B starts executing only after event case A has completely finished executing).

Since events are not generated only by front panel, the "block front panel activity" option is not enough.

Is there a way to do so?

Many thanks.

0 Kudos
Message 1 of 12
(3,747 Views)

Use producer/consumer and capture both events by the same event structure. Both events only enqueue a stateinformation which is used in the consumer to execute the "events code".

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 12
(3,744 Views)

Thanks for replying.

Unfortunately, I believe it's not enough. Inside every case, I need to perform a write&read operation to an external device (via a NI-6251 Daq). If I had only to write, that would have been fine, but the "enqueue" operation allows me only to put data on the write buffer (the consumer loop cannot send back read data to the producer loop).

 

0 Kudos
Message 3 of 12
(3,740 Views)

When the write and read are both inside the same event case, other events will queue up until that case has completed.

 

Felix 

0 Kudos
Message 4 of 12
(3,736 Views)
Yeah, the problem is: how can you enqueue a "read" command? The consumer loop cannot give back results to the producer loop, like as if it was a called sub-vi.
0 Kudos
Message 5 of 12
(3,733 Views)

xdaf wrote:
[...]The consumer loop cannot give back results to the producer loop, like as if it was a called sub-vi.

That is only true for the default producer/consumer. BUT you can use custom user events to pass back information or commands to the producer! This is i bit more complex than the default producer/consumer and it heavily depends on the application...so there is (at least as far as i know) no example directly available. Nevertheless, if you are used to work with custom user events, you will be able to implement this very fast and easily.

 

Another possible solution would be a consumer build as queued state machine. So the consumer can reconfigure/enqueue elements in its very own command queue.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 12
(3,730 Views)

An User-Event only based example is presented in this

Community nugget

 

Felix 

Message 7 of 12
(3,724 Views)

hi,

 

 Why are you not using STATE MACHINE ARCHITECTURE?..I think it will solve your problem.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 8 of 12
(3,721 Views)

You also might have a look at the OpenG Message Queue. It uses a notifier to report back.

To install OpenG, you need to download the VI package manager (the community edition is for free).

 

 

Felix 

Message 9 of 12
(3,712 Views)

Because I need to collect asynchronous events, each of whom recalls the same sub-vi (with different input data).

I think the producer-consumer structure is mandatory.

I'm working on the custom user event, I think that's the right strategy.

I'll keep you updated, in the meanwhile, thanks a lot!

Message Edited by xdaf on 09-08-2009 10:57 AM
0 Kudos
Message 10 of 12
(3,696 Views)