# CHAPTER 1: INTRODUCTION¶

## EXAMPLE 1.1: Page Number 8¶

In :
#Variable Declaration
Eg=24.0;                     #Generated voltage in V
Ri=0.01;                   #Internal Resistance in Ω
P=100;                     #Power supplied in watts

#Calculations
# (i)
V_Ri=I*Ri;                      #Voltage drop in internal resistance

# (ii)
V=Eg-(I*Ri);                     #Terminal Voltage

#Results
print ("The voltage drop in internal resistance is %.4f V"%V_Ri);
print ("The terminal voltage is %.2f V"%V);

The voltage drop in internal resistance is 0.0417 V
The terminal voltage is 23.96 V


## EXAMPLE 1.2: Page number 10¶

In :
#Variable declaration
Eg=500.0;                 #Generated voltage in V
Ri=1000.0;                #Internal Resistance in Ω

#Calculations
# (i)
RL=10;                    #Load resistance of case 1 in Ω
I= Eg/(RL+Ri);            #Load current in A

print("The load current for RL=10Ω is %.3f A"%I);

# (ii)
RL=50;                    #Load resistance of case 2 in Ω
I= Eg/(RL+Ri);            #Load current in A

print("The load current for RL=50Ω is %.3f A"%I);

# (iii)
RL=100;                    #Load resistance of case 3 in Ω
I= Eg/(RL+Ri);            #Load current in A
I=round(I,3);

print("The load current for RL=100Ω is %.3f A"%I);

The load current for RL=10Ω is 0.495 A
The load current for RL=50Ω is 0.476 A
The load current for RL=100Ω is 0.455 A


## Example 1.3: Page Number 11¶

In :
#Variable declaration
E=10.0;                #voltage of voltage source in V
Ri=10.0;               #Internal Resistance of the voltage source in Ω

#Calculation
Isc=E/Ri;                #short circuit current in A
I=Isc;                   #Current value of current source in A
R=Ri;                    #Internal Resistence of the current source in Ω

#Results
print("The current value of the current source= %d A"%Isc);
print("The internal resistance of the current source =%d Ω "%R);

The current value of the current source= 1 A
The internal resistance of the current source =10 Ω


## EXAMPLE 1.4: Page number 11-12¶

In :
#Variable declaration
I=6.0;                    # current value of current source in mA
Ri=2000.0;              #Internal Resistance of the current source in Ω

#Calcultion
V=(I/1000)*Ri;                      #Voltage of voltage source in V
R=Ri;                         #Internal resistance of voltage source in Ω

#Results
print("The voltage of voltage source is %d V"%V);
print("The internal resistance of the voltage source is %d Ω"%R);

The voltage of voltage source is 12 V
The internal resistance of the voltage source is 2000 Ω


## Example 1.5: Page number 13¶

In :
#variable declaration
E=200.0;                    #Generated voltage in V
Ri=100.0;                   #Internal Resistance of generator in Ω

#Calculations
#(i)
RL=100;                      #Load resistance for 1st case in Ω
I=E/(RL+Ri);                 #Load current in 1st case A
P=(I*I)*RL;                  #Power delivered to load of 2nd case in watts
Pt=(I*I)*(Ri+RL);            #Total power generated in watts

print("Power delivered for RL=100Ω is %d watts"%P);
print("Total power generated for RL=100Ω is %d watts"%Pt);

#(ii)
RL=300;                      #Load resistance for 2nd case in Ω
I=E/(RL+Ri);                 #Load current in 2nd case in A
P=(I*I)*RL;                  #Power delivered to load of 2nd case in watts
Pt=(I*I)*(Ri+RL);            #Total power generated in watts

print("Power delivered for RL=300Ω is %d watts"%P);
print("Total power generated for RL=300Ω is %d watts"%Pt);

Power delivered for RL=100Ω is 100 watts
Total power generated for RL=100Ω is 200 watts
Power delivered for RL=300Ω is 75 watts
Total power generated for RL=300Ω is 100 watts


## Example 1.6: Page number 14¶

In :
#Variable declaration
V=12.0;                  #Output from amplifier in V
R_out_eq=15;           #Equivalent resistance in Ω

#Calculations
Rt=RL+R_out_eq;           #Total resistance in Ω
I=V/Rt;                   #Circuit current in A
PL=pow(I,2)*RL;           #Power delivered to load in W

#Results
print("Load resistance required is = %d Ω"%RL);
print("Power delivered to load = %.1f W"%PL);

Load resistance required is = 15 Ω
Power delivered to load = 2.4 W


## Example 1.7, Page number 14¶

In :
#Variable declaration
V=50.0;                      #voltage from ac generator in V
R=100.0;                     #Resistance of internal impedance in Ω
XL=50.0;                     #inductive reactance of internal impedance in Ω

#Calculation
Zi=100+(50j);               #Internal impedance in complex form (Ω)
ZL=conjugate(Zi);          #Load impedance (conjugate of internal impedance ) in Ω
Zt=Zi+ZL;                  #Total impedance in Ω
I=real(V/Zt);              #Circuit current in A

Max_Power=pow(I,2)*R;      #Maximum power transferred to the load in watts

#Results
print ("Load impedance %d %dj Ω"%(real(ZL),imag(ZL)));
print("Maximum power transferred to the load =%.2f W"%Max_Power);

Load impedance 100 -50j Ω
Maximum power transferred to the load =6.25 W


## Example 1.8: Page number 16¶

In :
#Function for calculating parallel resistance
def pR(R1,R2):
return((R1*R2)/(R1+R2));

#Variable declaration
E=100.0;                              #Source voltage in V
R1=10.0;                              #Resistance of resistor 1 in Ω
R2=20.0;                              #Resistance of resistor 2 in Ω
R3=12.0;                              #Resistance of resistor 3 in Ω
R4=8.0;                               #Resistance of resistor 4 in Ω
RL=100.0;                             #Resistance of load in Ω

#Calculation
Req=R1+pR(R3+R4,R2);                 #Equivalent resistance after removing RL ,in Ω
I=E/Req;                             #Total circuit current in A
I8=I*R2/(R2+R3+R4);

#Thevenin's equivalent circuit's parameters
E0=I8*R4;                                         #Thevenin voltage V
R0=pR(pR(R1,R2)+R3,R4);                           #Thevenin resistance

#Result
print ("Current through load = %.2f A."%I_RL);

Current through load = 0.19 A.


## Example 1.9: Page number 17¶

In :
#Function for calculating parallel resistance
def pR(R1,R2):
return((R1*R2)/(R1+R2));

#Variable declaration
V=20.0;                           #Voltage source in V
R1=1000.0;                        #resistance of resistor 1 in Ω
R2=1000.0;                        #resistance of resistor 2 in Ω
R3=1000.0;                        #resistance of resistor 3 in Ω

#calculation
#parameter for Thevenin's equivalent circuit
E0=(V*R3)/(R1+R3);                         #thevenin voltage in V
R0=pR(R1,R3)+R2;                     #Thevenins resistance in Ω

#result
print("The thevenin voltage = %d V"%E0);
print("The thevenin resistance = %d Ω"%R0);

The thevenin voltage = 10 V
The thevenin resistance = 1500 Ω


## Example 1.10: Page number 18¶

In :
#Variable declaration
V=120.0;                          #Supply voltage in V
R1=40.0;                          #Resistor 1's resistance in Ω
R2=20.0;                          #Resistor 2's resistance in Ω
R3=60.0;                          #Resistor 3's resistance in Ω

#Calculations
#Using Thevenin's theorem, Thevenin's voltage and resistance are calculated
E0=(V*R2)/(R1+R2);                  #Thevenin voltage (voltage across the load resistance RL, after removing RL)in V
R0=(R1*R2)/(R1+R2) + R3;                 #Thevenin's resistance (Resistance between the terminals of load RL, with RL removed and source voltage shorted)in Ω
RL=R0;                              #Value of load resistance to be connected for maximum power transfer in Ω
Pmax=pow(E0,2)/(4*RL);              #Maximum power transferred to load in watts

#Results
print("The value of load resistance RL to which maximum power will be transferred = %.2f Ω."%RL);
print("The maximum power transferred to load =%.2f W."%Pmax);

The value of load resistance RL to which maximum power will be transferred = 73.33 Ω.
The maximum power transferred to load =5.45 W.


## Example 1.11: Page number 18-19-20¶

In :
#Variable declaration
V=80.0;                           #Supply voltage in V
R1=100.0;                         #Resistor 1's resistance in Ω
R2=100.0;                         #Resistor 2's resistance in Ω
R3=30.0;                          #Resistor 3's resistance in Ω
R4=80.0;                          #Resistor 4's resistance in Ω
R5=20.0;                          #Resistor 5's resistance in Ω
R6=60.0;                          #Resistor 6's resistance in Ω
R7=20.0;                          #Resistor 7's resistance in Ω
R8=50.0;                          #Resistor 8's resistance in Ω

#Calculations
#Using Thevenin's theorem,
E0=(V*R2)/(R1+R2);              #Thevenin's voltage for the circuit containing V, R1, R2 in V.
R0=(R1*R2)/(R1+R2);             #Thevenin's resistance for R1, R2 in Ω.

#Using Thevenin's theorem again on E0, R0 and rest of the circuit resistors.
E0_1=(E0*R4)/(R0+R3+R4);                #Thevenin's voltage for the cicruit containing E0, R0, R3, R4 in V
R0_1=((R0+R3)*R4)/(R0+R3+R4);           #Thevenin's resistance of R0,R3,R4 (R0 and R3 in series and both in parallel with R4), in Ω

#Using Thevenin's theorem again on E0_1, R0_1, and rest of the circuit resistors.
E0_2=(E0_1*R6)/(R0_1+R5+R6);                       #Thevenin's voltage for the circuit containing E0_1, R0_1, R5, R6 in V
R0_2=((R0_1+R5)*R6)/(R0_1+R5+R6);                  #Thevenin's resistance of R0_1,R5,R6 (R0 and R3 in series and both in parallel with R4), in Ω

I_50=E0_2/(R0_2+R7+R8);                           #Current through the 50 Ω resistor in A

#Results
print("The current through the 50 Ω resistor =%.1f A."%I_50);

The current through the 50 Ω resistor =0.1 A.


## Example 1.12: Page number 22¶

In :
from math import floor
#Variable declaration
V=40.0;                       #Voltage supply in V
R1=4.0;                       #Resistor 1's resistance in Ω
R2=6.0;                       #Resistor 2's resistance in Ω
R3=5.0;                       #Resistor 3's resistance in Ω
R4=8.0;                       #Resistor 4's resistance in Ω

#Calculation
#Using Norton's theorem,
#calculating Norton current by removing the load resistance R4 and short circuiting those two terminals of the circuit
R=R1 + (R2*R3)/(R2+R3);         #Load on source after removing R4 resistor, in  Ω
I=V/R;                          #Source current in A

#Using current dividing rule ,calculating the short circuit current.
I_N=(I*R2)/(R2+R3);             #Norton's equivalent current or the short circuit current in A

R_N=R3 + (R1*R2)/(R1+R2);       #Norton's equivalent resistance in Ω

I_8=(I_N*R_N)/(R_N+R4);         #Current through the 8 Ω resistance in A

#Results
print("The current through the 8Ω resistance =%.2f A."%I_8);

#Note: The answer in the book is 1.55 A, but in the above code the approximate value is obtained, i.e not 1.55A but 1.56A

The current through the 8Ω resistance =1.56 A.


## Example 1.13 :Page number 23¶

In :
#Variable declaration
V1=30.0;                #Voltage source 1, V
V2=18.0;                #Voltage source 2, V
R1=20.0;                #1st resistor, Ω
R2=10.0;                #2nd resistor, Ω

#Calculations

#Finding Thevenin's Equivalent circuit
I=(V1-V2)/(R1+R2);              #Current in the circuit, A

#Applying Kirchhoff's voltage law to 1st loop of the circuit,
#V1-I*R1-E0=0, where E0 is the voltage across the points X-Y.
E0=V1-I*R1;                     #Thevenin's voltage source, V

R0=R1*R2/(R1+R2);               #Thevenin's resistance, Ω

#Finding Norton's equivalent circuit
IN=E0/R0;                   #Norton's equivalent current source, A
RN=R0;                      #Norton's equivanlent resistance, Ω

#Result
print("IN=%.1fA and RN=%.2f Ω"%(IN,RN));

IN=3.3A and RN=6.67 Ω

In [ ]: