LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultanuous start in cloned vi's

Hi

I have following situation:

A master vi (that makes some visualisationand other stuff) and several cloned subvi's (set to reentrant) where calculations are done. Those subvi's are started withe "vi reference".

 

I need to start a process in those clones simultanuously. I'd say that this function should be implemented in the master vi. I have already tried to do it with semaphores and notifier but did not get a working result.

 

Also it necessary that I know when the calculations are done in the clones.

 

Any idea and suggestion?

 

Thanks alot

Yves

0 Kudos
Message 1 of 10
(3,017 Views)

Yves wrote:
[...]I have already tried to do it with [...] notifier but did not get a working result.[...]

Yves,

 

the mechanism i marked with bold letters is the one you should use. Please keep in mind that notifier only work when your VIs are already running. So all your clones have to run before setting the notifier in your master and all clones have to wait for the notification before doing anything "useful".

 

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 10
(3,003 Views)

Thank you for your reply.

I tried to do it, but I'm not happy because it doesnt' work.

Maybe anyone could have a look at the programm?

 

Thank your for any help

Yves

Download All
0 Kudos
Message 3 of 10
(2,957 Views)

Yves,

 

honestly, i do not understand your code. At least not by reading it in a reasonable amount of time. So please care about your code design and please think about possible architectures before implementing anything....

 

Attached you can find an example on how it could work for your needs.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Download All
Message 4 of 10
(2,955 Views)

Norbert,

 

Thank you very much for your example. I just had my vi's designed very quickly to test the function. But of course you're right I should have done it with a better structure for easier readability.

Your example is almost what I was looking for. Isn't it possible to stop only one of the slaves? And to start only some of the slaves?

 

Yves

0 Kudos
Message 5 of 10
(2,950 Views)

Yves,

 

it is possible to do so. But this is quite labor intensive since you have to keep track of "clone IDs" which requires a good resource management.

The "brute force approach" would be to introduce a named queue/notifier for each clone and send commands using those.

The more prudent approach would be to use a single notifier and include some kind of ID to the data contained in the notifier.

 

Please note:

Queues are in general N:1-mechanisms. So N senders send data which are processed by a single receiver. Queues do not lose data.

Notifiers are in general 1:N-mechanisms. So a single sender sends data to multiple receiver. Notifier lose data.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 6 of 10
(2,941 Views)

Wow. What a good explanation.

I don't fear labour intensive work. If I have time for it...

Well I'll have a try at both method. Although  I think that the "brute force approach" will be the more appropriate one.

Because my program has to solve several other tasks:

- it should be able to start the single clones

- it should be able to stop all clones when an error occurs on one clone

- it should be able to start a second "clone group" when the first "clone group" has finished its tasks.

...

 

Anyway, your contributions where a great help and now I have a new approach to solve the problem.

Yves

0 Kudos
Message 7 of 10
(2,935 Views)

Yves wrote:
[...]- it should be able to stop all clones when an error occurs on one clone[...]

This is a new requirement for this thread. And it needs new methods to accomplish it.

The reason:

The slave returns status information to the master.

 

Possible solutions include FGVs (Functional Global Variable) or user events (if the master is event driven).

Sounds like a nice list of requirements you have to implement 🙂

 

One question on the side:

Will this application build as executable in the future?

 

Norbert 

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

Oops, I didn't wanted to overload the thread. That's why I didn't mention everything on the beginning.

Too bad it's not working with Notifier. I really started to like this approach. But isn't it possible to solve this with a combination of Notifier and Rendezvous?

 

 

And yes, this application is built as an executable. In fact it's is already running but the master-slave event handling isn't working properly.

 

 

Yves

0 Kudos
Message 9 of 10
(2,919 Views)

Yves,

 

Rendezvous do not help here. Notifier is a decent tool to send simple status informations (or commands) from one place to another. But they are not bidirectional.

In your application, you need bidirectional transmission of information.

 

It does not make sense to create another Notifier in the other direction because this will easily confuse the code and lead to ..... well, strange things. 

User events are perfect for this if your master is event based.

FGV is perfect if you are polling in the master.

 

Building an application is only perfect if you include all code into the exe. So it is not good if you try to implement a plugin architecture this way. It has to do with applications instances which could lead to situations, where the notifier (even if named) are not identical in the slave in comparison to the master. But this is only an issue for you if you do not compile everything into the exe!

 

 hope this helps,

Norbert 

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