def test_two_port(self): Rexe = 0.0000001 Rexc = 0.0000001 Rwe = 0.2545383947014702 Rwke = 0.7943030881649811 Rv = 8.852701208752846e-06 Rintere = 0.00034794562965549745 Rinterc = 0.00017397281482774872 Rwkc = 0.39715154408249054 Rwka = 744.3007160198263 Rwa = 456.90414284754644 Rwc = 0.1272691973507351 Rtota= R(Rexe) + (R(Rwa) | R(Rwe) + (R(Rwka)|R(Rwke)+R(Rintere)+R(Rv)+R(Rinterc)+R(Rwkc))+ R(Rwc))+ R(Rexc) # | | Rtot = R(Rexe) + (R(Rwa) | R(Rwe) + (R(Rwka)|R(Rwke)+R(Rintere)+R(Rv)+R(Rinterc)+R(Rwkc))+ R(Rwc)) + (R(1.6+Rexc) | (R(Rexe) + (R(Rwa) | R(Rwe) + (R(Rwka)|R(Rwke)+R(Rintere)+R(Rv)+R(Rinterc)+R(Rwkc))+ R(Rwc))+ R(Rexc))) print(Rtot.simplify()) Rtot.draw('test.pdf') Rtot_2 = LSection(Rtota,Rtota) ans1 = Rtot_2.Y1sc print(ans1.simplify()) ans2 = Rtot_2.Y2sc print(ans2.simplify())
def network(self): return LSection(C('C_block'), R('R_shunt'))
L0 = 4.4 # 42 AWG 1.6 ohms/foot # 43 AWG 2.1 ohms/foot # 5000 turns, 42 AWG, 1.6 ohms/foot f0 = 7.715e3 R0 = 319e3 # The impedance at resonance will be slightly higher than R0. omega0 = 2 * np.pi * f0 C0 = 1 / (omega0**2 * L0) a = LSection(R(R0) + L(L0), C(C0)) f = np.logspace(1, 5, 1000) H = a.Vgain12 Hf = H.frequency_response(f) fig = figure() ax = fig.add_subplot(111) ax.loglog(f, abs(Hf), linewidth=2) ax.set_xlabel('Frequency (Hz)') ax.grid(True) b = a.short_circuit(1) Zoc = b.Zoc
from lcapy import Vdc, R, L, C, LSection, Shunt import numpy as np from matplotlib.pyplot import figure, savefig, show a1 = LSection(L(10), C(1, 5)) b1 = a1.prepend(Shunt(Vdc(5))).load(R(5)) a2 = LSection(L(10), C(1e-10, 5)) b2 = a2.prepend(Shunt(Vdc(5))).load(R(5)) a1 = (Vdc(5) + L(10)) a2 = (Vdc(5) + L(10)) | C(1, 5) b1 = a1.load(R(5)) b2 = a2.load(R(5)) t = np.linspace(0, 10, 1000) fig = figure() ax = fig.add_subplot(111) # Voltage across R ax.plot(t, b1.V.impulse_response(t), linewidth=2, label='without C') ax.plot(t, b2.V.impulse_response(t), linewidth=2, label='with C') ax.legend() ax.set_xlabel('Time (s)') ax.set_ylabel('Voltage (V)') ax.grid(True) fig = figure() ax = fig.add_subplot(111) # Current through R ax.plot(t, b1.I.impulse_response(t), linewidth=2, label='without C')
from lcapy import R, L, C, LSection, pprint, ZPK C1 = C('C_1') L1 = L('L_1') R1 = R('R_1') a = LSection(R1, C1 | L1) Av = a.Vtransfer pprint(Av.canonical()) pprint(Av.ZPK()) pprint(Av.poles()) pprint(Av.zeros())
def network(self): return LSection( R('R_in'), R('R_out') )
from lcapy import R, L, C, LSection, pprint, ZPK C1 = C('C_1') L1 = L('L_1') C2 = C('C_2') L2 = L('L_2') a = LSection(C1 | L1, C2 | L2) Av = a.Vtransfer pprint(Av.canonical()) pprint(Av.ZPK()) pprint(Av.poles()) pprint(Av.zeros())
def network(self): return LSection(R('R_row'), C('C_pass'))
L0 = 4.4 # 42 AWG 1.6 ohms/foot # 43 AWG 2.1 ohms/foot # 5000 turns, 42 AWG, 1.6 ohms/foot f0 = 7.715e3 R0 = 319e3 # The impedance at resonance will be slightly higher than R0. omega0 = 2 * np.pi * f0 C0 = 1 / (omega0**2 * L0) a = LSection(R(R0) + L(L0), C(C0)) R1 = 500e3 R1 = 1e3 C1 = 22e-9 a = a.chain(Shunt(R(R1) + C(C1))) f = np.logspace(1, 5, 1000) H = a.Vgain12 Hf = H.frequency_response(f) fig = figure() ax = fig.add_subplot(111) ax.loglog(f, abs(Hf), linewidth=2)
from lcapy import R, L, C, LSection, pprint, ZPK R1 = R('R_1') R2 = R('R_2') a = LSection(R1, R2) Av = a.Vtransfer pprint(Av.canonical()) pprint(Av.ZPK()) pprint(Av.poles()) pprint(Av.zeros())