Skip to content

PEM Cell - Refactor for OM#90

Draft
elenya-grant wants to merge 7 commits into
NatLabRockies:developfrom
elenya-grant:om_refactor/pem_cell
Draft

PEM Cell - Refactor for OM#90
elenya-grant wants to merge 7 commits into
NatLabRockies:developfrom
elenya-grant:om_refactor/pem_cell

Conversation

@elenya-grant

@elenya-grant elenya-grant commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Feature or improvement description

Added a cell base-class and PEM cell performance model. There are some basic tests included. Some outputs of the PEM cell are not yet used, but may be useful to include later. Also - some methods from the PEM model may be moved to another component as the structure of this gets figured out!

TODO:

  • rename current to I
  • rename current_density to J
  • rename hydrogen to H2
  • rename cell_active_area to A_cell
  • rename oxygen to O2
  • rename water to H2O
  • rename cell_voltage to V_cell
  • rename H2_production_rate to H2_out
  • rename O2_production_rate to O2_out
  • add power output (P_cell, or would P_cell_consumed make more sense?)
  • add constants.py file (missing at the moment)

Related issue, if one exists

Impacted areas of the software

  • electrolyzer/components/cell/cell.py: contains the cell base-class
  • electrolyzer/components/cell/pem_cell.py: contains the PEM cell model and config
  • electrolyzer/components/cell/test/test_pem_cell_config.py: tests for the PEM cell config.
  • electrolyzer/components/cell/test/test_pem_cell.py: tests for the PEM cell model

Additional supporting information

Test results, if applicable

@elenya-grant elenya-grant requested a review from johnjasa July 6, 2026 18:29
Comment on lines +269 to +290
def h2_production(self, inputs):
h2_grams_per_sec = self.h2_production_rate(inputs)
return h2_grams_per_sec * self.dt

def o2_production(self, inputs):
o2_grams_per_sec = self.o2_production_rate(inputs)
return o2_grams_per_sec * self.dt

def power_consumption_rate(self, inputs):
V_cell = self.cell_voltage(inputs)
I_cell = self.get_current(inputs)
return V_cell * I_cell

def energy_consumption(self, inputs):
V_cell = self.cell_voltage(inputs)
I_cell = self.get_current(inputs)
return V_cell * I_cell * self.dt

def conversion_efficiency(self, inputs):
h2_grams_per_sec = self.h2_production_rate(inputs)
power_W_per_sec = self.power_consumption_rate(inputs)
return power_W_per_sec / np.max([1e-30, h2_grams_per_sec])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all of these methods, I have a slight preference for passing in just the input variables needed (e.g. not passing in the whole inputs dictionary) so that's it's more clear what info is being used.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I agree. I do think that these specific methods will be moved to another component in a future PR. I could do that in this PR if you want!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on the inputs as the input to the method cell_voltage() in pem_cell.py?

@johnjasa johnjasa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me! I know it's a work in progress. I like the generality with which you're adding methods here. When we're looking at the bigger system and how the cell parts fit together, I might have more opinions about how to handle the inputs/outputs, but no big thoughts there yet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants