LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert dynamic data type to a numeric with specific precision

Solved!
Go to solution

Hi,

 

I would like to ask how can I convert the dynamic data from DAQ to a numeric type with specific precision?

 

The reason I want to do this is because that I want to eliminate the noise from the data I acquired from LVDT (maxium range 0-10V and has about 0.01V noise (error)). So if I limit the significant figure of the acquired data to 2 then I can get a data without oscillation and input it into the PID VI.

 

Any suggestions is much appreciated! 

 

Roy

0 Kudos
Message 1 of 6
(152 Views)
Solution
Accepted by Roy19

Hi Roy,

 


@Roy19 wrote:

I would like to ask how can I convert the dynamic data from DAQ to a numeric type with specific precision?

 

The reason I want to do this is because that I want to eliminate the noise from the data I acquired from LVDT (maxium range 0-10V and has about 0.01V noise (error)). So if I limit the significant figure of the acquired data to 2 then I can get a data without oscillation and input it into the PID VI.

 

Any suggestions is much appreciated! 


Why is there a DDT wire at all? Why not use "simple" datatypes right from the beginning???

 

To reduce noise on a signal you usually apply a filter. Simplest filters are low-pass filters, aka RunningAverage. LabVIEW comes with such a function, it's called PtByPt-Mean…

 

You can only convert your DDT wire into datatypes using "ordinary" float values, you cannot apply rounding right here. When you really want to "limit the significant digits" of your values you should apply a rounding function after the conversion from DDT. (Be aware of limitations of floating point datatypes, especially regarding rounding to multiples of 10.)

 

Does your PID really react heavily on fluctuation in the 3rd decimal after decimal separator? Maybe chaning the PID gains may help here, too!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 6
(143 Views)

Hi GerdW,

 

Thank you so much for your reply.

 

1. Cause I am using DAQ Assistant so the output signal is automatically DDT. May be I should use DAQmax instead so that I can have DBL data?

 

2. The round function only derives integer, the only way I can think of is that times the data with 100 and do the rounding and divides 100 again, so that I can get 3 significant digits, is there any more convinient function to get a specific decimal?

 

Roy

0 Kudos
Message 3 of 6
(70 Views)

@Roy19 wrote:

Hi GerdW,

 

Thank you so much for your reply.

 

1. Cause I am using DAQ Assistant so the output signal is automatically DDT. May be I should use DAQmax instead so that I can have DBL data?

 

2. The round function only derives integer, the only way I can think of is that times the data with 100 and do the rounding and divides 100 again, so that I can get 3 significant digits, is there any more convinient function to get a specific decimal?

 

Roy


I think that's actually how to do it.  More generally multiply your number by 10^x, where x is the number of desired decimal places, then divide by 10^x.  (BTW, this even works for rounding to digits to the left of the decimal place - e.g., using 10^0 will round your number to the nearest ones column; 10^-1 will round to the nearest 10's, etc.  Convenient if you want to round to, let's say, the nearest MHz.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(64 Views)

Hi Bill,

 

Really appreciated your help!

 

Roy

0 Kudos
Message 5 of 6
(59 Views)

This is actually how you would compare numbers to a certain decimal place.  Multiply both numbers by 10^x, round, then do the compare!  (You don't need to divide again before compare; that just gives you FP errors.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(56 Views)