Transmission Line Analysis
Microstrip(width, height, er, thickness)
Calculate microstrip transmission line parameters.
from rf_design import Microstrip
# Create microstrip object
ms = Microstrip(
width=100e-6, # 100 µm trace width
height=100e-6, # 100 µm dielectric height
er=4.0, # Relative permittivity
thickness=35e-6 # 35 µm copper thickness
)
# Calculate parameters
z0 = ms.impedance() # Characteristic impedance
er_eff = ms.effective_er() # Effective permittivity
delay = ms.delay_per_length() # Propagation delay
print(f"Z0 = {z0:.1f} Ω")
print(f"εr_eff = {er_eff:.2f}")
print(f"Delay = {delay*1e12:.1f} ps/mm")
Stripline(width, height, er)
from rf_design import Stripline
sl = Stripline(width=75e-6, height=200e-6, er=3.5)
z0 = sl.impedance()
loss = sl.loss_per_length(freq=10e9) # At 10 GHz
S-Parameter Analysis
SParameters.from_file(path)
Load S-parameters from Touchstone file.
from rf_design import SParameters
# Load from Touchstone file
sp = SParameters.from_file("component.s2p")
# Access parameters at specific frequency
s11 = sp.s11_at(28e9) # Complex S11 at 28 GHz
s21 = sp.s21_at(28e9) # Complex S21 at 28 GHz
# Get magnitude and phase
mag_s11 = sp.magnitude(sp.s11, freq=28e9) # dB
phase_s11 = sp.phase(sp.s11, freq=28e9) # degrees
# Interpolate at any frequency
s_matrix = sp.interpolate(25.5e9) # 2x2 S-matrix
SParameters.cascade(other)
# Cascade two networks
sp_total = sp1.cascade(sp2)
# De-embed fixture from measurement
sp_dut = sp_measured.deembed(sp_fixture_left, sp_fixture_right)
Impedance Matching
LMatch(zs, zl, freq)
from rf_design import LMatch, PiMatch, TMatch
# L-network matching
match = LMatch(
zs=50+0j, # Source impedance
zl=25+30j, # Load impedance
freq=2.4e9 # Operating frequency
)
# Get component values
L, C = match.components()
print(f"L = {L*1e9:.2f} nH")
print(f"C = {C*1e12:.2f} pF")
# Get topology
topology = match.topology() # 'lowpass' or 'highpass'
# Pi-match with specified Q
pi_match = PiMatch(zs=50, zl=100, freq=5e9, Q=5)
C1, L, C2 = pi_match.components()
Filter Design
LowPassFilter(order, fc, z0, type)
from rf_design.filters import LowPassFilter, BandPassFilter
# Butterworth low-pass filter
lpf = LowPassFilter(
order=5,
fc=1e9, # Cutoff frequency
z0=50, # Impedance
type='butterworth' # or 'chebyshev', 'bessel'
)
# Get normalized prototype values
g_values = lpf.prototype_values()
# Get denormalized component values
components = lpf.components()
for comp in components:
print(f"{comp.type}: {comp.value:.3f} {comp.unit}")
# Get frequency response
freq = np.linspace(0.1e9, 5e9, 1000)
s21 = lpf.response(freq)
# Bandpass filter
bpf = BandPassFilter(
order=3,
fc=2.4e9, # Center frequency
bw=100e6, # Bandwidth
z0=50
)
Antenna Analysis
PatchAntenna(width, length, er, height)
from rf_design.antenna import PatchAntenna, PhasedArray
# Rectangular patch antenna
patch = PatchAntenna(
width=3.8e-3, # Patch width
length=2.9e-3, # Patch length
er=2.2, # Substrate εr
height=0.8e-3 # Substrate height
)
# Calculate parameters
f_res = patch.resonant_frequency()
z_in = patch.input_impedance(28e9)
gain = patch.directivity()
# Get radiation pattern
theta = np.linspace(-90, 90, 181)
E_plane = patch.pattern(theta, phi=0) # E-plane
H_plane = patch.pattern(theta, phi=90) # H-plane
PhasedArray(elements, spacing, freq)
# Create 8x8 phased array
array = PhasedArray(
nx=8, ny=8, # Array dimensions
dx=0.5, # Element spacing (wavelengths)
dy=0.5,
freq=28e9,
element=patch # Element pattern
)
# Steer beam to (theta, phi)
array.steer(theta=30, phi=0)
# Get array factor
af = array.array_factor(theta, phi)
# Apply amplitude taper
array.set_taper('taylor', sll=-25)
# Calculate metrics
hpbw = array.hpbw()
sll = array.sidelobe_level()
gain = array.gain()
Signal Integrity
Channel(sparams, signaling)
from rf_design.si import Channel, Equalizer
# Create channel from S-parameters
channel = Channel(
sparams=sp,
signaling='pam4', # or 'nrz'
baud_rate=56e9
)
# Analyze channel
il = channel.insertion_loss(freq=28e9)
rl = channel.return_loss(freq=28e9)
pulse = channel.pulse_response()
# Add equalization
eq = Equalizer(
tx_ffe_taps=3,
rx_ctle_gain=10, # dB
rx_dfe_taps=10
)
# Optimize equalizer for channel
eq.optimize(channel, target_ber=1e-12)
# Generate eye diagram
eye = channel.eye_diagram(eq, samples=10000)
eye_height = eye.height()
eye_width = eye.width()
PDN Analysis
PDN(voltage, current, ripple)
from rf_design.pdn import PDN, Capacitor
# Define PDN requirements
pdn = PDN(
voltage=0.9, # Supply voltage
current=50, # DC current
di_dt=20/1e-9, # Transient di/dt
ripple=0.03 # 3% ripple budget
)
# Target impedance
z_target = pdn.target_impedance()
# Add decoupling capacitors
pdn.add_capacitor(Capacitor(
value=100e-9, # 100 nF
esr=2e-3, # 2 mΩ
esl=100e-12, # 100 pH
quantity=20
))
# Calculate impedance profile
freq = np.logspace(3, 9, 1000)
z_pdn = pdn.impedance(freq)
# Check if meets target
passes = pdn.meets_target()
Thermal Analysis
from rf_design.thermal import ThermalModel, Package
# Define package thermal model
pkg = Package(
theta_jc=0.5, # Junction to case
theta_ca=2.0, # Case to ambient
power=20 # Total power dissipation
)
# Calculate temperatures
t_ambient = 25
t_junction = pkg.junction_temp(t_ambient)
t_case = pkg.case_temp(t_ambient)
# Add heatsink
pkg.add_heatsink(theta=1.0) # 1 °C/W heatsink
# Transient analysis
time = np.linspace(0, 60, 100)
t_transient = pkg.transient_response(time, t_ambient)