Two inputs (Gas, Methane) in Gas_PP with methanation / Investment constraints

(repost/ new Topic from Modelleing a two way transformer with an investment object in oemof - #4 by Phil)

Hello everyone,
first of all I wanted to build an energy system like this:

Lignite source >> lignite_bus            >> Lignite powerplant >> electricity_bus   >> El_Demand
Gas source     >> gas_bus                >> Gas boiler         >> thermal_bus       >> Th_demand
solar source   >> solar_
[my_model_without_Lig.txt|attachment](upload://2gD87whVBRp158uvu4kZtWRxXON.txt) (115.9 KB)
[my_model.txt|attachment](upload://jwL8X2fDDLQL9jYl5twoUcK2Rmn.txt) (150.6 KB)
bus              >> PV powerplant      >> electricity_bus   >> El_Demand
Gas source     >> [gas_bus, methane_bus] >> Gas powerplant     >> electricity_bus   >> El_Demand
                                            Gas powerplant     >> thermal_bus       >> Th_demand
                  electricity_bus        >> Methane powerplant >> methane_bus 
                  methane_bus            >> Methane Storage    >> methane_bus 

I implemented the Gas-powerplant like this:

 trsf = solph.Transformer(
            label='pp_gas',
            inputs={gas_bus: solph.Flow( investment=...),
                methane_bus: solph.Flow( investment=...)},
  outputs={electricity_bus: solph.Flow(), thermal_bus: solph.Flow()},
  conversion_factors={electricity_bus: 0.3, thermal_bus: 0.5,
                              gas_bus: 1, methane_bus: 1})

But it seems that there is no way for oemof to solve this problem. Even with more than enough capacity in Gas and PV and expensive lignite costs, the System is not using the Gas-PP or produces Methane.
If i run the Simulation without Lignite, the System should produce methane with PV at daytime and use the methane in the Gas PP at night or just use the Gas-PP with natural gas only.
However, it does not consume gas and calls a ValueError because the demand cannot be met

ValueError: No value for uninitialized NumericValue object flow[pp_gas,electricity-BUS,0]

In the LP-Files the methane input is implemented.
my_model.txt (150.6 KB) #(Model with lignite PP >> working)
my_model_without_Lig.txt (115.9 KB) #(Model without lignite PP >> not working)

My idea to solve this Problem, was to split the gas power plant. In one with a gas input and one with a methane input. But both must have the same investments and a combined maximum output-flow.
So I wanted to add a investment constraint.

I tried
om.InvestmentFlow.investment_costs.expr(invest[i, o])
from
https://oemof-solph.readthedocs.io/en/latest/reference/oemof.solph.html?highlight=investmentflow#oemof.solph.blocks.investment_flow.InvestmentFlow

But I don’t understand the command correctly and the output is always the complete investment of alle powerplants.

Do you have a solution for the main-problem or the investment problems?
Greetings
Philipp

If you define the pp_gas Transformer like this you will have a permanent flow from both sources. You get four constraints.

flow_methan * 0.3 = flow_elec
flow_ gas * 0.3 = flow_elec
flow_methan * 0.5 = flow_therm
flow_ gas * 0.5 = flow_therm

Which means for one unit flow_elec you need 3.33 units flow_methan and(!) 3.33 units flow_gas. This is not what you want.

What is the difference between flow_methan and flow_gas? The output of the methan plant could feed into the gas bus. In that case your gas-chp will have only one input and you will not have all these problems.

To make it easier to analyse the LP-file:

  1. Please use only 2 or 3 time steps if you write out an LP-file to keep it readable.
  2. Please use the same names, so that I can find the objects in the LP-file.
Text and images licensed under CC BY 4.0Data licensed under CC0 1.0Code licensed under MITSite terms of serviceOpenmod mailing listOpenmod wiki.