0% found this document useful (0 votes)
30 views

M. File

The document contains code that analyzes two electrical sources with different magnitudes and angles. It calculates the voltages, currents, powers, and reactive powers resulting from the combination of the sources. The code outputs various parameters, including the real and imaginary components of power (P and Q) for each source and the total combination over a range of magnitudes for the first source. Plots of P and Q versus the first source magnitude are also generated.

Uploaded by

waqasdgi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

M. File

The document contains code that analyzes two electrical sources with different magnitudes and angles. It calculates the voltages, currents, powers, and reactive powers resulting from the combination of the sources. The code outputs various parameters, including the real and imaginary components of power (P and Q) for each source and the total combination over a range of magnitudes for the first source. Plots of P and Q versus the first source magnitude are also generated.

Uploaded by

waqasdgi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 14

M.

FILE
E1=input('Enter souurce # 1 magnitude')
120
A1=input('Angle of E1')
-5
E2=input('Enter souurce # 2 magnitude')
100
A2=input('Angle of a2')
0
Z=input('Enter the value of impedence')
1+7i
A1r=(A1*pi/180)
E1=(E1-30:1:E1+0)'
k=length(E1)
E2=(ones(k,1)*E2)
V1=E1.*cos(A1r)+j*E1.*sin(A1r)
V2=E2.*cos(A2)+j*E2.*sin(A2)
I12=(V1-V2)./Z
I21=-I12
S1=V1.*conj(I12)
S2=V2.*conj(I21)
P1=real(S1)
P2=real(S2)
Q1=imag(S1)
Q2=imag(S2)
S=S1+S2
P=real(S)
Q=imag(S)
Result=[E1,Q1,Q2,Q]
plot(E1,Q1,E1,Q2,E1,Q)

GRAPH

RESULTS
E1 =
120
A1 =
-5
E2 =
100
A2 =
0
Z=
1.0000 + 7.0000i
A1r =

-0.0873
E1 =
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
k=
31
E2 =
100
100
100
100
100

100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
V1 =
1.0e+002 *
0.8966 - 0.0784i
0.9065 - 0.0793i
0.9165 - 0.0802i
0.9265 - 0.0811i
0.9364 - 0.0819i
0.9464 - 0.0828i
0.9563 - 0.0837i
0.9663 - 0.0845i
0.9763 - 0.0854i
0.9862 - 0.0863i
0.9962 - 0.0872i
1.0062 - 0.0880i
1.0161 - 0.0889i
1.0261 - 0.0898i
1.0360 - 0.0906i
1.0460 - 0.0915i
1.0560 - 0.0924i
1.0659 - 0.0933i
1.0759 - 0.0941i

1.0859 - 0.0950i
1.0958 - 0.0959i
1.1058 - 0.0967i
1.1157 - 0.0976i
1.1257 - 0.0985i
1.1357 - 0.0994i
1.1456 - 0.1002i
1.1556 - 0.1011i
1.1655 - 0.1020i
1.1755 - 0.1028i
1.1855 - 0.1037i
1.1954 - 0.1046i
V2 =
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
I12 =

-1.3050 + 1.2911i
-1.2973 + 1.1499i
-1.2896 + 1.0086i
-1.2818 + 0.8674i
-1.2741 + 0.7262i
-1.2664 + 0.5850i
-1.2587 + 0.4438i
-1.2510 + 0.3026i
-1.2432 + 0.1614i
-1.2355 + 0.0202i
-1.2278 - 0.1210i
-1.2201 - 0.2622i
-1.2123 - 0.4035i
-1.2046 - 0.5447i
-1.1969 - 0.6859i
-1.1892 - 0.8271i
-1.1815 - 0.9683i
-1.1737 - 1.1095i
-1.1660 - 1.2507i
-1.1583 - 1.3919i
-1.1506 - 1.5331i
-1.1428 - 1.6744i
-1.1351 - 1.8156i
-1.1274 - 1.9568i
-1.1197 - 2.0980i
-1.1120 - 2.2392i
-1.1042 - 2.3804i
-1.0965 - 2.5216i
-1.0888 - 2.6628i
-1.0811 - 2.8040i
-1.0733 - 2.9452i
I21 =
1.3050 - 1.2911i
1.2973 - 1.1499i
1.2896 - 1.0086i
1.2818 - 0.8674i
1.2741 - 0.7262i
1.2664 - 0.5850i
1.2587 - 0.4438i
1.2510 - 0.3026i
1.2432 - 0.1614i
1.2355 - 0.0202i
1.2278 + 0.1210i
1.2201 + 0.2622i
1.2123 + 0.4035i
1.2046 + 0.5447i
1.1969 + 0.6859i
1.1892 + 0.8271i

1.1815 + 0.9683i
1.1737 + 1.1095i
1.1660 + 1.2507i
1.1583 + 1.3919i
1.1506 + 1.5331i
1.1428 + 1.6744i
1.1351 + 1.8156i
1.1274 + 1.9568i
1.1197 + 2.0980i
1.1120 + 2.2392i
1.1042 + 2.3804i
1.0965 + 2.5216i
1.0888 + 2.6628i
1.0811 + 2.8040i
1.0733 + 2.9452i
S1 =
1.0e+002 *
-1.2713 - 1.0552i
-1.2672 - 0.9395i
-1.2628 - 0.8210i
-1.2579 - 0.6997i
-1.2526 - 0.5757i
-1.2469 - 0.4488i
-1.2409 - 0.3191i
-1.2344 - 0.1866i
-1.2275 - 0.0514i
-1.2202 + 0.0867i
-1.2126 + 0.2276i
-1.2045 + 0.3713i
-1.1960 + 0.5177i
-1.1871 + 0.6670i
-1.1779 + 0.8191i
-1.1682 + 0.9740i
-1.1581 + 1.1316i
-1.1476 + 1.2921i
-1.1368 + 1.4554i
-1.1255 + 1.6215i
-1.1138 + 1.7903i
-1.1018 + 1.9620i
-1.0893 + 2.1365i
-1.0764 + 2.3138i
-1.0631 + 2.4938i
-1.0495 + 2.6767i
-1.0354 + 2.8624i
-1.0209 + 3.0509i
-1.0060 + 3.2422i
-0.9908 + 3.4362i

-0.9751 + 3.6331i
S2 =
1.0e+002 *
1.3050 + 1.2911i
1.2973 + 1.1499i
1.2896 + 1.0086i
1.2818 + 0.8674i
1.2741 + 0.7262i
1.2664 + 0.5850i
1.2587 + 0.4438i
1.2510 + 0.3026i
1.2432 + 0.1614i
1.2355 + 0.0202i
1.2278 - 0.1210i
1.2201 - 0.2622i
1.2123 - 0.4035i
1.2046 - 0.5447i
1.1969 - 0.6859i
1.1892 - 0.8271i
1.1815 - 0.9683i
1.1737 - 1.1095i
1.1660 - 1.2507i
1.1583 - 1.3919i
1.1506 - 1.5331i
1.1428 - 1.6744i
1.1351 - 1.8156i
1.1274 - 1.9568i
1.1197 - 2.0980i
1.1120 - 2.2392i
1.1042 - 2.3804i
1.0965 - 2.5216i
1.0888 - 2.6628i
1.0811 - 2.8040i
1.0733 - 2.9452i
P1 =
-127.1313
-126.7239
-126.2764
-125.7890
-125.2616
-124.6941
-124.0867
-123.4393
-122.7518

-122.0244
-121.2570
-120.4495
-119.6021
-118.7147
-117.7873
-116.8198
-115.8124
-114.7650
-113.6775
-112.5501
-111.3827
-110.1752
-108.9278
-107.6404
-106.3130
-104.9455
-103.5381
-102.0907
-100.6032
-99.0758
-97.5084
P2 =
130.5012
129.7290
128.9568
128.1846
127.4124
126.6401
125.8679
125.0957
124.3235
123.5513
122.7791
122.0069
121.2347
120.4625
119.6903
118.9181
118.1458
117.3736
116.6014
115.8292
115.0570
114.2848
113.5126
112.7404
111.9682

111.1960
110.4238
109.6515
108.8793
108.1071
107.3349
Q1 =
-105.5173
-93.9497
-82.1021
-69.9745
-57.5669
-44.8794
-31.9118
-18.6642
-5.1366
8.6710
22.7586
37.1262
51.7737
66.7013
81.9089
97.3965
113.1641
129.2117
145.5393
162.1468
179.0344
196.2020
213.6496
231.3772
249.3848
267.6724
286.2399
305.0875
324.2151
343.6227
363.3103
Q2 =
129.1066
114.9856
100.8646
86.7435
72.6225
58.5015

44.3804
30.2594
16.1383
2.0173
-12.1037
-26.2248
-40.3458
-54.4668
-68.5879
-82.7089
-96.8299
-110.9510
-125.0720
-139.1931
-153.3141
-167.4351
-181.5562
-195.6772
-209.7982
-223.9193
-238.0403
-252.1614
-266.2824
-280.4034
-294.5245
S=
3.3699 +23.5894i
3.0051 +21.0359i
2.6804 +18.7625i
2.3956 +16.7690i
2.1508 +15.0556i
1.9460 +13.6221i
1.7812 +12.4687i
1.6565 +11.5952i
1.5717 +11.0017i
1.5269 +10.6883i
1.5221 +10.6548i
1.5573 +10.9014i
1.6326 +11.4279i
1.7478 +12.2345i
1.9030 +13.3210i
2.0982 +14.6876i
2.3334 +16.3341i
2.6087 +18.2607i
2.9239 +20.4672i
3.2791 +22.9538i
3.6743 +25.7203i
4.1096 +28.7669i

4.5848 +32.0934i
5.1000 +35.7000i
5.6552 +39.5865i
6.2504 +43.7531i
6.8857 +48.1996i
7.5609 +52.9262i
8.2761 +57.9327i
9.0313 +63.2193i
9.8265 +68.7858i
P=
3.3699
3.0051
2.6804
2.3956
2.1508
1.9460
1.7812
1.6565
1.5717
1.5269
1.5221
1.5573
1.6326
1.7478
1.9030
2.0982
2.3334
2.6087
2.9239
3.2791
3.6743
4.1096
4.5848
5.1000
5.6552
6.2504
6.8857
7.5609
8.2761
9.0313
9.8265
Q=
23.5894
21.0359
18.7625

16.7690
15.0556
13.6221
12.4687
11.5952
11.0017
10.6883
10.6548
10.9014
11.4279
12.2345
13.3210
14.6876
16.3341
18.2607
20.4672
22.9538
25.7203
28.7669
32.0934
35.7000
39.5865
43.7531
48.1996
52.9262
57.9327
63.2193
68.7858
Result =
90.0000 -105.5173 129.1066 23.5894
91.0000 -93.9497 114.9856 21.0359
92.0000 -82.1021 100.8646 18.7625
93.0000 -69.9745 86.7435 16.7690
94.0000 -57.5669 72.6225 15.0556
95.0000 -44.8794 58.5015 13.6221
96.0000 -31.9118 44.3804 12.4687
97.0000 -18.6642 30.2594 11.5952
98.0000 -5.1366 16.1383 11.0017
99.0000 8.6710 2.0173 10.6883
100.0000 22.7586 -12.1037 10.6548
101.0000 37.1262 -26.2248 10.9014
102.0000 51.7737 -40.3458 11.4279
103.0000 66.7013 -54.4668 12.2345
104.0000 81.9089 -68.5879 13.3210
105.0000 97.3965 -82.7089 14.6876
106.0000 113.1641 -96.8299 16.3341
107.0000 129.2117 -110.9510 18.2607
108.0000 145.5393 -125.0720 20.4672

109.0000
110.0000
111.0000
112.0000
113.0000
114.0000
115.0000
116.0000
117.0000
118.0000
119.0000
120.0000

162.1468 -139.1931
179.0344 -153.3141
196.2020 -167.4351
213.6496 -181.5562
231.3772 -195.6772
249.3848 -209.7982
267.6724 -223.9193
286.2399 -238.0403
305.0875 -252.1614
324.2151 -266.2824
343.6227 -280.4034
363.3103 -294.5245

>> plot(V1,S1,V1,S2,V1,Sl)

22.9538
25.7203
28.7669
32.0934
35.7000
39.5865
43.7531
48.1996
52.9262
57.9327
63.2193
68.7858

You might also like