Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

ICPDS:

SUBMITTED TO:
SIR FURQAN

SUBMITTED BY:
Muhammad Burhan

22-ME-318

SECTION(A)

ASSIGNMENT#2
FIRSTLY FOR TWO TIMES OF SOURCE RESISTANCE

import matplotlib.pyplot as plt

# Give the user directions

print("This program will illustrate the Maximum Power Transfer Theorem by computing the load power
for different load resistances.")

# Ask user for source voltage and resistance

E = float(input("Enter the source voltage (E): "))

Rsource = float(input("Enter the source resistance (Rsource): "))

# Initialize the maximum power to zero

Pmax = 0

# Print out a heading for the table

print("Rload (ohms)\tVload (V)\tI (A)\tPload (W)")

# Create a list to store the load resistance, load voltage, load current, and load power values
r_values = []

v_values = []

i_values = []

p_values = []

# Start a loop for the range of load resistances

for Rload in [Rsource / 10 * i for i in range(11, 21)]:

# Compute the current, load voltage, and load power

I = E / (Rsource + Rload)

Vload = E * Rload / (Rsource + Rload)

Pload = Vload * I

# Compare the load power to Pmax and reset Pmax if it's larger

if Pload > Pmax:

Pmax = Pload

# Print out the values

print("%.2f\t\t%.2f\t\t%.2f\t\t%.2f" % (Rload, Vload, I, Pload))

# Add the values to the list

r_values.append(Rload)

v_values.append(Vload)

i_values.append(I)

p_values.append(Pload)

# Print out Pmax

print("Maximum Power: %.2f W" % Pmax)

# Plot the graph of load power versus load resistance


plt.plot(r_values, p_values)

plt.xlabel("Load Resistance (ohms)")

plt.ylabel("Load Power (W)")

plt.title("Load Power vs Load Resistance")

plt.show()

OUTPUT:
This program will illustrate the Maximum Power Transfer Theorem by computing the load power for
different load resistances.

Enter the source voltage (E): 220

Enter the source resistance (Rsource): 200

Rload (ohms) Vload (V) I (A) Pload (W)

220.00 115.24 0.52 60.36

240.00 120.00 0.50 60.00

260.00 124.35 0.48 59.47

280.00 128.33 0.46 58.82

300.00 132.00 0.44 58.08

320.00 135.38 0.42 57.28

340.00 138.52 0.41 56.43

360.00 141.43 0.39 55.56

380.00 144.14 0.38 54.67

400.00 146.67 0.37 53.78

Maximum Power: 60.36 W


Graph between r load and v load
160
140
120
LOAD RESISTANCE

100
80
60
40
20
0
220 240 260 280 300 320 340 360 380 400
LOAD VOLTAGE

Series1 Series2

GRAPH:

SECONDLY FOR SEVEN TIMES OF SOURCE RESISTANCE:


import matplotlib.pyplot as plt

# Give the user directions


print("This program will illustrate the Maximum Power Transfer Theorem by computing the load power
for different load resistances.")

# Ask user for source voltage and resistance

E = float(input("Enter the source voltage (E): "))

Rsource = float(input("Enter the source resistance (Rsource): "))

# Initialize the maximum power to zero

Pmax = 0

# Print out a heading for the table

print("Rload (ohms)\tVload (V)\tI (A)\tPload (W)")

# Create a list to store the load resistance, load voltage, load current, and load power values

r_values = []

v_values = []

i_values = []

p_values = []

# Start a loop for the range of load resistances

for Rload in [Rsource / 10 * i for i in range(11, 71)]:

# Compute the current, load voltage, and load power

I = E / (Rsource + Rload)

Vload = E * Rload / (Rsource + Rload)

Pload = Vload * I

# Compare the load power to Pmax and reset Pmax if it's larger

if Pload > Pmax:

Pmax = Pload
# Print out the values

print("%.2f\t\t%.2f\t\t%.2f\t\t%.2f" % (Rload, Vload, I, Pload))

# Add the values to the list

r_values.append(Rload)

v_values.append(Vload)

i_values.append(I)

p_values.append(Pload)

# Print out Pmax

print("Maximum Power: %.2f W" % Pmax)

# Plot the graph of load power versus load resistance

plt.plot(r_values, p_values)

plt.xlabel("Load Resistance (ohms)")

plt.ylabel("Load Power (W)")

plt.title("Load Power vs Load Resistance")

plt.show()

OUTPUT:
This program will illustrate the Maximum Power Transfer Theorem by computing the load power for
different load resistances.Enter the source voltage (E): 220

Enter the source resistance (Rsource): 200

Rload (ohms) Vload (V) I (A) Pload (W)

220.00 115.24 0.52 60.36

240.00 120.00 0.50 60.00

260.00 124.35 0.48 59.47

280.00 128.33 0.46 58.82


300.00 132.00 0.44 58.08

320.00 135.38 0.42 57.28

340.00 138.52 0.41 56.43

360.00 141.43 0.39 55.56

380.00 144.14 0.38 54.67

400.00 146.67 0.37 53.78

420.00 149.03 0.35 52.88

440.00 151.25 0.34 51.99

460.00 153.33 0.33 51.11

480.00 155.29 0.32 50.24

500.00 157.14 0.31 49.39

520.00 158.89 0.31 48.55

540.00 160.54 0.30 47.73

560.00 162.11 0.29 46.93

580.00 163.59 0.28 46.14

600.00 165.00 0.28 45.38

620.00 166.34 0.27 44.63

640.00 167.62 0.26 43.90

660.00 168.84 0.26 43.19

680.00 170.00 0.25 42.50

700.00 171.11 0.24 41.83

720.00 172.17 0.24 41.17

740.00 173.19 0.23 40.53

760.00 174.17 0.23 39.91

780.00 175.10 0.22 39.31

800.00 176.00 0.22 38.72

820.00 176.86 0.22 38.15

840.00 177.69 0.21 37.59

860.00 178.49 0.21 37.05


880.00 179.26 0.20 36.52

900.00 180.00 0.20 36.00

920.00 180.71 0.20 35.50

940.00 181.40 0.19 35.01

960.00 182.07 0.19 34.53

980.00 182.71 0.19 34.06

1000.00 183.33 0.18 33.61

1020.00 183.93 0.18 33.17

1040.00 184.52 0.18 32.74

1060.00 185.08 0.17 32.32

1080.00 185.62 0.17 31.90

1100.00 186.15 0.17 31.50

1120.00 186.67 0.17 31.11

1140.00 187.16 0.16 30.73

1160.00 187.65 0.16 30.35

1180.00 188.12 0.16 29.99

1200.00 188.57 0.16 29.63

1220.00 189.01 0.15 29.28

1240.00 189.44 0.15 28.94

1260.00 189.86 0.15 28.61

1280.00 190.27 0.15 28.28

1300.00 190.67 0.15 27.96

1320.00 191.05 0.14 27.65

1340.00 191.43 0.14 27.35

1360.00 191.79 0.14 27.05

1380.00 192.15 0.14 26.76

1400.00 192.50 0.14 26.47

Maximum Power: 60.36


Graph between v_load and r_load

200
LOAD RESISTANCE

150
100
50
0
Series2
0 0
28 36 440 20 00 0 0 Series1
5 6 68 6 40 0 0
7 8 92 0 80 0 0
10 10 116 24 320 00
1 1 14

LOAD VOLTAGE

Series1 Series2

GRAPH:

You might also like