def distributed_rlgc_from_sdb(length_m, freq, Sdb, Sdeg, z0_probe=complex(50, 0)): # length_m: (m) Length of structure being measured # s2p_filename: (str) s2p filename # z0_probe: (Ohms) Impedance of network analyzer/probes. 50 Ohm default. Sri = rfs.sdb2sri(Sdb, Sdeg) abcd = rfs.s2abcd(Sri, z0_probe, z0_probe) d_vec = np.zeros((len(abcd)), dtype=complex) c_vec = np.zeros((len(abcd)), dtype=complex) for idx, T in enumerate(abcd): d_vec[idx] = T[1][1] c_vec[idx] = T[1][ 0] # C vector (what I think needs to be used for Zc extraction) gamma = 1 / length_m * np.arccosh(d_vec) Zc = 1 / c_vec * np.sinh(gamma * length_m) R = (gamma * Zc).real L = 1 / 2 / math.pi / freq * ((gamma * Zc).imag) G = (gamma / Zc).real C = 1 / 2 / math.pi / freq * (gamma / Zc).imag losstan = (gamma / Zc).real / (gamma / Zc).imag attenuation = 20 * np.log10(abs(np.exp(-gamma * length_m))) return (freq, R, L, G, C, gamma, attenuation, losstan, Zc)
def get_pad_abcd(pad_L_s2p_filename, pad_2L_s2p_filename, z0_probe=complex(50, 0)): (freq_L, Sdb_L, Sdeg_L) = rfs.get_sdb_from_vna_csv(pad_L_s2p_filename) (freq_2L, Sdb_2L, Sdeg_2L) = rfs.get_sdb_from_vna_csv(pad_2L_s2p_filename) # ABCD matrices S_L = rfs.sdb2sri(Sdb_L, Sdeg_L) S_2L = rfs.sdb2sri(Sdb_2L, Sdeg_2L) abcd_L = rfs.s2abcd(S_L, z0_probe) abcd_2L = rfs.s2abcd(S_2L, z0_probe) abcd_pad = np.zeros(np.shape(abcd_L), dtype=complex) # ABCD matrix structure for pad abcd_pad_inv = np.zeros( np.shape(abcd_L), dtype=complex) # inverse abcd matrix structure for pad # iterating across each frequency point for idx, abcd_L_mat in enumerate(abcd_L): abcd_2L_mat = abcd_2L[idx] abcd_L_inv = la.inv(abcd_L_mat) abcd_P_squared = la.inv( np.dot(abcd_L_inv, np.dot(abcd_2L_mat, abcd_L_inv))) # PP = ( ML^-1 * M2L * ML^-1 )^-1 abcd_P = la.sqrtm( abcd_P_squared ) # ABCD matrix of the pad (single pad) for this frequency abcd_P_inv = la.inv(abcd_P) abcd_pad[idx] = abcd_P abcd_pad_inv[idx] = abcd_P_inv Sri_pad = rfs.abcd2s(abcd_pad, z0_probe, z0_probe) (Sdb_pad, Sdeg_pad) = rfs.sri2sdb(Sri_pad) return (freq_L, abcd_pad, abcd_pad_inv, Sri_pad, Sdb_pad, Sdeg_pad)