CPF_CURRENT_MPC Construct MPC for current continuation step. MPC = CPF_CURRENT_MPC(MPC_BASE, MPC_TARGET, YBUS, YF, YT, REF, PV, PQ, V, LAM, MPOPT) Constructs the MATPOWER case struct for the current continuation step based on the MPC_BASE and MPC_TARGET cases and the value of LAM.
0001 function mpc = cpf_current_mpc(mpcb, mpc, Ybus, Yf, Yt, ref, pv, pq, V, lam, mpopt) 0002 %CPF_CURRENT_MPC Construct MPC for current continuation step. 0003 % MPC = CPF_CURRENT_MPC(MPC_BASE, MPC_TARGET, YBUS, YF, YT, REF, PV, PQ, V, LAM, MPOPT) 0004 % 0005 % Constructs the MATPOWER case struct for the current continuation step 0006 % based on the MPC_BASE and MPC_TARGET cases and the value of LAM. 0007 0008 % MATPOWER 0009 % Copyright (c) 2016, Power Systems Engineering Research Center (PSERC) 0010 % by Ray Zimmerman, PSERC Cornell 0011 % and Shrirang Abhyankar, Argonne National Laboratory 0012 % 0013 % This file is part of MATPOWER. 0014 % Covered by the 3-clause BSD License (see LICENSE file for details). 0015 % See http://www.pserc.cornell.edu/matpower/ for more info. 0016 0017 %% define named indices into bus, gen, branch matrices 0018 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ... 0019 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus; 0020 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ... 0021 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ... 0022 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen; 0023 0024 %% update bus and gen matrices to reflect the loading and generation 0025 mpc.bus(:, PD) = mpcb.bus(:, PD) + lam * (mpc.bus(:, PD) - mpcb.bus(:, PD)); 0026 mpc.bus(:, QD) = mpcb.bus(:, QD) + lam * (mpc.bus(:, QD) - mpcb.bus(:, QD)); 0027 mpc.gen(:, PG) = mpcb.gen(:, PG) + lam * (mpc.gen(:, PG) - mpcb.gen(:, PG)); 0028 0029 %% update data matrices with solution 0030 [mpc.bus, mpc.gen, mpc.branch] = pfsoln(mpc.baseMVA, mpc.bus, mpc.gen, mpc.branch, Ybus, Yf, Yt, V, ref, pv, pq, mpopt);