LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Semaphore'd data allowed in CIN & LabVIEW?

Hi there !

I have a CIN that operates in a loop. For performance reasons, I must complete the loop operation before ending the CVI/CIN process and passing back a result.

The process takes several minutes to complete. I would like to know if there is a way (either supported or not) that will allow me to have LabVIEW update the CIN's progress while still in the CIN loop. Can this be done? How?

Kindest,
Warren
0 Kudos
Message 1 of 5
(2,694 Views)
If you need to complete the loop operation before the CIN completes, you could put the CIN in its own VI and call that VI dynamically. When you call it dynamically, you have the option to not wait for completion. If you make the VI reentrant, you would also be able to call multiple copies of the same VI. You might also consider putting the CIN in parrallel with the rest of your program and using the synchronization VI's to force things to happen at the right time.
Message 2 of 5
(2,694 Views)
Hi codeman,

So, say I wanted to pass a status back to LabVIEW while the CIN were in it's loop for the purpose of drawing a status bar. Is it possible to do that?

It doesn't seem as such. It sounds like the the CIN would have to operate in it's own VI..and even if I set it up to do that, there doesn't seem to be a way to pass back status from the CIN loop to update a status bar (or whatever).

Any ideas?

Kindest,
Warren
0 Kudos
Message 3 of 5
(2,694 Views)
> So, say I wanted to pass a status back to LabVIEW while the CIN were
> in it's loop for the purpose of drawing a status bar. Is it possible
> to do that?
>

From what I understand, you want to do is call a CIN, and in parallel,
update a status bar to show approximately when the CIN will be completed.

You have several options. If you can change the CIN to work on chunks
of the computation, then it can return periodically with a status, you
can update the panel of the VI, then dive back into the CIN. This
requires that the CIN be changed, and depending on what it is doing,
this could be very difficult, but it could be easy, so I listed it first.

Another option is to make sure that before you call the CIN, you call a
VI that will runs in parallel in another execution system and periodically
check some external data to see how the CIN is doing. The external data
can be TCP, file, or another call into a CIN/lsb. Probably the easiest
is a file. Open a tmp file and pass the path to both the CIN and the
progress subVI. Have the CIN occasionally seek to the beginning and write
out a percentage string or number. Have the subVI periodically seek and
read.

To make the subVI have a different execution system, use the VI Properties
dialog on the execution page. Assuming everything else is in the Standard
execution thread, make this on be Other2 or something like that. This will
ensure that the same thread isn't supposed to be running the CIN and in the
subVI. Since CINs aren't compiled by LV, they can't share threads the way
that VIs do.

Make sure to call the subVI first, or it won't get started until the CIN
finishes. The subVI can check the file and the sleep a few seconds. Be
sure that the LV file Open doesn't block any other access since you want
both of the pieces to have the file open at the same time. Alternately,
you could have them open, read/write, and close the file each time. Then
you can just ignore failed opens and catch it the next time.

If the status bar isn't on your subVI, try using control references to update
it, or alternately, leave this file reading in your upper level diagram, but
make the CIN call from another subVI set to another execution system.

One other thing to make sure of. If you do not mark you CIN as being reentrant,
it will run in the UI thread, and there is no chance of updating any LV panel
while the CIN is running.

Greg McKaskle
0 Kudos
Message 4 of 5
(2,694 Views)
Hi Greg !

Thanks for the ideas..I'm off and running with them !

Kindest,
Warren
0 Kudos
Message 5 of 5
(2,694 Views)