Home > matpower7.0 > lib > makeSdzip.m

makeSdzip

PURPOSE ^

MAKESDZIP Builds vectors of nominal complex bus power demands for ZIP loads.

SYNOPSIS ^

function Sd = makeSdzip(baseMVA, bus, mpopt)

DESCRIPTION ^

MAKESDZIP   Builds vectors of nominal complex bus power demands for ZIP loads.
   SD = MAKESDZIP(BASEMVA, BUS, MPOPT) returns a struct with three fields,
   each an nb x 1 vectors. The fields 'z', 'i' and 'p' correspond to the
   nominal p.u. complex power (at 1 p.u. voltage magnitude) of the constant
   impedance, constant current, and constant power portions, respectively of
   the ZIP load model.

   Example:
       Sd = makeSdzip(baseMVA, bus, mpopt);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Sd = makeSdzip(baseMVA, bus, mpopt)
0002 %MAKESDZIP   Builds vectors of nominal complex bus power demands for ZIP loads.
0003 %   SD = MAKESDZIP(BASEMVA, BUS, MPOPT) returns a struct with three fields,
0004 %   each an nb x 1 vectors. The fields 'z', 'i' and 'p' correspond to the
0005 %   nominal p.u. complex power (at 1 p.u. voltage magnitude) of the constant
0006 %   impedance, constant current, and constant power portions, respectively of
0007 %   the ZIP load model.
0008 %
0009 %   Example:
0010 %       Sd = makeSdzip(baseMVA, bus, mpopt);
0011 
0012 %   MATPOWER
0013 %   Copyright (c) 2015-2016, Power Systems Engineering Research Center (PSERC)
0014 %   by Shrirang Abhyankar
0015 %   and Ray Zimmerman, PSERC Cornell
0016 %
0017 %   This file is part of MATPOWER.
0018 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0019 %   See https://matpower.org for more info.
0020 
0021 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0022     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0023 
0024 if nargin < 3
0025     mpopt = [];
0026 end
0027 if ~isempty(mpopt) && ~isempty(mpopt.exp.sys_wide_zip_loads.pw)
0028     if any(size(mpopt.exp.sys_wide_zip_loads.pw) ~= [1 3])
0029         error('makeSdzip: ''exp.sys_wide_zip_loads.pw'' must be a 1 x 3 vector');
0030     end
0031     if abs(sum(mpopt.exp.sys_wide_zip_loads.pw) - 1) > eps
0032         error('makeSdzip: elements of ''exp.sys_wide_zip_loads.pw'' must sum to 1');
0033     end
0034     pw = mpopt.exp.sys_wide_zip_loads.pw;
0035 else
0036     pw = [1 0 0];
0037 end
0038 if ~isempty(mpopt) && ~isempty(mpopt.exp.sys_wide_zip_loads.qw)
0039     if any(size(mpopt.exp.sys_wide_zip_loads.qw) ~= [1 3])
0040         error('makeSdzip: ''exp.sys_wide_zip_loads.qw'' must be a 1 x 3 vector');
0041     end
0042     if abs(sum(mpopt.exp.sys_wide_zip_loads.qw) - 1) > eps
0043         error('makeSdzip: elements of ''exp.sys_wide_zip_loads.qw'' must sum to 1');
0044     end
0045     qw = mpopt.exp.sys_wide_zip_loads.qw;
0046 else
0047     qw = pw;
0048 end
0049 
0050 Sd.z = (bus(:, PD) * pw(3)  + 1j * bus(:, QD) * qw(3)) / baseMVA;
0051 Sd.i = (bus(:, PD) * pw(2)  + 1j * bus(:, QD) * qw(2)) / baseMVA;
0052 Sd.p = (bus(:, PD) * pw(1)  + 1j * bus(:, QD) * qw(1)) / baseMVA;

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005