def test_wire_capacitance_er(): rw = 7.5 s = 50 er = 4 C = mtl.wire_capacitance(s, rw) Cer = mtl.wire_capacitance(s, rw, er=er) assert C == approx(Cer / er, abs=1e-14)
def test_wire_capacitance(): # Paul MTL P4.2 rw = 7.5 s = 50 C = mtl.wire_capacitance(s, rw) C2 = mtl.wire_capacitance(s, rw, rw) assert C == approx(14.8e-12, abs=0.1e-12) assert C == approx(C2, abs=0.1e-12)
def test_two_wire_capacitance(): rw = 7.5 s = 50 wires = [Wire(-0.5 * s, 0, rw)] ref = Wire(0.5 * s, 0, rw) pair = mtl.WireMtl(wires, ref) C = mtl.wire_capacitance(s, rw) assert pair.capacitance()[[0]] == approx(C, rel=0.02, abs=1e-14)
def test_two_wire_capacitance_fdm_near(): rw = 1e-3 s = 3e-3 wires = [Wire(-0.5 * s, 0, rw)] ref = Wire(0.5 * s, 0, rw) pair = mtl.WireMtl(wires, ref) expected = mtl.wire_capacitance(s, rw) C = pair.capacitance(method='fdm', fdm_params={'dx': rw / 10}) assert C == approx(expected, rel=0.05, abs=0.1e-12)
def test_two_wire_capacitance_diagonal(): rw = 7.5 s = 50 x2 = y2 = s / np.sqrt(2) wires = [Wire(0, 0, rw)] ref = Wire(x2, y2, rw) pair = mtl.WireMtl(wires, ref) C = mtl.wire_capacitance(s, rw) assert pair.capacitance()[[0]] == approx(C, rel=0.02, abs=1e-14)
def test_wire_capacitance_rw2_too_close(): rw1 = 10 rw2 = 5 s = 14 with pytest.raises(Exception): mtl.wire_capacitance(s, rw1, rw2)
def test_wire_capacitance_too_close(): rw = 10 s = 19 with pytest.raises(Exception): mtl.wire_capacitance(s, rw)