Beispiel #1
0
def test_one_wire_capacitance_shield():
    rw = 0.5e-3
    rs = 4e-3
    er = 5.2
    wires = [Wire(0, 0, rw)]
    ref = Shield(rs)
    cable = mtl.WireMtl(wires, ref, er)
    C = cable.capacitance()
    expected = coax.capacitance(rw, rs, er)
    assert C == approx(expected, rel=0.001, abs=1e-14)
Beispiel #2
0
def test_two_wire_capacitance_shield():
    # Paul MTL P5.11
    rw = 0.1905e-3
    s = 4 * rw
    rs = 4 * rw
    wires = [Wire(-0.5 * s, 0, rw), Wire(0.5 * s, 0, rw)]
    ref = Shield(rs)
    pair = mtl.WireMtl(wires, ref)
    C = pair.capacitance()
    expected = np.array([[52.8, -10.73], [-10.73, 52.8]]) * 1e-12
    assert C == approx(expected, rel=0.001, abs=1e-14)
Beispiel #3
0
def test_two_wire_inductance_shield():
    # Paul MTL P5.10
    rw = 0.1905e-3
    s = 4 * rw
    rs = 4 * rw
    wires = [Wire(-0.5 * s, 0, rw), Wire(0.5 * s, 0, rw)]
    ref = Shield(rs)
    pair = mtl.WireMtl(wires, ref)
    L = pair.inductance()
    expected = np.array([[0.2197, 0.0446], [0.0446, 0.2197]]) * 1e-6
    assert L == approx(expected, rel=0.001)
Beispiel #4
0
def test_shield_contains_overlap():
    a = Wire(0.6, 0, 0.5)
    s = Shield(1.0)
    assert not s.contains(a)
Beispiel #5
0
def test_shield_contains_outside():
    a = Wire(2.0, 0, 0.5)
    s = Shield(1.0)
    assert not s.contains(a)
Beispiel #6
0
def test_shield_contains_wire_on_edge():
    a = Wire(0, 0.5, 0.5)
    s = Shield(1.0)
    assert s.contains(a)
Beispiel #7
0
def test_shield_contains_wire_larger():
    a = Wire(0, 0, 1.5)
    s = Shield(1.0)
    assert not s.contains(a)
Beispiel #8
0
def test_shield_contains():
    a = Wire(0, 0.0, 0.5)
    s = Shield(1.0)
    assert s.contains(a)
Beispiel #9
0
def test_shield_radius_zero():
    with pytest.raises(ValueError):
        Shield(0)