-
Notifications
You must be signed in to change notification settings - Fork 15
/
power_flow.m
72 lines (67 loc) · 2.95 KB
/
power_flow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
clc
clearvars
%--------------------------------------------------------------------------
% Runs the AC or DC power flow analysis.
%
% The AC power flow routine by default uses the Newton-Raphson Algorithm,
% where reactive power and voltage magnitudes constraints can be used, and
% only one constraint can be used for one simulation run. Additional
% algorithms that can be used are: Gauss-Seidel, decoupled Newton-Raphson,
% and fast decoupled Newton-Raphson (version BX) algorithm.
%
% Examples:
% runpf('ieee14_20', 'nr', 'main');
% runpf('ieee14_20', 'nr', 'maxIter', 100, 'main');
% runpf('ieee14_20', 'dnr', 'reactive', 'main');
% runpf('ieee14_20', 'fdnr', 'voltage', 'main');
% runpf('ieee14_20', 'dc', 'main', 'flow' 'save');
%--------------------------------------------------------------------------
% Syntax:
% runpf(DATA, METHOD)
% runpf(DATA, METHOD, LIMIT)
% runpf(DATA, METHOD, LIMIT, ATTACH)
% runpf(DATA, METHOD, LIMIT, ATTACH, DISPLAY, EXPORT)
%
% Description:
% - runpf(DATA, METHOD) computes power flow problem
% - runpf(DATA, METHOD, LIMIT) considering constraints
% - runpf(DATA, METHOD, LIMIT, ATTACH) maximum number of iterations
% - runpf(DATA, METHOD, LIMIT, ATTACH, DISPLAY, EXPORT) allows to show
% results and export models
%
% Input Arguments:
% - DATA: the first input argument in the runpf function must contain
% a name of the mat-file that contains power system data
% - METHOD:
% - 'nr': AC power flow analysis using Newton-Raphson algorithm
% - 'gs': AC power flow analysis using Gauss-Seidel algorithm
% - 'dnr': AC power flow analysis using decoupled
% Newton-Raphson algorithm
% - 'fdnr': AC power flow analysis using fast decoupled
% Newton-Raphson algorithm (version BX)
% - 'dc': DC power flow analysis
% - LIMIT
% - 'reactive': forces reactive power constraints
% - 'voltage': forces voltage magnitude constraints
% - ATTACH
% - 'maxIter', X: AC power flow maximum number of iterations(X)
% - DISPLAY
% - 'main': main bus data display
% - 'flow': power flow data display
% - EXPORT
% - 'save': save data display
%
% Although the syntax is given in a certain order, for methodological
% reasons, only DATA must appear as the first input argument, and the order
% of other inputs is arbitrary, as well as their appearance.
%--------------------------------------------------------------------------
% Outputs:
% - result: power flow results
% - data: input power system data
%--------------------------------------------------------------------------
%---------------------------Generate Path Name-----------------------------
addpath(genpath(fileparts(which(mfilename))));
%--------------------------------------------------------------------------
%---------------------------Power Flow Analysis----------------------------
[result, data] = runpf('ieee118_186', 'nr', 'main', 'flow', 'voltage');
%--------------------------------------------------------------------------