LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

starting background task in labview

Let me outline what I am looking to do.  I'm not sure if a background task is the best descriptor, but it's the one I'm coming up with.  it's tricky to explain, but here goes .....

 

When we start the program, we want to start the background task/alternate path/server (not sure which one best applies).  I do not want the program to wait for the background task to complete.  The program is then going to continue and do other processing.

 

The background task is going to do com port reads, filter them, and make the filtered results available to the original program.

 

Then when exiting the program the calling program would terminate the process.  An alternate process would also be needed for handle aborted cases.

 

Any ideas?

Mike

 

Mike
0 Kudos
Message 1 of 14
(4,020 Views)

Sounds like a poster child for Actor Framework (www.ni.com/actorframework). If that's too complicated, then you can use an asynchronous call to start the VI.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 2 of 14
(4,017 Views)

I was thinking of a server or a data socket.

Mike
0 Kudos
Message 3 of 14
(4,006 Views)

Is there a specific requirement to run the tasks on separate machines? If not then I don't understand the overhead associated with data sockets. It is fairly simple to do a "Call and Forget" with LabVIEW where one program can invoke the other then move on without waiting for execution. In this mode, both the caller and the callee exist in the same application instance and simple data transfer mechanisms (queue, notifier) can be used to transfer data between the two. TCPIP and other methods are available but IMHO should be avoided if something simpler will work.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 4 of 14
(4,000 Views)

There is more than one way to bake a cake, and with that said, the solution being presented here does solve other problems.  it is being used for a system where devices are stimulated and response is read on the com port.  When we scale it up we could conceivably be stimulating these devices on other computers.  In this case we could use the other machine to look for the data on the com port.  Hard to explain, but it does solve other problems. 

Mike
0 Kudos
Message 5 of 14
(3,995 Views)

I suspect "VI Server >>> Run VI" method is at the bottom of the code linked by Charles.

 

Typically the VI is opened, controls are set using Set Control and then run using the method mentioned above.

 

Ben

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

As far as starting the process on another machine, I don't believe that is possible. You could make a small LabVIEW program that is design to run as a service and have it "listen" for a command to start the program. You could then transfer data via TCP, network shared variable, etc. Would it help for me to send you some code demonstrating asynchronous calls?

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 7 of 14
(3,987 Views)

Yes, please do.

 

Thanks

Mike

Mike
0 Kudos
Message 8 of 14
(3,984 Views)

@Charles_CLA wrote:

As far as starting the process on another machine, I don't believe that is possible. You could make a small LabVIEW program that is design to run as a service and have it "listen" for a command to start the program. You could then transfer data via TCP, network shared variable, etc. Would it help for me to send you some code demonstrating asynchronous calls?


Hi Charles,

 

It USED TO BE POSSIBLE to use FTP to transfer VIs to remote machines then afterwards use VI Server to open (with complete file path) and run the VI on the remote machine.

 

Ben

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

Why is it I know when I see the solution I'm going to go "SMACK, I COULD'VE HAD A V8?!?!?!?!?!?!?!?!?!?"

Mike
0 Kudos
Message 10 of 14
(3,978 Views)