05-09-2019 07:07 AM
Hi
I have made a VISCA camera driver that automatically tracks objects. This driver uses TCP/IP and it all i based on writing a command, and waiting for a reply. Initially the system was designed to track only one object, but it now expanded to 7 cameras.
Since the system is waiting for a reply for each camera, i had to make all the vI's "preallocated clone for reentrant execution" since each camera has to send commands as fast as possible and not wait for the VI to be available for the next camera driver.
Below is a simple setup of my VI's:
TCP driver if Auto{ while(no error){ // Get current position Write request position Read position, wait for data to arrive // Controller Control system // Update Position Write new position Read reply } } else if Manual{ Write request position Read position, wait for data to arrive Write new manual position Read reply }
My question is: Is it possible to run the system without setting all the VI's to reentrant? and still run them without sharing the code? I want the main driver VI to allocate only one memory space for the subVI's, not a memory space for all of my calls.
The problem with setting all of the VI's to reentrant is first that i call them many more times than in my example and it will generate a lot of extra memory allocation. Also, i sometimes forget *blush* to set some new VI's to be reentrant, which of course makes my system run slower...
05-09-2019 07:18 AM
I have a routine that can run up to 24 Stations, each containing an Axis camera (connected over TCP/IP), though we typically run 4-7 at the same time. Each Station is run as a detached "clone" (configured as a pre-allocated reentrant VI) using Start Asynchronous Call. The Station, in turn, calls a "Camera" VI (similarly pre-allocated reentrant, but called once directly from the Station's Block Diagram). The Station "knows" the IP of its Camera and sends it to the Camera VI.
Let's say we have 6 Stations. Each gets started, so we have 6 copies of the Station code running at the same time (and need to have 6 as they have to run independently). Each calls one Camera VI, so we also end up with 6 Camera Clones. Because each is called once, and each runs as a Loop until it gets a signal to exit, we have exactly as much code as we need to manage the 6 Stations with their 6 (one apiece) Cameras.
Bob Schor
P.S. -- we do all of the programming in LabVIEW, not in some text-based language that you seem to be using.
05-10-2019 01:16 AM
So by setting only the TCPDriver.vi reentrant and not the subVI's, and calling it using Start Asynchronous Call it will work?
Will this make all the subVI's inside the TCPDriver only to be called and used inside each of the TCPDriver.vi clones?
I made the VI's without Action Engines, just in case this would be possible.
PS: I do not use text language for this project, it was only to show a brief description of the code.
05-10-2019 11:15 AM
Without seeing your code (all of the code -- if you are using LabVIEW Project, compress the folder containing the Project and all of your VIs and attach the resulting .zip file), I can't judge what needs to be reentrant and what doesn't. If I don't have some confidence in a response (i.e. if it is a "guess"), I'd rather not say anything so as not to waste your (and my) time.
Bob Schor