Home > matpower5.0 > psse_convert_hvdc.m

psse_convert_hvdc

PURPOSE ^

PSSE_CONVERT_HVDC Convert HVDC data from PSS/E RAW to MATPOWER

SYNOPSIS ^

function dcline = psse_convert_hvdc(dc, bus)

DESCRIPTION ^

PSSE_CONVERT_HVDC Convert HVDC data from PSS/E RAW to MATPOWER
   DCLINE = PSSE_CONVERT_HVDC(DC, BUS)

   Convert all two terminal HVDC line data read from a PSS/E
   RAW data file into MATPOWER format. Returns a dcline matrix for
   inclusion in a MATPOWER case struct.

   Inputs:
       DC  : matrix of raw two terminal HVDC line data returned by
             PSSE_READ in data.twodc.num
       BUS : MATPOWER bus matrix

   Output:
       DCLINE : a MATPOWER dcline matrix suitable for inclusion in
                a MATPOWER case struct.

   See also PSSE_CONVERT.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function dcline = psse_convert_hvdc(dc, bus)
0002 %PSSE_CONVERT_HVDC Convert HVDC data from PSS/E RAW to MATPOWER
0003 %   DCLINE = PSSE_CONVERT_HVDC(DC, BUS)
0004 %
0005 %   Convert all two terminal HVDC line data read from a PSS/E
0006 %   RAW data file into MATPOWER format. Returns a dcline matrix for
0007 %   inclusion in a MATPOWER case struct.
0008 %
0009 %   Inputs:
0010 %       DC  : matrix of raw two terminal HVDC line data returned by
0011 %             PSSE_READ in data.twodc.num
0012 %       BUS : MATPOWER bus matrix
0013 %
0014 %   Output:
0015 %       DCLINE : a MATPOWER dcline matrix suitable for inclusion in
0016 %                a MATPOWER case struct.
0017 %
0018 %   See also PSSE_CONVERT.
0019 
0020 %   MATPOWER
0021 %   $Id: psse_convert_hvdc.m 2370 2014-07-30 16:06:04Z ray $
0022 %   by Yujia Zhu, PSERC ASU
0023 %   and Ray Zimmerman, PSERC Cornell
0024 %   Based on mpdcin.m and mpqhvdccal.m, written by:
0025 %       Yujia Zhu, Jan 2014, yzhu54@asu.edu.
0026 %   Copyright (c) 2014 by Power System Engineering Research Center (PSERC)
0027 %
0028 %   This file is part of MATPOWER.
0029 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0030 %
0031 %   MATPOWER is free software: you can redistribute it and/or modify
0032 %   it under the terms of the GNU General Public License as published
0033 %   by the Free Software Foundation, either version 3 of the License,
0034 %   or (at your option) any later version.
0035 %
0036 %   MATPOWER is distributed in the hope that it will be useful,
0037 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0038 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0039 %   GNU General Public License for more details.
0040 %
0041 %   You should have received a copy of the GNU General Public License
0042 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0043 %
0044 %   Additional permission under GNU GPL version 3 section 7
0045 %
0046 %   If you modify MATPOWER, or any covered work, to interface with
0047 %   other modules (such as MATLAB code and MEX-files) available in a
0048 %   MATLAB(R) or comparable environment containing parts covered
0049 %   under other licensing terms, the licensors of MATPOWER grant
0050 %   you additional permission to convey the resulting work.
0051 
0052 %% define named indices into bus, gen, branch matrices
0053 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0054     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0055 c = idx_dcline;
0056 
0057 nb = size(bus, 1);
0058 ndc = size(dc, 1);
0059 e2i = sparse(bus(:, BUS_I), ones(nb, 1), 1:nb, max(bus(:, BUS_I)), 1);
0060 if ~ndc
0061     dcline = [];
0062     return;
0063 end
0064 
0065 %% extract data
0066 MDC = dc(:,2); % Control mode
0067 SETVL = dc(:,4); % depend on control mode: current or power demand
0068 VSCHD = dc(:,5); % scheduled compounded dc voltage
0069 ANMXR = dc(:,15); % nominal maximum rectifier firing angle
0070 ANMNR = dc(:,16); % nominal minimum rectifier firing angle
0071 GAMMX = dc(:,32); % nominal maximum inverter firing angle
0072 GAMMN = dc(:,33); % nominal minimum inverter firing angle
0073 SETVL = abs(SETVL);
0074 % Convert the voltage on rectifier side and inverter side
0075 % The value is calculated as basekV/VSCHD
0076 % basekV is the bus base voltage, VSCHD is the scheduled compounded
0077 % voltage
0078 dcline = zeros(ndc, c.LOSS1); % initiate the hvdc data format
0079 indr = dc(:,13); % rectifier end bus number
0080 indi = dc(:,30); % inverter end bus number
0081 dcind = [indr indi]; 
0082 % bus nominal voltage
0083 Vr = bus(e2i(indr), VM);
0084 Vi = bus(e2i(indi), VM);
0085 %% Calculate the real power input at the from end
0086 PMW = zeros(ndc, 1);
0087 for i = 1:ndc
0088     if MDC(i) == 1
0089         PMW(i) = SETVL(i); % SETVL is the desired real power demand
0090     elseif MDC(i) == 2;
0091         PMW(i) = SETVL(i)*VSCHD(i)/1000; % SETVL is the current in amps (need devide 1000 to convert to MW)
0092     else PMW(i) = 0;
0093     end
0094 end
0095 %% calculate reactive power limits
0096 [Qrmin,Qrmax] = psse_convert_hvdc_Qlims(ANMXR,ANMNR,PMW);    %% rectifier end
0097 [Qimin,Qimax] = psse_convert_hvdc_Qlims(GAMMX,GAMMN,PMW);    %% inverter end
0098 %% calculate the loss coefficient (Only consider the l1)
0099 % l1 = P'.*RDC;
0100 
0101 %% conclude all info
0102 status = ones(ndc, 1);
0103 status(MDC==0) = 0;     %% set status of blocked HVDC lines to zero
0104 % dcline(:,[1 2 3 4 5 8 9 10 11 12 13 14 15]) = [indr,indi,status,PMW, PMW, Vr, Vi,0.85*PMW, 1.15*PMW, Qrmin, Qrmax, Qimin, Qimax];
0105 dcline(:, [c.F_BUS c.T_BUS c.BR_STATUS c.PF c.PT c.VF c.VT ...
0106             c.PMIN c.PMAX c.QMINF c.QMAXF c.QMINT c.QMAXT]) = ...
0107     [indr indi status PMW PMW Vr Vi 0.85*PMW 1.15*PMW Qrmin Qrmax Qimin Qimax];
0108 
0109 
0110 function [Qmin, Qmax] = psse_convert_hvdc_Qlims(alphamax,alphamin,P)
0111 %PSSE_CONVERT_HVDC_QLIMS calculate HVDC line reactive power limits
0112 %
0113 %   [Qmin, Qmax] = psse_convert_hvdc_Qlims(alphamax,alphamin,P)
0114 %
0115 % Inputs:
0116 %       alphamax :  maximum firing angle
0117 %       alphamin :  minimum steady-state rectifier firing angle
0118 %       P :         real power demand
0119 % Outputs:
0120 %       Qmin :  lower limit of reactive power
0121 %       Qmax :  upper limit of reactive power
0122 %
0123 % Note:
0124 %   This function calculates the reactive power at the rectifier or inverter
0125 %   end. It is assumed the maximum overlap angle is 60 degree (see
0126 %   Kimbark's book). The maximum reactive power is calculated with the
0127 %   power factor:
0128 %       pf = acosd(0.5*(cosd(alphamax(i))+cosd(60))),
0129 %   where, 60 is the maximum delta angle.
0130 
0131 len = length(alphamax);
0132 phi = zeros(size(alphamax));
0133 Qmin = phi;
0134 Qmax = phi;
0135 for i = 1:len
0136     %% minimum reactive power calculated under assumption of no overlap angle
0137     %% i.e. power factor equals to tan(alpha)
0138     Qmin(i) = P(i)*tand(alphamin(i));
0139 
0140     %% maximum reactive power calculated when overlap angle reaches max
0141     %% value (60 deg). I.e.
0142     %%      cos(phi) = 1/2*(cos(alpha)+cos(delta))
0143     %%      Q = P*tan(phi)
0144     phi(i) = acosd(0.5*(cosd(alphamax(i))+cosd(60)));
0145     Qmax(i) = P(i)*tand(phi(i));
0146     if Qmin(i)<0
0147         Qmin(i) = -Qmin(i);
0148     end
0149     if Qmax(i)<0
0150         Qmax(i) = -Qmax(i);
0151     end
0152 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005