Basics of Electrical Engineering
PROJECT OBJECTIVE
This project is intended to give the basics of electrical engineering and electronics by highlighting the basics in electronics and using programming to try to solidify these principles.
REQUIRED KNOWLEDGE
- Understanding of programming. preferably python.
- Understanding of basic mathematics.
ELECTRONICS BASICS
CHARGE
Unit of charge is the coulomb. Coulomb is the quantity of electricity flowing past a given point.
`1 coloumb=1Amp * 1 second=As=6.24*10^(18)` electrons
one coulomb is 1 amp * 1-second =Amp second
The quantity of charge = current in amperes* time in seconds=Q
`Q=1A*1*s=1 c`
`Q=A*t`
Quantity of charge units are coulombs
WORK
The unit of work or energy is the joule(J). 1 J is 1 Nm
1 J is transferred when a force of 1 Newton is exerted through a distance of 1 m in the direction of the force.
Mechanically:
`W=F*s=m*a` where:
- W=Work done in J (joules)
- F=Force in Newton
- s=Distance in M (metres)
- m=mass in Kg
- a= acceleration in metres per second squared
In electricity, work is equal to power multiplied by time.
`W=P*t`
- P=is power in watts
- t=time in seconds
- W=P*t=J(joules)=watt second(Watts second)
- Units of work are J(joules) or Watt second(Watts second)
VOLTAGE
1 V is 1 Joule per coulomb.
1 V is the difference in potential between two points in a conductor which when carrying a current of one ampere dissipates a power of one watt.
`P=V*I`
`V=P/I=(W)/(Amp)=(J)/(s)*(1)/(I)`
`Q=It=C`
`I=C/t`
`V=J/s*(s/C)=J/C`
where:
P=power=W=Watts
V=Voltage
I=Current in ampres= amp
Q=Quantity of electric charge
C=coloumb
s=t=time in seconds
RESISTANCE
Resistance is the opposition of current flow and is given by the formulae below.
`R=V/I` Where :
R is the resistance in Ohms
V is the voltage or electric potential
I is the current in amperes
PYTHON PROGRAM
To calculate the missing value.
#python program for calculating electric charge
print('\n')
print('Q=Amps*time')
print('\n')
print('t is in seconds : s')
print('Current is in Amperes : Amps ')
print('Q is the quontity of charge in coloumbs: c')
print('Enter the following variables separate them by a coma\n')
print('The one you want to calculate should be replaced by question mark')
print('dont put symbols or letters betwween the digits separated by colomn ')
print('use the formart specified below')
print('Quantity of electric charge,Current in Amperes,Time in seconds')
print('Q,A,t')
def validate_input_data(data):
error='na'
data=data.split(',')
if len(data)>3: error='given input is too long'
if len(data)<3: error='given input is too short'
if error =='na':
for i in data:
if i=='?':
error='na'
break
else:
error='no question mark in the input'
return error
def calculate_missing_value(data):
data=data.split(',')
question_mark_position=23
ans='eror in calculation'
k=0
for i in data:
if i=='?':
question_mark_position=k
k=k+1
if question_mark_position==0:
val=float(data[1])*float(data[2])
ans= 'value of Q is = '+str(val)+' Columbs'
if question_mark_position==1:
val=float(data[0])/float(data[2])
ans= 'value if A is ='+str(val)+' Amperes'
if question_mark_position==2:
val=float(data[0])/float(data[1])
ans= 'Value of t is ='+str(val)+' Second'
return ans
def main():
print('hi')
while 1==1:
input_values=input()
if validate_input_data(input_values) !='na':
print(validate_input_data(input_values))
print('try again')
else:
print('\n')
print(calculate_missing_value(input_values))
print('\n')
main()
Conclusion
The above program can be easily modified to use other formulae as shown above to calculate energy ,power, resistance. etc.
REF
Theraja : Circuit Theory
John Bird: Circuit Theory