From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparator realisation: input signal - waveform, threshold - double constant

Solved!
Go to solution

Hello,

 

How to realise comparator, where input signal is waveform-type (coming from DAQ) and threshold is a double constant.

These two types are incompatible, so some conversion should be done. Which one ?

 

Thanks

 

Pavel

0 Kudos
Message 1 of 24
(4,181 Views)

The waveform is a cluster of 4 things: Array of DBLs, t0 (timestamp), dt (DBL), and attributes (variant). You can access the array of DBLs if you need.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 24
(4,176 Views)

Hi Pavel,

 

what exactly isn't compatible here?

check.png

Comparing a waveform with a scalar DBL value…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 24
(4,163 Views)

I assumed he was trying to use the "threshold" VI.

Thresh.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 24
(4,155 Views)

Hello James,

 

Thank you for feedback. Here is fragment of my VI.

The signal acquired from DAQ is then transformed inside of block "Lorentz Transform" (on the "Lorentz Transform" output the data is still waveform-type) and then should be compared with threshold.

When I transform wafeform in 1D array and apply it to comparator, discrepancy persists: array cannot be properly compared with single value - connection to LED is broken.

 

Does exist some example, where data is acquired by DAQ and then this stream of double values is compared with a threhold: when the acquired runtime value is greater then threshold, LED is ON.

 

Thanks

 

Pavel

 

comparator_realisation_problem.JPG

0 Kudos
Message 5 of 24
(4,150 Views)

Hi James,

 

I assume we should explain Pavel the advantage of providing a good example (VI) of the exact problem…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 24
(4,148 Views)

Hi Pavel,

 

array cannot be properly compared with single value - connection to LED is broken.

Your conclusion is: I cannot compare because I cannot display the result of the comparison?

You can compare an array to a scalar!

But you cannot display an array in a scalar boolean indicator!

 

Either use an array of booleans or a suitable boolean operation like "AND array elements" or "OR array elements"…

 

when the acquired runtime value is greater then threshold, LED is ON.

Your should check your wording: a waveform contains (usually) more than one value!

So you need to define, when the LED should be ON: when all values are above your limit or when atleast one value is above the limit?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 24
(4,142 Views)

Hello GerdW

 

My case is similar to the following setup:

  • low frequency (e.g. 0.5Hz), amplitude 1V SIN is applied to DAQ
  • the threshold value is 0.5V

Is it possible to put LED in VI, that in runtime changes to ON when SIN is more than 0.5V and OFF if it's less than 0.5V ?

 

Thanks

 

Pavel

0 Kudos
Message 8 of 24
(4,121 Views)

Like GerdW said, you have an array of values (multiple DBL values) that you are comparing to your threshold. You need to define the criteria that the LED will show True. Is it when all values are above threshold? When the first value is above? When the last value is above?

 

There are many possible ways to do this.

ThreshCompare.PNG

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 24
(4,103 Views)

Ok, I see.

Thanks. Probably should I redefine the problem ... for example create different acquisition branch with number of samples = 1 ?

 

0 Kudos
Message 10 of 24
(4,097 Views)