LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

online-dispaly from sub-vi's

I am generating data in an sub-vi's loop. How can
I display this data in an chart during generation.
The chart in the sub-vi works fine, it doesn't in
upper hirarchies.

tnx for help
Lothar


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 5
(3,064 Views)
wrote in message news:8u6082$t55$1@nnrp1.deja.com...
> I am generating data in an sub-vi's loop. How can
> I display this data in an chart during generation.
> The chart in the sub-vi works fine, it doesn't in
> upper hirarchies.

If you generate the whole dataset in the sub-VI and pass the data back to
the caller when the VI finishes executing, obviously the chart on the front
panel of the caller will only be updated when the whole dataset is complete.

The simplest solution to this if you absolutely require the chart to be
updated progressively is to have the sub-VI calculate just one, or perhaps a
few, datapoints each time it's called and then put the subVI, along with the
chart, into a while loop within the caller that runs until the datase
t is
complete.

If it is necessary that the subVI runs "single-shot" to produce the entire
dataset AND you need the front panel chart updating, you can use VI server
to allow your subVI to change the data in the chart indicator of the caller.
Make sure though that you don't update the caller any more than, say, ten
times per second or you could find the CPU overhead just to update the panel
is greater than the CPU overhead to generate the data in the first place. VI
server is well documented and there's a whole directory of examples supplied
with Labview to show how to use it.

Alternatively, if you only require an indication on the caller front panel
that the system is still "live" you could make a progress bar that the subVI
updates via VI server every second. Since this involves just the passing of
a single int rather than possibly a large array of doubles (depending on how
you do the chart update) the overhead of the progress bar is obviously much
less.
0 Kudos
Message 2 of 5
(3,064 Views)
"Craig Graham" wrote in message
news:3a068f14@newsgroups.ni.com...
> The simplest solution to this if you absolutely require the chart to be
> updated progressively is to have the sub-VI calculate just one, or perhaps
a
> few, datapoints each time it's called and then put the subVI, along with
the
> chart, into a while loop within the caller that runs until the dataset is
> complete.

Perhaps easier consider in the main VI using a while-loop inside a case
structure. Let the case structure be true only on the "run subvi" signal
from a menu, button or whatever. Let the while loop call the subvi and have
the subvi output the cancel signal to finish the while loop. Use timers
accordingly to distribute the CPU load. Write and read
from globals.

That would allow you to have two windows up concurrently and updating each
others data.

GOOP could do something similar but by refnum which means you can ditch the
globals. That way it would be multi-instance safe.

-joey
0 Kudos
Message 3 of 5
(3,064 Views)
[posted and mailed]

lj_zeus@my-deja.com wrote in <8u6082$t55$1@nnrp1.deja.com>:

>I am generating data in an sub-vi's loop. How can
>I display this data in an chart during generation.
>The chart in the sub-vi works fine, it doesn't in
>upper hirarchies.
>

If I understand you here then you have a separate parallel loop handling
the top level graphs? In this case use a global to pass the data from the
subvi loop to the SEPARATE graphing loop. Note that if the graphing loop
surrounds the subvi, then this will never work because the loop in the
subvi will hold execution until completion, and THEN update the graph in
the calling loop. IOW do this

begin

while !exit // parallel loop 1
updategraph from global
endwhile

while !exit // parallel loop 1
call sub
vi()
endwhile

end


function subvi()
while !done
get data to graph
write grah to global
endwhile
endfunc

--

Alexander C. Le Dain, PhD
ICON Technologies Pty Ltd
http://www.icon-tech.com.au

******************************************************************
* The LabVIEW FAQ http://www.icon-tech.com.au/thelabviewfaq.html *
******************************************************************
0 Kudos
Message 4 of 5
(3,064 Views)
Hi Lothar,

just look at my questions and the answers from 9.11.00 11:01: Exchanging
data between parallel runnig vi's

good luck
Henrik


lj_zeus@my-deja.com wrote:
>
> I am generating data in an sub-vi's loop. How can
> I display this data in an chart during generation.
> The chart in the sub-vi works fine, it doesn't in
> upper hirarchies.
>
> tnx for help
> Lothar
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
0 Kudos
Message 5 of 5
(3,061 Views)