-
Notifications
You must be signed in to change notification settings - Fork 11
/
loadTopologyIEEE123.m
51 lines (37 loc) · 12.5 KB
/
loadTopologyIEEE123.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function [nNodes, Y, mappingTerminal2Node, PhA, PhB, PhC, homesPerNode]=loadTopologyIEEE123(DSSObj)
% FUNCTION loadTopology: parse the topology config file and use values
% to initialize variables
% INPUT:
% DSSObj: OpenDSS COM Object used to obtain Ymatrix for the specified model
% OUTPUT:
% nNodes: the number of nodes
% Y: the three-phase nodal admittance matrix
% mappingTerminal2Node: mapping from bus names to node indices
% PhX: a logical vector showing whether a node is connected to phase X
% homesPerNode: the number of homes connected downstream of each node
%Reference the circuit for the interface
DSSCircuit = DSSObj.ActiveCircuit;
% Topology
NodeList = DSSCircuit.YNodeOrder;
nNodes = length(NodeList);
keySet = {'150.1','150.2','150.3','150r.1','150r.2','150r.3','149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','9r.1','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','25r.1','25r.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','300.1','300.2','300.3','110.1','111.1','112.1','113.1','114.1','135.1','135.2','135.3','152.1','152.2','152.3','160r.1','160r.2','160r.3','160.1','160.2','160.3','61s.1','61s.2','61s.3','94_open.1','610.1','610.2','610.3'};
% keySet = {'150.1','150.2','150.3','150r.1','150r.2','150r.3','149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','9r.1','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','25r.1','25r.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','300.1','300.2','300.3','110.1','111.1','112.1','113.1','114.1','135.1','135.2','135.3','152.1','152.2','152.3','160r.1','160r.2','160r.3','160.1','160.2','160.3','61s.1','61s.2','61s.3','300_open.1','300_open.2','300_open.3','94_open.1','610.1','610.2','610.3'};
% keySet = {'150.1','150.2','150.3','150r.1','150r.2','150r.3','149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','9r.1','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','25r.1','25r.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','300.1','300.2','300.3','110.1','111.1','112.1','113.1','114.1','135.1','135.2','135.3','152.1','152.2','152.3','160r.1','160r.2','160r.3','160.1','160.2','160.3','61s.1','61s.2','61s.3','610.1','610.2','610.3'};
valueArray = 1:nNodes;
mappingTerminal2Node = containers.Map(keySet,valueArray);
PhA = zeros(1,nNodes);
PhB = zeros(1,nNodes);
PhC = zeros(1,nNodes);
% polyphase nodal admittace matrix
Y = constructYMatrix(DSSObj);
% Loads
homesPerNode = zeros(1,nNodes);
% loadBuses = {'149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','300.1','300.2','300.3','110.1','111.1','112.1','113.1','114.1','135.1','135.2','135.3','152.1','152.2','152.3','160.1','160.2','160.3','610.1','610.2','610.3','300_open.1','300_open.2','300_open.3','94_open.1'};
loadBuses = {'149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','110.1','111.1','112.1','113.1','114.1','135.1','135.2','135.3','160.1','160.2','160.3','610.1','610.2','610.3'};
% loadBuses = {'149.1','149.2','149.3','1.1','1.2','1.3','2.2','3.3','7.1','7.2','7.3','4.3','5.3','6.3','8.1','8.2','8.3','12.2','9.1','13.1','13.2','13.3','14.1','34.3','18.1','18.2','18.3','11.1','10.1','15.3','16.3','17.3','19.1','21.1','21.2','21.3','20.1','22.2','23.1','23.2','23.3','24.3','25.1','25.2','25.3','26.1','26.3','28.1','28.2','28.3','27.1','27.3','31.3','33.1','29.1','29.2','29.3','30.1','30.2','30.3','250.1','250.2','250.3','32.3','35.1','35.2','36.1','36.2','35.3','40.1','40.2','40.3','37.1','38.2','39.2','41.3','42.1','42.2','42.3','43.2','44.1','44.2','44.3','45.1','47.1','47.2','47.3','46.1','48.1','48.2','48.3','49.1','49.2','49.3','50.1','50.2','50.3','51.1','51.2','51.3','151.1','151.2','151.3','52.1','52.2','52.3','53.1','53.2','53.3','54.1','54.2','54.3','55.1','55.2','55.3','57.1','57.2','57.3','56.1','56.2','56.3','58.2','60.1','60.2','60.3','59.2','61.1','61.2','61.3','62.1','62.2','62.3','63.1','63.2','63.3','64.1','64.2','64.3','65.1','65.2','65.3','66.1','66.2','66.3','67.1','68.1','67.2','67.3','72.1','72.2','72.3','97.1','97.2','97.3','69.1','70.1','71.1','73.3','76.1','76.2','76.3','74.3','75.3','77.1','77.2','77.3','86.1','86.2','86.3','78.1','78.2','78.3','79.1','79.2','79.3','80.1','80.2','80.3','81.1','81.2','81.3','82.1','82.2','82.3','84.3','83.1','83.2','83.3','85.3','87.1','87.2','87.3','88.1','89.1','89.2','89.3','90.2','91.1','91.2','91.3','92.3','93.1','93.2','93.3','94.1','95.1','95.2','95.3','96.2','98.1','98.2','98.3','99.1','99.2','99.3','100.1','100.2','100.3','450.1','450.2','450.3','197.1','197.2','197.3','101.1','101.2','101.3','102.3','105.1','105.2','105.3','103.3','104.3','106.2','108.1','108.2','108.3','107.2','109.1','110.1','111.1','112.1','113.1','114.1','160.1','160.2','160.3','610.1','610.2','610.3'};
% display(setdiff(keySet, loadBuses))
for i=1:length(loadBuses)
% the number of homes connected to a node is drawn from a uniform
% distrbution between 5 and 15
homesPerNode(mappingTerminal2Node(cell2mat(loadBuses(i)))) = randi([5 10],1,1);
end