Thanks Tobias! I was just about to respond to your first message when I saw 
this. I’ve linked to this from https://github.com/MATPOWER/matpower/issues/38 
so I have it right there when I get some time to try to integrate this into 
makePTDF().

    Ray


On Feb 18, 2020, at 2:07 AM, 
[email protected]<mailto:[email protected]> wrote:

Finally with some more thoughts I figured it out and want to apologize, that I 
asked in the first place.  Now I get for a sample of buses the same PTDF values 
as with the makePTDF function.
Here is my solution, if anyone might be interested:

"
OutmailID: 124387247, List: 'matpower-l', MemberID: 82861091
SCRIPT: "% alternative as in 
https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159
 nb = size(mpc.bus, 1);
 slack_bus = find(mpc.bus(:, BUS_TYPE) == REF); % Ref. slack
 slack = slack_bus;
 noslack = find((1:nb)' ~= slack_bus);
 [Bbus, Bf, Pbusinj, Pfinj] = makeBdc(mpc);
 Bbus(slack, :) = [];   % remove slack row
 Bbus(:, slack) = [];   % remove slack col
 
 for it = 1:numel(exemplary_subSet_slack)
 
     dP = zeros(nb, 1); % init
     dP(slack) = [];   % remove slack
 
 
     i = exemplary_subSet_slack(it);
 
     if i > slack
         i = i-1;
     end
 
     dP(i) = 1;
 
     dx = Bbus \ dP;
 
     dTheta = zeros(nb, 1); % init
 
     dTheta(noslack) = dx;
     H_altern(:,it) = Bf * dTheta;
 end"
TCL MERGE ERROR ( 02/18/2020 17:30:52 ): "syntax error in expression "i": 
variable references require preceding $% slack distribution
slack_weights(1:numel(exemplary_subSet_slack)) = 
1/numel(exemplary_subSet_slack);
v = H_altern * slack_weights';
for k = 1:numel(exemplary_subSet_slack)
    H_newAndDistributed(:, k) = H_altern(:, k) - v;
end

With best regards,
Tobias Hoffmann


Von: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 Im Auftrag von Marwan Ahmed Alasali
Gesendet: Montag, 17. Februar 2020 10:22
An: MATPOWER discussion forum 
<[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Betreff: Re: alternative to makePTDF for a subset of busses (with distributed 
slack)

Dear all,

I want data for IEEE30 bus system

On Mon, 17 Feb 2020 at 14:49, 
<[email protected]<mailto:[email protected]>> wrote:
Dear all,
I would like to calculate the PTDFs of a subset of ~500 nodes for a large 
network of > 10,000 nodes. Since the whole calculation of the PTDF matrix is 
very CPU-intensive (as I have already read in 
https://github.com/MATPOWER/matpower/issues/37 and 
[email protected]/msg05580.html<http://[email protected]/msg05580.html>), I 
tried to orientate myself on this: 
https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159.
Here is my consideration using the example of the test scenario "case30":

mpc = loadcase(case30);
mpc = ext2int(mpc);
"
OutmailID: 124387247, List: 'matpower-l', MemberID: 82861091
SCRIPT: "% Referenz PTDF
 % distributed_slack_setNodes = [1, 7, 15, 24];
 define_constants()
 mpc = loadcase(case30);
 exemplary_subSet_slack = randi(30,1,5);
 weightSlack = zeros(size(mpc.bus,1),1);
 weightSlack(exemplary_subSet_slack) = 1;
 slackForPTDF = weightSlack/numel(exemplary_subSet_slack);
 H_makePTDF = makePTDF(mpc,slackForPTDF);%,slackForPTDF)%,slack);
 H_makePTDF_rel = H_makePTDF(:,exemplary_subSet_slack);"
TCL MERGE ERROR ( 02/18/2020 17:30:52 ): "invalid command name "1,"% 
alternative as in 
https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159
nb = size(mpc.bus, 1);
slack_bus = find(mpc.bus(:, BUS_TYPE) == REF); % Ref. slack
slack = slack_bus;
noslack = find((1:nb)' ~= slack_bus);
[Bbus, Bf, Pbusinj, Pfinj] = makeBdc(mpc);
Bbus(slack, :) = [];   % remove slack row
Bbus(:, slack) = [];   % remove slack col
for it = 1:numel(exemplary_subSet_slack)

    dP = zeros(nb, 1); % init
    dP(slack) = [];   % remove slack


    i = exemplary_subSet_slack(it);
    tmpDistributed_slack_set = exemplary_subSet_slack;
    tmpDistributed_slack_set(it) = [];

    dP(i) = 1;
    j = tmpDistributed_slack_set;
    dP(j) = -1 / numel(j);

    dx = Bbus \ dP;

    dTheta = zeros(nb, 1); % init

    dTheta(noslack) = dx;
    H_altern(:,it) = Bf * dTheta;
end
"
OutmailID: 124387247, List: 'matpower-l', MemberID: 82861091
SCRIPT: "% slack distribution
 slack_weights(1:numel(exemplary_subSet_slack)) = 
1/numel(tmpDistributed_slack_set) - 1/numel(exemplary_subSet_slack);
 v = H_altern * slack_weights';
 for k = 1:numel(exemplary_subSet_slack)
     H_altern_2(:, k) = H_altern(:, k) - v;
 end
 
 Unfortunately, the calculation does not lead to the desired result. I suspect 
my error in the distribution of the slack, but I am not sure.
 I would be very happy about a help. Thanks a lot!
 
 With best regards,
 Tobias Hoffman
 
 
 --
 
 Thanks & Regards
 
 Marwan Ahmed Alasali
 Research Scholar
 Department of Electrical Engineering,
 Aligarh Muslim University, Aligarh
 Contact:+91-9634376962
 [email protected]<mailto:[email protected]>
 [email protected]<mailto:[email protected]>
 skype :  marwan.alaslay
 
  --_000_5E99F7502F324D4380330801FFA0A276cornelledu_ Content-Type: text/html; 
charset="utf-8" Content-ID: 
<[email protected]> 
Content-Transfer-Encoding: base64  <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head>
 <body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: 
after-white-space;" class="">
 Thanks Tobias! I was just about to respond to your first message when I saw 
this. I’ve linked to this from
 <a href="https://github.com/MATPOWER/matpower/issues/38"; 
class="">https://github.com/MATPOWER/matpower/issues/38</a> so I have it right 
there when I get some time to try to integrate this into
 <font face="Courier" class="">makePTDF()</font>.
 <div class=""><br class="">
 </div>
 <div class="">&nbsp; &nbsp; Ray</div>
 <div class=""><br class="">
 </div>
 <div class="">
 <div class="">
 <div><br class="">
 <blockquote type="cite" class="">
 <div class="">On Feb 18, 2020, at 2:07 AM, <a 
href="mailto:[email protected]"; class="">
 [email protected]</a> wrote:</div>
 <br class="Apple-interchange-newline">
 <div class="">
 <div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 
0); font-family: Helvetica; font-size: 12px; font-style: normal; 
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; 
text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
 <div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
 <span lang="EN-GB" class="">Finally with some more thoughts I figured it out 
and want to apologize, that I asked in the first place. &nbsp;Now I get for a 
sample of buses the same PTDF values as with the makePTDF function.<o:p 
class=""></o:p></span></div>
 <div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
 <span lang="EN-GB" class="">Here is my solution, if anyone might be 
interested:</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
 <div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
 <span lang="EN-GB" style="font-size: 12pt; font-family: &quot;Courier 
New&quot;;" class=""><o:p class="">&nbsp;</o:p></span></div>
 <div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
 <span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;; color: forestgreen;" class="">"
TCL MERGE ERROR ( 02/18/2020 17:30:52 ): "wrong # args: should be "for start 
test next command"% alternative as in<span 
class="Apple-converted-space">&nbsp;</span><a 
href="https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159"; 
style="color: purple; text-decoration: underline;" 
class="">https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159</a></span><span
 lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">nb = size(mpc.bus, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack_bus = find(mpc.bus(:, BUS_TYPE) == REF);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">%
 Ref. slack</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack = slack_bus;</span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">noslack = find((1:nb)' ~= slack_bus);</span><span 
lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">[Bbus, Bf, Pbusinj, Pfinj] = makeBdc(mpc);</span><span 
lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">Bbus(slack, :) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack row</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">Bbus(:, slack) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack col</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier 
New&quot;;" class=""><o:p class="">&nbsp;</o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">for</span><span lang="EN-GB" style="font-size: 9pt; 
font-family: &quot;Courier New&quot;;" class=""><span 
class="Apple-converted-space">&nbsp;</span>it = 
1:numel(exemplary_subSet_slack)</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dP = zeros(nb, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% init</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; dP(slack) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;i = 
exemplary_subSet_slack(it);</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;" 
class="">if</span><span lang="EN-GB" style="font-size: 9pt; font-family: 
&quot;Courier New&quot;;" class=""><span 
class="Apple-converted-space">&nbsp;</span>i
 &gt; slack</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = 
i-1;</span><span lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier 
New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;" 
class="">end</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dP(i) = 1;</span><span 
lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dx = Bbus \ dP;</span><span 
lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dTheta = zeros(nb, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">%
 init<span class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dTheta(noslack) = dx;</span><span 
lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier New&quot;;" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; H_altern(:,it) = Bf * 
dTheta;</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">end</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier 
New&quot;;" class=""><o:p class="">&nbsp;</o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">%%% slack distribution</span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack_weights(1:numel(exemplary_subSet_slack)) = 
1/numel(exemplary_subSet_slack);</span><span lang="EN-GB" style="font-size: 
8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">v = H_altern * slack_weights';</span><span lang="EN-GB" 
style="font-size: 8pt; font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">for</span><span lang="EN-GB" style="font-size: 9pt; 
font-family: &quot;Courier New&quot;;" class=""><span 
class="Apple-converted-space">&nbsp;</span>k = 
1:numel(exemplary_subSet_slack)</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; H_newAndDistributed(:, k) = H_altern(:, 
k) - v;</span><span lang="EN-GB" style="font-size: 8pt; font-family: 
&quot;Courier New&quot;;" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">end</span><span lang="EN-GB" style="font-size: 8pt; 
font-family: &quot;Courier New&quot;;" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 8pt; font-family: &quot;Courier 
New&quot;;" class=""><o:p class="">&nbsp;</o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
With best regards,<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
Tobias Hoffmann<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span class=""><o:p class="">&nbsp;</o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span class=""><o:p class="">&nbsp;</o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<b class="">Von:</b><span class="Apple-converted-space">&nbsp;</span><a 
href="mailto:[email protected]"; style="color: purple; 
text-decoration: underline;" 
class="">[email protected]</a><span 
class="Apple-converted-space">&nbsp;</span>&lt;<a 
href="mailto:[email protected]"; style="color: purple; 
text-decoration: underline;" 
class="">[email protected]</a>&gt;<span 
class="Apple-converted-space">&nbsp;</span><b class="">Im
 Auftrag von<span class="Apple-converted-space">&nbsp;</span></b>Marwan Ahmed 
Alasali<br class="">
<b class="">Gesendet:</b><span 
class="Apple-converted-space">&nbsp;</span>Montag, 17.<span 
class="Apple-converted-space">&nbsp;</span><span lang="EN-GB" class="">Februar 
2020 10:22<br class="">
<b class="">An:</b><span class="Apple-converted-space">&nbsp;</span>MATPOWER 
discussion forum &lt;<a href="mailto:[email protected]"; style="color: 
purple; text-decoration: underline;" 
class="">[email protected]</a>&gt;<br class="">
<b class="">Cc:</b><span class="Apple-converted-space">&nbsp;</span><a 
href="mailto:[email protected]"; style="color: purple; text-decoration: 
underline;" class="">[email protected]</a><br class="">
<b class="">Betreff:</b><span class="Apple-converted-space">&nbsp;</span>Re: 
alternative to makePTDF for a subset of busses (with distributed slack)<o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class=""><o:p class="">&nbsp;</o:p></span></div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">Dear all,<o:p class=""></o:p></span></div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class=""><o:p class="">&nbsp;</o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">I want data for IEEE30 bus system<o:p 
class=""></o:p></span></div>
</div>
</div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class=""><o:p class="">&nbsp;</o:p></span></div>
<div class="">
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">On Mon, 17 Feb 2020 at 14:49, &lt;</span><a 
href="mailto:[email protected]"; style="color: purple; 
text-decoration: underline;" class=""><span lang="EN-GB" 
class="">[email protected]</span></a><span lang="EN-GB" 
class="">&gt;
 wrote:<o:p class=""></o:p></span></div>
</div>
<blockquote style="border-style: none none none solid; border-left-width: 1pt; 
border-left-color: rgb(204, 204, 204); padding: 0cm 0cm 0cm 6pt; margin: 5pt 
0cm 5pt 4.8pt;" class="" type="cite">
<div class="">
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">Dear all,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">I would like to calculate the PTDFs of a subset of 
~500 nodes for a large network of &gt; 10,000 nodes. Since the whole 
calculation of the PTDF matrix is very CPU-intensive (as I have already read 
in<span class="Apple-converted-space">&nbsp;</span></span><a 
href="https://github.com/MATPOWER/matpower/issues/37"; target="_blank" 
style="color: purple; text-decoration: underline;" class=""><span lang="EN-GB" 
class="">https://github.com/MATPOWER/matpower/issues/37</span></a><span 
lang="EN-GB" class=""><span class="Apple-converted-space">&nbsp;</span>and
 _</span><a href="http://[email protected]/msg05580.html"; target="_blank" 
style="color: purple; text-decoration: underline;" class=""><span lang="EN-GB" 
class="">[email protected]/msg05580.html</span></a><span lang="EN-GB" 
class="">), I tried to orientate
 myself on this:<span class="Apple-converted-space">&nbsp;</span></span><a 
href="https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159"; 
target="_blank" style="color: purple; text-decoration: underline;" 
class=""><span lang="EN-GB" 
class="">https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159</span></a><span
 lang="EN-GB" class="">.<span class="Apple-converted-space">&nbsp;</span><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">Here is my consideration using the example of the 
test scenario &quot;case30&quot;:<span 
class="Apple-converted-space">&nbsp;</span><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 7pt;" class="">&nbsp;</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">mpc = loadcase(case30);</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">mpc = ext2int(mpc);</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">%%% Referenz PTDF</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">% distributed_slack_setNodes = [1, 7, 15, 
24];</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">define_constants()</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">mpc = loadcase(case30);</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">exemplary_subSet_slack = randi(30,1,5);</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">weightSlack = zeros(size(mpc.bus,1),1);</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">weightSlack(exemplary_subSet_slack) = 1;</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slackForPTDF = 
weightSlack/numel(exemplary_subSet_slack);</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">H_makePTDF = makePTDF(mpc,slackForPTDF);</span><span 
lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">%,slackForPTDF)%,slack);</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">H_makePTDF_rel = 
H_makePTDF(:,exemplary_subSet_slack);</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">%%% alternative as in<span 
class="Apple-converted-space">&nbsp;</span></span><a 
href="https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159"; 
target="_blank" style="color: purple; text-decoration: underline;" 
class=""><span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" 
class="">https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159</span></a><span
 lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">nb = size(mpc.bus, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack_bus = find(mpc.bus(:, BUS_TYPE) == REF);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">%
 Ref. slack</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack = slack_bus;</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">noslack = find((1:nb)' ~= slack_bus);</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">[Bbus, Bf, Pbusinj, Pfinj] = makeBdc(mpc);</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">Bbus(slack, :) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack row</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">Bbus(:, slack) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack col</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">for</span><span lang="EN-GB" style="font-size: 9pt; 
font-family: &quot;Courier New&quot;;" class=""><span 
class="Apple-converted-space">&nbsp;</span>it = 
1:numel(exemplary_subSet_slack)</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dP = zeros(nb, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% init</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; dP(slack) = [];&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: 
forestgreen;" class="">% remove
 slack</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;i = 
exemplary_subSet_slack(it);</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; tmpDistributed_slack_set = 
exemplary_subSet_slack;</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; tmpDistributed_slack_set(it) = 
[];</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;dP(i) = 1;</span><span 
lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; j = 
tmpDistributed_slack_set;</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; dP(j) = -1 / numel(j);<span 
class="Apple-converted-space">&nbsp;</span></span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-size: 
9pt; font-family: &quot;Courier New&quot;;" class="">dx = Bbus \ dP;</span><o:p 
class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;;" 
class="">&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;;" 
class="">&nbsp;&nbsp;&nbsp;&nbsp;dTheta = zeros(nb, 1);<span 
class="Apple-converted-space">&nbsp;</span></span><span style="font-size: 9pt; 
font-family: &quot;Courier New&quot;; color: forestgreen;" class="">% init<span 
class="Apple-converted-space">&nbsp;</span></span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;;" 
class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;;" 
class="">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-GB" style="font-size: 
9pt; font-family: &quot;Courier New&quot;;" class="">dTheta(noslack) = 
dx;</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp; H_altern(:,it) = Bf * 
dTheta;</span><span lang="EN-GB" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">end</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: forestgreen;" class="">%%% slack distribution</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">slack_weights(1:numel(exemplary_subSet_slack)) = 
1/numel(tmpDistributed_slack_set) - 
1/numel(exemplary_subSet_slack);</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">v = H_altern * slack_weights';</span><span lang="EN-GB" 
class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">for</span><span lang="EN-GB" style="font-size: 9pt; 
font-family: &quot;Courier New&quot;;" class=""><span 
class="Apple-converted-space">&nbsp;</span>k = 
1:numel(exemplary_subSet_slack)</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier 
New&quot;;" class="">&nbsp;&nbsp;&nbsp;<span 
class="Apple-converted-space">&nbsp;</span></span><span style="font-size: 9pt; 
font-family: &quot;Courier New&quot;;" class="">H_altern_2(:, k) = H_altern(:, 
k) - v;</span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9pt; font-family: &quot;Courier New&quot;; 
color: blue;" class="">end</span><span lang="EN-GB" class=""><o:p 
class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">&nbsp;<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">Unfortunately, the calculation does not lead to the 
desired result. I suspect my error in the distribution of the slack, but I am 
not sure.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">I would be very happy about a help. Thanks a 
lot!<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">&nbsp;<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">With best regards,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">Tobias Hoffman<o:p class=""></o:p></span></div>
</div>
</div>
</blockquote>
</div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class=""><br clear="all" class="">
<o:p class=""></o:p></span></div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class=""><o:p class="">&nbsp;</o:p></span></div>
</div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" class="">--<span 
class="Apple-converted-space">&nbsp;</span><o:p class=""></o:p></span></div>
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 12pt;" class=""><o:p 
class="">&nbsp;</o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 12pt;" class="">Thanks &amp; Regards<o:p 
class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 12pt;" class=""><o:p 
class="">&nbsp;</o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<b class=""><span lang="EN-GB" style="font-size: 13.5pt; color: blue; 
background-color: white; background-position: initial initial; 
background-repeat: initial initial;" class="">Marwan Ahmed 
Alasali</span></b><span lang="EN-GB" style="font-size: 12pt;" class=""><o:p 
class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9.5pt; color: rgb(136, 136, 136);" 
class="">Research Scholar</span><span lang="EN-GB" style="font-size: 9.5pt;" 
class=""><o:p class=""></o:p></span></div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9.5pt; color: rgb(136, 136, 136);" 
class="">Department of Electrical Engineering,</span><span lang="EN-GB" 
style="font-size: 9.5pt;" class=""><o:p class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span lang="EN-GB" style="font-size: 9.5pt; color: rgb(136, 136, 136);" 
class="">Aligarh Muslim University, Aligarh<br class="">
Contact:&#43;91-9634376962</span><span lang="EN-GB" style="font-size: 9.5pt;" 
class=""><o:p class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<a href="mailto:[email protected]"; target="_blank" style="color: purple; 
text-decoration: underline;" class=""><span lang="EN-GB" style="font-size: 
9.5pt;" class="">[email protected]</span></a><span lang="EN-GB" 
style="font-size: 9.5pt;" class=""><o:p class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<a href="mailto:[email protected]"; target="_blank" style="color: purple; 
text-decoration: underline;" class=""><span lang="EN-GB" style="font-size: 
9.5pt;" class="">[email protected]</span></a><span lang="EN-GB" 
style="font-size: 9.5pt;" class=""><o:p class=""></o:p></span></div>
</div>
<div class="">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, 
sans-serif;" class="">
<span style="font-size: 9.5pt;" class="">skype :&nbsp;</span><span 
style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(84, 102, 
109);" class="">&nbsp;marwan.alaslay</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>

--

Reply via email to