% Delivered to the U.S. Government in Accordance with Contract FA8650-10-C-7080.
% 
%
% (c) 2011 United Technologies Corp.
% Developed with the sponsorship of the Defense Advanced Research Projects Agency (DARPA).
% Permission is hereby granted, free of charge, to any person obtaining a copy of this data,
% including any software or models in source or binary form, as well as any drawings, 
% specifications, and documentation (collectively "the Data"), to deal in the Data without 
% restriction, including without limitation the rights to use, copy, modify, merge, publish,
% distribute, sublicense, and/or sell copies of the Data, and to permit persons to whom the Data
% is furnished to do so, subject to the following conditions:
%  
% The above copyright notice and this permission notice shall be included in all copies or
% substantial portions of the Data.
%  
% THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
% BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR
% COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE
% USE OR OTHER DEALINGS IN THE DATA.

% Authors:  Fernando Rodriguez                      John Finn
%           Sr Engineer/Scientist                   Contractor
%           Power Electronics Systems               Embedded Systems & Networks
%           United Technologies Research Center     United Technologies Research Center
%           411 Silver Lane                         411 Silver Lane
%           East Hartford,CT 06108                  East Hartford,CT 06108
%           rodrigf@utrc.utc.com                    ccfinnje@utrc.utc.com
%           tel: (860) 610-7102                     tel: +1 860-610-7696
%%

function [Source_data, TL_data, SW_data, Load_data, Conv_data] = topologyRev03_12L
    % Boeing 777, 36 load topology without converters, with only one GEN
    clear all
    close all
    clc

    %% sources
    %                            --Power--
    %              Bus #, EPS #, WATT, VAR,  
    Source_data = [    1,     1,    0,   0];  % Gen 1

    %% transmission lines
    % TL impedance/ft in ohms @ 400Hz
    RTL = 6.31e-4;  LTL = 5.65e-8;         
    TL_Z = (RTL+1i*LTL); 
    TL=20*ones(1,68)*TL_Z;
    TL(1) = 0.02 + 2/(2*pi*400)*1i;
    %          TL #, EPS #, Bus 1, Bus 2,     Z
    TL_data = [   1,     1,     1,     2,  TL(1);
                  3,     1,     3,     4,  TL(3);
                  5,     1,     3,     5,  TL(5);      
                  8,     1,     3,     6,  TL(8);
                  9,     1,     7,    10,  TL(9);
                 10,     1,     7,    11,  TL(10);
                 11,     1,     7,    12,  TL(11);
                 12,     1,     7,    13,  TL(12);
                 13,     1,     7,    14,  TL(13);
                 14,     1,     7,    15,  TL(14);
                 15,     1,     8,    16,  TL(15);
                 16,     1,     8,    17,  TL(16);
                 17,     1,     8,    18,  TL(17);
                 24,     1,     9,    19,  TL(24);
                 25,     1,     9,    20,  TL(25);
                 26,     1,     9,    21,  TL(26);
                 27,     1,    18,    30,  TL(27);
                 28,     1,    21,    33,  TL(28);
                 29,     1,    30,    34,  TL(29);
                 30,     1,    33,    35,  TL(30)];

    %% Switches
    SW_Z = 0.2e-3;  % SW impedance in ohms  
    SW=ones(1,58)*SW_Z;
    %          SW #, EPS #, Bus 1, Bus 2,     Z
    SW_data = [   1,     1,     2,     3,  SW(1);
                  2,     1,     4,     7,  SW(2);
                  4,     1,     5,     8,  SW(4);
                  7,     1,     6,     9,  SW(7);
                  8,     1,    10,    22,  SW(8);
                  9,     1,    11,    23,  SW(9);
                 10,     1,    12,    24,  SW(10);
                 11,     1,    13,    25,  SW(11);
                 12,     1,    14,    26,  SW(12);
                 13,     1,    15,    27,  SW(13);       
                 14,     1,    16,    28,  SW(14);
                 15,     1,    17,    29,  SW(15);
                 22,     1,    19,    31,  SW(22);
                 23,     1,    20,    32,  SW(23);
                 24,     1,    34,    36,  SW(24);
                 25,     1,    35,    37,  SW(25)];
    %% Loads
    
    % rms voltage and fundamental frequency
    Vm = 115;
    f = 400;
    
    % cruise power of each load (kVA)
    Cruise = [2.56;
              2.56;
              6;
              6;
              2.56;
              2.56;
              2.6;
              2.6;
              4.64;
              4.64;
              7.04;
              7.04;
              14.24;
              14.24;
              0.8;
              0.8;
              6.08;
              6.08;
              2.56;
              2.56;
              6;
              6;
              2.56;
              2.56;
              2.6;
              2.6;
              4.64;
              4.64;
              7.04;
              7.04;
              14.24;
              14.24;
              0.8;
              0.8;
              6.08;
              6.08];
    Cruise = 1000.*Cruise;
    
    % power factors
    pf = [0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.90;
          0.90;
          0.90;
          0.90;
          0.90;
          0.90;
          0.97;
          0.97;
          1.00;
          1.00;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.97;
          0.90;
          0.90;
          0.90;
          0.90;
          0.90;
          0.90;
          0.97;
          0.97;
          1.00;
          1.00];      
          
    RLD = Vm^2./(pf.*Cruise);
    LLD = Vm^2./((1 - pf).*Cruise*2*pi*f);
    
    % Load i is DC (pf = 1), then LLDi = 0 H           
    for i = 1 : length(LLD)
        if pf(i) == 1
            LLD(i) = 0;
        end
    end
    
    %          Bus #, Bus Code,  Re(Z),  Im(Z);   Load #
    Load_data =  [22,        0,  RLD(1),  LLD(1);  % 1
                  23,        0,  RLD(3),  LLD(3);  % 3
                  24,        0,  RLD(5),  LLD(5);  % 5
                  25,        0,  RLD(7),  LLD(7);  % 7
                  26,        0,  RLD(9),  LLD(9);  % 9
                  27,        0, RLD(11), LLD(11);  % 11
                  28,        0, RLD(13), LLD(13);  % 13
                  29,        0, RLD(15), LLD(15);  % 15
                  36,        0, RLD(17), LLD(17);  % 17
                  31,        0, RLD(31), LLD(31);  % 31
                  32,        0, RLD(33), LLD(33);  % 33
                  37,        0, RLD(35), LLD(35)]; % 35
	disp([[1:1:length(Load_data(:,3))]',115*sqrt(2)./Load_data(:,3)])
%% Converters

%                          EPS  EPS
%           Conv Bus  bus Code Code  conv    
%             no  in  out  in   out   eff                      
Conv_data =  [  0   0    0   0     0     0];
end