Commit dac6d8ae authored by Angioni's avatar Angioni

minor update

parent fa93a619
......@@ -28,20 +28,22 @@ HW = H'*W;
G1 = HW*H;%gain matrix
G2 = G1;
P_post = inv(G2); %estimated state error covariance
ref1 = 11*GridData.DM.NGF+10*GridData.DM.NGS+2*GridData.DM.Nload;
if GridData.inj_status == 1
P_post(:,ref1+1)=[];
P_post(ref1+1,:)=[];
for x = 1 : ref1 + 2*GridData.Lines_num
P_post(:,x) = P_post(:,x) .* ([GridData.base_status; GridData.base_current*ones(2*GridData.Lines_num,1)] );
end
for x = 1 : ref1 + 2*GridData.Lines_num
P_post(x,:) = P_post(x,:) .* ([GridData.base_status; GridData.base_current*ones(2*GridData.Lines_num,1)] )';
if isfield(GridData, 'DM') == 1
ref1 = 11*GridData.DM.NGF+10*GridData.DM.NGS+2*GridData.DM.Nload;
if GridData.inj_status == 1
P_post(:,ref1+1)=[];
P_post(ref1+1,:)=[];
for x = 1 : ref1 + 2*GridData.Lines_num
P_post(:,x) = P_post(:,x) .* ([GridData.base_status; GridData.base_current*ones(2*GridData.Lines_num,1)] );
end
for x = 1 : ref1 + 2*GridData.Lines_num
P_post(x,:) = P_post(x,:) .* ([GridData.base_status; GridData.base_current*ones(2*GridData.Lines_num,1)] )';
end
end
end
%we initialize the state
if strcmp(GridData.type_of_model,'single_phase')==1
Vmagn_status = ones(GridData.Nodes_num,1);
......
......@@ -28,22 +28,8 @@ if strcmp(type_of_model,'single_phase')==1 %single phase model
%*******************************************************************
% sample grid : subsitute with your grid data
base_power = 1e5; %Watts
base_voltage = 400/sqrt(3); %Volts
Nodes = [1,2,3,4,5,6,7]; %nodes names
topology_initial = [1 , 2 ,3 ,4 ,4 , 4 ]; %initial nodes of each line
topology_final = [2 , 3 ,4 ,5 ,6 , 7 ]; %final nodes of each line
topology = [topology_initial;topology_final]; % lines intial and final nodes
Nodes_num = length(Nodes); %number of nodes in the grid
Lines_num = length(topology_initial); %number of lines in the grid
topology = [(1:Lines_num);topology]; % the topology matrix contains also a row with the names of the lines
base_Z = (base_voltage^2)/base_power; %base impedance
length_cable = 1e-3*[1000 ,40 ,110 ,60 ,45 ,60 ]; %length in km of each line
% Pi model of the lines
R1 = length_cable.* [0.0031 ,0.0754 ,0.091,0.524 ,0.387,0.524]; %ohm per km, multiplied by length of the lines
X1 = length_cable.* [0.0149 ,0.1 ,0.1 ,0.1 ,0.1 ,0.1 ]; %ohm per km, multiplied by length of the lines
B1 = zeros(size(topology_initial));
G1 = zeros(size(topology_initial));
%run sample_singlephase1
run sample_singlephase2
%*******************************************************************
R1 = R1/base_Z;
......@@ -57,22 +43,7 @@ elseif strcmp(type_of_model,'three_phase_sequence')==1 % the system is modeled a
%*******************************************************************
% sample grid : subsitute with your grid data
base_power = 1e5;%Watts
base_voltage = 400/sqrt(3);%Volts
Nodes = [1,2,3,4,5,6,7];%nodes names
topology_initial = [1 , 2 ,3 ,4 ,4 , 4 ];%initial nodes of each line
topology_final = [2 , 3 ,4 ,5 ,6 , 7 ];%final nodes of each line
topology = [topology_initial;topology_final];% lines intial and final nodes
Nodes_num =length(Nodes); %number of nodes in the grid
Lines_num =length(topology_initial); %number of lines in the grid
topology = [(1:Lines_num);topology];% the topology matrix contains also a row with the names of the lines
base_Z = (base_voltage^2)/base_power; %base impedance
length_cable = 1e-3*[1000 ,40 ,110 ,60 ,45 ,60 ]; %length in km of each line
% Pi model of the lines
R1 = length_cable.* [0.0031 ,0.0754 ,0.091,0.524 ,0.387,0.524]; %ohm per km, multiplied by length of the lines
X1 = length_cable.* [0.0149 ,0.1 ,0.1 ,0.1 ,0.1 ,0.1]; %ohm per km, multiplied by length of the lines
B1 = zeros(size(topology_initial));
G1 = zeros(size(topology_initial));
run sample_threephase1
%*******************************************************************
parameters_R_pos = R1/base_Z;
......
......@@ -26,23 +26,8 @@ if strcmp(GridData.type_of_model,'single_phase') == 1
%*******************************************************************
% sample grid power : subsitute with your grid power data
% V_magn = ones(1,GridData.Nodes_num);
% V_ph = zeros(1,GridData.Nodes_num);
% A_load = 1000*[1 , 10 , 20 , 1 , 1 , 1];
% PF = [0.95,0.95,0.95,0.95,0.95,0.95];
V_magn = ones(1,GridData.Nodes_num);
V_ph = zeros(1,GridData.Nodes_num);
A_load = [2500,2500];
PF = [0.95,0.95];
P_load = A_load.*PF;
Q_load = A_load.*sin(acos(PF));
P_gen = zeros(size(P_load));
Q_gen = zeros(size(P_load));
%run sample_singlephase1
run sample_singlephase2
%*******************************************************************
P_tot = (P_load-P_gen)/(GridData.base_power);
......@@ -154,16 +139,7 @@ elseif strcmp(GridData.type_of_model,'three_phase_sequence') == 1
%*******************************************************************
% sample grid power : subsitute with your grid power data
V_magn = ones(3,GridData.Nodes_num);
V_ph = zeros(3,GridData.Nodes_num);
A_load = 1000*[7 , 70, 70, 7, 7, 7];
A_load = [A_load;A_load;A_load];
PF = [0.97,0.90,0.97,0.97,0.97,0.97];
PF = [PF;PF;PF];
P_load = A_load.*PF;
Q_load = A_load.*sin(acos(PF));
P_gen = zeros(size(P_load));
Q_gen = zeros(size(P_load));
run threephase1
%*******************************************************************
P_tot = (P_load-P_gen)/(GridData.base_power);
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code to generate sample data
%
% @author Andrea Angioni <aangioni@eonerc.rwth-aachen.de>
% @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
% @license GNU General Public License (version 3)
%
% dsse
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
base_power = 1e5; %Watts
base_voltage = 400/sqrt(3); %Volts
Nodes = [1,2,3,4,5,6,7]; %nodes names
topology_initial = [1 , 2 ,3 ,4 ,4 , 4 ]; %initial nodes of each line
topology_final = [2 , 3 ,4 ,5 ,6 , 7 ]; %final nodes of each line
topology = [topology_initial;topology_final]; % lines intial and final nodes
Nodes_num = length(Nodes); %number of nodes in the grid
Lines_num = length(topology_initial); %number of lines in the grid
topology = [(1:Lines_num);topology]; % the topology matrix contains also a row with the names of the lines
base_Z = (base_voltage^2)/base_power; %base impedance
length_cable = 1e-3*[1000 ,40 ,110 ,60 ,45 ,60 ]; %length in km of each line
% Pi model of the lines
R1 = length_cable.* [0.0031 ,0.0754 ,0.091,0.524 ,0.387,0.524]; %ohm per km, multiplied by length of the lines
X1 = length_cable.* [0.0149 ,0.1 ,0.1 ,0.1 ,0.1 ,0.1 ]; %ohm per km, multiplied by length of the lines
B1 = zeros(size(topology_initial));
G1 = zeros(size(topology_initial));
V_magn = ones(1,length(Nodes));
V_ph = zeros(1,length(Nodes));
A_load = 1000*[1 , 10 , 20 , 1 , 1 , 1];
PF = [0.95,0.95,0.95,0.95,0.95,0.95];
% A_load = [2500,2500];
% PF = [0.95,0.95];
P_load = A_load.*PF;
Q_load = A_load.*sin(acos(PF));
P_gen = zeros(size(P_load));
Q_gen = zeros(size(P_load));
\ No newline at end of file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code to generate sample data
%
% @author Andrea Angioni <aangioni@eonerc.rwth-aachen.de>
% @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
% @license GNU General Public License (version 3)
%
% dsse
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
base_power = 1e5; %Watts
base_voltage = 400/sqrt(3); %Volts
Nodes = [1,2,3,4,5,6]; %nodes names
topology_initial = [1 , 2 ,3 ,4 ,5 ]; %initial nodes of each line
topology_final = [2 , 3 ,4 ,5 ,6 ]; %final nodes of each line
topology = [topology_initial;topology_final]; % lines intial and final nodes
Nodes_num = length(Nodes); %number of nodes in the grid
Lines_num = length(topology_initial); %number of lines in the grid
topology = [(1:Lines_num);topology]; % the topology matrix contains also a row with the names of the lines
base_Z = (base_voltage^2)/base_power; %base impedance
length_cable = [0.000207 ,0.000489 ,0.000489,0.000489 ,0.000489]; %length in km of each line
% Pi model of the lines
R1 = length_cable.* [0.152,0.152,0.152,0.152,0.152]; %ohm per km, multiplied by length of the lines
X1 = length_cable.* [0.113,0.113,0.113,0.113,0.113]; %ohm per km, multiplied by length of the lines
B1 = zeros(size(topology_initial));
G1 = zeros(size(topology_initial));
V_magn = ones(1,length(Nodes));
V_ph = zeros(1,length(Nodes));
A_load = 1000*[200 , 200, 20 , 20, 20, 20];
PF = [0.97,0.97,0.97,0.97,0.97,0.97];
% A_load = [2500,2500];
% PF = [0.95,0.95];
P_load = A_load.*PF;
Q_load = A_load.*sin(acos(PF));
P_gen = zeros(size(P_load));
Q_gen = zeros(size(P_load));
\ No newline at end of file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code to generate sample data
%
% @author Andrea Angioni <aangioni@eonerc.rwth-aachen.de>
% @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
% @license GNU General Public License (version 3)
%
% dsse
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
base_power = 1e5;%Watts
base_voltage = 400/sqrt(3);%Volts
Nodes = [1,2,3,4,5,6,7];%nodes names
topology_initial = [1 , 2 ,3 ,4 ,4 , 4 ];%initial nodes of each line
topology_final = [2 , 3 ,4 ,5 ,6 , 7 ];%final nodes of each line
topology = [topology_initial;topology_final];% lines intial and final nodes
Nodes_num =length(Nodes); %number of nodes in the grid
Lines_num =length(topology_initial); %number of lines in the grid
topology = [(1:Lines_num);topology];% the topology matrix contains also a row with the names of the lines
base_Z = (base_voltage^2)/base_power; %base impedance
length_cable = 1e-3*[1000 ,40 ,110 ,60 ,45 ,60 ]; %length in km of each line
% Pi model of the lines
R1 = length_cable.* [0.0031 ,0.0754 ,0.091,0.524 ,0.387,0.524]; %ohm per km, multiplied by length of the lines
X1 = length_cable.* [0.0149 ,0.1 ,0.1 ,0.1 ,0.1 ,0.1]; %ohm per km, multiplied by length of the lines
B1 = zeros(size(topology_initial));
G1 = zeros(size(topology_initial));
V_magn = ones(3,length(Nodes));
V_ph = zeros(3,length(Nodes));
A_load = 1000*[7 , 70, 70, 7, 7, 7];
A_load = [A_load;A_load;A_load];
PF = [0.97,0.90,0.97,0.97,0.97,0.97];
PF = [PF;PF;PF];
P_load = A_load.*PF;
Q_load = A_load.*sin(acos(PF));
P_gen = zeros(size(P_load));
Q_gen = zeros(size(P_load));
\ No newline at end of file
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