LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning Myself

Should I be able to make a copy of main.vi

to something like main2.vi and run both copies.

I does work, but I do get some slight odd behavior.

What would the "GOTCHA's" be for doing this.

 

0 Kudos
Message 1 of 15
(3,541 Views)

Make "Main" vi Re-entrant and call it two times.

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

What kind of "odd" behavior? You need to be more specific!

 

What do the programs do? Do the programs access any shared resources (DAQ, subVIs, etc.)

0 Kudos
Message 3 of 15
(3,524 Views)

As Christian alluded to, it will work right up until you get to shared resources.

 

Think of it as if you are the boss and the people and equipment used at your work-place are the sub-VI and widgets, respectively.

 

YOu could clone yourself and both of you could set off on different projects with no problems right up till your employees "have to serve two masters" ("A man can not serve two masters." I believe that was Jesus who said that).

 

So to pull that stunt off you have to figure out a set of rules for your emplyees so that they aren't being given contradictory tasks.

 

Now getting concrete...

 

One of the big conflicts in LV is sharing DAQ widgets. If you set up the DAQ as a producer and make your app a consumer...

 

But now I am specualting!

 

Tkae care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 15
(3,483 Views)

The program has two very distinct components. One that gathers data, one that

does analysis. In it's final version 2 copies will be running on different machines.

I wish to do the development on a single machine, not two. The code does not

use any hardware. The two areas of the code communicate via TCP/IP. While

testing I just open the same socket on address "localhost". My assumption has

been that if I can run Vi "A" and vi "B" at the same time, why not 2 copies of "A".

After all, they should be executing in separate code spaces. I the code does not call

itself, hence no reason to have to set them to be re-entrant. I work on hardware 

development during the day and will only be able to get back to this until tonight.

My thought is that "Globals" may be my culprit.

0 Kudos
Message 5 of 15
(3,463 Views)

Have you considered using multiple loops, one for getting the data and one for processing, using a queue to pass data between them? Then you could avoid running separate programs all together, and eliminate the tcp/ip communication.

 

Edit: didn't see the end product would run on different machines.

0 Kudos
Message 6 of 15
(3,441 Views)

I'm not creating two programs. I am executing the one program twice

and using each instance in a different mode.

0 Kudos
Message 7 of 15
(3,435 Views)

Good morning,

 

You had mentioned that you saw some odd behavior, could you describe what you are seeing?  If possible, provide screenshots if you think it will give more clarity.

 

Regards,

 

Joe S.

0 Kudos
Message 8 of 15
(3,421 Views)

 


@Ben_01880 wrote:

The two areas of the code communicate via TCP/IP. While

testing I just open the same socket on address "localhost". My assumption has

been that if I can run Vi "A" and vi "B" at the same time, why not 2 copies of "A".


Do you mean that both instances are trying to listen on the same port?

 

0 Kudos
Message 9 of 15
(3,416 Views)

Same Socket, Same IP.

One instance Listens & Reads, One Writes.

0 Kudos
Message 10 of 15
(3,409 Views)