matlab潮流计算工具箱使用手册

合集下载

MATLAB机器学习工具箱的使用方法

MATLAB机器学习工具箱的使用方法

MATLAB机器学习工具箱的使用方法1. 引言在现代科技发展的背景下,机器学习在各个领域中的应用越来越广泛。

而MATLAB作为一款功能强大的数学软件,其机器学习工具箱为用户提供了丰富的算法和工具,方便快捷地进行机器学习任务。

本文将详细介绍MATLAB机器学习工具箱的使用方法,帮助读者更好地利用这个工具箱进行数据分析、模型训练和结果评估等任务。

2. 数据预处理在进行机器学习任务之前,首先需要对数据进行预处理。

MATLAB机器学习工具箱提供了多种数据预处理的方法和函数,如数据清洗、特征选择、数据变换等。

可以使用`preprocess`函数对数据进行缺失值处理,使用`featureselect`函数进行特征选择,或者使用`datapreprocessing`函数进行数据变换。

通过这些预处理的方法,可以使得数据更好地适用于后续的机器学习算法。

3. 特征工程特征工程是机器学习中一个重要的环节,它的目的是将原始数据转换为能够更好地反映问题特点的特征。

MATLAB机器学习工具箱提供了丰富的特征工程方法和函数,如特征提取、特征转换和特征选择等。

可以使用`featureextract`函数对原始数据进行特征提取,使用`featuretransform`函数进行特征转换,或者使用`featureselect`函数进行特征选择。

这些方法和函数的灵活使用可以帮助用户更好地理解数据并选择合适的特征。

4. 模型选择与训练在进行机器学习任务的过程中,选择适合问题的机器学习模型是非常重要的。

MATLAB机器学习工具箱提供了多种常见的机器学习模型,如线性回归、决策树、支持向量机等。

可以使用`fitmodel`函数来选择和训练机器学习模型。

用户可以根据具体的问题需求选择合适的模型,并通过调整模型参数来优化模型性能。

5. 模型评估与调优在完成模型的训练之后,需要对模型的性能进行评估和调优。

MATLAB机器学习工具箱提供了多种模型评估的方法和函数,如交叉验证、ROC曲线分析、精确度和召回率等。

matlab使用手册

matlab使用手册

附录MATLAB简介这里介绍MATLAB一些入门知识,包括MATLAB桌面和窗口,MATLAB 命令格式、数据格式、数据文件和变量管理,MATLAB的数组和矩阵运算,MATLAB的字符串、元胞和结构等数据类型,MATLAB的程序设计方法,MATLAB作图方法在线帮助的使用和程序文件和目录的管理等。

一、MATLAB桌面启动MATLAB后,就进入MATLAB的桌面,图1为MATLAB6.1的默认(Default)桌面。

第一行为菜单栏,第二行为工具栏,下面是三个最常用的窗口。

右边最大的是命令窗口(Command Window),左上方前台为发行说明书窗口(Launch pad),后台为工作空间(Workspace),左下方为命令历史(Command History)后台为当前目录(Current Directory)。

1.窗口(1)命令窗口该窗口是进行MATLAB操作最主要的窗口。

窗口中“>>”为命令输入提示符,其后输入运算命令,按回车键就可执行运算,并显示运算结果.。

图1 (2)发行说明书窗口发行说明书窗口是MATLAB 所特有的,用来说明用户所拥有的Mathworks 公司产品的工具包、演示以及帮助信息。

(3)工作空间在默认桌面,位于左上方窗口前台,列出内存中MATLAB 工作空间的所有变量的变量名、尺寸、字节数。

用鼠标选中变量,击右键可以打开、保存、删除、绘图等操作。

(4)当前目录在默认桌面,位于左下方窗口后台,用鼠标点击可以切换到前台。

该窗口列出当前目录的程序文件(.m )和数据文件(.mat )等。

用鼠标选中文件,击右键可以进行打开、运行、删除等操作。

(5)命令历史(Command History )该窗口列出在命令窗口执行过的MATLAB 命令行的历史记录。

用鼠标选中命令行,击右键可以进行复制、执行(Evaluate Selection )、删除等操作。

除上述窗口外,MATLAB 常用窗口还有编程器窗口、图形窗口等。

matlab使用说明书

matlab使用说明书

Matlab使用说明书一、将电化学噪声的代码装载到matlab程序中以便使用1、打开matlab操作界面2、左上角file子菜单中set path,点击Add Folder在指定的位置将my files装载进入matlab的程序中。

Save 完后close。

二、ECN analyzer使用细则大致浏览EN图形特征在窗口中输入ecda命令回车后便会弹出“石维工作室荣誉出品”的窗口,单击“电化学噪声分析器”,ECN analyzer窗口便会展现在眼前。

单击“获取文件夹”从指定的目录下获取实验数据,双击任何一个“.dat”文件后,该文件中所有“.dat”文件就会自动获取到对应的目录下。

注意:加载前一定要检查一下所装载的文件是否完整,如若不完整可能是测试不到1h就被停止测试导致,对于这样的文件一定要将其删除,否则可能会使matlab界面卡死。

也会在Rn计算中出现偏差。

检查ECN analyzer中所有作图窗口中“参与计算”确定全部不被勾选后,单击“EN总制图”这样程序就会自动的将左边所获取的所有文件依次显示成图形,这样一方面可以大致浏览文件中EN图形特征,同时也可以发现一些非正常现象的文件,从而将其清理。

如果觉得还没看清楚图形特征也可再次点击“EN browse”重新浏览图形特征。

或直接点击左侧的单个文件逐一浏览EN特征。

确定合适的“分解层数”、“窗口宽度”、“电流阀值”、“最小峰高”按钮功能解释:分解层数:小波滤波的一个关键参数,它决定是否滤波完全,从而除去背景噪声,显现由电化学反应引起的EN的特征。

“窗口宽度”、“电流阀值”、“最小峰高”分别对应设置为:50s、1e-8A、0.2时表示在每50s的范围内,将经过小波滤波后的高频信号曲线取极值,求出所有峰点,在这些峰点中计算出各自对应的峰高,并以最大峰高的0.2倍为界限,低于最大峰高的0.2倍的峰舍弃,同于低于电流阀值的也一并舍弃。

所以“窗口宽度”、“电流阀值”、“最小峰高”这三个参数决定最终选取峰的数目,为了保证所选峰合理性,可以适当调整上述三个参数,如将分解层数适当调大,电流阀值降低、最小峰高也降低便可将一些小峰选入其中,但实际应用中,太小的峰没有什么意义。

MATLAB工具箱的安装与配置指南

MATLAB工具箱的安装与配置指南

MATLAB工具箱的安装与配置指南Matlab是一种强大的数学软件,广泛应用于工程和科学领域的数据分析和建模。

Matlab工具箱是Matlab软件的扩展包,提供了各种专业领域的工具和函数,使得用户可以更便捷地进行数据处理和模型构建。

本文将详细介绍Matlab工具箱的安装与配置指南,帮助读者快速上手使用这些功能强大的工具。

一、MATLAB工具箱的获取首先,我们需要获得Matlab软件及相关工具箱的安装包。

Matlab软件官方提供了学术试用版及商业版的下载,用户可以根据自己的需求选择相应的版本。

在获得Matlab软件安装包后,我们需要进一步获取相应的工具箱。

Matlab提供了丰富的工具箱,涵盖了各个学科领域,如信号处理、图像处理、机器学习等。

用户可以在Matlab官方网站上查找并下载所需的工具箱。

二、MATLAB工具箱的安装在获得Matlab工具箱的安装包后,我们可以开始进行安装。

1. 解压安装包使用解压软件将下载的工具箱包进行解压,解压后得到相应的文件夹。

2. 安装工具箱打开Matlab软件,在主界面点击"文件" -> "Set Path" -> "Add with Subfolders",选择解压后的工具箱文件夹。

然后点击"保存",等待Matlab完成工具箱的安装。

3. 激活工具箱完成工具箱的安装后,我们需要激活这些工具箱,使其能够在Matlab中正常使用。

在Matlab主界面点击"Home" -> "Help" -> "Licensing",将打开"Licensing"窗口。

选择"Activate Software",输入Matlab账户信息,点击"Next",根据指引完成激活过程。

matlab tmd潮汐使用方法

matlab tmd潮汐使用方法

matlab tmd潮汐使用方法下载提示:该文档是本店铺精心编制而成的,希望大家下载后,能够帮助大家解决实际问题。

文档下载后可定制修改,请根据实际需要进行调整和使用,谢谢!本店铺为大家提供各种类型的实用资料,如教育随笔、日记赏析、句子摘抄、古诗大全、经典美文、话题作文、工作总结、词语解析、文案摘录、其他资料等等,想了解不同资料格式和写法,敬请关注!Download tips: This document is carefully compiled by this editor. I hope that after you download it, it can help you solve practical problems. The document can be customized and modified after downloading, please adjust and use it according to actual needs, thank you! In addition, this shop provides you with various types of practical materials, such as educational essays, diary appreciation, sentence excerpts, ancient poems, classic articles, topic composition, work summary, word parsing, copy excerpts, other materials and so on, want to know different data formats and writing methods, please pay attention!MATLAB TMD潮汐使用方法引言在海洋工程和地球物理学领域,潮汐是一项重要的研究对象。

潮流计算matlab

潮流计算matlab

电力系统大作业——用matlab潮流计算郭尚坤08292007 电气0809班%主程序:[dfile,pathname]=uigetfile('ieee14.m','Select Data File');if pathname==0error('you must select a valid data file')elselfile=length(dfile);% strip off .meval(dfile(1:lfile-2)); %打开数据文件endglobal n;global m;[nb,mb]=size(bus); %节点重新编号[nl,ml]=size(line);nSW=0; % 平衡节点数目nPV=0; % PV节点数目nPQ=0; % PQ节点数目for i=1:nb, % nb为总节点数type=bus(i,6);if type==3,nSW=nSW+1; % 统计平衡节点数目SW(nSW,:)=bus(i,:);elseif type==2,nPV=nPV+1; % 统计PV节点数目PV(nPV,:)=bus(i,:);elsenPQ=nPQ+1; % 统计PQ节点数目PQ(nPQ,:)=bus(i,:);endend;bus=[PQ;PV;SW];newbus=[1:nb]';f=bus(:,1);nodenum=[newbus bus(:,1)];bus(:,1)=newbus;for i=1:nlfor j=1:2for k=1:nbif line(i,j)==nodenum(k,2)line(i,j)=nodenum(k,1);breakendendendendK=0; %迭代次数初值Kmax=10; %最大迭代次数eps1=1.0e-10;eps2=1.0e-10;m=nPQ;n=nb;Um=eye(m,m);myf=fopen('output1.dat','w');for K=1:Kmaxfor i=1:mfor j=1:mif i==jUm(i,j)=bus(i,2);endendendb=dPQ(Y,bus);C=jac(bus,Y);dX=C\b';dx=dX';[nx,mx]=size(dx);for i=1:n-1 %计算相角bus(i,3)=bus(i,3)-dX(i,1);endB=dx(nx,n:mx)*Um; %计算电压差bus(1:m,2)=bus(1:m,2)-B'; %计算电压值dx(nx,n:mx)=B;fprintf(myf,'--第%d次迭代时雅可比矩阵--',K)fprintf(myf, '\n');for i=1:(n+m-1)for j=1:(n+m-1)fprintf(myf,'%8.6f', C(i,j));fprintf(myf, ' ');endfprintf(myf, '\n');endfprintf(myf,'--第%d次迭代时dPQ的误差--',K)fprintf(myf, '\n');for i=1:(n+m-1)fprintf(myf,'%8.6e', b(1,i));fprintf(myf, '\n');endfprintf(myf, '\n');fprintf(myf,'--第%d次迭代时dx(误差)--',K)fprintf(myf, '\n');for i=1:(n+m-1)fprintf(myf,'%8.6e', dX(i,1));fprintf(myf, '\n');fprintf(myf, '\n');fprintf(myf,'第%d次迭代后节点电压(仅PQ节点)',K)fprintf(myf, '\n');for i=1:mfprintf(myf,'%8.6f', bus(i,2));fprintf(myf, '\n');endfprintf(myf, '\n');fprintf(myf,'第%d次迭代后相角(角度)',K)fprintf(myf, '\n');for i=1:nfprintf(myf,'%8.6f', bus(i,3)*180/pi);fprintf(myf, '\n');endfprintf(myf, '\n');if (max(abs(dx))<eps1)&(max(abs(b))<eps2) %判断是否达到计算精度break;endend%计算功率P1=0;T=0; %计算平衡节点的有功for j=1:nT=bus(n,2)*bus(j,2)*(real(Y(n,j))*cos(bus(n,3)-bus(j,3))+imag(Y(n,j))*sin(bus(n,3)-bus(j,3)));P1=P1+T;endbus(n,4)=P1;for k=m+1:n %计算PV节点、平衡节点的无功Q1=0;T=0;for j=1:nT=bus(k,2)*bus(j,2)*(real(Y(k,j))*sin(bus(k,3)-bus(j,3))-imag(Y(k,j))*cos(bus(k,3)-bus(j,3)));Q1=Q1+T;endbus(k,5)=Q1;endbus(:,1)=f; %换回各节点、支路的初始编号r=zeros(1,mb);for t=1:nfor l=t+1:nif bus(t,1)>bus(l,1)r=bus(t,:);bus(t,:)=bus(l,:);bus(l,:)=r;endendendfor i=1:nlfor j=1:2for k=1:nbif line(i,j)==nodenum(k,1)breakendendendendfclose(myf);Pf=loss(bus,line); %计算支路潮流及损耗%将节点导纳矩阵、节点潮流计算结果写入文件output2myf=fopen('output2.dat','w');fprintf(myf, '--节点导纳矩阵--\n');for k=1:nfor j=1:nfprintf(myf,'%8.6f', real(Y(k,j)));fprintf(myf, '+i*');fprintf(myf,'%8.6f', imag(Y(k,j)));fprintf(myf, ' ');endfprintf(myf, '\n');endfprintf(myf, '------------------牛顿-拉夫逊法潮流计算结果-------------\n');fprintf(myf, '------------节点计算结果------------\n');fprintf(myf, '-- 节点节点电压节点相角注入有功功率(P)注入无功功率(Q) 类型--\n');for l=1:nbfor j=1:mbif j==1|j==6fprintf(myf, ' %8.1f ', bus(l,j));elseif j==3fprintf(myf, ' %8.6f ', bus(l,j)*180/pi);elsefprintf(myf, ' %8.6f ', bus(l,j));endendfprintf(myf, ' \n');endfprintf(myf, '--支路计算结果--\n');fprintf(myf, '-- 节点(I) 节点(J) 线路功率S(I,J) 线路功率S(J,I) 线路损耗dS(I,J)--\n');for k=1:nlfor j=1:5if j<=2fprintf(myf,'%8.1f ', Pf(k,j));fprintf(myf, ' ');elsefprintf(myf,'%8.6f', real(Pf(k,j)));fprintf(myf, '+i*');fprintf(myf,'%8.6f', imag(Pf(k,j)));endendfprintf(myf, '\n');endfclose(myf);%根据支路参数建立节点导纳矩阵程序:function Y=y(bus,line)%目的:根据支路参数建立节点导纳矩阵%输入:节点参数矩阵--bus;支路参数矩阵--line%输出:节点导纳矩阵--Y[nb,mb]=size(bus);[nl,ml]=size(line);Y=zeros(nb,nb);for k=1:nlI=line(k,1);J=line(k,2);Zt=line(k,3)+j*line(k,4);if Zt==0disp('对地支路');Yt=inf;elseYt=1/Zt;endYm=line(k,5)+j*line(k,6);K=line(k,7);if(K==0)&(J~=0) %普通线路Y(I,I)=Y(I,I)+Yt+Ym;Y(J,J)=Y(J,J)+Yt+Ym;Y(I,J)=Y(I,J)-Yt;Y(J,I)=Y(I,J);endif(K==0)&(J==0) %对地支路K=J=0,R=X=0 Y(I,I)=Y(I,I)+Ym;endif K>0 %K>0时变压器支路Y(I,I)=Y(I,I)+Yt+Ym;Y(J,J)=Y(J,J)+Yt/K^2;Y(I,J)=Y(I,J)-Yt/K;Y(J,I)=Y(I,J);endif K<0 %K<0时变压器支路Y(I,I)=Y(I,I)+Yt+Ym;Y(J,J)=Y(J,J)+Yt*K^2;Y(I,J)=Y(I,J)+Yt*K;endend%形成雅克矩阵程序:function J=jac(bus,Y)%形成雅可比矩阵global n;global m;for i=1:(n-1) %计算PQ、PV节点的有功P1=0;T=0;for j=1:nT=bus(i,2)*bus(j,2)*(real(Y(i,j))*cos(bus(i,3)-bus(j,3))+imag(Y(i,j))*sin(bus(i,3)-bus(j,3)));P1=P1+T;endbus(i,4)=P1;endfor i=1:n-1 %计算PV、PQ节点的无功Q1=0;T=0;for j=1:nT=bus(i,2)*bus(j,2)*(real(Y(i,j))*sin(bus(i,3)-bus(j,3))-imag(Y(i,j))*cos(bus(i,3)-bus(j,3)));Q1=Q1+T;endbus(i,5)=Q1;endfor i=1:n-1 %计算Hfor j=1:n-1if i~=jH(i,j)=-bus(i,2)*bus(j,2)*(real(Y(i,j))*sin(bus(i,3)-bus(j,3))-imag(Y(i,j))*cos(bus(i,3)-bus(j,3)));N(i,j)=-bus(i,2)*bus(j,2)*(real(Y(i,j))*cos(bus(i,3)-bus(j,3))+imag(Y(i,j))*sin(bus(i,3)-bus(j,3)));K(i,j)=bus(i,2)*bus(j,2)*(real(Y(i,j))*cos(bus(i,3)-bus(j,3))+imag(Y(i,j))*sin(bus(i,3)-bus(j,3)));L(i,j)=H(i,j);endendendfor i=1:n-1 %计算Hfor j=1:n-1if j==iH(i,i)=bus(i,5)+imag(Y(i,i))*bus(i,2)^2;N(i,i)=-bus(i,4)-real(Y(i,i))*bus(i,2)^2;K(i,i)=N(i,i)+2*real(Y(i,i))*bus(i,2)^2;L(i,i)=-H(i,i)+2*imag(Y(i,i))*bus(i,2)^2;endendendN=N(1:n-1,1:m);L=L(1:m,1:m);J=[H,N;K,L];%计算dPQ的程序:function dPQ=dPQ(Y,bus)%delP--有功偏差量%delQ--无功偏差量%Y--节点导纳矩阵%bus--节点参数(P,Q,U及相角)矩阵global n;global m;delP=zeros(1,n-1);delQ=zeros(1,m);for i=1:(n-1) %形成delP矩阵(PQ、PV节点)P1=0;T=0;for j=1:nT=bus(i,2)*bus(j,2)*(real(Y(i,j))*cos(bus(i,3)-bus(j,3))+imag(Y(i,j))*sin(bus(i,3)-bus(j,3)));P1=P1+T;enddelP(1,i)=bus(i,4)-P1;endfor i=1:m %形成delQ矩阵(PQ节点)Q1=0;T=0;for j=1:nT=bus(i,2)*bus(j,2)*(real(Y(i,j))*sin(bus(i,3)-bus(j,3))-imag(Y(i,j))*cos(bus(i,3)-bus(j,3)));Q1=Q1+T;enddelQ(1,i)=bus(i,5)-Q1;enddPQ=[delP,delQ];%计算线路损耗、线路潮流程序:function Pf=loss(bus,line)%计算线路损耗、线路潮流[nl,ml]=size(line);Pf=zeros(nl,5);for k=1:nlI=line(k,1);J=line(k,2);Zt=line(k,3)+i*line(k,4);if Zt==0Yt=inf;elseYt=1/Zt;endYm=line(k,5)+i*line(k,6);K=line(k,7);if (K==0)&(J~=0) %普通线路潮流S(I,J)=bus(I,2)^2*(conj(Yt)+conj(Ym))-bus(I,2)*(cos(bus(I,3))+i*sin(bus(I,3)))*bus(J,2)*(cos(bus(J,3))-i*sin(bus(J,3))) *conj(Yt);S(J,I)=bus(J,2)^2*(conj(Yt)+conj(Ym))-bus(J,2)*(cos(bus(J,3))+i*sin(bus(J,3)))*bus(I,2)*(cos(bus(I,3))-i*sin(bus(I,3))) *conj(Yt);delS(I,J)=S(I,J)+S(J,I);endif(K==0)&(J==0) %对地支路潮流J=5;S(I,5)=bus(I,2)^2*conj(Ym);endif K>0 %变压器支路k>0时的潮流S(I,J)=bus(I,2)^2*(conj(Ym+Yt*(1-1/K))+conj(Yt/K))-bus(I,2)*(cos(bus(I,3))+i*sin(bus(I,3)))*bus(J,2)*(cos(bus(J,3))-i *sin(bus(J,3)))*conj(Yt/K);S(J,I)=bus(J,2)^2*(conj(Yt))/K^2-bus(J,2)*(cos(bus(J,3))+i*sin(bus(J,3)))*bus(I,2)*(cos(bus(I,3))-i*sin(bus(I,3)))*conj( Yt/K);delS(I,J)=S(I,J)+S(J,I);endif K<0 %变压器支路k<0时的潮流S(I,J)=bus(I,2)^2*(conj(Ym+Yt))+bus(I,2)*(cos(bus(I,3))+i*sin(bus(I,3)))*bus(J,2)*(cos(bus(J,3))-i*sin(bus(J,3)))*conj( Yt*K);S(J,I)=bus(J,2)^2*(conj(Yt))*K^2+bus(J,2)*(cos(bus(J,3))+i*sin(bus(J,3)))*bus(I,2)*(cos(bus(I,3))-i*sin(bus(I,3)))*conj (Yt*K);delS(I,J)=S(I,J)+S(J,I);endif J==5&Zt==0Sp=[line(k,1) line(k,2) S(I,5) 0 S(I,5)];elseSp=[line(k,1) line(k,2) S(I,J) S(J,I) delS(I,J)];endPf(k,:)=Sp;end%输入的参数数据:% data for test case%各节点参数:节点编号,注入有功,注入无功,(Sn=100MV A)电压幅值,电压相位,类型%类型:1=PQ节点,2=PV节点,3=平衡节点% (bus#)( volt )( ang )( p )( q )(bus type)1,1.0,0.0,-0.478,0.039,1;2,1.0,0.0,-0.076,-0.016,1;3,1.0,0.0,0.0,0.0,1;4,1.0,0.0,-0.295,-0.166,1;5,1.0,0.0,-0.09,-0.058,1;6,1.0,0.0,-0.035,-0.018,1;7,1.0,0.0,-0.061,-0.016,1;8,1.0,0.0,-0.135,-0.058,1;9,1.0,0.0,-0.149,-0.05,1;10,1.045,0.0,0.183,0.0,2;11,1.010,0.0,-0.942,0.0,2;12,1.70,0.0,-0.112,0.047,2;13,1.90,0.0,0.0,0.174,2;14,1.060,0.0,0.0,0.0,3];%各支路参数:起点编号,终点编号,电阻,电抗,电导,电纳line = [1,2,0.01335,0.04211,0.0,0.0,0;1,3,0.0,0.20912,0.0,0.0,0;1,4,0.0,0.55618,0.0,0.0,0;1,10,0.05811,0.17632,0.0,0.0340,0;1,11,0.06701,0.17103,0.0,0.0128,0;2,10,0.05695,0.17388,0.0,0.0346,0;2,12,0.0,0.25202,0.0,0.0,0;2,14,0.05403,0.22304,0.0,0.0492,0;3,4,0.0,0.11001,0.0,0.0,0;3,13,0.0,0.17615,0.0,0.0,0;4,5,0.03181,0.08450,0.0,0.0,0;4,9,0.12711,0.27038,0.0,0.0,0;5,6,0.08205,0.19207,0.0,0.0,0;6,12,0.09498,0.19890,0.0,0.0,0;7,8,0.22092,0.19988,0.0,0.0,0;7,12,0.12291,0.25581,0.0,0.0,0;8,9,0.17093,0.34802,0.0,0.0,0;8,12,0.06615,0.13027,0.0,0.0,0;10,11,0.04699,0.19797,0.0,0.0438,0;10,14,0.01938,0.05917,0.0,0.0528,0];输出结果数据1:--第1次迭代时雅可比矩阵---38.624033 21.578554 4.781943 1.797979 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 5.346051 5.119505 -0.000000 -0.000000 -10.417258 6.840981 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000021.578554 -38.240787 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 5.427654 -0.000000 6.745496 -0.000000 6.840981 -9.429913 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000004.781943 -0.000000 -24.658288 9.090083 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-0.000000 -0.000000 -0.000000 -0.0000001.797979 -0.000000 9.090083 -24.282506 10.365394 -0.000000 -0.000000 -0.000000 3.029050 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -5.326055 3.902050 -0.000000 -0.000000 -0.000000 1.424005-0.000000 -0.000000 -0.000000 10.365394 -14.768338 4.402944 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 3.902050 -5.782934 1.880885 -0.000000 -0.000000 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 4.402944 -11.362870 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 6.959926 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 1.880885 -2.467393 -0.000000 -0.000000 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -7.651113 2.251975 -0.000000 -0.000000 -0.000000 5.399139 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -2.946815 2.489025 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 2.251975 -14.941622 2.314963 -0.000000 -0.000000 10.374684 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 2.489025 -4.555697 1.136994-0.000000 -0.000000 -0.000000 3.029050 -0.000000 -0.000000 -0.000000 2.314963 -5.344014 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 1.424005 -0.000000 -0.000000 -0.000000 1.136994 -2.5610005.346051 5.427654 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -32.727644 5.047017 -0.000000 -0.000000 1.761905 1.777691 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000005.119505 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 5.047017 -10.166523 -0.000000 -0.000000 2.005835 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-0.000000 6.745496 -0.000000 -0.000000 -0.000000 6.959926 5.399139 10.374684 -0.000000 -0.000000 -0.000000 -29.479246 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 3.323549 2.594145 5.268177 -0.000000-0.000000 -0.000000 10.786262 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -10.786262 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000010.608721 -6.840981 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -1.761905 -2.005835 0.000000 0.000000 -37.968631 21.578554 4.781943 1.797979 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-6.840981 9.706123 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -1.777691 0.000000 0.000000 0.000000 21.578554 -31.542421 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 4.781943 -0.000000 -14.439724 9.090083 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 5.326055 -3.902050 0.000000 0.000000 0.000000 -1.424005 0.000000 0.000000 0.000000 0.000000 1.797979 -0.000000 9.090083 -24.282506 10.365394 -0.000000 -0.000000 -0.000000 3.0290500.000000 0.000000 0.000000 -3.902050 5.782934 -1.880885 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 10.365394 -14.768338 4.402944 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 -1.880885 5.204433 0.000000 0.000000 0.000000 0.000000-0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 5.083169 -2.489025 0.000000 0.000000 0.000000 -2.594145 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -3.204764 2.251975 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -2.489025 8.894195 -1.136994 0.000000 0.000000 -5.268177 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 2.251975 -6.397765 2.3149630.000000 0.000000 0.000000 -1.424005 0.000000 0.000000 0.000000 -1.136994 2.561000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 3.029050 -0.000000 -0.000000 -0.000000 2.314963 -5.344014--第1次迭代时dPQ的误差---3.822688e-0016.210513e-0020.000000e+000-2.950000e-001-9.000000e-0021.333520e+0001.007177e+0002.034249e+000-1.490000e-0016.056626e-002-9.219354e-001-7.942109e+0000.000000e+0003.667009e-0013.333183e+0005.109282e+000-1.660000e-001-5.800000e-0022.847852e+0002.207175e+0004.213929e+000-5.000000e-002--第1次迭代时dx(误差)---7.699084e-001-8.544764e-001-1.189723e+000-1.410571e+000-1.585607e+000-1.994895e+000-2.196974e+000-2.162427e+000-1.721659e+000-4.249173e-001-6.178169e-001-2.246296e+000-1.189723e+000-5.568104e-001-5.586033e-001-1.299237e+000-1.208867e+000-1.285646e+000-1.499291e+000-2.011550e+000-1.901143e+000-1.488513e+000第1次迭代后节点电压(仅PQ节点)1.5568101.5586032.2992372.2088672.2856462.4992913.0115502.9011432.488513第1次迭代后相角(角度)44.11250048.95789268.16611180.81979290.848607114.299041125.877362123.89794698.64381324.34596735.398301128.70329568.1661110.000000--第2次迭代时雅可比矩阵---88.468596 50.770062 15.630499 4.956802 0.000000 0.000000 0.000000 0.000000 0.000000 8.760031 8.351203 0.000000 0.000000 -17.679024 20.962621 6.976678 3.695668 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000053.574257 -70.163300 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.844924 -0.000000 1.871649 0.000000 12.117328 -29.191523 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000015.630499 -0.000000 -85.475262 45.044595 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000 24.800168 -6.976678 -0.000000 3.136302 10.112981 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000004.956802 -0.000000 45.044595 -111.557696 48.101358 0.000000 0.000000 0.000000 13.454941-0.000000 -0.000000 0.000000 -0.000000 -3.695668 -0.000000 -10.112981 -24.720611 28.512426 -0.000000 -0.000000 -0.000000 12.548251-0.000000 -0.000000 -0.000000 54.962689 -73.761205 18.798516 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 10.286004 -30.269750 19.866386 -0.000000 -0.000000 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 27.350216 -42.131939 0.000000 0.000000 -0.000000 -0.000000 -0.000000 14.781722 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.152201 -35.701334 -0.000000 -0.000000 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -36.269587 20.414751 -0.000000 -0.000000 -0.000000 15.854836 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -43.168982 21.053877 -0.000000-0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 18.912486 -66.242459 18.617657 -0.000000 -0.000000 28.712316 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 22.413069 -72.744607 0.293713-0.000000 -0.000000 -0.000000 18.246829 -0.000000 0.000000 0.000000 11.613550 -29.860379 -0.000000 -0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 2.355263 -0.000000 -0.000000 -0.000000 14.554342 -14.8093936.904762 6.537084 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000 -35.851861 4.723753 -0.000000 0.000000 5.396002 6.042147 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.0000007.404987 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 5.183063 -12.588050 -0.000000 0.000000 4.294174 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 -0.000000 -0.000000-0.000000 1.871649 -0.000000 -0.000000 -0.000000 18.914409 16.625167 31.272979 -0.000000 -0.000000 -0.000000 -68.684204 -0.000000 -0.000000 -10.345614 -0.000000 -0.000000 -0.000000 3.718215 7.001258 12.708639 -0.000000-0.000000 -0.000000 24.800168 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000 -24.800168 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000033.280772 -20.962621 -6.976678 -3.695668 0.000000 0.000000 0.000000 0.000000 0.000000 0.233337 -1.879142 0.000000 0.000000 -97.165875 50.770062 15.630499 4.956802 0.000000 0.000000 0.000000 0.000000 0.000000-12.117328 17.294580 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.004159 0.000000 -10.345614 0.000000 53.574257 -99.357152 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.0000006.976678 0.000000 3.136302 -10.112981 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 15.630499 -0.000000 -121.215950 45.044595 0.000000 0.000000 0.000000 0.000000 0.0000003.695668 0.000000 10.112981 27.252028 -28.512426 0.000000 0.000000 0.000000 -12.548251 0.000000 0.000000 0.000000 0.0000004.956802 -0.000000 45.044595 -125.395530 48.101358 0.000000 0.000000 0.000000 13.4549410.000000 0.000000 0.000000 -10.286004 30.152390 -19.866386 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 54.962689 -80.543606 18.798516 0.000000 0.000000 0.0000000.000000 0.000000 0.000000 0.000000 0.152201 12.220377 0.000000 0.000000 0.000000 0.000000 0.000000 -12.372578 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 27.350216 -64.020523 0.000000 0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 29.658409 -21.053877 0.000000 0.0000000.000000 -8.604532 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -62.187049 20.414751 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -22.413069 40.458166 -0.293713 0.000000 0.000000 -17.751384 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 18.912486 -113.363276 18.6176570.000000 0.000000 0.000000 -2.355263 0.000000 0.000000 0.000000 -14.554342 16.909605 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 18.246829 -0.000000 0.000000 0.000000 11.613550 -36.327356--第2次迭代时dPQ的误差--7.322874e+000-6.024472e+0003.136302e+0009.707086e-001-1.486800e-001-1.177548e+001-6.816287e+000-1.627822e+0019.011063e-0011.442203e+0003.766432e-001-6.045480e+0000.000000e+000-4.309639e+000-1.461293e+001-1.787034e+001-7.084917e+000-3.449200e+000-1.096229e+001-1.297473e+001-2.361841e+001-3.283488e+000--第2次迭代时dx(误差)--7.463082e-0017.954075e-0011.282017e+0001.553903e+0001.801690e+0002.314056e+0002.532583e+0002.510944e+0002.031354e+0002.758084e-0014.877708e-0012.596165e+0001.282017e+000-1.022801e-001-1.281804e-0012.457598e-002-1.510861e-001-1.422363e-0015.472778e-0022.816086e-0012.267577e-001-7.420019e-002第2次迭代后节点电压(仅PQ节点)1.7160411.7583862.2427312.5425962.6107482.3625102.1634712.2432872.673161第2次迭代后相角(角度)1.3521903.384402-5.288058-8.212275-12.380604-18.286594-19.228934-19.968564-17.7441768.5433117.451092-20.045989-5.2880580.000000--第3次迭代时雅可比矩阵---107.449063 64.339505 18.280415 7.735891 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 8.723401 8.369851 -0.000000 -0.000000 -33.906343 22.938392 -2.128130 -1.303493 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000065.803521 -93.903508 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 9.224175 0.000000 10.883156 -0.000000 18.320439 -40.148863 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000018.280415 0.000000 -94.238507 51.767412 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.000000 24.190680 2.128130 -0.000000 -0.516231 -2.644362 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000007.735891 0.000000 51.767412 -151.916589 70.507019 -0.000000 -0.000000 -0.000000 21.906266 0.000000 0.000000 -0.000000 0.000000 1.303493 -0.000000 2.644362 -37.947834 20.832273 -0.000000 -0.000000 -0.000000 6.1357450.000000 0.000000 0.000000 66.741532 -94.948096 28.206563 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 -0.000000 30.834903 -39.252891 8.745203 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 25.819129 -42.495346 -0.000000 -0.000000 0.000000 0.000000 0.000000 16.676217 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 14.333924 -21.142642 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -22.844227 11.084502 0.000000 0.000000 0.000000 11.759725 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -20.202132 11.937858 -0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.772631 -47.668940 13.606970 0.000000 0.000000 23.289338 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 12.220026 -36.325917 7.3518450.000000 0.000000 0.000000 18.700765 0.000000 -0.000000 -0.000000 14.136240 -32.837005 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 -0.000000 12.954276 -0.000000 -0.000000 -0.000000 6.274231 -17.3722379.480361 9.786321 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -41.877577 5.068935 -0.000000 -0.000000 1.851316 2.255032 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000009.101262 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 5.023265 -14.124527 -0.000000 -0.000000 2.489221 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000000.000000 10.883156 0.000000 0.000000 0.000000 16.194071 11.599663 23.257398 0.000000 0.000000 0.000000 -61.934289 0.000000 -0.000000 4.716418 -0.000000 -0.000000 -0.000000 8.353052 5.778354 11.849469 -0.0000000.000000 0.000000 24.190680 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.000000 -24.190680 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000028.010895 -22.938392 2.128130 1.303493 0.000000 0.000000 0.000000 0.000000 0.000000 -4.148120 -4.356006 0.000000 0.000000 -118.100775 64.339505 18.280415 7.735891 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-18.320439 19.018229 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -3.971376 0.000000 4.716418 0.000000 65.803521 -121.860594 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-2.128130 0.000000 -0.516231 2.644362 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 18.280415 0.000000 -102.418265 51.767412 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000-1.303493 0.000000 -2.644362 30.915873 -20.832273 0.000000 0.000000 0.000000 -6.135745 0.000000 0.000000 0.000000 0.000000 7.735891 0.000000 51.767412 -162.046258 70.507019 -0.000000 -0.000000 -0.000000 21.9062660.000000 0.000000 0.000000 -30.834903 39.580107 -8.745203 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 66.741532 -106.373981 28.206563 -0.000000 -0.000000 -0.0000000.000000 0.000000 0.000000 0.000000 -14.333924 21.677303 0.000000 0.000000 0.000000 0.000000 0.000000 -7.343379 0.000000 0.000000 0.000000 0.000000 0.000000 25.819129 -52.356079 -0.000000 -0.000000 0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 17.383077 -11.937858 0.000000 0.000000 0.000000 -5.445220 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -27.967881 11.084502 0.0000000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -12.220026 31.358440 -7.351845 0.000000 0.000000 -11.786569 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.772631 -59.717994 13.6069700.000000 0.000000 0.000000 -12.954276 0.000000 0.000000 0.000000 -6.274231 19.228507 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 18.700765 0.000000 -0.000000 -0.000000 14.136240 -43.537423--第3次迭代时dPQ的误差---3.425724e+000-1.064132e+001-5.162313e-001-3.810980e+0007.360782e-0022.323305e-001-1.470528e+000-2.618738e+0007.791352e-001-2.042190e+000-3.425627e-0011.156931e+0010.000000e+000-5.286856e+000-1.399454e+001-4.089879e+000-5.230835e+000-5.770943e+000-4.948367e+000-2.577827e+000-6.082527e+000-5.400209e+000--第3次迭代时dx(误差)--9.674289e-0021.172732e-001-7.870880e-003-4.668014e-002-8.644519e-002-1.584698e-001-1.940180e-001-1.949970e-001-1.391568e-0011.392652e-0011.715593e-001-2.170152e-001-7.870880e-0032.010999e-0012.142528e-0012.135755e-0012.788091e-0012.825328e-0012.223360e-0011.748684e-0011.963064e-0012.880642e-001第3次迭代后节点电压(仅PQ节点)1.3709451.3816471.7637381.8336971.8731261.8372391.7851491.8029151.903119第3次迭代后相角(角度)-4.190769-3.334859-4.837089-5.537700-7.427659-9.206943-8.112522-8.796060-9.7710800.564000-2.378530-7.611937-4.8370890.000000--第4次迭代时雅可比矩阵---70.787576 40.675150 11.561949 4.518688 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 7.103700 6.928088 -0.000000 -0.000000 -20.202620 13.567039 -0.130429 -0.106247 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000041.062278 -63.775374 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 7.314738 0.000000 9.293937 -0.000000 12.345919 -20.057751 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.00000011.561949 0.000000 -59.982694 29.396602 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.000000 19.024142 0.130429 -0.000000 -0.229050 -0.359479 -0.000000 -0.000000 -0.000000 -0.000000 -0.0000004.518688 0.000000 29.396602 -80.849041 36.025140 -0.000000 -0.000000 -0.000000 10.908611 0.000000 0.000000 -0.000000 0.000000 0.106247 -0.000000 0.359479 -18.954787 12.221085 -0.000000 -0.000000 -0.000000 4.1755430.000000 0.000000 0.000000 35.141107 -50.486980 15.345872 -0.000000 -0.000000 -0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 -0.000000 -0.000000 14.569427 -20.011329。

第9章 工具箱使用

第9章  工具箱使用

9.2
优化工具箱
• 9.2.1 理论基础 • 优化工具箱(Optimization Toolbox) 位于 安装目录下Toolbox子目录的Optim目录之 下,用来解决函数的极值问题或设计参数 的优化问题,例如: • (1)无限定条件的非线性极值问题 • (2)限定条件的非线性极值问题 • (3)二次规划和线性规划问题 • (4)非线性最小平方和曲线拟合问题
• %定义f0902函数—下述代码另存为工作目录下的f0902.m文件 • function [c,ceq]=f0902(x) %非线性不等式与等式条件极值问 题的条件函数 • c=[1.5+x(1)*x(2)-x(1)-x(2);-x(1)*x(2)-10]; %非线性不等式条件(矩 阵) • ceq=[]; %非线性等式条件,为空矩阵
• 图形窗口方式 • 在命令窗口输入命令wavemenu→单击 [wavelet 1-D](六个分析部分之一) →选 择[file] →[load] →[Signal] →选择 Mat信号文件(如 toolbox/wavelet/wavedemo/sumsin)
Байду номын сангаас
第9章
9.1
工具箱使用
MATLAB工具箱使用简介
9.2
9.3
优化工具箱
神经网络工具箱
9.4
小波分析工具箱
9.1 MATLAB工具箱使用简介
• MATLAB工具箱由m文件组成,位于安装目录 的Toolboxes子目录下,用来解决不同领域 的专门问题 • 可通过菜单[Help]→[Full Product Family Help] →[Demos]的说明来学习各 种工具箱。表9-1(P173)给出了常用工具 箱一览表

电力系统分析潮流计算matlab

电力系统分析潮流计算matlab

目录:一、软件需求说明书......................................................... .. (3)二、概要设计说明书......................................................... .. (4)1、编写潮流计算程序......................................................... . (4)2、数据的输入测试......................................................... .. (4)3、运行得出结果......................................................... (4)4、进行实验结果验证......................................................... . (4)三、详细设计说明书......................................................... .. (5)1、数据导入模块......................................................... (5)2、节点导纳矩阵模块......................................................... . (5)3、编号判断模块......................................................... (5)4、收敛条件判定模块......................................................... .. (5)5、雅可比矩阵模块......................................................... (5)6、迭代计算模块......................................................... . (5)7、计算输出参数模块......................................................... .. (5)四、程序代码......................................................... .. (6)五、最测试例......................................................... (15)1、输入结果......................................................... (15)2、输出结果......................................................... (15)3、结果验证......................................................... (15)一、软件需求说明书本次设计利用MATLAB/C++/C(使用MATLAB)编程工具编写潮流计算,实现对节点电压和功率分布的求取。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

MATPOWERA M ATLAB™ Power System Simulation PackageVersion 3.2September 21, 2007User’s ManualRay D. Zimmerman Carlos E. Murillo-Sánchez rz10@ carlos_murillo@ © 1997-2007 Power Systems Engineering Research Center (PS ERC)School of Electrical Engineering, Cornell University, Ithaca, NY 14853Table of ContentsTable of Contents (2)1Introduction (3)2Getting Started (4)2.1System Requirements (4)2.2Installation (4)2.3Running a Power Flow (4)2.4Running an Optimal Power Flow (4)2.5Getting Help (4)3Technical Reference (6)3.1Data File Format (6)3.2Modeling (8)3.3Power Flow (11)3.4Optimal Power Flow (12)3.4.1AC OPF Formulation (13)3.4.2DC OPF Formulation (21)3.5Unit Decommitment Algorithm (22)3.6MATPOWER Options (22)3.7Summary of the Files (28)4Acknowledgments (33)5References (33)Appendix A: Notes on LP-Solvers for M ATLAB (34)Appendix B: Additional Notes (34)Appendix C: Auction Code (35)1IntroductionWhat is MATPOWER?MATPOWER is a package of M ATLAB M-files for solving power flow and optimal power flow prob-lems. It is intended as a simulation tool for researchers and educators that is easy to use and modify. MATPOWER is designed to give the best performance possible while keeping the code simple to understand and modify. The MATPOWER home page can be found at:/matpower/Where did it come from?MATPOWER was developed by Ray D. Zimmerman, Carlos E. Murillo-Sánchez and Deqiang Gan of PSERC at Cornell University (/) under the direction of Robert Thomas. The initial need for M ATLAB based power flow and optimal power flow code was born out of the computational requirements of the PowerWeb project (see /powerweb/).Who can use it?•MATPOWER is free. Anyone may use it.•We make no warranties, express or implied. Specifically, we make no guarantees regarding the correctness MATPOWER’s code or its fitness for any particular purpose.•Any publications derived from the use of MATPOWER must cite MATPOWER /matpower/.•Anyone may modify MATPOWER for their own use as long as the original copyright notices remain in place.•MATPOWER may not be redistributed without written permission.•Modified versions of MATPOWER, or works derived from MATPOWER, may not be distrib-uted without written permission.2Getting Started2.1System RequirementsTo use MATPOWER you will need:•M ATLAB version 6 or later1•M ATLAB Optimization Toolbox (required only for some OPF algorithms)Both are available from The MathWorks (see /).2.2InstallationStep 1: Go to the MATPOWER home page (/matpower/) and follow the download instructions.Step 2: Unzip the downloaded file.Step 3: Place the files in a location in your M ATLAB path.2.3Running a Power FlowTo run a simple Newton power flow on the 9-bus system specified in the file case9.m, with the de-fault algorithm options, at the M ATLAB prompt, type:>> runpf('case9')2.4Running an Optimal Power FlowTo run an optimal power flow on the 30-bus system whose data is in case30.m, with the default algo-rithm options, at the M ATLAB prompt, type:>> runopf('case30')To run an optimal power flow on the same system, but with the option for MATPOWER to shut down (decommit) expensive generators, type:>> runuopf('case30')2.5Getting HelpAs with M ATLAB’s built-in functions and toolbox routines, you can type help followed by the name of a command or M-file to get help on that particular function. Nearly all of MATPOWER’s M-files have such documentation. For example, the help for runopf looks like:1Although it is likely that most things work fine in M ATLAB5, this is not supported due to limited testing resources. MATPOWER 3.0 required M ATLAB 5 and MATPOWER 2.0 and earlier required only M ATLAB 4.>> help runopfRUNOPF Runs an optimal power flow.[baseMVA, bus, gen, gencost, branch, f, success, et] = ...runopf(casename, mpopt, fname, solvedcase)Runs an optimal power flow and optionally returns the solved values in the data matrices, the objective function value, a flag which is true if the algorithm was successful in finding a solution, and the elapsed time in seconds. All input arguments are optional. If casename is provided it specifies the name of the input data file or struct (see also 'helpcaseformat' and 'help loadcase') containing the opf data. The defaultvalue is 'case9'. If the mpopt is provided it overrides the defaultMATPOWER options vector and can be used to specify the solutionalgorithm and output options among other things (see 'help mpoption' for details). If the 3rd argument is given the pretty printed output will be appended to the file whose name is given in fname. If solvedcase isspecified the solved case will be written to a case file in MATPOWERformat with the specified name. If solvedcase ends with '.mat' it saves the case as a MAT-file otherwise it saves it as an M-file. MATPOWER also has many options which control the algorithms and the output. Type:>> help mpoptionand see Section 3.6 for more information on MATPOWER's options.3Technical Reference3.1Data File FormatThe data files used by MATPOWER are simply M ATLAB M-files or MAT-files which define and re-turn the variables baseMVA, bus, branch, gen, areas, and gencost. The baseMVA variable is a scalar and the rest are matrices. Each row in the matrix corresponds to a single bus, branch, or generator. The columns are similar to the columns in the standard IEEE and PTI formats. The details of the specifica-tion of the MATPOWER case file can be found in the help for caseformat.m:>> help caseformatCASEFORMAT Defines the MATPOWER case file format.A MATPOWER case file is an M-file or MAT-file which defines the variablesbaseMVA, bus, gen, branch, areas, and gencost. With the exception ofbaseMVA, a scalar, each data variable is a matrix, where a row correspondsto a single bus, branch, gen, etc. The format of the data is similar tothe PTI format described in/research/pstca/formats/pti.txtexcept where noted. An item marked with (+) indicates that it is includedin this data but is not part of the PTI format. An item marked with (-) isone that is in the PTI format but is not included here. Those marked with(2) were added for version 2 of the case file format. The columns foreach data matrix are given below.MATPOWER Case Version Information:A version 1 case file defined the data matrices directly. The last two,areas and gencost, were optional since they were not needed for runninga simple power flow. In version 2, each of the data matrices are storedas fields in a struct. It is this struct, rather than the individualmatrices that is returned by a version 2 M-casefile. Likewise a version 2MAT-casefile stores a struct named 'mpc' (for MATPOWER case). The structalso contains a 'version' field so MATPOWER knows how to interpret thedata. Any case file which does not return a struct, or any struct whichdoes not have a 'version' field is considered to be in version 1 format.See also IDX_BUS, IDX_BRCH, IDX_GEN, IDX_AREA and IDX_COST regardingconstants which can be used as named column indices for the data matrices.Also described in the first three are additional columns that are addedto the bus, branch and gen matrices by the power flow and OPF solvers.Bus Data Format1 bus number (1 to 29997)2 bus typePQ bus = 1PV bus = 2reference bus = 3isolated bus = 43 Pd, real power demand (MW)4 Qd, reactive power demand (MVAr)5 Gs, shunt conductance (MW (demanded) at V = 1.0 p.u.)6 Bs, shunt susceptance (MVAr (injected) at V = 1.0 p.u.)7 area number, 1-1008 Vm, voltage magnitude (p.u.)9 Va, voltage angle (degrees)(-) (bus name)10 baseKV, base voltage (kV)11 zone, loss zone (1-999)(+) 12 maxVm, maximum voltage magnitude (p.u.)(+) 13 minVm, minimum voltage magnitude (p.u.)Generator Data Format1 bus number(-) (machine identifier, 0-9, A-Z)2 Pg, real power output (MW)3 Qg, reactive power output (MVAr)4 Qmax, maximum reactive power output (MVAr)5 Qmin, minimum reactive power output (MVAr)6 Vg, voltage magnitude setpoint (p.u.)(-) (remote controlled bus index)7 mBase, total MVA base of this machine, defaults to baseMVA(-) (machine impedance, p.u. on mBase)(-) (step up transformer impedance, p.u. on mBase)(-) (step up transformer off nominal turns ratio)8 status, > 0 - machine in service<= 0 - machine out of service(-) (% of total VAr's to come from this gen in order to hold V at remote bus controlled by several generators)9 Pmax, maximum real power output (MW)10 Pmin, minimum real power output (MW)(2) 11 Pc1, lower real power output of PQ capability curve (MW)(2) 12 Pc2, upper real power output of PQ capability curve (MW)(2) 13 Qc1min, minimum reactive power output at Pc1 (MVAr)(2) 14 Qc1max, maximum reactive power output at Pc1 (MVAr)(2) 15 Qc2min, minimum reactive power output at Pc2 (MVAr)(2) 16 Qc2max, maximum reactive power output at Pc2 (MVAr)(2) 17 ramp rate for load following/AGC (MW/min)(2) 18 ramp rate for 10 minute reserves (MW)(2) 19 ramp rate for 30 minute reserves (MW)(2) 20 ramp rate for reactive power (2 sec timescale) (MVAr/min)(2) 21 APF, area participation factorBranch Data Format1 f, from bus number2 t, to bus number(-) (circuit identifier)3 r, resistance (p.u.)4 x, reactance (p.u.)5 b, total line charging susceptance (p.u.)6 rateA, MVA rating A (long term rating)7 rateB, MVA rating B (short term rating)8 rateC, MVA rating C (emergency rating)9 ratio, transformer off nominal turns ratio ( = 0 for lines )(taps at 'from' bus, impedance at 'to' bus, i.e. ratio = Vf / Vt)10 angle, transformer phase shift angle (degrees), positive => delay(-) (Gf, shunt conductance at from bus p.u.)(-) (Bf, shunt susceptance at from bus p.u.)(-) (Gt, shunt conductance at to bus p.u.)(-) (Bt, shunt susceptance at to bus p.u.)11 initial branch status, 1 - in service, 0 - out of service(2) 12 minimum angle difference, angle(Vf) - angle(Vt) (degrees)(2) 13 maximum angle difference, angle(Vf) - angle(Vt) (degrees)(+) Area Data Format1 i, area number2 price_ref_bus, reference bus for that area(+) Generator Cost Data FormatNOTE: If gen has n rows, then the first n rows of gencost containthe cost for active power produced by the corresponding generators.If gencost has 2*n rows then rows n+1 to 2*n contain the reactivepower costs in the same format.1 model, 1 - piecewise linear,2 - polynomial2 startup, startup cost in US dollars3 shutdown, shutdown cost in US dollars4 n, number of cost coefficients to follow for polynomialcost function, or number of data points for piecewise linear5 and following, cost data defining total cost functionFor polynomial cost:c2, c1, c0where the polynomial is c0 + c1*P + c2*P^2For piecewise linear cost:x0, y0, x1, y1, x2, y2, ...where x0 < x1 < x2 < ... and the points (x0,y0), (x1,y1),(x2,y2), ... are the end- and break-points of the cost function. Some columns are added to the bus, branch and gen matrices by the solvers. See the help for idx_bus, idx_brch, and idx_gen for more details.3.2ModelingAC FormulationFixed loads are modeled as constant real and reactive power injections,!Pdand!Qdspecified in col-umns 3 and 4, respectively, of the bus matrix. The shunt admittance of any constant impedance shuntelements at a bus are specified by Gsh and Bshin columns 5 and 6, respectively, of the bus matrix!Ysh=Gsh+jBshbaseMVAEach branch, whether transmission line, transformer or phase shifter, is modeled as a standard π-model transmission line, with series resistance R and reactance X and total line charging capacitance!Bc, in series with an ideal transformer and phase shifter, at the from end, with tap ratio!" and phase shift angle!"shift. The parameters R, X,!Bc,!" and!"shift, are found in columns 3, 4, 5, 9 and 10 of the branch matrix, respectively. The branch voltages and currents at the from and to ends of the branch are related by the branch admittance matrix!Ybras follows!IfIt"#$%&'=Y brVfVt"#$%&'(1) where!Ybr=Ys+jBc2"#$%&'1(2)Ys1(e j*shift)Ys1(e)j*shiftYs+jBc2+,---./and!Ys=1R+jX.The elements of the individual branch admittance matrices and the bus shunt admittances are com-bined by MATPOWER to form a complex bus admittance matrix!Ybus, relating the vector of complex bus voltages!Vbuswith the vector of complex bus current injections!Ibus!Ibus=YbusVbusSimilarly, admittance matrices!Yfand!Yt, are formed to compute the vector of complex current injec-tions at the from and to ends of each line, given the bus voltages!Vbus.!If=YfVbusIt=YtVbusThe vectors of complex bus power injections, and branch power injections can be expressed as!Sbus=diag(Vbus)Ibus*Sf=diag(Vf)If*St=diag(Vt)It*where!Vfand!Vtare vectors of the complex bus voltages at the from and to ends, respectively, of all branches, and diag() converts a vector into a diagonal matrix with the specified vector on the diagonal.DC FormulationFor the DC formulation, the same parameters are used, with the exception that the following assump-tions are made:•Branch resistances R and charging capacitances!Bcare negligible (i.e. branches are lossless).•All bus voltage magnitudes are close to 1 p.u.•Voltage angle differences are small enough that!sin"ij#"ij.Combining these assumptions and equation (1) with the fact that!S=VI*, the relationship between thereal power flows and voltage angles for an individual branch can be written as!PfPt"#$%&'=B br(f(t"#$%&'+Pf,shiftPt,shift"#$%&'(2)where!Bbr=1X"1#1#11$%&'()(3)!Pf,shiftPt,shift"#$%&'=(shiftX)1*1"#$%&'.(4)The elements of the individual branch shift injections and!Bbrmatrices are combined by MATPOWERto form a bus!Bbusmatrix and!Pbus,shiftshift injection vector, which can be used to compute bus realpower injections from bus voltage angles!Pbus=Bbus"bus+Pbus,shiftSimilarly, MATPOWER builds the matrix!Bfand the vector!Pf,shiftwhich can be used to compute thevectors !Pfand!Ptof branch real power injections!Pf=Bf"bus+Pf,shiftPt=#Pf3.3Power FlowMATPOWER has five power flow solvers, which can be accessed via the runpf function. In addition to printing output to the screen, which it does by default, runpf optionally returns the solution in out-put arguments:>> [baseMVA, bus, gen, branch, success, et] = runpf(casename);The solution values are stored as follows:bus(:, VM)bus voltage magnitudesbus(:, VA)bus voltage anglesgen(:, PG)generator real power injectionsgen(:, QG)generator reactive power injectionsbranch(:, PF)real power injected into “from” end of branchbranch(:, PT)real power injected into “to” end of branchbranch(:, QF)reactive power injected into “from” end of branchbranch(:, QT)reactive power injected into “to” end of branchsuccess 1 = solved successfully, 0 = unable to solveet computation time required for solutionThe default power flow solver is based on a standard Newton’s method [10] using a full Jacobian, up-dated at each iteration. This method is described in detail in many textbooks. Algorithms 2 and 3 are variations of the fast-decoupled method [9]. MATPOWER implements the XB and BX variations as described in [1]. Algorithm 4 is the standard Gauss-Seidel method from Glimm and Stagg [3], based on code contributed by Alberto Borghetti, from the University of Bologna, Italy. To use one of the power flow solvers other than the default Newton method, the PF_ALG option must be set explicitly. For example, for the XB fast-decoupled method:>> mpopt = mpoption('PF_ALG', 2);>> runpf(casename, mpopt);The last method is a DC power flow [11], which is obtained by executing runpf with the PF_DC op-tion set to 1, or equivalently by executing rundcpf directly. The DC power flow is obtained by a di-rect, non-iterative solution of the bus voltage angles from the specified bus real power injections, based on equations (2), (3) and (4).For the AC power flow solvers, if the ENFORCE_Q_LIMS option is set to 1 (default is 0), then if any generator reactive power limit is violated after running the AC power flow, the corresponding bus is converted to a PQ bus, with the reactive output set to the limit, and the case is re-run. The voltage magnitude at the bus will deviate from the specified value in order to satisfy the reactive power limit. If the generator at the reference bus reaches a reactive power limit and the bus is converted to a PQ bus, the first remaining PV bus will be used as the slack bus for the next iteration. This may result in the real power output at this generator being slightly off from the specified values.Currently, none of MATPOWER’s power flow solvers include any transformer tap changing or han-dling of disconnected or de-energized sections of the network.Performance of the power flow solvers, with the exception of Gauss-Seidel, should be excellent even on very large-scale power systems, since the algorithms and implementation take advantage of M ATLAB’s built-in sparse matrix handling.3.4Optimal Power FlowMATPOWER includes several solvers for the optimal power flow (OPF) problem, which can be ac-cessed via the runopf function. In addition to printing output to the screen, which it does by default, runopf optionally returns the solution in output arguments:>> [baseMVA, bus, gen, gencost, branch, f, success, et] = runopf(casename);In addition to the values listed for the power flow solvers, the OPF solution also includes the follow-ing values:bus(:, LAM_P)Lagrange multiplier on bus real power mismatchbus(:, LAM_Q)Lagrange multiplier on bus reactive power mismatchbus(:, MU_VMAX)Kuhn-Tucker multiplier on upper bus voltage limitbus(:, MU_VMIN)Kuhn-Tucker multiplier on lower bus voltage limitgen(:, MU_PMAX)Kuhn-Tucker multiplier on upper generator real power limitgen(:, MU_PMIN)Kuhn-Tucker multiplier on lower generator real power limitgen(:, MU_QMAX)Kuhn-Tucker multiplier on upper generator reactive power limitgen(:, MU_QMIN)Kuhn-Tucker multiplier on lower generator reactive power limitbranch(:, MU_SF)Kuhn-Tucker multiplier on MVA limit at "from" end of branchbranch(:, MU_ST)Kuhn-Tucker multiplier on MVA limit at "to" end of branchf final objective function valueMATPOWER can make use of a number of different OPF solvers. There are two legacy solvers from early versions of MATPOWER, namely the constr and LP-based solvers, that have been deprecated and will be removed from future versions. The details of the problem formulation and solution algo-rithms used by these solvers can be found in the user's manual included with previous versions of MATPOWER.The current generation of solvers use the generalized AC OPF formulation described below. MATPOWER includes one based on fmincon from M ATLAB’s Optimization Toolbox and there are two optional packages, MINOPF2 and TSPOPF3, that implement higher performance OPF solvers us-ing MEX files. MINOPF, based on the MINOS [7] solver, has been available since mid-2004 and is distributed separately because it has a more restrictive license than MATPOWER. TSPOPF is a collec-tion of three solvers developed by Hongye Wang [11] and is currently distributed separately as well. The performance of MATPOWER’s OPF solvers depends on several factors. First, for problems of this general nature, fmincon does not exploit and preserve sparsity, so it is inherently limited to solving small power systems. The MEX based solvers, on the other hand, do exploit sparsity and are suitable for much larger problems. MINOPF is coded in FORTRAN and evaluates the required Jacobians us-ing an optimized structure that follows the order of evaluation imposed by the compressed-column sparse format which is employed by MINOS. In fact, the new generalized OPF formulation included in MATPOWER 3.0 and later is inspired by the data format used by MINOS. The solvers in the TSPOPF package are implemented in the C language.MATPOWER’s OPF implementation is not currently able to handle unconnected or de-energized sec-tions of the network.2 See /minopf/.3 See /tspopf/.Piecewise linear costs using constrained cost variables (CCV)The OPF formulations in MATPOWER allow for the specification of convex piecewise linear costfunctions for active or reactive generator output. An example of such a cost curve is shown below.This non-differentiable cost is modeled using an extra helper cost variable for each such cost curve and additional constraints on this variable and Pg , one for each segment of the curve. The constraints build a convex “basin” equivalent to requiring the cost variable to lie in the epigraph of the cost curve. When the cost is minimized, the cost variable will be pushed against this basin. If the helper cost vari-able is y , then the contribution of the generator’s cost to the total cost is exactly y . In the above case, the two additional required constraints are1) !y "m 1(P g #x 0)+c 0(y must lie above the first segment) 2) ! y "m 2(P g #x 1)+c 1 (y must lie above the second segment)where m 1 and m 2 are the slopes of the two segments. Also needed, of course, are the box restrictions on P g : P min ≤ P g ≤ P max . The additive part of the cost contributed by this generator is y .This constrained cost variable (CCV) formulation is used by all of the MATPOWER OPF solvers for handling piecewise linear cost functions, with the exception of two that are part of the optional TSPOPF package, namely the step-controlled primal/dual interior point method (SCPDIPM ) and the trust region based augmented Lagrangian method (TRALM ), both of which use a cost smoothing tech-nique instead.3.4.1 AC OPF FormulationThe AC optimal power flow problem solved by MATPOWER is a “smooth” OPF with no discrete variables or controls. The generalized AC OPF formulation, used by the current generation of MATPOWER ’s OPF solvers, offers a number of extra capabilities relative to the traditional formula-tion of minimizing the cost of generation subject to voltage, flow and generator limits, used by the first generation of MATPOWER OPF solvers:• mixed polynomial and piecewise linear costs• dispatchable loads• generator P-Q capability curves• branch angle difference limits • additional user supplied linear constraints• additional user supplied costsNew in MATPOWER 3.2 are the generalized user supplied cost formulation, the generator capability curves, the branch angle difference limits and a simplification of the general linear constraint specifi-cation used in version 3.0.The problem is formulated in terms of two groups of optimization variables, labeled x and z . The x variables are the OPF variables, consisting of the voltage angles ! " and magnitudes V at each bus, and real and reactive generator injections P g and Q g .! x ="V P g Q g # $ % % % % & '( ( ( ( Additional user defined variables are grouped in z .The optimization problem can be expressed as follows: ! min x ,y ,z f 1i (P gi )+f 2i (Q gi )()i"+12w T Hw +C w T wsubject to!g P (x )=P (",V )#P g +P d =0 (active power balance equations)!g Q (x )=Q (",V )#Q g +Q d =0 (reactive power balance equations) ! g S f (x )=S f (",V )#S max $0 (apparent power flow limit of lines, from end) ! g S t (x )=S t (",V )#S max $0 (apparent power flow limit of lines, to end) ! l "A x z # $ % & ' ( "u (general linear constraints)! x min "x "x max (voltage and generation variable limits)! z min "z "z max (limits on user defined variables) Here f 1i and f 2i are the costs of active and reactive power generation, respectively, for generator i at a given dispatch point. Both f 1i and f 2i are assumed to be polynomial or piecewise-linear functions.The most significant additions to the traditional, simple OPF formulation appear in the generalizedcost terms containing w and in the general linear constraints involving the matrix A, described in the next two sections. These two frameworks allow tremendous flexibility in customizing the problem formulation, making MATPOWER even more useful as a research tool.Note: In Optimization Toolbox versions 3.0 and earlier, fmincon seems to be providing inaccurate shadow prices on the constraints. This did not happen with constr and it may be a bug in these ver-sions of the Optimization Toolbox.General Linear ConstraintsIn addition to the standard non-linear equality constraints for nodal power balance and non-linear ine-quality constraints for line flow limits, this formulation includes a framework for additional linear constraints involving the full set of optimization variables.! l "A x z # $ % & '( "u (general linear constraints) Some portions of these linear constraints are supplied directly by the user, while others are generated automatically based on the case data. Automatically generated portions include:• rows for constraints that define generator P-Q capability curves• rows for constant power factor constraints for dispatchable or price-sensitive loads• rows for branch angle difference limits• rows and columns for the helper variables from the CCV implementation of piecewise linear gen-erator costs and their associated constraintsIn addition to these automatically generated constraints, the user can provide a matrix A u and vectors l u and u u to define further linear constraints. These user supplied constraints could be used, for example, to restrict voltage angle differences between specific buses. The matrix A u must have at least n x col-umns where n x is the number of x variables. If A u has more than n x columns, a corresponding z optimi-zation variable is created for each additional column. These z variables also enter into the generalized cost terms described below, so A u and N must have the same number of columns.!l u "A u x z # $ % & '( "u u (user supplied linear constraints) Change from MATPOWER 3.0: The A u matrix supplied by the user no longer includes the (all zero) columns corresponding to the helper variables for piecewise linear generator costs. This should sim-plify significantly the creation of the desired A u matrix. Generalized Cost FunctionThe cost function consists of two parts. The first is the polynomial or piecewise linear cost of genera-tion. A polynomial or piecewise linear cost is specified for each generator’s active output and, option-ally, reactive output in the appropriate row(s) of the gencost matrix. Any piecewise linear costs are implemented using the CCV formulation described above which introduces corresponding helper variables. The general formulation allows generator costs of mixed type (polynomial and piecewise linear) in the same problem.The second part of the cost function provides a general framework for imposing additional costs on the optimization variables, enabling things such as using penalty functions as soft limits on voltages, additional costs on variables involved in constraints handled by Langrangian relaxation, etc.。

相关文档
最新文档