Hello Philip

I used the following code to verify the equivalence of the original and
reduced model results.

Regards

Álvaro Jaramillo Duque

define_constants;
mpc = loadcase("your_case")

% compute PF DC
mpc = rundcpf(mpc); % original case
gen_org.pg = sum(mpc.gen(:,PG)); % generation original case

%% give external bus indices
ExBus=[11]'; % input list of external buses (buses to be eliminated)

% reduced case
[mpcreduced,Link,BCIRCr]=MPReduction(mpc,ExBus,0); % call reduction
subroutine

% compute PF DC
mpcreduced = rundcpf(mpcreduced);
gen_fin.pg = sum(mpcreduced.gen(:,PG)); % generation reduced case

% power generated differences, must be close to zero, otherwise something
is wrong
((gen_org.pg - gen_fin.pg)/((gen_org.pg + gen_fin.pg)/2))*100

%% voltage angles differences in the buses
% numerical index
bus_org = mpc.bus(:,BUS_I);
bus_redu = mpcreduced.bus(:,BUS_I);
% keep the binary indices to create two comparable vectors
bus_id_in = ismember(bus_org,bus_redu);
% difference
bus_VA_diff = abs(mpc.bus(bus_id_in,VA) - mpcreduced.bus(:,VA));
plot(bus_VA_diff); % must be close to zero
title('Voltage angles differences in the buses');

Reply via email to