ncp_sigmoid/Sigmoid函数法/snd_setting.m

44 lines
2.2 KiB
Matlab
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function [x,secondBegin,mut,oneTrans,Zt,tij,Tn,kt0,r,l,u,z,w,y,oneCap,capKn,Bci,Zb,mub,q0,Tn1,capKn1,Kn,capK,firstT,firstcapK,firstfx,firstV,Gap]=...
snd_setting(x,secondBegin,transNum,T,transKmin,transKmax,r,m,capNum,capK,pgvNum,mu0,capBi,fx,e,f)
%程序功能:连续化处理过程重新初始化
%编写时间2010年10月
%% 保留预计算结果
firstT=T;
firstcapK=capK;
firstfx=fx;
firstV=sqrt(e.^2+f.^2);
%% 连续化处理阶段赋初值
secondBegin=secondBegin-1;
oneTrans=ones(transNum,1);
oneCap=ones(capNum,1);
mut=oneTrans*mu0; %Zt对应的陡度参数初值
mub=oneCap*mu0; %Zb对应的陡度参数初值
maxTap=5; %变压器最大调节档位
K=1./T; %变压器采用的是k1模型但是为了推导公式方便将T=1/k代入公式中在获取实际变比时要转化回来
Kmax=1./transKmin;
Kmin=1./transKmax;
kt0=(Kmax-Kmin)/(maxTap-1); %变压器单位调节幅度
Kn=fix((K-Kmin)./kt0).*kt0+Kmin; %获取变压器变量连续最优解左右两侧档位对应的变比
Kn1=Kn+kt0;
Tn=1./Kn1;
Tn1=1./Kn;
kt0=Tn1-Tn;
q0=1; %电容器档位的单位调节幅度
capK=capK./capBi; %由于在预计算中capK是表示投入电容器的容量而这里是要将其转为投入电容器的档位
capKn=floor(capK);
capKn1=capKn+q0;
tij=(T-Tn)./kt0; %经过预计算后对离散量的求解转变为求解0-1变量
Bci=(capK-capKn)/q0;
Zt=mut.*log(tij./(oneTrans-tij)); %变比对应的新引入连续变量
Zb=mub.*log(Bci./(oneCap-Bci)); %电容电抗器对应的新引入的连续变量
x(1:transNum)=Zt; %在连续化处理阶段,所求的变量不再是原来的离散变量,而是新引入的连续变量
x(transNum+pgvNum+1:transNum+pgvNum+capNum)=Zb;
%% 连续化处理阶段重新给松弛因子和拉格朗日乘子赋初值
l=ones(r,1);
u=l;
z=l;
w=-l;
y=sparse(m,1);
Gap=l'*z-u'*w;