LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enqueue in another VI using Application/VI Referencing?

Hello,

 

I am exploring the possibility of being able to inject into another LabVIEW application from another to extend functionality of an application we do not want to modify. The main application is a producer/consumer state machine where the 2nd application simply needs to be able to shutdown the main application by either switching an existing boolean to true, or by adding the stop command to its message queue.

 

From what I've tried so far it seems you cannot change the property value of a boolean through the application/vi property nodes when the boolean is a latching mechanical button so my next idea was to try and add a stop command to the main application's queue, however, I can't seem to find much information on doing this so maybe it's not possible.

 

If anyone has any ideas on how to either get around changing the main application's boolean value or adding to its queue that'd be greatly appreciated.

0 Kudos
Message 1 of 19
(335 Views)

Hi JCoder,

 


@JCoder wrote:

I am exploring the possibility of being able to inject into another LabVIEW application from another to extend functionality of an application we do not want to modify. The main application is a producer/consumer state machine where the 2nd application simply needs to be able to shutdown the main application by either switching an existing boolean to true, or by adding the stop command to its message queue.


When you write "application" you are talking about two executables running in parallel?

(You don't talk about running two VIs within the very same LabVIEW environment?)

 


@JCoder wrote:

my next idea was to try and add a stop command to the main application's queue, however, I can't seem to find much information on doing this so maybe it's not possible.


When you run two executables then they DON'T share any references (like queues).

You cannot simple enqueue data into a queue managed by a different executable.

 

(Any antivirus software will get nervous if that would even be possible by simple means!)

 


@JCoder wrote:

From what I've tried so far it seems you cannot change the property value of a boolean through the application/vi property nodes


There are some ways to talk to a different (LabVIEW-made) executable, but you have to implement them first…

It seems you need to modify your "1st executable" anyway.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 19
(323 Views)

What do you mean by "application"?

 

If two VIs run within the same instance, i.e. inside the same compiled executable or in labview.exe (=development), then one VI can access front panel elements or queues of the other.

Upon creating a queue inside a VI, you can give it a name, and if you do the same in a second VI, that VI would acually use the queue from the first.

Front panel elements are more tricky, since you somehow need to get the reference to that boolean. If it's a latching boolean, you cannot assign it a value.

0 Kudos
Message 3 of 19
(320 Views)

Hi,

 

Yes so I mean 2 executables running in parallel.

 

I've attached my example of trying to trigger a boolean through referencing the Application and VI, but this obviously doesn't work due to the buttons being latching, which can't be changed.

 

So my question is: is there a similar method to add to an existing queue within the main executable, that way I can inject a "pause/shutdown" from the 2nd executable?

 

JCoder_1-1777458066333.png

 

 

0 Kudos
Message 4 of 19
(297 Views)

Hi JCoder,

 


@JCoder wrote:

So my question is: is there a similar method to add to an existing queue within the main executable, that way I can inject a "pause/shutdown" from the 2nd executable?


Implement an additional "module"/subroutine in your 2nd executable that listens on a network port (TCP, UDP). When it receives a message that subroutine can inject the message content (your command) into the queue.

 

(That's how you implement remote control between executables the easy way.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 19
(285 Views)

Thanks for the reply,

 

I'm not familiar with this, are there any examples or documentation you can point to for me to learn?

0 Kudos
Message 6 of 19
(276 Views)

Look at the simple TCP example (HELP->FIND EXAMPLES) that ships with LabVIEW for an idea. You can add the server functionality to the existing executable and the client functionality to the new executable.

 

0xDEAD

0 Kudos
Message 7 of 19
(264 Views)

@Sebastian.Weber wrote:

What do you mean by "application"?

 

If two VIs run within the same instance, i.e. inside the same compiled executable or in labview.exe (=development), then one VI can access front panel elements or queues of the other.

Upon creating a queue inside a VI, you can give it a name, and if you do the same in a second VI, that VI would acually use the queue from the first.


It's actually more restricted. Most LabVIEW refnums are application context scoped. That means you can not share queues that are located in different application contexts. An application context is any target in a project but also any other explicitly opened Application refnum. For things like your host target and a realtime target this is quite obvious, they are located on different hardware and obviously can't share memory just like that. But it even applies to separate application refnum contexts inside the host target. And if it is in different projects then of course too.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 8 of 19
(232 Views)

The easiest solution is probably a Network published variable that both can read/write.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 19
(211 Views)

A couple of these solutions involve making a modification to the main application, which can't be done.

 

@GerdW, could you elaborate more on your solution please?

 

Thanks for the responses.

0 Kudos
Message 10 of 19
(184 Views)