I want screen shots for matlab as soon as possible If u not get leave it functio
ID: 2267687 • Letter: I
Question
I want screen shots for matlab as soon as possible
If u not get leave it
function[v,theta] = Init_Voltages_and_Angles( netdat )
nb = netdat.nb;
% Flat start initialization
v = ones(nb,1);
% Set generator bus voltage magnitudes to their scheduled values
v(netdat.GenBus) = netdat.vgen;
theta = zeros(nb,1);
------------------------------------------------------------------------------------------
function[ flowdat ] = Flows_and_Injections( Af, At, Ash, v, theta,
netdat )
frombus = netdat.frombus;
tobus = netdat.tobus;
ns = netdat.ns;
gsf = netdat.gsf;
gst = netdat.gst;
bsf = netdat.bsf;
bst = netdat.bst;
bline = netdat.bline;
gline = netdat.gline;
alpha = netdat.alpha;
vf = v(frombus);
vt = v(tobus);
thetaf = theta(frombus);
thetat = theta(tobus);
thetal = thetaf - thetat;
cthl = cos(thetal);
sthl = sin(thetal);
vk = alpha.*vf;
pf = vk.*( vk.*(gsf + gline) - vt.*(gline.*cthl + bline.*sthl));
qf = vk.*(-vk.*(bsf + bline) - vt.*(gline.*sthl - bline.*cthl));
pt = vt.*( vt.*(gst + gline) - vk.*(gline.*cthl - bline.*sthl));
qt = vt.*(-vt.*(bst + bline) - vk.*(-gline.*sthl - bline.*cthl));
p = Af*pf + At*pt;
q = Af*qf + At*qt;
if ns > 0
shuntbus = netdat.shuntbus;
vsh = v(shuntbus);
shuntG = netdat.shuntG;
shuntB = netdat.shuntB;
psh = vsh.*vsh.*shuntG;
qsh = - vsh.*vsh.*shuntB;
p = p + Ash*psh;
q = q + Ash*qsh;
else
psh = [];
qsh = [];
vsh = [];
end
flowdat.vt = vt;
flowdat.vk = vk;
flowdat.vsh = vsh;
flowdat.sthl = sthl;
flowdat.cthl = cthl;
flowdat.pf = pf;
flowdat.qf = qf;
flowdat.pt = pt;
flowdat.qt = qt;
flowdat.p = p;
flowdat.q = q;
flowdat.psh = psh;
flowdat.qsh = qsh;
----------------------------------------------------------------------------
Pageof 2
ZOOM
function[ partials ] =...
Flow_and_Injection_Partials( netdat, flowdat, Af, At, Ash )
% pf is the real power flow on line i-j from bus i to bus j
% qf is the reaactive power flow on line i-j from bus i to bus j
% pt is the real power flow on line i-j from bus j to bus i
% qt is the reaactive power flow on line i-j from bus j to bus i
bsf = netdat.bsf;
bst = netdat.bst;
gsf = netdat.gsf;
gst = netdat.gst;
gline = netdat.gline;
bline = netdat.bline;
alpha = netdat.alpha;
vk = flowdat.vk;
vt = flowdat.vt;
vsh = flowdat.vsh;
cthl = flowdat.cthl;
sthl = flowdat.sthl;
ppfptl = vk.*vt.*(gline.*sthl - bline.*cthl);
ppfpvf = 2*alpha.*vk.*(gsf + gline) - alpha.*vt.*(gline.*cthl +
bline.*sthl);
ppfpvt = - vk.*(gline.*cthl + bline.*sthl);
pqfptl = - vk.*vt.*(gline.*cthl + bline.*sthl);
pqfpvf = - 2*alpha.*vk.*(bsf + bline) - alpha.*vt.*(gline.*sthl -
bline.*cthl);
pqfpvt = - vk.*(gline.*sthl - bline.*cthl);
pptptl = vk.*vt.*(gline.*sthl + bline.*cthl);
pptpvf = -alpha.*vt.*(gline.*cthl - bline.*sthl);
pptpvt = 2*vt.*(gst + gline) - vk.*(gline.*cthl - bline.*sthl);
pqtptl = vk.*vt.*(gline.*cthl - bline.*sthl);
pqtpvf = alpha.*vt.*(gline.*sthl + bline.*cthl);
pqtpvt = -2*vt.*(bst + bline) + vk.*(gline.*sthl + bline.*cthl);
Explanation / Answer
function[v,theta] = Init_Voltages_and_Angles( netdat )
nb = netdat.nb;
v = ones(nb,1);
v(netdat.GenBus) = netdat.vgen;
theta = zeros(nb,1);
function[ flowdat ] = Flows_and_Injections( Af, At, Ash, v, theta,netdat )
frombus = netdat.frombus;
tobus = netdat.tobus;
ns = netdat.ns;
gsf = netdat.gsf;
gst = netdat.gst;
bsf = netdat.bsf;
bst = netdat.bst;
bline = netdat.bline;
gline = netdat.gline;
alpha = netdat.alpha;
vf = v(frombus);
vt = v(tobus);
thetaf = theta(frombus);
thetat = theta(tobus);
thetal = thetaf - thetat;
cthl = cos(thetal);
sthl = sin(thetal);
vk = alpha.*vf;
pf = vk.*( vk.*(gsf + gline) - vt.*(gline.*cthl + bline.*sthl));
qf = vk.*(-vk.*(bsf + bline) - vt.*(gline.*sthl - bline.*cthl));
pt = vt.*( vt.*(gst + gline) - vk.*(gline.*cthl - bline.*sthl));
qt = vt.*(-vt.*(bst + bline) - vk.*(-gline.*sthl - bline.*cthl));
p = Af*pf + At*pt;
q = Af*qf + At*qt;
if ns > 0
shuntbus = netdat.shuntbus;
vsh = v(shuntbus);
shuntG = netdat.shuntG;
shuntB = netdat.shuntB;
psh = vsh.*vsh.*shuntG;
qsh = - vsh.*vsh.*shuntB;
p = p + Ash*psh;
q = q + Ash*qsh;
else
psh = [ ];
qsh = [ ];
vsh = [ ] ;
end
flowdat.vt = vt;
flowdat.vk = vk;
flowdat.vsh = vsh;
flowdat.sthl = sthl;
flowdat.cthl = cthl;
flowdat.pf = pf;
flowdat.qf = qf;
flowdat.pt = pt;
flowdat.qt = qt;
flowdat.p = p;
flowdat.q = q;
flowdat.psh = psh;
flowdat.qsh = qsh;
function[ partials ] = Flow_and_Injection_Partials( netdat, flowdat, Af, At, Ash )
bsf = netdat.bsf;
bst = netdat.bst;
gsf = netdat.gsf;
gst = netdat.gst;
gline = netdat.gline;
bline = netdat.bline;
alpha = netdat.alpha;
vk = flowdat.vk;
vt = flowdat.vt;
vsh = flowdat.vsh;
cthl = flowdat.cthl;
sthl = flowdat.sthl;
ppfptl = vk.*vt.*(gline.*sthl - bline.*cthl);
ppfpvf = 2*alpha.*vk.*(gsf + gline) - alpha.*vt.*(gline.*cthl + bline.*sthl);
ppfpvt = - vk.*(gline.*cthl + bline.*sthl);
pqfptl = - vk.*vt.*(gline.*cthl + bline.*sthl);
pqfpvf = - 2*alpha.*vk.*(bsf + bline) - alpha.*vt.*(gline.*sthl -bline.*cthl);
pqfpvt = - vk.*(gline.*sthl - bline.*cthl);
pptptl = vk.*vt.*(gline.*sthl + bline.*cthl);
pptpvf = -alpha.*vt.*(gline.*cthl - bline.*sthl);
pptpvt = 2*vt.*(gst + gline) - vk.*(gline.*cthl - bline.*sthl);
pqtptl = vk.*vt.*(gline.*cthl - bline.*sthl);
pqtpvf = alpha.*vt.*(gline.*sthl + bline.*cthl);
pqtpvt = -2*vt.*(bst + bline) + vk.*(gline.*sthl + bline.*cthl);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.