Hydrogen Model with Compressor Energy Demand

134 views
Skip to first unread message

Miguel Caicedo

unread,
Jan 8, 2025, 2:25:42 PM1/8/25
to pypsa
Dear PyPsa Team,

I am currently modeling an on-grid hydrogen system and would appreciate your feedback on whether the use of the components follows the correct approach. Please find the attached image for reference.

My goal is to frame the model as a capacity expansion problem, where I define the hydrogen demand and, based on that, optimize the capacities of the extendable components.

Additionally, I was hoping to include the compressor load, which I intend to derive after determining the optimal electrolyzer capacity (and thus the required mass flow, which will inform the capacity of the compressor's shaft motor). See also the image for reference.

I’d be happy to discuss further and hear your thoughts.

Best regards,
Miguel



Screenshot 2025-01-08 at 20.23.48.png

Bennet Köppchen

unread,
Jan 9, 2025, 3:26:27 AM1/9/25
to pypsa
Hi Miguel, 

if you really want to analyze the aspect of optimizing the compressors load and capacity I have another suggestion for your problem. 

Instead of using an extra (inelastic) Load connected to the electricity bus you could think about modelling the compressor as a multilink with 2 input and two outputs. 
Connect the multilink like this:
Bus 0: connected to the H2 Bus (low pressure)
Bus 1: connected the H2 Bus (high pressure) 
Bus 2: conncected to electricty (set efficiency to a negative value and use relative value for electricity consumption per H2 compression) 
Bus 3: connected to additional Bus with same efficiency as bus 2 but positive value (e.g. call the new bus 'compressor consumption bus')
then connect an infinite negativ Generator to bus 3 which consumes all energy that has been sent to the 'compressor consumption bus' 
Additionally you can give the Multilink capacity costs for analyzing the expansion.
See the picture attached for clarification. 

Using this approach the compressor ist able to 'convert' the hydrogen simultaneously as it consumes electricity. 
I hope the idea helps you with your problem. 

See this link to better understand a multiklink: 

I used this model a few year ago, so you should validate that again. 
Please let me know if you need further discussion. 

Cheers 
Bennet 
compressor model pypsa.pdf

Miguel Caicedo

unread,
Jan 9, 2025, 7:06:22 PM1/9/25
to pypsa
Hello Bennet,

thanks a lot for taking the time to explain your solution (really out of the box thinking there!)
-I have adjusted my sketch accordingly to fit your suggestion, see image attached. Would you kindly confirm this is a proper modeling using the components of pypsa? I still have to validate of course, but I would like to get your final opinion before setting all up.
-could you kindly confirm if the condition for the compressor´s electricity demand based on hydrogen flow is that the p_set for the multilink sub-link  3 is p_set= (kW/kg_H2)*(n.links_t.p1['Electrolyzer']/39,4)? 
-You mentioned you use the model years ago, is there any work I can reference?
Thanks!

Best,
Miguel

Screenshot 2025-01-10 at 01.04.41.png

Bennet Köppchen

unread,
Jan 12, 2025, 4:00:49 AM1/12/25
to pypsa
Dear Miguel, 

yes, I can confirm that you may use the PyPSA components for modelling this system. 
But, you should have a look into the documentation to understand how multilinks work. 

In particular the example with biomass and synthetic fuels is very interesting: 

Keep in mind that all inputs and outputs always work simultaneously, which means that you have to define every input and output relativ to the each other. For each Unit of hydrogen consumed from Bus 'H2' there is a relativ consumption of electricity being consumed from Bus 'electricity'. 
In case of hydrogen you should bring it from kg to kWh.  
Here is a example: 
I assume that the compressor needs 8 kWh_electricity per 1 kg_hydrogen, then you know that per kWh hydogen you have an electricity demand of 0.24 kWh (8kWh_elec/33.3kWh_h2). 
To define your multilink you don't need any power capacities or p_set, just define the compressor size (p_nom at bus0) and set all other efficiencies accordingly. 
Since pypsa only knows multilinks with multiple outputs you have to set the efficiency for p3 to -0.24 ( negativ!) (as in my example) so that the link withdraws from the elctricity bus for each positiv power flow. The efficiency from bus p4 is als 0.24 so make sure the same amount of electricity leaves the multilink. Efficiency for bus p2 can be set to 1. 
You must not set any power capacities nor p_set values for the links. This would hinder the optimization in controlling the compressor power (and nominal power capacity) endogenously.

Two further information: 
1. You can set the multilink to extendable and add an investment price. This price is again depending on the power inflow add bus0 so it should be in €/(kWh_H2*a) or €/(kg_H2*a) (or something like that). 
2. You can can set the generator at bus p4 to extendable, but this could need more calculation time than just using a very high exogenously set value (like 1000000). Also keep in mind to ensure that this generator consumes energy by setting "sign = -1".

I used this approach in a student project. So unfortunetly there is no publication you can refer to, but I would be very interested in seeing this model in action. 

I hope that helps. Let me know if you need further information. 

Bennet 

Miguel Caicedo

unread,
Jan 21, 2025, 5:23:26 AM1/21/25
to pypsa
Hello Bennet, 

I hope you are doing well, first of all thanks again for sharing your thoughts. I have been testing your solution and I had to make a minor adjustment:

  • After several tries, adding the "compressor_consumption" bus an the  generator that tracks the consumption, it leads to infeasible results, the model cannot be solved by PyPsa. 
  • I removed this bus and the generator and modeled as shown in the attached image "model_components". The model is solved in MW.
  • The consumption of the generator can be tracked with n.links_t.p2, in my image see the column compressor_MW
  • I think this works because I am modelling a capacity expansion problem, where the generators pv and wind are extendable, that means that the consumption of the compressor is actually compensated with larger pv/wind capacity. 
  • I wanted the user to be able to define the pressure wished for the hydrogen before the model is solved. I used the formula you see attached taken from link, see also link for comparison . This formula is slightly adapted to define the efficiency of the multilink point that is attached to the electricity bus (p2).
  • For initial pressure of 20 bar and final pressure of 200 bar the compressor consumption is around 0,452MW to compress a hydrogen flow of ~11MW or 289kg/h, in one stage, and comparing with wind, solar, electrolyzer power of >10MW this seems very low, nevertheless the compressor consumption per kg seems to be in line with what I found in literature : 2,2kWh/kg_2, this aligns with other values as in link, see " Regarding the storage pressure inside the metal tank (200 bar) and underground cavern (180 bar), the energy consumption of the hydrogen compressor is approximately 2.2 kWh/kgH2", and as in link for a 700 bar compression would be  6kWh/kgH2, giving a good hint that my result is feasible.
Since you expressed your interest to see the model in action I would be more than happy to have a short sparring session with you, if it fits you well. As always, happy to hear your thoughts!
All best,
Miguel





results.png
model_components.png
compressor_rated_power.png
Reply all
Reply to author
Forward
0 new messages