Em 27/3/2010 05:31, Marechiare escreveu: >>>> ok, my idea was to make this peak-measurement every 20mS, >>>> and average it with the previous one. Resimulated the peak >>>> method, and it fits in the 1.2% error indeed. >>>> = >>> You are still sampling at 1KHz to find the peaks, right? The >>> 1.2% error I mentioned comes from the 1KHz samples missing >>> the peak by as much as 500uS. >>> = >> Yes, my (and your) simulation show that. >> = > > Detecting peaks is not a good idea in my opinion. Much better advice was: > > > = >> Trying to detect the peak value and scale that is IMO a bad idea >> because a single brief spike could throw the reading way off. >> >> Taking the average of the magnitude and scaling it would probablly >> be a reasonable option. True RMS is also pretty easy to calculate >> (square the individual values, average them and take the square root >> at the end) >> = I agree, once I designed an equipment to protect AC induction motors from line disturbances. This equipment was intended to substitute another from a big brand here in Brazil that was not working well. I used an integrator to measure the RMS value. After the new design was done I decided to study the circuit of the big brand equipment and found that it used a peak detector. I then decided to analyze the power supply in an industry I had access (the same that would produce the new equipment) and found that it is common for some circuits to have permanently distorted waveforms. Most had the peak "shaved off", and when the generators took over, they produced very high and narrow peaks once every cycle. The big brand equipment was detecting a too low voltage because the peak was a few volts below the nominal. It didn't took in account that the peaks bear very little energy. Somebody forgot that the AC is a sinusoid :) The problem with the generators was due to their electronic "excitators" that fed the field only once every cycle, deriving power to the field from only one phase, half-wave rectified. This caused the field to receive an initial current inrush and decay through a free-wheeling diode. Bad design, but worked. The glitch was something like 500V but just a vertical line on the scope, the sinusoid was somewhat distorted around it also. Several multi-meters (including true RMS ones) showed a nominal voltage in both cases, and for the industrial equipment it was the same as if the disturbances were not there, but the protection equipment was measuring an absurdly high value. The dangerous disturbances that needed to be avoided were too low or too high (RMS) voltage and loss of one phase. Best regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist