示例#1
0
def test_4c_coupling_statements(mtl4c_params):
    result = pi_model_mtl(1, **mtl4c_params)
    lines = result.split('\n')
    _, Ke = get_inductances(mtl4c_params['L'])
    assert f'K12_001 L11_001 L22_001 {Ke[0, 1]:.5e}' in lines
    assert f'K13_001 L11_001 L33_001 {Ke[0, 2]:.5e}' in lines
    assert f'K23_001 L22_001 L33_001 {Ke[1, 2]:.5e}' in lines
示例#2
0
def test_4c_inductor_statements(mtl4c_params):
    result = pi_model_mtl(1, **mtl4c_params)
    lines = result.split('\n')
    Le, _ = get_inductances(mtl4c_params['L'])
    assert f'L11_001 101 201 {Le[0]:.5e}' in lines
    assert f'L22_001 102 202 {Le[1]:.5e}' in lines
    assert f'L33_001 103 203 {Le[2]:.5e}' in lines
示例#3
0
def test_3c_inductor_statements(mtl3c_params):
    result = pi_model_mtl(1, **mtl3c_params)
    lines = result.split('\n')
    Le, Ke = get_inductances(mtl3c_params['L'])
    assert f'L11_001 101 201 {Le[0]:.5e}' in lines
    assert f'L22_001 102 202 {Le[1]:.5e}' in lines
    assert f'K12_001 L11_001 L22_001 {Ke[0, 1]:.5e}' in lines
示例#4
0
def test_4c_capacitance(mtl4c_params):
    N = 1
    result = pi_model_mtl(N, **mtl4c_params)
    lines = result.split('\n')
    Ce = get_capacitances(mtl4c_params['C'])
    for i in range(3):
        capacitances = get_values_of(f'C{i+1}{i+1}', lines)
        assert len(capacitances) == N + 1
        assert sum(capacitances) == approx(Ce[i, i], rel=0.001)
        assert len(set(capacitances)) == 1
示例#5
0
def test_4c_inductance(mtl4c_params):
    N = 1
    result = pi_model_mtl(N, **mtl4c_params)
    lines = result.split('\n')
    Le, _ = get_inductances(mtl4c_params['L'])
    for i in range(3):
        inductances = get_values_of(f'L{i+1}{i+1}', lines)
        assert len(inductances) == N
        assert sum(inductances) == approx(Le[i], rel=0.001)
        assert len(set(inductances)) == 1
示例#6
0
def test_4c_mutual_capacitor_statements(mtl4c_params):
    result = pi_model_mtl(1, **mtl4c_params)
    lines = result.split('\n')
    Ce = get_capacitances(mtl4c_params['C'])
    assert f'C12_001 101 102 {0.5 * Ce[0, 1]:.5e}' in lines
    assert f'C12_002 201 202 {0.5 * Ce[0, 1]:.5e}' in lines
    assert f'C13_001 101 103 {0.5 * Ce[0, 2]:.5e}' in lines
    assert f'C13_002 201 203 {0.5 * Ce[0, 2]:.5e}' in lines
    assert f'C23_001 102 103 {0.5 * Ce[1, 2]:.5e}' in lines
    assert f'C23_002 202 203 {0.5 * Ce[1, 2]:.5e}' in lines
示例#7
0
def test_4c_self_capacitor_statements(mtl4c_params):
    result = pi_model_mtl(1, **mtl4c_params)
    lines = result.split('\n')
    Ce = get_capacitances(mtl4c_params['C'])
    assert f'C11_001 101 100 {0.5 * Ce[0, 0]:.5e}' in lines
    assert f'C11_002 201 100 {0.5 * Ce[0, 0]:.5e}' in lines
    assert f'C22_001 102 100 {0.5 * Ce[1, 1]:.5e}' in lines
    assert f'C22_002 202 100 {0.5 * Ce[1, 1]:.5e}' in lines
    assert f'C33_001 103 100 {0.5 * Ce[2, 2]:.5e}' in lines
    assert f'C33_002 203 100 {0.5 * Ce[2, 2]:.5e}' in lines
示例#8
0
def test_4c_coupling(mtl4c_params):
    N = 1
    result = pi_model_mtl(N, **mtl4c_params)
    lines = result.split('\n')
    _, Ke = get_inductances(mtl4c_params['L'])
    for i in range(3):
        for j in range(i + 1, 3):
            couplings = get_values_of(f'K{i+1}{j+1}', lines)
            assert len(couplings) == N
            assert sum(couplings) == approx(Ke[i, j], rel=0.001)
            assert len(set(couplings)) == 1