7
@Opti/Geteb.m
Normal file
7
@Opti/Geteb.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = Geteb( this )
|
||||
%BE Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=this.eb;
|
||||
|
||||
end
|
||||
|
||||
7
@Opti/Getgle.m
Normal file
7
@Opti/Getgle.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = Getgle( this )
|
||||
%GLE Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=this.gle;
|
||||
|
||||
end
|
||||
|
||||
31
@Opti/Opti.m
Normal file
31
@Opti/Opti.m
Normal file
@@ -0,0 +1,31 @@
|
||||
classdef Opti
|
||||
%OPTI Summary of this class goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
properties
|
||||
PD0=NaN;
|
||||
QD0=NaN;
|
||||
Volt0=NaN;
|
||||
wPD=NaN;
|
||||
wQD=NaN;
|
||||
wVolt=NaN;
|
||||
PDi=NaN;
|
||||
QDi=NaN;
|
||||
Y=NaN;
|
||||
Angel=NaN;
|
||||
r=NaN;
|
||||
c=NaN;
|
||||
PG=NaN;
|
||||
QG=NaN;
|
||||
gle=NaN;%opti toolbox大于小于等于
|
||||
eb=NaN;%等式、不等式约束右边的值
|
||||
Balance=NaN;
|
||||
end
|
||||
|
||||
methods
|
||||
function this=Opti()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
27
@Opti/equ.asv
Normal file
27
@Opti/equ.asv
Normal file
@@ -0,0 +1,27 @@
|
||||
function [ output_args,this ] = equ( this )
|
||||
%EQU Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
PDi=this.PDi;
|
||||
QDi=this.QDi;
|
||||
Volt0=this.Volt0;
|
||||
Angel=this.Angel;
|
||||
r=this.r;
|
||||
c=this.c;
|
||||
PG=this.PG;
|
||||
QG=this.QG;
|
||||
PD=x(1:length(PDi));
|
||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||
Volt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
|
||||
VAngel=x(length(PDi)+length(QDi)+length(Volt0):end);
|
||||
PD_=zeros(PD,length(Volt0));
|
||||
QD_=zeros(QD,length(Volt0));
|
||||
PD_(PDi)=PD;
|
||||
QD_(QDi)=QD;
|
||||
busNum=length(Volt0);
|
||||
VMatrix=sparse(r,c,VAngel(r)-VAngel(c)-Angel,busNum,busNum);
|
||||
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
|
||||
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
||||
output_args=[dP;dQ];
|
||||
this.gle=ze
|
||||
end
|
||||
|
||||
30
@Opti/equ.m
Normal file
30
@Opti/equ.m
Normal file
@@ -0,0 +1,30 @@
|
||||
function [ output_args,this ] = equ( this,x )
|
||||
%EQU Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
PDi=this.PDi;
|
||||
QDi=this.QDi;
|
||||
Volt0=this.Volt0;
|
||||
Angel=this.Angel;
|
||||
r=this.r;
|
||||
c=this.c;
|
||||
PG=this.PG;
|
||||
QG=this.QG;
|
||||
Balance=this.Balance;
|
||||
Y=this.Y;
|
||||
PD=x(1:length(PDi));
|
||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||
Volt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
|
||||
VAngel=x(length(PDi)+length(QDi)+length(Volt0):end);
|
||||
PD_=zeros(length(Volt0),1);
|
||||
QD_=zeros(length(Volt0),1);
|
||||
PD_(PDi)=PD;
|
||||
QD_(QDi)=QD;
|
||||
busNum=length(Volt0);
|
||||
VMatrix=sparse(r,c,VAngel(r)-VAngel(c)-Angel,busNum,busNum);
|
||||
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
|
||||
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
||||
output_args=[dP;dQ];
|
||||
this.gle=zeros(length(output_args),1);
|
||||
this.eb=this.gle;
|
||||
end
|
||||
|
||||
19
@Opti/init.m
Normal file
19
@Opti/init.m
Normal file
@@ -0,0 +1,19 @@
|
||||
function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angel,r,c,PG,QG,Balance )
|
||||
%INIT Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
this.PDi=PDi;
|
||||
this.QDi=QDi;
|
||||
this.wPD=wPD;
|
||||
this.wQD=wQD;
|
||||
this.PD0=PD0;
|
||||
this.QD0=QD0;
|
||||
this.Y=Y;
|
||||
this.Angel=Angel;
|
||||
this.r=r;
|
||||
this.c=c;
|
||||
this.PG=PG;
|
||||
this.QG=QG;
|
||||
this.Balance=Balance;
|
||||
this.Volt0=Volt0;
|
||||
end
|
||||
|
||||
15
@Opti/obj.asv
Normal file
15
@Opti/obj.asv
Normal file
@@ -0,0 +1,15 @@
|
||||
function [ output_args ] = obj( this )
|
||||
%OBJ Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
wPD=this.wPD;
|
||||
wQD=this.wQD;
|
||||
PD=this.PD;
|
||||
QD=this.QD;
|
||||
wVolt=t
|
||||
t4=wPD.*(PD(PD0~=0)-PD0(PD0~=0)).^2;
|
||||
t5=wQD.*(QD(QD0~=0)-QD0(QD0~=0)).^2;
|
||||
t6=wVolt.*(Volt-Volt0').^2;
|
||||
out_arg=sum(t4)+sum(t5)+sum(t6);
|
||||
|
||||
end
|
||||
|
||||
17
@Opti/obj.m
Normal file
17
@Opti/obj.m
Normal file
@@ -0,0 +1,17 @@
|
||||
function [ output_args ] = obj( this,x )
|
||||
%OBJ Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
PDi=this.PDi;
|
||||
QDi=this.QDi;
|
||||
PD=x(1:length(PDi));
|
||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||
wPD=this.wPD;
|
||||
wQD=this.wQD;
|
||||
% wVolt=this.wVolt;
|
||||
PD0=this.PD0;
|
||||
QD0=this.QD0;
|
||||
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
|
||||
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
|
||||
output_args=sum(t4)+sum(t5);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user