LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem about implementation of a controller in main_vi based on the test data of sub_vi

Hi Group:
 I am developing a measurement and control system based on the PCI-6040E and SCXI1001,1102, and 1160.

But now, I have a question ,which is how to implement a controller in main_vi based on the test data of sub_vi.
 
my  program is consist of main_vi and  several sub_vi,  the main_vi is used for controlling and give the operation signal to hardware system (relay). and sub_vi is used for sampling data.
for example: the sub_vi collects data from the hardware and the control algorithm and output is implemented in the main_vi, so the question is how to transfer the test data from the sub_vi to main_vi synchronously.

I try to set the output connecter, but the data just return when  sub_vi is closed.
 
anybody have good idea about it.
 
Thanks a lot
0 Kudos
Message 1 of 4
(2,248 Views)

sorry,  it seems there is a problem about data transferring between the loop in sub_vi and the loop in main_vi. So the data will be sent back, after the loop of sub_vi is done or interrupt.

Does anybody know how to fix that problem, data transferring between the main_vi and sub_vi's loop.

Thanks a lot

0 Kudos
Message 2 of 4
(2,242 Views)

Hi hanwei

a Queue should help you. Create the Queue with Obtain Queue and give both vi´s the reference. In one loop you write the data into the queue and inthe other you wait til some data is available.

Mike



Message Edited by MikeS81 on 01-29-2008 10:50 AM
0 Kudos
Message 3 of 4
(2,240 Views)
Hi hanwei,

I'm making the assumption that you are not using LabVIEW Real-Time. If you are, you should use RT FIFOs. Otherwise, follow MikeS81's advice.

I would go a step further and say that most likely it would be a better design to remove the loop (while loop?) from the subVI and instead place the subVI within a while loop in your top-level VI. This way on each execution of your subVI it will quickly return your data. Then you can also perform all the queue and dequeue operations in the two seperate while loops in your top-level VI. This organization will be easier to read, document, and understand.
0 Kudos
Message 4 of 4
(2,218 Views)