I need to calculate the minimum and maximum values of real power injection at each bus.
Sbus = V .* conj(Ybus * V); P_bus = real(Sbus); Q_bus = imag(Sbus); for i=1:length(P_bus) if P_bus(i)>0 P_inj_max(i,:) = P_bus(i,:)+0.05*P_bus(i,:); P_inj_min(i,:) = P_bus(i,:)-0.05*P_bus(i,:); else P_inj_max(i,:) = P_bus(i,:)-0.05*P_bus(i,:); P_inj_min(i,:) = P_bus(i,:)+0.05*P_bus(i,:); end end for i=1:length(Q_bus) if Q_bus(i)>0 Q_inj_max(i,:) = Q_bus(i,:)+0.05*Q_bus(i,:); Q_inj_min(i,:) = Q_bus(i,:)-0.05*Q_bus(i,:); else Q_inj_max(i,:) = Q_bus(i,:)-0.05*Q_bus(i,:); Q_inj_min(i,:) = Q_bus(i,:)+0.05*Q_bus(i,:); end end On Thu, Oct 13, 2022 at 1:33 AM Ray Daniel Zimmerman <r...@cornell.edu> wrote: > I’m afraid I don’t understand what you are trying to calculate. > > Ray > > > On Oct 11, 2022, at 11:22 AM, naime ahmadi <naimeahm...@gmail.com> wrote: > > Hello, > I want to solve the optimization function for calculating voltage. > As a constraint, I need to calculate each bus's minimum and maximum values > of real and reactive power injection. > here is the calculation: > Pfe=branch(:,PF)/baseMVA; > Qfe=branch(:,QF)/baseMVA; > Pte=branch(:,PT)/baseMVA; > Qte=branch(:,QT)/baseMVA; > > P_inj_max = Pfe+0.05*Pfe; > P_inj_min = Pfe-0.05*Pfe; > > Q_inj_max = Qfe+0.05*Qfe; > Q_inj_min = Qfe-0.05*Qfe; > > Is this way correct? > Kind regards, > Naime > > On Tue, Oct 11, 2022 at 1:45 PM naime ahmadi <naimeahm...@gmail.com> > wrote: > >> Thank you for your time >> >> On Tue, Oct 11, 2022 at 7:14 AM Carlos E Murillo-Sanchez < >> ce.murillosanc...@gmail.com> wrote: >> >>> Slight correction: >>> >>> Sf = V( mpc.branch(:, F_BUS) ) .* conj(Yf * V); >>> St = V( mpc.branch(:, T_BUS) ) .* conj(Yf * V); >>> >>> carlos. >>> >>> Ray Daniel Zimmerman wrote: >>> >>> In matrix form, you can do the corresponding calculations as follows >>> (e.g. for case9): >>> >>> define_constants >>> mpc = loadcase('case9'); >>> [Ybus, Yf, Yt] = makeYbus(mpc); >>> V = mpc.bus(:, VM) .* exp(1j * mpc.bus(:, VA)*pi/180); >>> Sbus = V .* conj(Ybus * V); >>> Sf = V .* conj(Yf * V); >>> St = V .* conj(Yt * V); >>> >>> Here Sbus are the bus injections into the branches (equal to the >>> generation – load), and Sf and St are the branch power flows at the >>> *from* and * to* ends, respectively. >>> >>> Ray >>> >>> >>> >>> On Oct 10, 2022, at 1:41 AM, naime ahmadi <naimeahm...@gmail.com> wrote: >>> >>> I have forgotten to attach the picture. >>> >>> >>> On Mon, Oct 10, 2022 at 3:40 PM naime ahmadi <naimeahm...@gmail.com> >>> wrote: >>> >>>> Hello, >>>> I have a question regarding equations (2) and (3) in the attached >>>> picture. >>>> I am not sure equation (3) is correct. But *sj* is the power injection >>>> and *f{i,j}* is the power flow. >>>> I am a littel bit confused, how should I calculate y*{j,k} and * Yjk* >>>> in Matpower? >>>> According to the attached picture y*{j,k} is line adminance vector and >>>> Yjk bus adminance matrix. How can I calculate them from Ybus? >>>> Thank you, >>>> Naime >>>> >>> <Capture.JPG> >>> >>> >>> >>> >