用Gauss-Noton法求解输电网状态估计。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-03-19 15:13:59 +08:00
parent 4b44a7684f
commit 1ffcde12ba
2 changed files with 105 additions and 1 deletions

2
run.m
View File

@ -2,7 +2,7 @@ clear
clc
% yalmip('clear')
addpath('.\Powerflow')
[~, ~, ~, ~,Volt,Vangle,Y,Yangle,r,c,newwordParameter,PG,QG,PD,QD,Balance]=pf('s1047.dat', '0');
[~, ~, ~, ~,Volt,Vangle,Y,Yangle,r,c,newwordParameter,PG,QG,PD,QD,Balance]=pf('ieee301.dat', '0');
%%
sigma=0.03;%
%%

104
公式/内点法公式.tex Normal file
View File

@ -0,0 +1,104 @@
\documentclass[10pt,a4paper,final]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fontspec}%使用xetex
\setmainfont[BoldFont=黑体]{宋体} % 使用系统默认字体
\XeTeXlinebreaklocale "zh" % 针对中文进行断行
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt % 给予TeX断行一定自由度
\linespread{1.5} % 1.5倍行距
\begin{document}
由于之前的Gauss-Newton对1047节点收敛性不好dX为0的时候最优条件不为0准备改用内点法求解。
\begin{equation}
f(x)=[z-h(x)]^T W [z-h(x)]
\end{equation}
最优条件等价为
\begin{equation}
\bigtriangledown f(x)=J^T W [z-h(x)]=0
\end{equation}
其中$J$$h(x)$$Jacobi$矩阵
\newline
对于线路功率
线路有功功率Jacobi
\begin{equation}
\begin{aligned}
\frac{\partial P_{ij}}{\partial V_1}=
2V_1G_{ij}-V_2[cos(\theta_1 - \theta_2)G_{ij}+sin (\theta_1 - \theta_2)B_{ij}]
\end{aligned}
\end{equation}
\begin{equation}
\begin{aligned}
\frac{\partial P_{12}}{\partial V_2}=
-V_1[cos(\theta_1 - \theta_2)G_{ij}+sin (\theta_1 - \theta_2)B_{ij}]
\end{aligned}
\end{equation}
利用Newton法对上式进行展开写成元素形式。以两个变量为例
\begin{equation}
\bigtriangledown f= [ \bigtriangledown f_1\,, ... \,,\bigtriangledown f_n]^T
\end{equation}
\begin{equation}
\begin{aligned}
\bigtriangledown^2 f_1=(\omega_1 \frac{ \partial f_1 }{\partial x_1} \frac{ \partial f_1 }{\partial x_1}
+\omega_2 \frac{ \partial f_2 }{\partial x_1} \frac{ \partial f_2 }{\partial x_1} ) \Delta x_1 \\
+ (\omega_1 \frac{ \partial f_1 }{\partial x_1} \frac{ \partial f_1 }{\partial x_2}
+\omega_2 \frac{ \partial f_2 }{\partial x_1} \frac{ \partial f_2 }{\partial x_2} ) \Delta x_2 \\
+( \omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_1 } + \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_1 } ) \Delta x_1 \\
+ ( \omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_2 } + \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_2 } ) \Delta x_2
\end{aligned}
\end{equation}
利用matlab的语句可以表示为
\begin{equation}
J ^T W J + \tilde{Q}
\end{equation}
其中
\begin{equation}
J ^T W J=
(\omega_1 \frac{ \partial f_1 }{\partial x_1} \frac{ \partial f_1 }{\partial x_1}
+\omega_2 \frac{ \partial f_2 }{\partial x_1} \frac{ \partial f_2 }{\partial x_1} ) \Delta x_1 \\
+ (\omega_1 \frac{ \partial f_1 }{\partial x_1} \frac{ \partial f_1 }{\partial x_2}
+\omega_2 \frac{ \partial f_2 }{\partial x_1} \frac{ \partial f_2 }{\partial x_2} ) \Delta x_2
\end{equation}
\begin{equation}
\label{非矢量化二阶导数}
\tilde{Q}=
( \omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_1 } + \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_1 } ) \Delta x_1 \\
+ ( \omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_2 } + \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_2 } ) \Delta x_2
\end{equation}
式(\ref{非矢量化二阶导数})可以用Matlab语言在不需要循环的情况下处理好。因为
% 线路功率二阶导数
\begin{equation}
\begin{aligned}
\frac{\partial^2 P_{12}}{\partial V_1^2}&=
\frac{-2}{k^2}B_{12}\\
&=\frac{-2B_{12}}{k^2}
\end{aligned}
\end{equation}
\begin{equation}
\begin{aligned}
\frac{\partial^2 P_{12}}{\partial V_1 \partial V_2 }&=
\frac{-1}{k}[sin(\theta_1 - \theta_2)G_{ij}-cos (\theta_1 - \theta_2)B_{ij}] \\
&=
\frac{-[sin(\theta_1 - \theta_2)G_{ij}-cos (\theta_1 - \theta_2)B_{ij}]}{k}
\end{aligned}
\end{equation}
\begin{equation}
\begin{aligned}
\frac{\partial^2 P_{12}}{\partial V_2^2}&=0
\end{aligned}
\end{equation}
利用
sparse([1 1],[1 1],[$ \omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_1 } \quad \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_1 } $] ) 可以表示
$
\omega_1 f_1 \frac{ \partial ^2 f_1 }{ \partial x_1 \partial x_1 } + \omega_2 f_2 \frac{ \partial ^2 f_2 }{ \partial x_1 \partial x_1 }
$
在海森矩阵中与 $\Delta x_1$ 对应的元素也就是第一行第一列的元素其他的类似。用这种办法可以不利用矢量化公式任然依靠Matlab语句实现矢量化运算。
\end{document}