Power calculation from Voltage and current waveforms

조회 수: 132 (최근 30일)
Stefano Albertini
Stefano Albertini 2021년 2월 17일
답변: Harsh 2023년 8월 12일
Hi to everybody!
I'm trying to calculate active and reactive power starts from current and voltage waveforms.
To do that i've prepared a simulink model and a matlab script, i'll attached to this post.
With simulink is really easy to obtain datas I'm looking for, but it's just a model. My goal is to write analytic formula to do that and after implement into a FPGA for a real calculation in AC/DC application.
Theory said that :
with t2-t1=period T.
So in my code I've multiplie voltage vector for current vector and integrated it during 1 period. The result is not god, but I've no idea why.
Maybe use trapz as integral is not the best way?
Could you help me?
  댓글 수: 2
Stefano Albertini
Stefano Albertini 2021년 2월 23일
Hi again,
further information.
%Model parameters
Vmod_rms = 230; %[V] Voltage module rms
freq = 50; %[Hz] frequency
Rcarico = 10; %[Ohm] R load
Lcarico = 50e-3; %[H] L load
Xlcarico = 2*pi*freq*Lcarico;
%analytic calculation for Power active, reactive and apparent
Icarico = Vmod_rms/(Rcarico+1i*Xlcarico);
Icarico_rms = rms(abs(Icarico));
Icarico_pk = Icarico_rms*sqrt(2);
cosfi = abs(cos((angle(Icarico))));
PowerP = Vmod_rms*Icarico_rms*cosfi;
PowerS = Vmod_rms*Icarico_rms;
PowerQ = sqrt(PowerS^2-PowerP^2);
And from simulation I obtain the same results.
%% Power measured in Simulink
Pload_rms = rms(Pload.Data);
Pload_avg = mean(Pload.Data);
Qload_rms = rms(Qload.Data);
The problem, in my opinion, is due to integration .
I've tryed to use just a single period of voltage (2006:4009 was found analyzing data) but the result is 5 order greather.
from calculus:
PowerP = 1525W
from simulation:
P=1526W reading on simulink scope
Export data to workspace and make mean or rms ov power vector I obtain different value (Pmean=1369W and Prms=1441W and I don't understand why...)
But applying integral formula:
%% Power calculate with integral formula
for i=2006:4009
Pint(i) = Vload.signals.values(i)*(Iload.signals.values(i));
end
Pcalc = (1/20e-3)*(trapz(Pint));
I obtain Pcalc=1.536e+8W!!!
Note that it's a case that the number is simular, I've tryed to reduce the load and results are completely different.
What's wrong in my code?
Help me please!!
David Goodmanson
David Goodmanson 2021년 3월 4일
Hi Stefano, nothing I or anyone else can really say without seeing the data. Certainly if the simulink data contains more than one frequency component, then things are different.

댓글을 달려면 로그인하십시오.

답변 (2개)

David Goodmanson
David Goodmanson 2021년 2월 24일
Hi Stefano,
The biggest issue is that when using trapz, you have not taken into account the width of the time steps when doing the integration. WIth only one input provided to trapz, that program assumes each width to be 1. For proper results the time array must be inputted as well.
Starting where your code leaves off, the following integration agrees with powerP = 1.5256e+03
Note that the line
Icarico_rms = rms(abs(Icarico));
is highly misleading. Since abs(Icarico) is a real scalar, and since rms(scalar) = scalar), the rms function does not actually do anything. Fortunately Icarico is basically an rms quantity already.
% go to amplitudes since the integral will take care of the rms adjustment
V0 = Vmod_rms*sqrt(2);
I0 = Icarico_rms*sqrt(2);
phi = angle(Icarico);
t = linspace(0,1/50,100001);
V = V0*cos(2*pi*freq*t);
I = I0*cos(2*pi*freq*t + phi);
% plot, and multiply I by 10 for visual purposes
plot(t,V,t,I*10)
legend('V','I*10')
title('ELI the ICEman')
PowerPint = (1/(1/50))*trapz(t,V.*I)
  댓글 수: 3
David Goodmanson
David Goodmanson 2021년 3월 2일
HI Stefano
I'm not sure what you mean. If I change the value of Rcarico, which is the only one available, then
PowerP and PowerPint (the calculation I appended) still agree.
Stefano Albertini
Stefano Albertini 2021년 3월 3일
Hi David
I referred to simulated ones.
In my script I lunch a simulink simulation, and I'm trying to calculate power (with trapz) from data imported in workspace from Simulink.
With original value of Rcarico (sorry I've writed Rload) power calculated with trapz is similar to the one I've calculated by formula.
If I change Rcarico value (for example divided by 2) power with trapz is really different from Power calculated with formula.
For this reason I think there still be some problems with trapz.
Thanks!
Stefano

댓글을 달려면 로그인하십시오.


Harsh
Harsh 2023년 8월 12일
Consider a single-phase circuit with a resistive load. The circuit parameters are as follows:
  • Voltage amplitude (Vm) = 100 V
  • Frequency (f) = 50 Hz
  • Resistance (R) = 50 ohms
Write a Scilab/MATLAB code to generate and plot the instantaneous current, voltage, real power, and reactive power over one cycle of the AC waveform. Assume a sinusoidal waveform for the voltage.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by