LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Another Silly LabVIEW Question

Say you have an application where you have several VIs running, one reading
thermocouples, another reading voltages, another strain gauges, etc. Each VI
runs at its on sample rate.



Is it possible to have these VIs independently update a global variable
panel including a data ready flag where a central data logging VI would
continuously scan the flags and, when all indicate fresh data, write the
data to a file and reset the binary flags. The flags would eventually be set
true again when the associated VI has valid data again, etc.



This would allow for tight loops running in each VI and the VIs would
respond quickly to any changes you make like updating sample rates, display
items, etc. This is a kind of "parallel" processing of VIs. Is
there a
better way to accomplish the same kind of thing?



How do you get one central VI to load and start the other VIs in a way so
that they are running essentially as stand alone programs, the only link
between them being the global variable that is being checked by the one
central VI. Is there a function you can call that will start a VI and return
from that VI leaving it running?



The basic problem I'm trying to get around here is sequential dependencies,
say you call the Acquire Analog Waveform VI with a sample rate of 1000 s/s
and a sample count of 5000, that ties up the PC for a full five seconds
where you might not have that problem if using some kind of parallel
technique provided the other VIs are not trying to use the same DAQ
hardware, etc.



You could manually start all the various VIs but it seems there aught to be
a way to get one VI to start another, independent, VI.



Please keep any suggestions simple; I'm no programming expert.



Thanks,

Bill
0 Kudos
Message 1 of 5
(3,027 Views)
Hi Bill,
I've attached three .vi's - one main, and two almost identical sub .vi's. Instead of using a global variable .vi, I've used Queue's to marshal the threads that the .vi's are running in. (the difference is the number that is passed into the queue). This is better because if two .vi's finish at the same time, you don't lose the fact that seeing to one means the other one gets lost. If you used one global variable, then as soon if two .vi's write to it before the main .vi has seen a change, then the first .vi's notification would be lost.
The sub vi's are launched using labview's active X capabilities through it's application server (VI Server). This allows the .vi's to be opened, and set running and the front panels displayed.
I've revers
ed the queue idea, to allow the top level .vi to close the sub .vi's too. Each sub.vi can be independantely closed, with no effect on the main.vi, or if the main.vi is closed, the whole program (sub.vi's and all) get's closed.
You need to be careful about what hardware you're talking to - just because you've got multiple .vi's running, they may not all be able to use the same piece of hardware at the same time. (Multiple initialisations of hardware can cause many problems).

They say a picture's worth a thousand words, so with labview you get a dictionary full - check out .vi's. They're in LV 6.1.
Hope that helps

S.
// it takes almost no time to rate an answer Smiley Wink
Download All
0 Kudos
Message 2 of 5
(3,027 Views)
Any help here folks?

Thanks,
-Bill

"SHS" wrote in message
news:CESe9.15669$h92.4153498772@newssvr11.news.prodigy.com...
> Say you have an application where you have several VIs running, one
reading
> thermocouples, another reading voltages, another strain gauges, etc. Each
VI
> runs at its on sample rate.
>
>
>
> Is it possible to have these VIs independently update a global variable
> panel including a data ready flag where a central data logging VI would
> continuously scan the flags and, when all indicate fresh data, write the
> data to a file and reset the binary flags. The flags would eventually be
set
> true again when the associated VI has valid data again, etc.
>
>
>
> This would allow for tight loops running in each VI and the VIs
would
> respond quickly to any changes you make like updating sample rates,
display
> items, etc. This is a kind of "parallel" processing of VIs. Is there a
> better way to accomplish the same kind of thing?
>
>
>
> How do you get one central VI to load and start the other VIs in a way so
> that they are running essentially as stand alone programs, the only link
> between them being the global variable that is being checked by the one
> central VI. Is there a function you can call that will start a VI and
return
> from that VI leaving it running?
>
>
>
> The basic problem I'm trying to get around here is sequential
dependencies,
> say you call the Acquire Analog Waveform VI with a sample rate of 1000 s/s
> and a sample count of 5000, that ties up the PC for a full five seconds
> where you might not have that problem if using some kind of parallel
> technique provided the other VIs are not trying to use the same DAQ
> hardware, etc.
>
>
>
> You could manually start all the various VIs
but it seems there aught to
be
> a way to get one VI to start another, independent, VI.
>
>
>
> Please keep any suggestions simple; I'm no programming expert.
>
>
>
> Thanks,
>
> Bill
>
>
>
0 Kudos
Message 3 of 5
(3,027 Views)
Help with your question, or help with the answer I gave?

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 5
(3,027 Views)
Hi,

The reason why nobody awnsers is that there are a million ways to do this.
Also, a complete awnser could fill a 300 page book.

Using Globals is not necessary, nor recommended. You could of cource make
one UI/MMI/CHI and call it the 'global panel'.

You could;

+ Make a vi with loops, each loop opens a interface, and get the data from
it. The main vi puts it on the front panel (each loop can do this, or a
dedicated loop can collect the data and put it on the screen).

+ Do the same thing, but start and query the vi's dynamically (keyword: vi
server). This way you can "manually start all the various VIs" and "get one
VI to start another, independent".

+ We have an (commercial, for now only for internal use) state machine that
handles parallel processes. Go this way if you're working in a 10 member
team and make 30 projects a year, or if the code needs to be validated.

+ One of the other 999997 solutions... Or make a new the 1000001th solotion
yourself ; )

Regards,

Wiebe.


"SHS" wrote in message
news:CESe9.15669$h92.4153498772@newssvr11.news.prodigy.com...
> Say you have an application where you have several VIs running, one
reading
> thermocouples, another reading voltages, another strain gauges, etc. Each
VI
> runs at its on sample rate.
>
>
>
> Is it possible to have these VIs independently update a global variable
> panel including a data ready flag where a central data logging VI would
> continuously scan the flags and, when all indicate fresh data, write the
> data to a file and reset the binary flags. The flags would eventually be
set
> true again when the associated VI has valid data again, etc.
>
>
>
> This would allow for tight loops running in each VI and the VIs would
> respond quickly to any changes you make like updating sample rates,
display
> items, etc. This is a kind of "parallel" processing of VIs. Is there a
> better way to accomplish the same kind of thing?
>
>
>
> How do you get one central VI to load and start the other VIs in a way so
> that they are running essentially as stand alone programs, the only link
> between them being the global variable that is being checked by the one
> central VI. Is there a function you can call that will start a VI and
return
> from that VI leaving it running?
>
>
>
> The basic problem I'm trying to get around here is sequential
dependencies,
> say you call the Acquire Analog Waveform VI with a sample rate of 1000 s/s
> and a sample count of 5000, that ties up the PC for a full five seconds
> where you might not have that problem if using some kind of parallel
> technique provided the other VIs are not trying to use the same DAQ
> hardware, etc.
>
>
>
> You could manually start all the various VIs but it seems there aught to
be
> a way to get one VI to start another, independent, VI.
>
>
>
> Please keep any suggestions simple; I'm no programming expert.
>
>
>
> Thanks,
>
> Bill
>
>
>
0 Kudos
Message 5 of 5
(3,027 Views)