LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview PID

I looked at the 7833R manual:

 

Glitch energy at midscale transition.......................±200 mV for 3 μs

 

http://www.ni.com/pdf/manuals/372492c.pdf, page 3.

 

Since the input looks so good with a 1uSec delay, I don't think the averaging is that important.  Averaging is only to clean up any noise that would still be in the data.

 

Since the output isn't rated to get within +/-2LSB within less than 3 uSec, I recommend changing the delay to 3uSec.  That will do well for a 1kHz signal, but if you really need better, 2uSec would be a fair compromise.  Most PID controls don't need updates faster than 1mSec, so once you're done testing, you may be able to raise the delay quite a bit.  And you could add electronic filtering to the output to reduce the +/-200mV glitch more.  Or, (if your design allows it), avoid the 0V crossing, and just use 0..10V instead.

___________________
CLD, CPI; User since rev 8.6.
Message 31 of 39
(1,849 Views)

Might be worth writing LabVIEW code generate the waveform and see how the output looks, instead of trying to duplicate the input on the output.

0 Kudos
Message 32 of 39
(1,842 Views)

Dear ZX81,

Thank you so much for your solution. Actually I checked and found that the glitch is in the order of 200 mV and when I zoomed the time scale it took about 2.5 seconds. I could not believe such a big glitch is software based. For my application, an allowed glitch of plus or minus 10 mV is acceptable. This is because my setpoint  will be a value close to zero and such a glitch will greatly affect my results.

I made a quick search on the web and found out that one of the ways to minimize glitches is by using a deglitching filter (http://digital.ni.com/public.nsf/websearch/9B13E25B0B0EC197862562B4007D2E33?OpenDocument). Now am clueless on how to implement this at all.

See the attached files below.

I also changed the delay to 3 uSec and attached find the output.

 

Thank you.

 

Kind Regards,

Opuk

 

 

0 Kudos
Message 33 of 39
(1,823 Views)

Hi Opuk,

 

when I zoomed the time scale it took about 2.5 seconds.

From your image I would guess the glitch takes ~1.5µs (micro seconds)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 34 of 39
(1,810 Views)

Hi GerdW,

Thanks for the correction. Am sorry iits not in the magnitude of seconds

0 Kudos
Message 35 of 39
(1,801 Views)

--- As far as implementing a solution for the output glitches:

 

1. The simplest approach would be an R-C filter (output goes through a Resistor to a Capacitor, then to 0VDC; use the signal between R & C).  You can use two stages for even better clean-up.

 

2. You could also use a little circuitry to shift the voltage from 1..9V to -4..4V, and avoid the glitch.  But it looked like there's another (smaller) glitch at a higher value, likely +/- 2048 in the raw value.  So you may need to avoid that, too.

 

3. You could use two outputs, and use a resistor divider between them (that can be combined into an R-C filter, too).  One output could be 0.1..10V, and the other -10..0.1V.  The average would be -4.95..+4.95V.  The software would need to output positive values on one channel, while keeping the other at -0.1V, and vice-versa for negative values.

 

If you have an R-C filter, and need high frequency outputs (R-C filters attenuate/reduce high frequency signals), you can pre-filter the output to amplify the higher frequency.  It's been 20 years since I've made a compensating filter, and don't remember most of the details--it resembles a high-pass filter, but adds the unfiltered signal, too (i.e. out[n] = y[n] + a*(y[n]-y[n-b]), where 'a' and 'b' are found experimentally).

 

--- As far as the noisy input:

 

I'm shocked that it would be that noisy.  A little noise isn't much of a problem for most PID applications (unless you are driving a valve).  But that much is ridiculous.  Especially with filtering (7X box filter).  (by the way, the FPGA usage will be a little lower if you use 8 instead--1/8 is a simpler binary value).

 

Could you add the original (unfiltered) input to the chart?  I don't think there is anything wrong with the math, but there is a small chance.  There may be a clue how to fix it, too.  Sometimes an occasional bad value can be filtered better using the Median instead of Mean/Average, or by removing the min & max, then averaging the rest.

 

With the triangle wave, it looked like adding a 1uSec delay fixed it...  That isn't a great surprise, since a lot of A/D Converters behave poorly when they are polled too quickly.  3uSec ought to have done as well or better.  It makes me suspicious that 3uSec has a similar problem.  Please try a few different delay periods, and see if anything cleans up the signal.  I couldn't find any clues in the documentation, but didn't look very hard, either.

 

 

___________________
CLD, CPI; User since rev 8.6.
0 Kudos
Message 36 of 39
(1,778 Views)

Dear ZX81,

Thanks for the marvelous suggestions. I am sorry for late response. I am now working on these suggestions  and will get back to you on the outcome soonest. I am not good in electronics though based on my background, but am doing more research on filter design. Thank you.

 

Best Regards,

Opuk

0 Kudos
Message 37 of 39
(1,734 Views)

Dear ZX81,

Thanks for the marvelous suggestions. I am sorry for late response. I am now working on these suggestions  and will get back to you on the outcome soonest. I am not good in electronics though my background being mehanical, but am doing more research on filter design. Thank you.

 

Best Regards,

Opuk

0 Kudos
Message 38 of 39
(1,725 Views)

Hi ZX81,

I designed a band pass filter using resistors and capacitors and am glad my output signal is very clean now. See the attachment. Thank you for your suggestions. I now want to check about the noise on the signal.

Thank you.

 

Best Regards,

Opuk

0 Kudos
Message 39 of 39
(1,705 Views)