Olin Lathrop ha scritto: > Take a look at the plot I posted a few days ago. The input to the filter > was a sine with the whole bottom cut off. The output of the two pole filter > looked a lot more sinusoidal. going to put it in there, then :) > Dario is looking at the line voltage, which has very low impedence. That > means that even with significant harmonics in the current drawn from this > line, the voltage will have little harmonic content. The approximation that > most of the power is in the fundamental is quite reasonable for many line > voltage measuring purposes. Remember that Dario only needs 5% accuracy. More realistically I may want some +-1% (218..222 out of 220) but I seem to be pretty close at the moment. > Yes, the multiplies are the same cost as adds, but you conveniently left out > the square root at the end. RMS would require one multiply and one add per > sample. The two poles of low pass filtering I showed used 4 adds and 2 > multiplies per sample. A good chunk of the 80 extra operations per line > cycle will be offset by the square root operation of RMS. However, both > methods will take only a tiny fraction of processor cycles, and Dario made > it clear that there were plenty of cycles available, so there is no real > distinction here. Now I'm wondering how can I save some cycles, i.e. I need one readout out of 1-2 seconds, so am wondering if I still have to sample every 1mS and do the math for IIR and peak-detect every time... I may wish to do it only for one or two full sine every 1 second... maybe: what do you think about this? -- Ciao, Dario -- Cyberdyne -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist