summaryrefslogtreecommitdiff
path: root/1445/CH7/EX7.2/ch7_ex_2.sce
blob: ac414b4456c6e4fb9bc3c7d04f187546754abcc1 (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
29
30
31
32
//CHAPTER 7- SINGLE PHASE TRANSFORMER
//Example 2

disp("CHAPTER 7");
disp("EXAMPLE 2");

//VARIABLE INITIALIZATION
v1=400;                         //primary voltage in Volts
v2=200;                         //secondary voltage in Volts
I0=1;                           //in Amperes
pf1=0.4;                        //power factor in degrees 
I2=50;                          //secondary current in Amperes
pf2=0.8;                        //lagging power factor in degrees

//SOLUTION

//function to convert from polar to rectangular form
function [x,y]=pol2rect(mag,angle1);
x=mag*cos(angle1);
y=mag*sin(angle1);
endfunction;

phi_0=acos(pf1);
phi=acos(pf2);       
I2_dash=(v2*I2)/v1; 
[x0,y0]=pol2rect(I0,-phi_0); 
[x2_dash,y2_dash]=pol2rect(I2_dash,-phi); 
I1_x=x0+x2_dash;                //x-component of I1
I1_y=y0+y2_dash;                //y-component of I1
disp(sprintf("The primary current in reactangular form is (%f-j%f) A",I1_x,-I1_y));

//END