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!!