Modelling a heat pump in oemof (solph)

heat-pump
oemof

#1

How can I model a heat pump in oemof. I think it is necessary to create three buses (low temperature reservoir, electricity, high temperature). But the LinearTransformer class does not allow more than one input. Is there another way to do it?


Do-a-thon: Collect approaches to thermal energy systems
#2

It depends on which oemof version you use. If you use oemof < v0.1.2 (but 0.1.x) you have to model it with just two buses. You can calculate the COP in advance using the temperature of the reservoir and the average temperature of the heat bus. You can pass it as a list, numpy.array, pandas.Series etc…

from oemof import solph
cop = [2.5, 2.3, 2.5]  # length = number of time steps  
solph.LinearTransformer(
    label="pp_gas",
    inputs={electricity_bus: solph.Flow()},
    outputs={heat_bus: solph.Flow(nominal_value=maximum_output)},
    conversion_factors={electricity_bus: cop})

With oemof >= v0.1.2 you can use two or three buses. But think hard if you gain an extra value by using an extra bus.

from oemof import solph
b_el = solph.Bus(label='electricity')
b_th_low = solph.Bus(label='low_temp_heat')
b_th_high = solph.Bus(label='high_temp_heat')

cop = 3  # coefficient of performance of the heat pump

solph.LinearN1Transformer(
    label='heat_pump',
    inputs={bus_elec: Flow(), bus_low_temp_heat: Flow()},
    outputs={bus_th_high: Flow()},
    conversion_factors={bus_elec: cop,
                        b_th_low: cop/(cop-1)})

#3

UPDATE:

With oemof > v0.2.0 the LinearTransformer and the LinearN1Transformer are renamed to Transformer. Now you can model unlimited inputs and outputs with the same class. Please notice, that the definition of the conversion_factors changed for input flows (see the API documentation of the Transformer class ).

    from oemof import solph

    b_el = solph.Bus(label='electricity')
    b_th_low = solph.Bus(label='low_temp_heat')
    b_th_high = solph.Bus(label='high_temp_heat')

    cop = 3  # coefficient of performance of the heat pump

    solph.Transformer(
        label='heat_pump',
        inputs={b_el: Flow(), b_th_low: Flow()},
        outputs={b_th_high: Flow()},
        conversion_factors={b_el: 1/cop,
                            b_th_low: (cop-1)/cop})

If you model the heat pump with one Input you just have to rename the class.

    from oemof import solph
    cop = [2.5, 2.3, 2.5]  # length = number of time steps  
    solph.Transformer(
        label="pp_gas",
        inputs={electricity_bus: solph.Flow()},
        outputs={heat_bus: solph.Flow(nominal_value=maximum_output)},
        conversion_factors={electricity_bus: cop})