# Power to Hydrogen and Electricity Arbitrage?

Hello,

I’m working on modelling a hydrogen production system using Oemof.Solph, where the electricity sources are fixed wind and solar generators, and the only load is hydrogen demand (with no electricity demand). Additionally, I have a market price time series for excess electricity.

Here’s a summary of the components and challenges I’ve encountered:

Components:

• Bus: 2 - Electricity, hydrogen
• Source: 2 - wind and solar (each with a capacity of 11 MW)
• Transformer: 1 - electrolysis (4 MW)
• Sink: 2 - hydrogen demand and excess electricity
• GenericStorage: 1 - hydrogen store

Problems Encountered:

1. Electrolyser Capacity: Despite setting the existing electrolyser capacity to 4 MW, the model still optimizes the capacity of the electrolyser (to 1.9 MW). How can I keep the capacity constant? Also, I need the capital cost of the electrolyser to be factored into the model.This is how I defined the electrolysis component:
``````electrolysis = solph.Transformer(label='electrolysis_l',
inputs={bus_electricity: solph.Flow()},
outputs={bus_hydrogen: solph.Flow(
nominal_capacity= 4,#MW
investment=solph.Investment(
ep_costs=costs.at['electrolysis', 'capital_cost']),
variable_costs =costs.at['electrolysis', 'marginal_cost'],
maximum=4,#MW
existing=4,#MW
)},
conversion_factors={bus_hydrogen: costs.at['electrolysis','efficiency']},
)
``````
1. Excess Electricity: I have excess electricity, but is it possible to include the monetary value of the excess electricity sold in the optimized objective function? While not critically important, it would be useful to compare the model with PyPSA.
2. Electricity from the Grid: I’m considering modeling the usage of electricity from the grid, depending on prices, similar to arbitrage. My initial idea is using a Source component:
``````grid = solph.Source(label='grid_l',
outputs={bus_electricity: solph.Flow(
variable_costs=time_series['electricityprice'],
nominal_capacity= 4, #MW Capacity of the electrolyser
)
},)
``````

However, I’m unsure if this approach will work, as the grid component would be included in the objective function, but the money gained from excess electricity sink component would be kept outside it. hence I’m seeking a solution for problem 2.

If anyone has an alternative solution for the entire model or any other approaches, as well as a solution for problem 1, I would greatly appreciate your insights and assistance.

Best regards, Sajid

Hello Sajid,

thank you for posting your questions.

Now to my suggestions regarding these:

1. You may either want to provide `nominal_value` OR (exclusive) the `investment` attribute.

• Note that in the latest `oemof.solph` version, the `investment` attribute is directly passed to `nominal_value` as it replaces it. In your case, I understand that you still want to have the investment expenses included.
• As you want your investment to be fixed, i.e. a parameter, not a variable, my suggestion is to provide `nominal_value=4` and remove the `investment` attribute. You can calculate the respective annuity afterwards, using `oemof.tools.economics.annuity()` method, see oemof.tools package — oemof-tools 0.4.4.dev0 documentation and add that to your objective value in the postprocessing.
• One side note: The code identation above is not so well-readable. You may consider applying the python black formatter: Getting Started - Black 23.10.1 documentation
2. Excess electricity: I did not fully get what you aim for here. If I understand it correctly, you are thinking about selling excess energy and obtaining sort of a reward for this.

• In case you do not have any controllable generation source, you could think of passing negative variable costs to the excess electricity sink.
• But exercise caution here! I think you allow for obtaining electricity from the grid (as you write under 3.). The model could run into an adverse incentive to maximize consumption in case you can earn money with that or be agnostic about consuming and selling at the same price in case there are no losses along the way. So the consumption either needs to be (slightly) more expensive or some losses need to be there along the way to prevent this from happening.
• Again, I’d favor calculating the value of excess electricity sold in the postprocessing and subtracting it from the objective value, just to be on the safe side. But I think, the solution with energy losses should also work.
3. Concerning your third question, I think you can refer to what I wrote under 2.

@pschoen Feel free to add to this or correct me in case you have other ideas. Thank you!

Best regards and good luck,
Johannes