03-21-2013 01:40 PM
Hello all,
So I have a problem that I can not seem to see. I have an application that starts twelve of the same displays using the Start Asynchronous Call node and the x80 option (I am calling and forgetting). The VI is called and is running. The VI that is called is shown below:
The top loop retrieves data from a serial port while the bottom loop simply changes the color and blink rate of the display based on the value returned in the top loop (I apologize that this is broken, but hopefully I can still illustrate my point). Now, the top loop should be executing at a rate of 1 Hz and is throttled by the serial read in the Get Data function in the top loop. I have timed the execution of all elements in the top loop and they complete at less than 10 ms every time (each time the loop completes successfully and the the next step case to be executed is again 'Run'. While the total execution time is < 10 ms, the time between loop iteration i and loop iteration i+1 is 5 s (every time!).
I have used this method (asynchronous running) before with no problems, but I suspect that this time I am missing something. Can anyone see or think of something I might be missing? The VI above is reentrant (preallocated clone).
Thanks, Matt
03-21-2013 03:05 PM
OK - so this has something to do with the frame prior to the 'Run' case ('Init'). The five seconds corresponds to the amount of time it takes to determine that we can not make a connection with one of the serial ports. The Init case looks like this:
where the actual initialization VI looks like:
(once again and humor me - pretend like the snippet is not broken). So, if the device that we are trying to make a connection with is not powered, we will make a successful connection to the 'Outgoing Port' but configuration of the 'Incoming Port' will throw an 'Uknown System Error' and it takes the configure VI 5 s to return with this error.
But I still don't understand why this is impacting every other instance of the Display.vi shown in the post above. The VIs are reentrant and it is not clear to me that they share any resources. Any thoughts?
Matt
03-21-2013 04:53 PM
Are the VISA Serial Init VIs re-entrant? If there is any VI that is being called by all instances of your clones that is not re-entrant that will result in a bottle neck waiting to execute that VI. All of your clones will run serially while accessing that VI.
03-21-2013 05:49 PM
Thanks, Mark. My first thought was that I was calling something that was not reentrant that was causing the collision. I can't see anything that is shared between the two VIs, but I will look again.
As for the serial configuration - I am not certain that this is reentrant, but it shouldn't matter as it is not being called in the clones that are actually connected to the devices. My problem is not with the 5 s lag itself (I believe this lag is caused by hardware and that the timeout is a minimum timeout) - rather that it seems to be having an impact on those clones which are not calling the serial config VI.
Matt
03-21-2013 11:06 PM
I changed the Reentrancy setting to 'Shared clone reentrant execution' (from 'Preallocated...') and the whole system flies. Why would the behavior be so different?