Hello, I recently encountered some unexpected behaviour using the makePTDF function and wasn't sure if it was working as intended.
I have quite a large grid (22000 branches and 15000 buses) divided up into 21 areas. I would like to calculate the PTDF of the grid so that the slack for a given bus is equally distributed among all the buses outside of the area the bus in question belongs to. So if bus 1 belongs to area A the slack for the calculation of the PTDF for bus 1 should be equally distributed among the buses that are not inside area A. Making use of the functionalities implemented in matpower 7.1 I could write a for-loop and create the appropriate slack column with weights for each bus and then call makePTDF like: H = MAKEPTDF(MPC, SLACK, BUS_IDX) % SLACK is nb x 1 which is unfortunately very time consuming. It should be able to prepare a slack matrix of size nb x nb, where nb is the number of buses in the system, where each column represents the weights of the slack for the given bus. So basically taking the column vectors of the for-loop approach and concatenating them horizontally. However, I'm not sure the makePTDF function performs the calculation correctly when calling H = MAKEPTDF(MPC, SLACK) % SLACK is nb x nb with a slack matrix. Line 183 of the current version of makePTDF does 183 H = H * slack; which differs from the implementation for a column slack in lines 165-181 where it basically does 171 v = H * slack; 172 for k = 1:nb 173 H(:, k) = H(:, k) - v; 174 end I believe line 183 should be rewritten to do something similar to lines 171-174 as in: H = H - H * slack; This delivers the same result as the first calculation with a for-loop and a column vector. Moreover, when working with a column slack, the function makes sure the weights in the vector are normalized at line 165: 165 slack = slack/sum(slack); %% normalize weights However, when handling a matrix slack, no normalization is performed. This could be solved by adding a line before line 183 such as: slack = slack ./ sum(slack); %% normalize weights for each column If that were the case the normalization would be performed for every case with a distributed slack, meaning this line would be valid for both a column and a matrix slack and could be moved higher between both if clauses in lines 163-164, rendering: 163 if length(slack) ~= 1 && ~txfr slack = slack ./ sum(slack); %% normalize weights 164 if size(slack, 2) == 1 %% slack is a vector of weights If the current implementation at line 183 is indeed correct, I would deeply appreciate some help understanding the meaning of the calculation, because so far I cannot get a grasp of it. If you need any additional information, a working example or if I should create an issue on Github, please let me know and I will gladly do so. I have attached the outcome of mpver in a txt file for further context. Thank you very much for the amazing toolbox you have created. Kind regards, Jon Martinez Corral Amprion GmbH Transmission System Operation System Analysis Von-Werth-Str. 274, 50259 Pulheim T +49 2234 85-55422 M +49 174 2183826 jon.martinezcor...@amprion.net<mailto:jon.martinezcor...@amprion.net> www.amprion.net<http://www.amprion.net/> Information on data protection<https://www.amprion.net/data-protection/> Aufsichtsrat/Supervisory Board: Uwe Tigges (Vorsitzender/Chairman) Geschäftsführung/Executive Directors: Dr Hans-Jürgen Brick (Vorsitzender/Chairman), Dr Hendrik Neumann, Peter Rüth Sitz der Gesellschaft/Company domicile: Dortmund - Eingetragen beim/Registered at Amtsgericht Dortmund - Handelsregister-Nr./Commercial Register no. HRB 15940
MATPOWER Version 7.1 08-Oct-2020 MATLAB Version 9.9 29-Jul-2020 Release: (R2020b) Optimization Toolbox Version 9.0 29-Jul-2020 Release: (R2020b) MP-Test Version 7.1 08-Oct-2020 MIPS Version 1.4 08-Oct-2020 MP-Opt-Model Version 3.0 08-Oct-2020 MOST Version 1.1 08-Oct-2020 SDP_PF -- not installed -- SynGrid Version 1.0.1 20-Jun-2019 Artelys Knitro -- not installed -- BPMPD_MEX -- not installed -- CLP -- not installed -- CPLEX -- not installed -- GLPK -- not installed -- Gurobi -- not installed -- IPOPT -- not installed -- MINOPF -- not installed -- MOSEK -- not installed -- OSQP -- not installed -- PARDISO -- not installed -- PDIPMOPF -- not installed -- SCPDIPMOPF -- not installed -- SDPT3 -- not installed -- SeDuMi -- not installed -- TRALMOPF -- not installed -- YALMIP -- not installed -- Architecture: PCWIN64 MATPOWER 7.1 is distributed under the 3-clause BSD License. Please see the LICENSE file for details.