09-19-2013 07:55 AM
Hello,
I am working on a project in which I want to calculate the rate of some signal. I have used the peak detector to detect the peak of the waveform.
The peak detector works accurately but after sometime like 40 seconds it starts counting the noise ( which is less than the value of Amplitude, and which it was previously not counting), I don't know the reason for this.
Can any one pls help me out to solve this problem
Thanks v.much
Solved! Go to Solution.
09-19-2013 08:17 AM
In my experience, the peak detector function works fine. Are you setting reasonable input parameters, or are you just sending in your input and reading the output, going with the defaults?
We can't possibly help without more information (your program, some data, etc.).
Cameron
09-19-2013 09:50 AM
@Abuzar wrote:
Hello,
I am working on a project in which I want to calculate the rate of some signal. I have used the peak detector to detect the peak of the waveform.
The peak detector works accurately but after sometime like 40 seconds it starts counting the noise ( which is less than the value of Amplitude, and which it was previously not counting), I don't know the reason for this.
Can any one pls help me out to solve this problem
Thanks v.much
Does your signal actually end and then you are detecting noise only?
09-20-2013 01:07 AM - edited 09-20-2013 01:13 AM
Thanks for replying, Actually i found a reason which i want to share with you to get a better solution.
I was previously building the program using multiple producer consumer loops in which one was generting the data, the second was plotting, and the third was analyzing and calcualting the threshold voltage.
As in this pic
Latter i formed a new vi, in which i made all these things happen in a single while loop like this
From here what i came to know that when the reading gets fluctuate (the calculation value) i actually gets error in the vi(New bits arrived earlier error of VISA).
I removed the connection between the visa read and the build array function and then there wasnt any error in the vi(New bits arrived error of VISA).
I think that the time required to do the calculation produces error in the output. Because whenever the error occurs (in calculation) and i stop the vi, it gives an error output (of VISA) of new bits arrived earlier.
So, now can anyone pls give me the solution for it.
As i already deployed the producer and consumer loop to sepreate the production and calcuation and the same error comes when i combine all the operations in a single while loop.
I shall be very thankfull to all who replied.
Regards
09-20-2013 09:46 AM
@Abuzar wrote:
Hello everyone,@camerond
Thanks for replying, Actually i found a reason which i want to share with you to get a better solution.
I was previously building the program using multiple producer consumer loops in which one was generting the data, the second was plotting, and the third was analyzing and calcualting the threshold voltage.
As in this pic
Latter i formed a new vi, in which i made all these things happen in a single while loop like this
From here what i came to know that when the reading gets fluctuate (the calculation value) i actually gets error in the vi(New bits arrived earlier error of VISA).
I removed the connection between the visa read and the build array function and then there wasnt any error in the vi(New bits arrived error of VISA).
I think that the time required to do the calculation produces error in the output. Because whenever the error occurs (in calculation) and i stop the vi, it gives an error output (of VISA) of new bits arrived earlier.
So, now can anyone pls give me the solution for it.
As i already deployed the producer and consumer loop to sepreate the production and calcuation and the same error comes when i combine all the operations in a single while loop.
I shall be very thankfull to all who replied.
Regards
A more fundamental question then:
Why did you change it? Why did you fix something that wasn't broken? It would seem to me that the first way was superior.
09-20-2013 10:24 AM
Dear billko
As I wrote in my first post that I was working on Peak Detection in an incoming signal to find out the frequency of it.
The problem occurring in my first vi was that it was detecting some points as the peaks while they were not.
Also mention here that it always occur after some time. I.e.. It works perfectly for a certain time but then start counting some points as peaks which are not the peaks.
In order to get resolve the problem I made the vi in a single vi and concluded that what I think that the time is taken in calculating the peaks creates delay in getting the serial data and then it start counting the areas which are not peaks as peaks.
How do I concluded this was because, I disconnect the incoming data from the Build array (which you can see in the second vi) and then the vi runs accurately (i.e.. A new data arrives before the previous) in the VISA communication.
Also when inaccurate points are detected as peaks I stop my vi immediately and gets the error of VISA communication.
So some problem I think lies in the time of calculation that remains present in the producer consumer technique too.
Thanks a lot.
Regards
09-20-2013 12:18 PM - edited 09-20-2013 12:19 PM
I still stand by my post that the original architecture isn't what was wrong. I think your "extra bytes" at the port are actually leftover data that wasn't read from the time before! Here is an excerpt from VISA read:
This function might return less than the number of bytes requested if the function reaches the end of the buffer, reaches a termination character, or if a timeout occurs. The output error cluster indicates if a timeout has occurred.
[edit]
I believe that sometimes you are reading before all the data is in the buffer.
[/edit]
What you need is to figure out a method to wait until there are the necessary bytes at the port before placing it in the queue. There are various examples here and in LabVIEW itself that show you how you might do this, depending on how the data is formatted.
09-27-2013 01:54 AM
Hello,
Finally working on the first vi I found the solution of my problem
The reason I got for the changing value of the rate was that filled array, i.e. with time the array gets more and more values in it and it took time to work on it and as a result the vi giving wrong results of the rate.
I finally limited the value of array and then passed that limited array to the producer consumer section for calculation and then it worked correctly.
I request all to reply me whether i took the right way to the solution.
Thanks to all who helped me in getting a solution.
Regards