LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about executing two loops simultaneously

Hi,

I have a problem executing two loops 'simultaneously'.

Let me first describe what I want:

I have one loop that contineously acquires data (at 1kHz) and sends feedback
signals (to the valves at a rate of 50 Hz). On the other hand there's a high
frequency acquirement (at at least 250 kHz) for a duration of, let say, up
to 10 secs.

The high frequency acquirement is not contineous, but it should be executed
at a time that I want to. It should be executed multiple times also.

What I have used is a notifier to execute the other loop at a time that I
want. It's ok when I run the other loop for only 0.5 seconds, but when I do
it for 10 sec. then the other control loop doens't function anymore. The
valves stay at the
same opening position because it doesn't get any feedback
from this loop.

How can I fix this problem ?

Many thanks,

Chang-Kwon Kang
0 Kudos
Message 1 of 3
(2,134 Views)
Chang-Kwon,

I believe that your problem doesn't really lie in the fact that you have two loops, I think it is rooted in how you are doing your data acquisition.

First, let me make the assumption that you are using buffered acquisition for your data (you must be to get 250 kHz). When you do your buffered acquisition, are you using DAQ occurrences to see when the buffer is full (or has a specific amount of data in it) before you perform your AI Read?

What I'm getting at is when you perform a buffered acquisition, you call the AI Read VI to get the data out of the buffer and into LabVIEW. If you ask the AI Read for an amount of data that is not available in the buffer yet, it will consume the "data acquisition" thread until the data IS available. T
herefore, any other data acquisition VI's that you are trying to run will be halted until this operation completes.

The way to get around this is to use the DAQ occurrence VI. This VI will halt until the amount of data is available in the buffer, but it doesn't consume the data acquisition thread while it is waiting; when it returns that the data is ready, then you can perform your AI Read. This allows you to have more than one data acquisition going on in either one or more loops.

Hope you understood that. Let me know if I can help you further.

Mark
Message 2 of 3
(2,134 Views)
Mark,

thanks for your kind answer.

I think I get what you mean. I'll try to use DAQ occurence VI.

Thank you again,

Chang-Kwon

"markwysong" wrote in message
news:506500000005000000C9530000-1007855737000@exchange.ni.com...
> Chang-Kwon,
>
> I believe that your problem doesn't really lie in the fact that you
> have two loops, I think it is rooted in how you are doing your data
> acquisition.
>
> First, let me make the assumption that you are using buffered
> acquisition for your data (you must be to get 250 kHz). When you do
> your buffered acquisition, are you using DAQ occurrences to see when
> the buffer is full (or has a specific amount of data in it) before you
> perform your AI Read?
>
> What I'm getting at is when you perform a buffered
acquisition, you
> call the AI Read VI to get the data out of the buffer and into
> LabVIEW. If you ask the AI Read for an amount of data that is not
> available in the buffer yet, it will consume the "data acquisition"
> thread until the data IS available. Therefore, any other data
> acquisition VI's that you are trying to run will be halted until this
> operation completes.
>
> The way to get around this is to use the DAQ occurrence VI. This VI
> will halt until the amount of data is available in the buffer, but it
> doesn't consume the data acquisition thread while it is waiting; when
> it returns that the data is ready, then you can perform your AI Read.
> This allows you to have more than one data acquisition going on in
> either one or more loops.
>
> Hope you understood that. Let me know if I can help you further.
>
> Mark
0 Kudos
Message 3 of 3
(2,134 Views)