05-03-2021 02:51 AM
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
Solved! Go to Solution.
05-03-2021 03:08 AM - edited 05-03-2021 03:09 AM
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!
05-03-2021 10:19 AM
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
05-03-2021 10:37 AM - edited 05-03-2021 10:38 AM
@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.)
05-03-2021 10:41 AM
Hi Bill,
Really appreciated your help!
Roy
05-03-2021 10:48 AM - edited 05-03-2021 10:50 AM
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.)