LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running 2 while loops

Is there a way to run two while loops at the same time where one loop is running very slowly and the other quickly? I have a system that logs data as tension is placed on wire rope products. The customer may apply tension for several hours. There is a while loop that is timed for up to 5 minutes sample rate. The load on the item under test may suddenly and briefly jump or lurch and then come back to near the same amount of load and this is considered to be a failure. The problem is that with a 5 minute sample rate (or even faster) we will not "see" this in the results. Is there a way to simultaneously run a second while loop to essentially monitor the activity during a test? It would be niced to run the second loop at 100 mSec or even faster.
Also, it is possible to promptly interrupt the first while loop either automatically or manually?
0 Kudos
Message 1 of 3
(2,984 Views)
dej143 wrote:
> Is there a way to run two while loops at the same time where one loop
> is running very slowly and the other quickly? I have a system that
> logs data as tension is placed on wire rope products. The customer
> may apply tension for several hours. There is a while loop that is
> timed for up to 5 minutes sample rate. The load on the item under
> test may suddenly and briefly jump or lurch and then come back to near
> the same amount of load and this is considered to be a failure. The
> problem is that with a 5 minute sample rate (or even faster) we will
> not "see" this in the results. Is there a way to simultaneously run a
> second while loop to essentially monitor the activity during a test?
> It would be niced to run the second loop at 100 mSec or
even faster.
> Also, it is possible to promptly interrupt the first while loop either
> automatically or manually?


Hi,
If I had to do this I would set up a continuous buffered ADC operation
at 10Hz or more and monitor the samples as I read them from the buffer.
If a significant change occurred in the data (from a minimum and maximum
array function perhaps?) then start saving the data, either to an array
or disk. If no significant change had taken place then you could just
save one sample out to a result file if it was a suitable time (5 mins)
to do so.
There are probably many other ways but personally I would try to steer
clear of having two loops acquiring data the same time. Although it is
possible to have two or more loops running in parallel the fact that
they would be reading from the same DAQ device may be a cause of
problems. Also communicating between the loops as you suggest will break
dataflow and will leave might leave you wondering what is happening
when! (I
've been there myself many times :-} )

Regards,

Dave R.
0 Kudos
Message 2 of 3
(2,984 Views)
This case would be a classic candidate for the use of occurrences.
You could
create one high speed monitoring loop to monitor the tension in the
rope. The other loop would use a wait on occurrence with a timeout
period of 5 minutes (or whatever you want.) The high speed loop could
then set an occurrence to signal the "low" speed loop that a failure
event had occurred.

Your "low" speed loop would then actually run at slow speeds unless a
failure(s) happened. Then it would run at the speed at which they
were detected by the high speed loop.

Occurrence signalling happens at an "atomic" level, i.e. it
instantaneously signals across all running threads, while loops, etc.
so that you don't need to poll. Polling will never be faster than
occurrences and will use much more CPU than occurrences.

To carry this even further, if your monitoring system hardware can
signal your host PC using SRQ's or DAQ occurrences when a failure
happens then you can stop polling in the "high" speed loop as well and
could avoid missing failures altogether.


Douglas De Clue
LabVIEW developer
ddeclue@bellsouth.net



DaveR wrote in message news:<3D1DF52A.1050304@unforgettable.com>...
> dej143 wrote:
> > Is there a way to run two while loops at the same time where one loop
> > is running very slowly and the other quickly? I have a system that
> > logs data as tension is placed on wire rope products. The customer
> > may apply tension for several hours. There is a while loop that is
> > timed for up to 5 minutes sample rate. The load on the item under
> > test may suddenly and briefly jump or lurch and then come back to near
> > the same amount of load and this is considered to be a failure. The
> > problem is that with a 5 minute sample rate (or even faster) we will
> > not "see" this in the results. Is there a way to simultaneously run a
> > second while loop to essentially monitor the activity during a test?
> > It would be niced to run the second loop at 100 mSec or even faster.
> > Also, it is possible to promptly interrupt the first while loop either
> > automatically or manually?
>
>
> Hi,
> If I had to do this I would set up a continuous buffered ADC operation
> at 10Hz or more and monitor the samples as I read them from the buffer.
> If a significant change occurred in the data (from a minimum and maximum
> array function perhaps?) then start saving the data, either to an array
> or disk. If no significant change had taken place then you could just
> save one sample out to a result file if it was a suitable time (5 mins)
> to do so.
> There are probably many other ways but personally I would try to steer
> clear of having two loops acquiring data the same time. Although it is
> possible to have two or more loops running in parallel the fact that
> they would be reading from the same DAQ device may be a cause of
> problems. Also communicating between the loops as you suggest will break
> dataflow and will leave might leave you wondering what is happening
> when! (I've been there myself many times :-} )
>
> Regards,
>
> Dave R.
0 Kudos
Message 3 of 3
(2,984 Views)