# Mass flow-dependent COP of a heat pump in oemof

Hello all,

I am currently trying to model a heat pump located in the return flow to a geothermal heat plant (GHP) in a district heating system.

A part of the return flow is used as the heat source and further cooled down from 58 °C to a minimum of 35 °C. Another part of the return flow is heated up from 58 °C to the supply temperature of 90 – 100 °C (depending on outside temperature).

The mass flows entering the heat pump are dependent on the operation of the GHP – if the GHP is not in operation, neither can the HP operate. But the mass flow also varies depending on how many of the four doublets of the GHP are active. The operation of the GHP is not known beforehand since it is part of the dispatch optimization.

The COP of the HP is therefore dependent on two variables:

1. Variation of outside temperature
This leads to different supply temperatures. The return temperature of 58 °C is assumed to be constant all year.

2. Variation of mass flow
Depending on the current operation of the GHP, the mass flow of the HP varies. The COP in partial load differs from the one in full load.

The heat pump is currently modelled as a Transformer with one electrical input and one thermal input with the latter being estimated through the mass flows and temperature levels in different load situations of the GHP.

The sole implementation of a COP considering 1) is easily possible in oemof when calculating the COP for delta T in the HP (e.g. in oemof-thermal) and then putting the time series of COPs as conversion_factors in the Transformer-Component, but what about 2) or ideally a combination of both?

Any ideas are very much appreciated!

Hi @kapwil,

Thanks for bringing up the question. Unluckily, I currently don’t see there is a one-node solution.

The `OffsetTransformer` can model both, part loads and time-dependent COP. So, if the temperature is known a priori, it would solve both of your problems. It does so, by allowing an offset, `Q = COP * E_el - E_0 * s`, where s is a binary status variable. However, it only allows one input and one output. The most elegant solution would be to change the implementation to allow for multiple inputs. (This is like the one-component version of suggestion 2.)

Alternatively, you could opt for a multi-node solution. I see two possible approaches:

1. You could have multiple `Transformer` components for different part loads, e.g. `Q > 0.8 Q_{max}` and `Q > 0.9 Q_{max}`. If the efficiency rises with the load, merging all of the outgoing `Flow`s in a bus with one outgoing `Flow` that is limited to `Q_{max}` would be enough. If you model low part loads and e.g. 40 % + 50 % is more efficient then 90%, you’d have to enforce that just one `Transformer` is active, using the constraint `limit_active_flow_count`.
2. You use an `OffsetTransformer`for the relation between electricity and heat. The heat `Flow` enters a bus where also the Anergy `Flow`enters. Now you need to formulate a (custom) constraint so that `Q(t) = E(t) + A(t)`, where `Q` is heat, `E` is electricity, and `A` is anergy (your 58 °C).

Hi @pschoen,

thanks for this answer and bringing the `OffsetTransformer` back to my attention.

Better late than never - here’s what I came up with: I opted for a solution where I model only three load points of the heat pump as three seperate `Transformer`s with an `OffsetTransformer` sitting before each heat pump. The `OffsetTransformer`s act like a valve and open the stream to the heat pump load point that is possible based on how many dublettes of the GHP are in operation. The individual `Transformer`s then use a predefined temperature-dependent COP.

Maybe this helps someone encountering a similar problem.