eecalculations.py

Created by capnmattttt

Created on April 15, 2018

998 Bytes

A group of useful EE calculations


from engnote import *
from math import *

#3db cutoff of an LC filter
def lcf3dB():
  l = float(input('Inductance (H): '))
  c = float(input('Capacitance (F): '))
  a = eng((1/(2*pi*sqrt(l*c))))
  print(a, 'Hz')
  return


#3db cutoff of an RC filter
def rcf3dB():
  r = float(input('Resistance (Ohms): '))
  c = float(input('Capacitance (F): '))
  a = eng((1/(2*pi*r*c)))
  print(a, 'Hz')
  return

#Impedance of a Capacitor
def z_cap():
  f = float(input('Frequency (Hz): '))
  c = float(input('Capacitance (F): '))
  a = eng((1/(2*pi*f*c)))
  print(a, 'Ohms')
  return

#Impedance of a Inductor
def z_ind():
  f = float(input('Frequency (Hz): '))
  l = float(input('Inductance (H): '))
  a = eng((2*pi*f*l))
  print(a, 'Ohms')
  return

#Voltage Divider
def v_divider():
  Z1 = float(input('Impedance Top (Ohms): '))
  Z2 = float(input('Impedance Bottom (Ohms): '))
  Vin = float(input('Input Voltage (Volts): '))
  a = eng(Vin*(Z2/(Z1 + Z2)))
  print(a, 'Volts')
  return