LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mean with collector or Mean Ptbypt after true signal

Dear All

 

After searching in the forum, and after trying use the collector and the Mean PtByPt vi I still do not have what I need.

I will work with ni usb 6009 daq.

I need to acquire data after a true value (in my caso will be with a proximity switch) for an about 1 secound duration, no matter how much data acquires, at the final I need only the average value of all data collected during the true signal.

I try with continous samples and N samples but seems do nothing.

 

 

 

The collector should work, but it ask for the amount of data and it has bolean inputs for reset and for enable, but it gives data all time, even if i change the number of data collected...

 

If some body can help me with some tips I will appreciate.

 

best regards

cpalka

 

 

 

0 Kudos
Message 1 of 8
(6,524 Views)

Look at a function called Boolean Crossing Pt by Pt  (point by point).  It will give you a true output whenever a signal goes from true to false, false to true, or either direction.  You can use the output of that to determine when to reset the data in the collector based on your digital input signal.

0 Kudos
Message 2 of 8
(6,516 Views)

Hi Ravens

 

Thanks for your help.

But imagine that I have 100 samples each secound, and if i have the collector configured to 1000 samples, and after that I add a mean block to give me the mean of this 1000 points collected or less (depends the reset if occurs before the 1000 values), so after a reset it should wait for 1000 samples, before sending data to an output. Should be 10 sec before sending data. Bu this is not happening it sends data all time.

And the loop, I need to put an waiting time?

Should I use arrays???

 

CPalka

0 Kudos
Message 3 of 8
(6,502 Views)

Right now these are all hypothetical situations you are talking about.  It would be easier to discuss if you showed code with what you've done so far so we can see how it does or doesn't meet your needs and modify it accordingly.

 

Arrays are always good to use.  Whether you need a wait time or not, I don't know.  Maybe you only need an elapsed Time Express VI.  Or just a check that tells you when your array, or the Collector VI has reached 1000.

 

It is easier to make suggestions seeing real code than it is to speculate on paragraphs.

0 Kudos
Message 4 of 8
(6,491 Views)

Here is a small example

 

You can change for a simulate signal to put it working

 

 

CPalka

0 Kudos
Message 5 of 8
(6,486 Views)

Your Mean pt by pt seems to do nothing for 2 reasons.

 

1.  You are sending in the signal through the evil blue Dynamic Data Type wire which hides the details of what is in it and magically allows you to connect to almost everything without really knowing what is happening.  In this case it is getting coerced to something else at the Mean Pt by Pt.  Since Mean Pt by Pt is expecting a single value and keeps a running average of what is sent in, that signal of 100 data points is getting 99 thrown out and leaving just 1 to be averaged in.  Reset probably is doing something there, but you probably don't really see it since your loss of 99% of the data is hiding it.

 

2.  For the collector up top, you are never putting a graph on what is coming out of the collector to see how it is working with the data.  Now for that one, the reset is working like you expect, you just don't see it unless you notice that your array size count drops to zero and counts back up to 1000 after you click the button.

0 Kudos
Message 6 of 8
(6,480 Views)

Hi Ravens

 

I try to use convert from dynamic data, but it is not alowed. I used a graph but is the same stills get readings time after time and not if i press the bolean button.

The collector until it is full (for example 1000 data points) it lets data outs from collector before it is completly full.

I expected no data from collector before it get 1000 samples.

 

Seems to be a very simple and usefully task (getting/saving data through a true signal, but in fact it is not so easy (for me of course) and i search in the forum, but nothing appear similiar to it.

 

Best regards

cpalka

 

 

0 Kudos
Message 7 of 8
(6,459 Views)

Here is the solution

 

best

cpalka

0 Kudos
Message 8 of 8
(6,453 Views)