Home

Awesome

PowerSAS.m

I. Documentation

HTML

PDF

II. What is PowerSAS.m?

PowerSAS.m is a numerically robust and computationally efficient power grid analysis tool based on semi-analytical solutions (SAS) technology. (Click here for more details of the SAS technology).

The PowerSAS.m is the version for MATLAB/Octave users. It currently provides the following functionalities (more coming soon!):

Key features

III. Installation

1. System requirements

Matlab (7.1 or later) or GNU Octave (4.0.0 or later).

2. Installation

3. Test

4. Initialization

To initialize PowerSAS.m, add the main directory of PowerSAS.m to your Matlab or GNU Octave path and run the command initpowersas. This will ensure that all the functions of PowerSAS.m are added to the path and thus callable.

IV Basic Usage

1 Initialization before use

To initialize PowerSAS.m, add the main directory of PowerSAS to Matlab or GNU Octave path, and execute command initpowersas. This will ensure all the functions of PowerSAS be added to the path and thus callable.

2 Call high-level API -- runPowerSAS

Most grid analysis functionalities can be invoked through the high-level function runPowerSAS. runPowerSAS is defined as follows:

function res=runPowerSAS(simType,data,options,varargin)
Input arguments
Output

Output res is a struct containing simulation result, system states, system data, etc.

To access the system states, we need to further access each kind of state variable in res.stateCurve. For example, the commands to extract the voltage from res.stateCurve are shown below:

[~,idxs]=getIndexDyn(res.SysDataBase); % Get the indexes of each kind of state variables
vCurve=res.StateCurve(idxs.vIdx,:); % idxs.vIdx is the row indexes of voltage variables

3 Basic analysis functionalities

3.1 Power flow analysis

When simType='pf', the runPowerSAS function runs power flow analysis. In addition to the conventional power flow model, runPowerSAS also integrates an extended power flow to solve the steady state of dynamic models. For example, it will calculate the rotor angles of synchronous generators and slips of induction motors in addition to the network equations.

To perform power flow analysis, call the runPowerSAS function as follows:

res=runPowerSAS('pf',data,options)

where the argument data can either be a string of file name or a SysData struct.

Below are some examples:

% Use file name string to specify data
res1=runPowerSAS('pf','d:/codes/d_003.m'); % Filename can use absolute path
res2=runPowerSAS('pf','d_003.m'); % If data file is already in the Matlab/Octave path,
                                  % then can directly use file name
res3=runPowerSAS('pf','d_003'); % Filename can be without '.m'
res4=runPowerSAS('pf','d_003',setOptions('dataPath','d:/codes'); % Another way to specify data path

% Use SysData struct to specify data
SysData=readDataFile('d_003.m','d:/codes'); % Generate SysData struct from data file
res5=runPowerSAS('pf',SysData); % Run power flow using SysData struct

3.2 Continuation Power Flow

Continuation power flow (CPF) analysis in PowerSAS.m features enhanced efficiency and convergence. To perform continuation power flow analysis, call runPowerSAS function as follows:

res=runPowerSAS('cpf',data,options,varargin)

where options (optional) specifies the options of CPF analysis, and varargin are the input arguments:

Some examples can be found in example/ex_cpf.m.

3.3 Contingency Analysis

Contingency analysis computes the system states immediately after removing a line/lines. To perform contingency analysis, call runPowerSAS as follows:

res=runPowerSAS('ctg',data,options,varargin)

where options (optional) specifies the options of contingency analysis. When not using customized options, set options=[]. And varargin are the input arguments:

Some examples can be found in example/ex_ctg.m.

3.4 N-1 screening

N-1 screening is essentially performing a series of contingency analysis, each removing a line from the base state. To perform N-1 screening, call runPowerSAS as follows:

res=runPowerSAS('n-1',data,options)

The return value res is a cell containing each contingency analysis results.

Some examples can be found in example/ex_n_minus_1.m.

3.5 Transient Stability Analysis

Transient stability anslysis (TSA) assesses the system dynamic behavior and stability after given disturbance(s). 3-phase balanced fault(s) are the most common disturbances in the TSA. In PowerSAS, the TSA supports the analysis of the combinations of multiple faults. To perform transient Stability Analysis, call runPowerSAS in the following way:

res=runPowerSAS('tsa',data,options,varargin)

where options (optional) specifies the options of TSA. When not using customized options, set options=[]. And varargin are the input arguments:

By default, the TSA is run for 10 seconds. To change the simulation length, specify in the options argument, e.g. options=setOptions('simlen',30).

Example can be found in example/ex_tsa.m.

4. Plot dynamic analysis results

PowerSAS provides an integrated and formatted way of plotting the system behavior in the time domain. The function for plotting curves is plotCurves. The function is defined as follows:

function plotCurves(figId,t,stateCurve,SysDataBase,variable,...
                    subIdx,lw,dot,fontSize,width,height,sizeRatio)

The argument list is explained as follows:

V. Citing

If you are using PowerSAS.m in research work to be published, please include explicit citation of our work in your publication. Please place the following entries in your bibliography:

[1]. J. Liu, R. Yao, F. Qiu, Y. Liu and K. Sun, "PowerSAS.m – An Open-Source Power System Simulation Toolbox Based on Semi-Analytical Solution Technologies," in IEEE Open Access Journal of Power and Energy, In Press.

The corresponding BiBTex citations are given below:

@ARTICLE{powersas,
         author={Liu, Jianzhe and Yao, Rui and Qiu, Feng and Liu, Yang and Sun, Kai},
         journal={IEEE Open Access Journal of Power and Energy}, 
         title={{PowerSAS.m} – An Open-Source Power System Simulation Toolbox Based on Semi-Analytical Solution Technologies}, 
         year={2023},
         doi={10.1109/OAJPE.2023.3245040}
        }