blob: be53f2564290aea55ee3946f14bd06f9d78fb703 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
clc;
clear;
e1=input("source #1 voltage mag. =");
a1=input("source #1 phase angle =");
e2=input("source #2 voltage mag. =");
a2=input("source #2 phase angle =");
r=input("line resistance =");
x=input("line reactance =");
z=r+(%i*x);
a1=((-30+a1):5:(30+a1))';
a1r=a1*%pi/180;
k=length(a1);
a2=ones(k,1)*a2;
a2r=a2*%pi/180;
v1=e1.*cos(a1r)+%i*e1.*sin(a1r);
v2=e2.*cos(a2r)+%i*e2.*sin(a2r);
i12=(v1-v2)./z;
i21=-i12;
s1=v1.*conj(i12);p1=real(s1);q1=imag(s1);
s2=v2.*conj(i21);p2=real(s2);q2=imag(s2);
sl=s1+s2;pl=real(sl);ql=imag(sl);
result1=[a1,p1,p2,pl];
disp("delta 1 p-1 p-2 p-l");
disp(result1);
plot(a1,p1,a1,p2,a1,pl);
xlabel("source #1 voltage phase angle");
ylabel("P,watts");
plotframe;
|