LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI server between 2 Vis in 2 different projects

Solved!
Go to solution

Hi!

I have a VI (refered as "T_FANUC.vi" in the example) which is part of "TETRA.lvproj". This VI is called by a main VI and runs until this Main.vi close.

 

I made another project named Supervision.lvproj and created a VI named "Simulation Robot.vi" (VI attached to this post). I'm trying to use VI server to get/set control values of "T_FANUC.vi". But VI server property node "Exec. State" always sees "T_FANUC.vi" as Idle even if it runs...

 

However if "T_FANUC" is placed in the same project as "Simulation Robot.vi", it works fine...

 

But project are built w/LV 8.5.1 and running on the same computer.

 

Isn't it possible to use VI server between two VIs placed in two different projects ? 

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 1 of 8
(3,406 Views)

zyl7,

 

It is possible to communicate between two different projects with VI Server.  Each LabVIEW project exists as it's own application instance, so you would need to open an application reference before opening a reference to a VI in the other project.  This is done through TCP, so you need to make sure that each project has TCP access enabled, and that each is using a unique TCP port, just as if they were communicating across a network.  You didn't attach anything in your post, so it is unclear if you have done this.  Let me know if this helps.

 

Chris M 

0 Kudos
Message 2 of 8
(3,384 Views)

CMal,

 

thanks for your post !

VI Server TCP feature is enabled on both projects.

But both are listening on port 3363... Should one listen on an other port ?

Could you post a screenshot showing how i should use "open application reference" and "open VI reference" ?

 

Thanks !

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 3 of 8
(3,367 Views)
Solution
Accepted by topic author CyGa

zyl7,

 

I am attaching a simple mockup of how to call one VI from a VI in a different project.  The VI server settings of the calling project (Supervision) don't matter in this case, but the called project (TETRA) must setup VI server access on a port that is not already in use.

 

Chris M 

Download All
Message 4 of 8
(3,355 Views)

CMal,

 

thank you for your zip.

Indeed, it works fine under LV8.6.1. However, I'm using LV 8.5.1 and it still doesn't work w/my VIs... Is there any issue with LV8.5.1 ?

 

  • When I let  Open Application Ref 's "machine name" input empty, property node "App Ref => All VIs in memory" returns only running VIs present in "Simulation.lovproj"
  • If I write "Localhost" in Open Application Ref 's "machine name" input, property node returns error 1032 (access denied)...
 
I must say that I'm lost... 

 

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
Download All
0 Kudos
Message 5 of 8
(3,325 Views)

Here is a Zip which illustrate the problem I'm facing. 

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 6 of 8
(3,323 Views)

zyl7,

 

The error you are getting from the "All VIs in Memory" property is because this property is not meant to be used with remote references.  The help for this property explains this:

 

Returns a list of VIs in memory for the specified application instance. This property returns an error if you wire a remote application reference to the reference input. For a remote application, use the Exported VIs in Memory property to return a list of exported VIs

 

You need to setup VI server access on the "Slave" project.  To do this, right click "My Computer" in the project explorer, then enable port 3364 (in this case) on the "VI Server: Configuration" page, and add 'localhost' to the list in the "VI Server: Machine Access" page.

 

I would suggest using relative paths with the "build path" and "strip path" functions, instead of the absolute path that you have on the "Simulation.vi" diagram.  This will make it easier for others to run these VIs on other computers.

 

Chris M 

0 Kudos
Message 7 of 8
(3,313 Views)

CMal,

 

thank you for your help. One thing was missing in your last post : I had to fill "VI Server : Exported VIs" list with Add.vi (see attached zip). Filling it with "*" is much easier to allow all exported VIs currently running on the computer to communicate with teh VI Server.

 

Thank you again ! 

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 8 of 8
(3,287 Views)