* News/학교
부산대학교 일반물리학 교류회로
soicem
2019. 11. 9. 02:16
import math
V = [1, 2, 3, 4, 5]
freq = [100, 200, 300, 400, 500]
Tv = 1000
C = 22 * (10**5) * (10**-12)
R = 1484
def printFormat(v, message=""):
print(message, "%5.4f"% (v))
def r_circuit():
#R회로
print("R회로")
## change voltages
for v in V:
printFormat((v / R) * Tv)
## change frequencies
print()
for f in freq:
printFormat((v / R) * Tv)
print()
def c_circuit():
#C회로
print("C회로")
## change voltages
for v in V:
printFormat(2*math.pi * (100) * v * C * Tv)
print()
## change frequencies
for f in freq:
printFormat(2*math.pi * (f) * 5 * C * Tv)
print()
def R_C_circuit():
#R-C회로
print("R-C회로")
## change voltages
for v in V:
Z = (math.sqrt(R**2 + (1 / (100* 2*math.pi * C ) )**2))
printFormat(v * Tv / Z, "Iac: ",)
print()
## change frequencies
tempV = 5
for f in freq:
Z = (math.sqrt(R**2 + (1 / (f* 2*math.pi * C ) )**2)) # Z
print(f, "Hz => ")
print("Z: ", end ="")
printFormat(Z)
printFormat((tempV * Tv) / Z, "Iac: ")
print("\n")
#위상상수
print("위상상수")
for f in freq:
D_constant = math.atan(-1/(2 * math.pi * f * C * R)) * (180 / math.pi)
printFormat(D_constant)
r_circuit()
c_circuit()
R_C_circuit()
# tools
# pico=10**-12
# 임피던스 이론값: I = V/Z
#R회로
#Ohms Law: I = V/R
#C회로
#2*math.pi * (300) * 22 * (10**5) * (10**-12) * 5
#R-C회로
#Z: (math.sqrt(1484**2 + (1 / (100* 2*math.pi * 22 * (10**-7) ) )**2))
#임피던스 이론값: I = V/Z
#위상상수: math.atan(-1/(2 * math.pi * 100 * (22 * (10**-7))* 1484)) * (180 / math.pi)
#Tools
#math.atan2(15.9, 10) * (180 / math.pi)
#R = 1/(pi*f*C)
#pico=10**-12
어쩌다보니 교류회로 실제값 계산하는거 코드로 옮겼다. 흠...