Example #1
0
def test_offsettransformer_wrong_flow_type():
    """No NonConvexFlow for Inflow defined."""
    with pytest.raises(TypeError,
                       match=r'Input flows must be of type NonConvexFlow!'):
        bgas = Bus(label='gasBus')
        components.OffsetTransformer(label='gasboiler',
                                     inputs={bgas: Flow()},
                                     coefficients=(-17, 0.9))
Example #2
0
def test_offsettransformer_too_many_output_flows():
    """Too many Output Flows defined."""
    with pytest.raises(ValueError,
                       match='OffsetTransformer` must not have more than 1'):
        bm1 = Bus(label='my_offset_Bus1')
        bm2 = Bus(label='my_offset_Bus2')

        components.OffsetTransformer(label='ostf_2_out',
                                     inputs={
                                         bm1:
                                         Flow(nominal_value=60,
                                              min=0.5,
                                              max=1.0,
                                              nonconvex=NonConvex())
                                     },
                                     outputs={
                                         bm1: Flow(),
                                         bm2: Flow()
                                     },
                                     coefficients=(20, 0.5))
Example #3
0
def test_offsettransformer__too_many_input_flows():
    """Too many Input Flows defined."""
    with pytest.raises(ValueError,
                       match=r"OffsetTransformer` must not have more than 1"):
        bgas = Bus(label='GasBus')
        bcoal = Bus(label='CoalBus')
        components.OffsetTransformer(label='ostf_2_in',
                                     inputs={
                                         bgas:
                                         Flow(nominal_value=60,
                                              min=0.5,
                                              max=1.0,
                                              nonconvex=NonConvex()),
                                         bcoal:
                                         Flow(nominal_value=30,
                                              min=0.3,
                                              max=1.0,
                                              nonconvex=NonConvex())
                                     },
                                     coefficients=(20, 0.5))
Example #4
0
def test_offsettransformer_empty():
    """No NonConvexFlow for Inflow defined."""
    components.OffsetTransformer()
Example #5
0
def test_offsettransformer_too_many_coefficients():
    with pytest.raises(
            ValueError,
            match=r'Two coefficients or coefficient series have to be given.'):
        components.OffsetTransformer(label='of2', coefficients=(1, 4, 7))
Example #6
0
def test_offsettransformer_not_enough_coefficients():
    with pytest.raises(
            ValueError,
            match=r'Two coefficients or coefficient series have to be given.'):
        components.OffsetTransformer(label='of1', coefficients=([1, 4, 7]))