NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Ails26
Posts: 40
0 Kudos

problems with the threshold detector.vi

I am trying to set an upper thresthold of 2.75 on the y-axis. what is wrong that the chart wont display it. It is problem a problem in my code so I have attached it

 

Thank youthreshold detector.JPG

Knight of NI
johnsold
Posts: 10,132
0 Kudos

Re: problems with the threshold detector.vi

Well, what is wrong is that you did not use the output of the Threshold Detector in any way to affect the chart.

 

It is not clear what you mean by "set a threshold... on the y-axis."  Do you want to make a mark on the chart at the threshold level? Do you want to limit the array values so that they cannot exceed the threshold?  What do you want to do with elements which are above the threshold?

 

Lynn

Member
Ails26
Posts: 40
0 Kudos

Re: problems with the threshold detector.vi

Sorry i'm new to LabVIEW so I'm abit rought!! What i am trying to do is set a threshold at 2.75 when the waveform goes above that threshold the user will be notified and the graph will count the amount of times the graph went into therhreshold zone.when it stays below the 2.75 everything is ok.

 

Maybe the threshold detector isnt the best thing to use. what do you think?

 

Ails

Knight of NI
johnsold
Posts: 10,132
0 Kudos

Re: problems with the threshold detector.vi

Ails,

 

I am still not sure exactly what you want to do.  Depending on how clean your signal is you may be able to use the Threshold Detector.vi to determine the number of places the signal is above the threshold.

 

To determine which data points are above the threshold is somewhat different.  Simply testing each point to see if it is greater than the threshold may be enough.

 

Look at this VI to see if it gives you any useful ideas.

 

Lynn

Member
Ails26
Posts: 40
0 Kudos

Re: problems with the threshold detector.vi

Lynn

The signal is coming from a pressure sensor so when full strength is applied onto the sensor the sensor goes to 5V. For this project applying pressure above 2.75V is bad. I want the user to stay below the 2.75V limit an if the cross the limit I want to switch on a light and count how many times the limit was crossed by the pressure sensor over a period of time. I hope that help in making it a bit clearer.

Is the threshold.vi what I should be looking for??

Ails
Knight of NI
johnsold
Posts: 10,132
0 Kudos

Re: problems with the threshold detector.vi

Ails,

 

The Threshold Detector.vi will count the number of times the signal exceeded the threshold.  If you signal is noisy and near the threshold you could get a very high count.

 

For the Overpressure indicator just wire an LED to the output of a >? comparision.  Connect the data to one input and the threshold to the other.

 

Lynn

Member
Ails26
Posts: 40
0 Kudos

Re: problems with the threshold detector.vi

Lynn

 

the light part works now I just need the threshold line at 2.75

 

Your threshold.vi is similar to what I am looking but I just looking for it to say that the threshold was passed 3 times instead of count all the points like the threshold.vi does. Also once its below the threshold I dont really care about the signal. do you think the threshold vi is the right thing to use?

 

Ails

Knight of NI
johnsold
Posts: 10,132
0 Kudos

Re: problems with the threshold detector.vi

Count seems to count the number of times the signal crosses the threshold in the positive going direction.  Is that not what you want?  In my VI the sine signal has three peaks above threshold with about 12 data points in each peak.  The count output shows 3.  If your signal has a lot of noise near the threshold, you may see extra counts.

 

To draw a line at the threshold jsut create an array with the same number of elements as your data and make all the elements = threshold.  Initialize array will do this for you in one step.  Use Build Array to make a 2D array with the data in one row and the threshold array in the other.

 

Lynn