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:

 

%%% 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

 

%%% 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] 
<[email protected]> Im Auftrag von Marwan Ahmed Alasali
Gesendet: Montag, 17. Februar 2020 10:22
An: MATPOWER discussion forum <[email protected]>
Cc: [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, < <mailto:[email protected]> 
[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> 
https://github.com/MATPOWER/matpower/issues/37 and _ 
<http://[email protected]/msg05580.html> [email protected]/msg05580.html), I 
tried to orientate myself on this:  
<https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159> 
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);

%%% 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);

%%% alternative as in  
<https://github.com/MATPOWER/matpower/issues/37#issuecomment-391459159> 
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

%%% 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

 <mailto:[email protected]> [email protected]

 <mailto:[email protected]> [email protected]

skype :  marwan.alaslay

 

 

Reply via email to