-
Notifications
You must be signed in to change notification settings - Fork 0
/
jacobiano.m
110 lines (77 loc) · 3.83 KB
/
jacobiano.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
% <CÁLCULO DO FLUXO DE POTÊNCIA - LOAD FLOW APPLYING NEWTON-RAPHSON METHOD V1.0.
% This is the main source of this software that calculates the power flow of a power network described using an excel input data file >
% Copyright (C) <2014> <Sebastián de Jesús Manrique Machado> <e-mail:[email protected]>
%
% 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
% (at your option) 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/>.
%Cálculo_Fluxo_de_Potência_ Newton Raphson
% Sebastián de Jesús Manrique Machado
% Estudante_Mestrado Em Engenharia Elétrica
% UEL - 2014.
%Função para achar Jacobiano.
function [ J_11, J_12, J_21, J_22 ] = jacobiano( v_barras, delt_barras, G_barras, B_barras, P_calc, Q_calc, num_n_PV, num_n_PQ )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
J_11 = zeros(num_n_PV + num_n_PQ , num_n_PV + num_n_PQ);
%|| Derivada de P respeito a Theta || H
%=====================================
% Em barras PV e PQ tem-se P dado e a variável Theta é desconhecida sempre
for i = 1 : num_n_PV + num_n_PQ
for j = 1 : num_n_PV + num_n_PQ
if (i == j)
J_11(i , j) = ( -(v_barras(i))^2 ) * B_barras(i , j) - Q_calc(i);
elseif(i > j)
J_11(i , j) = v_barras(i) * v_barras(j) * ( (G_barras(i,j)*sin(delt_barras(i)-delt_barras(j)) ) - (B_barras(i,j)*cos(delt_barras(i)-delt_barras(j)) ) );
J_11(j , i) = v_barras(i) * v_barras(j) * ( (G_barras(j,i)*sin(delt_barras(j)-delt_barras(i)) ) - (B_barras(j,i)*cos(delt_barras(j)-delt_barras(i)) ) );
end
end
end
%|| Derivada de P respeito a V || N
%=================================
% Em barras PV e PQ tem-se P dado e a variável V é desconhecida nas PQ
J_12 = zeros(num_n_PV + num_n_PQ , num_n_PQ);
for i = 1 : num_n_PV + num_n_PQ
for j = 1 : num_n_PQ
if (i == j)
J_12(i , j) = ( v_barras(i) * G_barras(i , j)) + (1/v_barras(i))*P_calc(i);
else
J_12(i , j) = v_barras(i) * ( (G_barras(i,j)*cos(delt_barras(i)-delt_barras(j)) ) + (B_barras(i,j)*sin(delt_barras(i)-delt_barras(j)) ) );
end
end
end
%|| Derivada de Q respeito a Theta ||
%=====================================
J_21 = zeros(num_n_PQ , num_n_PV + num_n_PQ);
for i = 1 : num_n_PQ
for j = 1 : num_n_PV + num_n_PQ
if (i == j)
J_21(i , j) = P_calc(i)-(v_barras(i)^2*G_barras(i,j));
else
J_21(i , j) = -v_barras(i) * v_barras(j) *( (G_barras(i,j)*cos(delt_barras(i)-delt_barras(j)) ) + (B_barras(i,j)*sin(delt_barras(i)-delt_barras(j)) ) );
end
end
end
%|| Derivada de Q respeito a V ||
%=================================
J_22 = zeros(num_n_PQ , num_n_PQ);
for i = 1 : num_n_PQ
for j = 1 : num_n_PQ
if (i == j)
J_22(i , j) = ( -(v_barras(i)) * B_barras(i , j)) + (1/v_barras(i))*Q_calc(i);
elseif(i > j)
J_22(i , j) = v_barras(i) * ( (G_barras(i,j)*sin(delt_barras(i)-delt_barras(j)) ) - (B_barras(i,j)*cos(delt_barras(i)-delt_barras(j)) ) );
J_22(j , i) = v_barras(j) * ( (G_barras(j,i)*sin(delt_barras(j)-delt_barras(i)) ) - (B_barras(j,i)*cos(delt_barras(j)-delt_barras(i)) ) );
end
end
end
end