# Power system power flow (realized by Matlab)

Keywords: Android MATLAB Algorithm Mini Program

catalogue

1. Overview

4. PowerWorld simulation

(1) Normal operation

(3) Increase of generator output

5. MATLAB programming example

(1) Flow chart of power flow calculation program

(2) Program code of power flow calculation

6. Data acquisition (Baidu online disk)

## 1. Overview

At first, the power flow of power system was calculated manually. Later, in order to meet the needs of the increasing development of power system, computer network has been formed, which provides a material basis for power flow calculation of power system. Power flow calculation is the most basic content in power system analysis and calculation, and it is also an essential tool in power system operation and design. According to the given operating conditions, network wiring and component parameters of the system, the amplitude and phase angle of each bus voltage, the power flowing through each component and the power loss of the whole system can be determined through power flow calculation.

This paper introduces the power flow calculation based on Newton Raphson method and Gauss Seidel method, verifies the algorithm of Newton Raphson method in MATLAB, builds a simple power system model with PowerWorld, verifies the MATLAB results, and more vividly understands the distribution of power flow in the actual power system.

## 2. Main tasks

(1) In the field of electrical engineering, power flow calculation, short circuit calculation and stability calculation are commonly known as the three major calculations of power system.

(2) Computer algorithm and program design of power flow in high voltage transmission network (PQ decomposition method, Newton Raphson method)

(3) Or computer algorithm program design of power flow in medium voltage distribution network (forward derivation method, homotopy continuation method, etc.)

(4) Or computer algorithm program design of power system short circuit fault (unlimited requirements)

(5) It is suggested to download some power system analysis software commonly used in industry or academia from the Internet as the verification reference and comparison of their own program calculation results, such as PSS/E, Powerworld and PS

(1) The mathematical model of power network is deduced according to the power system network, and the node admittance matrix is written;

(2) After giving the initial value of each node voltage variable (rectangular coordinate system form), the unbalance is solved;

(3) Form Jacobian matrix;

(4) After solving the correction quantity, re modify the initial value and re cycle the calculation from 2;

(5) When the calculated voltage variable reaches the required accuracy, the power distribution, power loss and balance node power of each branch are calculated;

(6) Computer programming and debugging; Continuous adjustment;

(7) The power flow analysis of the given system is calculated and analyzed, and compared with the manual calculation results.

## 4. PowerWorld simulation

### (1) Normal operation

Build a complex model based on PowerWorld, as shown in the figure, and also characterize the power flow distribution under its normal operation state. ### (2) Load increase

When the load on node Five increases to 530MW, the power flow of the system changes greatly. As shown in the figure, the voltage level of multiple lines under overload operation also decreases a lot, indicating that the voltage level of the system will be seriously affected under overload. ### (3) Increase of generator output

When the generator active power output on node Six increases to 800MW, the power flow of the system changes greatly. As shown in the figure, when multiple lines are under overload operation, the voltage level also decreases slightly. ## 5. MATLAB programming example

### (1) Flow chart of power flow calculation program

The flow chart of power flow calculation program based on Newton Raphson method is shown in the figure. ### (2) Program code of power flow calculation

```function [node_result,s_result] = PowerSystem           % Main program of power flow calculation
%%
[node] = OpenNode;
[nn,mn] = size(node);                        % Open data file.And return node
%%
[line] = OpenLine;
[nl,ml] = size(line);                                    % Open data file.And return line
%%
[node,line,nPQ,nPV,nodenum,PH,PV,PQ] = Num(node,line);    % Reorder nodes
%%
Y = sparse(Yij(node,line))                             % Calculate node admittance matrix
%%
[U] = abs(Gauss_Seidel(Y,node,nPQ,nPV))            % return GS The result of the algorithm is used as the initial value
%%
[node_result,s_result] =Newton_Raphson(U,Y,node,nPQ,nPV,line,nodenum);     % Calculation of tidal current results by Newton Raphson method
%%
Result_Write(node_result,s_result,node,line);              % Write results to file

function [node] = OpenNode
[dfile,pathname]=uigetfile('*.m','Select Node File');   % The data file type is m File, window title“ Select Node File"
if pathname == 0
error(' you must select a valid data file')    % If no valid file is selected, an error message appears
else
lfile =length(dfile);                               % Remove file suffix
eval(dfile(1:lfile-2));                             % Open file
end

node = ...
[
1   1.00  0.00   -1.60  -0.80  1 ;
2    1.00  0.00   -2.00  -1.00  1 ;
3   1.00  0.00   -3.70  -1.30  1 ;
4    1.05  0.00    5.00   0.00  2 ;
5    1.05  0.00    0.00   0.00  3 ];```

## 6. Data acquisition (Baidu online disk)

Extraction code: + qq:207962168

Posted by Pantho on Wed, 17 Nov 2021 00:58:12 -0800