Pankaj(ADS)

Featured post

Python Codes for Electric Potential

Python Codes for Electric Potential Code:- import numpy as np import math import matplotlib.pyplot as plot ''' Calculating Elect...

Monday, 26 April 2021

Python Codes (Calculation of Circuit Parameters)

0 comments

 Python Codes (Calculation of Circuit Parameters)

The following article contains the python code for calculating electrical circuit parameters like equivalent resistance,Voltage drop and Power dissipated across the resistance.

Given Circuit



#----Codes are Designed By Pankaj Aswal---#

'''

Electrical Circuit is

+┌─ R1--- ┬─────┬-------|

 V                 R2           R3       R4

  |                    |                         R5     

-└─R7-R6─┴─────┴------|


with following values:

'''

import matplotlib.pyplot as plt

#------Circuit Parameters------#

Vt = 10

R1 = 0.245

R2 = 1.5

R3 = 2.00360

R4 = 0.55

R5 = 0.028

R6 = 0.0099

R7 = 1.23456

R45 = R4 + R5

R67 = R6 + R7

R2345 = ((1/R2)+(1/R3)+(1/R45))**(-1)

#-------Equivalent Resistance Calculation-------#

Rtotal = R1 + R2345 + R67

print(f'Rtotal = {round(Rtotal,7)} Ohm')

#--------Net Current from Source----------------#

It = Vt/Rtotal

print(f'It = {round(It,2)} Ampere')

I6 = It

I7 = It

V6 = I6 * R6

V7 = I7 * R7

#---------Voltage Drop across 6th and 7th Resistance------#

print(f'V6 = {round(V6,5)} Volt, V7 = {round(V7,5)} Volt')

I2345 = It

V2345 = I2345 * R2345

#--Voltage Drop across Combination of 2nd,3rd,4th and 5th Resistance---#

print(f'V2345 = {round(V2345,5)} Volt')

I7 = It

P7 = R7 * I7**2

#-----Power across 7th Resistance----#

print(f'P7 = {round(P7,2)} Watt')

V45 = V2345

I45 = V45/R45

I4 = I45

P4 = R4 * I4**2

#-----Power across 4th Resistance----#

print(f'P4 = {round(P4,4)} Watt')

Output of Python Program

>>> 

========== RESTART: D:/Desktop/Python(TUT)/equivalent Resistance.py ==========

Rtotal = 1.8347791 Ohm

It = 5.45 Ampere

V6 = 0.05396 Volt, V7 = 6.72866 Volt

V2345 = 1.88207 Volt

P7 = 36.67 Watt

P4 = 5.8315 Watt

No comments:

Post a Comment