Commit 2bd139cf authored by Angioni's avatar Angioni

minor updates

parent dcb883eb
......@@ -23,7 +23,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [W,GridData,R] = Weight_m_nopu(GridData,PowerData,Combination_devices,Accuracy)
if isfield(PowerData,'x_status') == 1
PowerDatax_status=PowerData.x_status.*GridData.base_status;
end
PowerDataVmagn = PowerData.Vmagn*GridData.base_voltage;
PowerDataImagn = PowerData.Imagn*GridData.base_current;
PowerDataPinj = PowerData.Pinj*GridData.base_power;
......@@ -109,16 +111,48 @@ if strcmp(GridData.type_of_model,'single_phase') == 1
% voltage real part - here it is converted from the covariance of magnitude and phase angle
if Combination_devices.Vmagn_measure(1,x)==1 && Combination_devices.Vph_measure(1,x)==1
if x == 1 % we remove the phase measurement from the first bus
rotV(1,1) = cos(PowerData.Vph(x));
Rtemp = rotV*(Accuracy.Accuracy_Vmagn*PowerDataVmagn(x))^2*rotV';
if Rtemp(1,1) < LM;
Rtemp(1,1) = LM; end
R(n+1,n+1) = Rtemp;
W(n+1,n+1) = Rtemp^-1;
n=n+1;
LocationMeas(n,1) = x;
TypeMeas(n,1) = 3;% 3 represent measurements of type voltage magnitude
DelayMeas(n,1) = Combination_devices.Vmagn_measure(2,x);
if isfield(GridData,'rm_column') == 1
if GridData.rm_column == 0
rotV(1,1) = cos(PowerData.Vph(x));
rotV(1,2) = - sin(PowerData.Vph(x))*PowerDataVmagn(x) ;
rotV(2,1) = sin(PowerData.Vph(x)) ;
rotV(2,2) = cos(PowerData.Vph(x))*PowerDataVmagn(x);
Rtemp = rotV*[(Accuracy.Accuracy_Vmagn*PowerDataVmagn(x))^2, 0; 0 (Accuracy.Accuracy_Vph)^2]*rotV';
if Rtemp(1,1) < LM; Rtemp(1,1) = LM; end
if Rtemp(2,2) < LM; Rtemp(2,2) = LM; end
R(n+1:n+2,n+1:n+2) = Rtemp;
W(n+1:n+2,n+1:n+2)= Rtemp^-1;
n=n+1;
LocationMeas(n,1) = x;
TypeMeas(n,1) = 3;% 4 represent measurements of type voltage magnitude
DelayMeas(n,1) = Combination_devices.Vmagn_measure(2,x);
n=n+1;
LocationMeas(n,1) = x;
TypeMeas(n,1) = 4;% 4 represent measurements of type voltage phase angle
DelayMeas(n,1) = Combination_devices.Vph_measure(2,x);
else
rotV(1,1) = cos(PowerData.Vph(x));
Rtemp = rotV*(Accuracy.Accuracy_Vmagn*PowerDataVmagn(x))^2*rotV';
if Rtemp(1,1) < LM; Rtemp(1,1) = LM; end
R(n+1,n+1) = Rtemp;
W(n+1,n+1) = Rtemp^-1;
n=n+1;
LocationMeas(n,1) = x;
TypeMeas(n,1) = 3;% 3 represent measurements of type voltage magnitude
DelayMeas(n,1) = Combination_devices.Vmagn_measure(2,x);
end
else
rotV(1,1) = cos(PowerData.Vph(x));
Rtemp = rotV*(Accuracy.Accuracy_Vmagn*PowerDataVmagn(x))^2*rotV';
if Rtemp(1,1) < LM; Rtemp(1,1) = LM; end
R(n+1,n+1) = Rtemp;
W(n+1,n+1) = Rtemp^-1;
n=n+1;
LocationMeas(n,1) = x;
TypeMeas(n,1) = 3;% 3 represent measurements of type voltage magnitude
DelayMeas(n,1) = Combination_devices.Vmagn_measure(2,x);
end
else
rotV(1,1) = cos(PowerData.Vph(x));
......
......@@ -30,6 +30,7 @@ if strcmp(type_of_model,'single_phase')==1 %single phase model
% sample grid : subsitute with your grid data
%run sample_singlephase1
run sample_singlephase2
%run CIGRE_MV
%*******************************************************************
R1 = R1/base_Z;
......@@ -304,6 +305,7 @@ GridData.topology = topology;
GridData.base_power = base_power;
GridData.base_voltage = base_voltage;
GridData.base_current = GridData.base_power/base_voltage;
GridData.base_impedance = GridData.base_voltage/GridData.base_current;
GridData.R1 = R1;
GridData.X1 = X1;
GridData.B1 = B1;
......
......@@ -28,6 +28,7 @@ if strcmp(GridData.type_of_model,'single_phase') == 1
% sample grid power : subsitute with your grid power data
%run sample_singlephase1
run sample_singlephase2
%run CIGRE_MV
%*******************************************************************
P_tot = (P_load-P_gen)/(GridData.base_power);
......@@ -98,6 +99,19 @@ if strcmp(GridData.type_of_model,'single_phase') == 1
Vph_status(x,1) = (phase(Volts(x,1)));
end
end
if Vnode(GridData.topology(3,b),1) == 1
if Vnode(GridData.topology(2,b),1) == 0
x = GridData.topology(2,b);
Vnode(x,1) = Vnode(x,1) + 1;
Volts(x,1) = Volts(GridData.topology(3,b),1) - ( GridData.R1(1,b)+1i*GridData.X1(1,b))*Amps(b,1);
Vmagn_status(x,1) = abs(Volts(x,1));
Vph_status(x,1) = (phase(Volts(x,1)));
end
end
end
end
iteration=iteration+1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment