LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need advice on programming a virtual power meter

Hello all

 

I need some advice on programming a virtual power meter, it is suppose to measure 3 phase, but with the hardware i have right now, i'm only focused on 1 phase. I have written a "working" program,  however the accuracy of it is not up to the IEC standards regarding power meters, so i need some help to workout how i can get more accurate readings. Note the accuracy is measured against varying frequency that can be found on the live power network. The hint I was given by the professor was that either round to nearest length of zero crossing and average over known number of cycles or perform error analysis on the waveform and then find the correction factor for the extra or missing sample, as right now the inaccuracy in the result is most likely caused by the frequency not matched with the sampling window. I have attached the program and the error analysis I did before.

 

Kind  regards

Richard

 

Download All
0 Kudos
Message 1 of 6
(2,591 Views)

You will achieve more accurate results if you have an integer number of cycles in the measurement window.

 

The bigger issue that I see is that you are adding power values from one iteration to the next. This is leading to an accumulating error. More fundamentally, power doesn't add like that, especially if you have a dynamic live power network. Energy adds. Power averages. 

 

Evaluate your measurements without feeding back in the power measured from all previous iterations.

 

 

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 2 of 6
(2,545 Views)

Thank you for pointing out the errors, is the measurement window currently in floating point?

So to get information from one loop to next I should look at the use of arrays?

I was adding the power because I want it to function as the meter that we use at home, but yes, i understand it doesn't add.

 

Richard

 

0 Kudos
Message 3 of 6
(2,476 Views)

The measurement window is the block of time-domain samples used to calculate power (active, non-active, apparent). 

 

To pass data from one iteration to the next within a loop, continue to use shift registers. Scalars or arrays can be passed through shift registers. Do you want to pass data to the next iteration because you want to view history or because you want to sum energy over a number of blocks?

 

One recommendation might be to record 60 seconds of data and test your processing algorithm on that recorded data.

 

I think I remember that your code used functions from the Electrical Power Toolkit. There are a number of examples that use API VIs that calculate accurate power measurements for fixed-frequency applications. Furthermore, in the Electrical Power Toolkit for LabVIEW 2020, you can find examples intended for dynamic-frequency measurements that demonstrate continuous acquisition, recording voltage and current waveforms to TDMS, cycle-based processing, etc.. Review the example VIs in <LabVIEW>\examples\EV Power Test\Traction Inverter\Traction Inverter (DC + 3-Wire AC).lvproj

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 4 of 6
(2,464 Views)

the original sampling was going to be continuous due to live network variation, but now it changed to batch acquisition because of limitation from the hardware. Now the batch processing is going to be working with 256 samples per cycle, and using the IQ data to ensure accuracy when calculating power parameters.

The display needs to show power parameters, active, non-active apparent. I know these will be averaged over the cycle, I wanted to use the shift register was to get a watt meter of the energy used over time.

My code did use function from electrical power toolkit, but as you have said it is accurate with fixed frequency application, but due to frequency changed in live network, my supervisor has told me to calculate from IQ data.

How can i get IQ data from the voltage and current waveform? I have seen a lot of explanation on what it is, but I couldn't figure out how to get it in labview, is it just taking the voltage waveform and shift it by 90 degrees left and right to get the IQ data?

 

0 Kudos
Message 5 of 6
(2,447 Views)

Does the batch processing resample so that you have exactly 256 samples per cycle for all frequencies, or are you still sampling with constant time interval (dt) and you happen to have 256 samples in a cycle at some nominal frequency? Just curious; I don't expect your answer to affect my responses below.

 

If you want to display a history of calculated values, connect your measurement to a chart and configure the chart history length. If you want to measure power and integrate the measurements to find the energy consumed, use the <LabVIEW>\vi.lib\addons\Electrical Power\EV Power Test\Battery\Power and Energy\Integrate Watt to Joule (1 Channel).vi

 

If you have the voltage and current waveforms for an integer number of electrical cycles (static or dynamic frequency), use <LabVIEW>\vi.lib\addons\Electrical Power\EV Power Test\Three Phase Power Measurement\Time Analysis\Power (1-Phase, 1 Ch).vi to measure apparent power (S) and separate into active (I) and non-active (Q) power components. If you dig into that VI, you will see this subVI:

 

Single Channel Power Measurement.png


If power quality is something you are going to be investigating, I recommend obtaining a copy of standard IEEE 1459 - 2010. This standard describes the math for single-phase and three-phase systems and also for sinusoidal and non-sinusoidal signals.

 

Overall, I recommend working through the math you need to do before worrying about "how to get it in LabVIEW, ...". Understand the math. Translate that math to a discretely sampled domain. Finally, implement the discrete math in whatever language you choose. Make sure your implementation (whether you build your own or leverage Electrical Power Toolkit) returns the expected results for a couple of known use/test cases. Then, you understand the implementation and how to verify your measurements. This community can best help you with specific LabVIEW knowledge gaps.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 6 of 6
(2,423 Views)