D2AIBR_DV2 Computes 2nd derivatives of |complex current|^2 w.r.t. V. ----- DEPRECATED - Please use D2ABR_DV2 instead ----- ----- See wrapper code in D2AIBR_DV2 for example. ----- The derivatives can be take with respect to polar or cartesian coordinates of voltage, depending on the 8th argument. [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU) [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU, 0) Returns 4 matrices containing the partial derivatives w.r.t. voltage angle and magnitude of the product of a vector MU with the 1st partial derivatives of the square of the magnitude the branch currents. [HRR, HRI, HIR, HII] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU, 1) Returns 4 matrices containing the partial derivatives w.r.t. real and imaginary part of complex voltage of the product of a vector MU with the 1st partial derivatives of the square of the magnitude the branch currents. Takes as inputs sparse first derivative matrices of complex current, complex current vector, sparse branch admittance matrix YBR, voltage vector V and nl x 1 vector of multipliers MU. Output matrices are sparse. Example: f = branch(:, F_BUS); [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch); [dIf_dV1, dIf_dV2, dIt_dV1, dIt_dV2, If, It] = ... dIbr_dV(branch, Yf, Yt, V, vcart); Ybr = Yf; dIbr_dV1 = dIf_dV1; dIbr_dV2 = dIf_dV2; Ibr = If; [H11, H12, H21, H22] = ... d2AIbr_dV2(dIbr_dV1, dIbr_dV2, Ibr, Ybr, V, mu, vcart); Here the output matrices correspond to: H11 = d/dV1 (dAIbr_dV1.' * mu) H12 = d/dV2 (dAIbr_dV1.' * mu) H21 = d/dV1 (dAIbr_dV2.' * mu) H22 = d/dV2 (dAIbr_dV2.' * mu) See also DIBR_DV, DABR_DV. For more details on the derivations behind the derivative code used in MATPOWER information, see: [TN2] R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and their Derivatives using Complex Matrix Notation", MATPOWER Technical Note 2, February 2010. [Online]. Available: https://matpower.org/docs/TN2-OPF-Derivatives.pdf doi: 10.5281/zenodo.3237866
0001 function [H11, H12, H21, H22] = ... 0002 d2AIbr_dV2(dIbr_dV1, dIbr_dV2, Ibr, Ybr, V, mu, vcart) 0003 %D2AIBR_DV2 Computes 2nd derivatives of |complex current|^2 w.r.t. V. 0004 % 0005 % ----- DEPRECATED - Please use D2ABR_DV2 instead ----- 0006 % ----- See wrapper code in D2AIBR_DV2 for example. ----- 0007 % 0008 % The derivatives can be take with respect to polar or cartesian coordinates 0009 % of voltage, depending on the 8th argument. 0010 % 0011 % [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU) 0012 % [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU, 0) 0013 % 0014 % Returns 4 matrices containing the partial derivatives w.r.t. voltage 0015 % angle and magnitude of the product of a vector MU with the 1st partial 0016 % derivatives of the square of the magnitude the branch currents. 0017 % 0018 % [HRR, HRI, HIR, HII] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, MU, 1) 0019 % 0020 % Returns 4 matrices containing the partial derivatives w.r.t. real and 0021 % imaginary part of complex voltage of the product of a vector MU with the 0022 % 1st partial derivatives of the square of the magnitude the branch currents. 0023 % 0024 % Takes as inputs sparse first derivative matrices of complex current, 0025 % complex current vector, sparse branch admittance matrix YBR, voltage 0026 % vector V and nl x 1 vector of multipliers MU. Output matrices are sparse. 0027 % 0028 % Example: 0029 % f = branch(:, F_BUS); 0030 % [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch); 0031 % [dIf_dV1, dIf_dV2, dIt_dV1, dIt_dV2, If, It] = ... 0032 % dIbr_dV(branch, Yf, Yt, V, vcart); 0033 % Ybr = Yf; 0034 % dIbr_dV1 = dIf_dV1; 0035 % dIbr_dV2 = dIf_dV2; 0036 % Ibr = If; 0037 % [H11, H12, H21, H22] = ... 0038 % d2AIbr_dV2(dIbr_dV1, dIbr_dV2, Ibr, Ybr, V, mu, vcart); 0039 % 0040 % Here the output matrices correspond to: 0041 % H11 = d/dV1 (dAIbr_dV1.' * mu) 0042 % H12 = d/dV2 (dAIbr_dV1.' * mu) 0043 % H21 = d/dV1 (dAIbr_dV2.' * mu) 0044 % H22 = d/dV2 (dAIbr_dV2.' * mu) 0045 % 0046 % See also DIBR_DV, DABR_DV. 0047 % 0048 % For more details on the derivations behind the derivative code used 0049 % in MATPOWER information, see: 0050 % 0051 % [TN2] R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and 0052 % their Derivatives using Complex Matrix Notation", MATPOWER 0053 % Technical Note 2, February 2010. [Online]. Available: 0054 % https://matpower.org/docs/TN2-OPF-Derivatives.pdf 0055 % doi: 10.5281/zenodo.3237866 0056 0057 % MATPOWER 0058 % Copyright (c) 2008-2019, Power Systems Engineering Research Center (PSERC) 0059 % by Ray Zimmerman, PSERC Cornell 0060 % 0061 % This file is part of MATPOWER. 0062 % Covered by the 3-clause BSD License (see LICENSE file for details). 0063 % See https://matpower.org for more info. 0064 0065 %% default input args 0066 if nargin < 7 0067 vcart = 0; %% default to polar coordinates 0068 end 0069 0070 d2F_dV2 = @(V, mu)d2Ibr_dV2(Ybr, V, mu, vcart); 0071 [H11, H12, H21, H22] = d2Abr_dV2(d2F_dV2, dIbr_dV1, dIbr_dV2, Ibr, V, mu);