/
phase-shifter.py
executable file
·88 lines (73 loc) · 1.52 KB
/
phase-shifter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
# based on https://www.microwaves101.com/encyclopedias/high-pass-low-pass-phase-shifters
import sys
from math import pi,sin,cos
if len(sys.argv) < 3:
print("Usage: " + sys.argv[0] + " frequency[hz] angle [Z=50]")
sys.exit(1)
F = int(sys.argv[1])
w = 2*pi*F
a = int(sys.argv[2])*pi/180
Z = 50
if len(sys.argv) >= 4:
Z = int(sys.argv[2])
print("""
High pass tee:
C1 C2
|| ||
---||---+---||---
|| | ||
C
C L1
C
|
V
""")
L = Z / (w*sin(a))
C = sin(a)/(w*Z*(1-cos(a)))
print("C1 = C2 = {:.4f} pF".format(C*1000*1000*1000*1000))
print("L1 = {:.4f} uH".format(L*1000*1000))
print("""
Low pass tee:
L1 L2
---CCCC---+---CCCC---
|
-----
----- C1
|
V
""")
L = Z*(1-cos(a))/(w*sin(a))
C = sin(a)/(w*Z)
print("L1 = L2 = {:.4f} uH".format(L*1000*1000))
print("C1 = {:.4f} pF".format(C*1000*1000*1000*1000))
print("""
High pass pi:
C1
||
---+---||---+---
| || |
C C
C L1 C L2
C C
| |
V V
""")
C = 1/(w*Z*sin(a))
L = Z*sin(a)/(w*(1-cos(a)))
print("C1 = {:.4f} pF".format(C*1000*1000*1000*1000))
print("L1 = L2 = {:.4f} uH".format(L*1000*1000))
print("""
Low pass pi:
L1
---+---CCCC---+---
| |
----- C1 ----- C2
----- -----
| |
V V
""")
C = (1-cos(a))/(w*Z*sin(a))
L = Z*sin(a)/w
print("L1 = {:.4f} uH".format(L*1000*1000))
print("C1 = C2 = {:.4f} pF".format(C*1000*1000*1000*1000))