#### am85

##### Member level 2

I am currently working on a project to calculate the RMS voltage, RMS current and phase difference using an FPGA. First an ADC will convert the analog signal and then the FPGA should process the digital data and calculate the three values. I would appreciate it if anyone can help with the following questions. I am using a spartan 6 FPGA.

1) Which algorithm is the best to use: summing up the squares of all samples from the ADC til the voltage is zero, dividing by n then getting the square root

OR finding the peak voltage and then dividing by the square root of 2.

2)Do i need to filter the signal coming from the ADC first before performing the calculations? which filter to use?

I tried implementing a moving average filter using the FIR core in Xilinx, but when i set the coefficients to fractions as 0.3 for getting the average of the values, i get strange outputs from the filter. there are also several filter types and architectures available in the core, which confused me.

3)what would be the fastest method to perform these calculations? is it creating a coprocessor for microblaze and using the hardware FPU for parallel calculations?

sorry for the numerous questions and thanks a lot in advance.