Skip to content

Commit

Permalink
fix bad merge conflict resolution from ad7d7c8 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
RHammond2 authored Nov 8, 2024
1 parent a0cc817 commit 055119f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 95 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
run: |
sudo apt-get update && sudo apt-get install -y libglpk-dev glpk-utils coinor-cbc
python -m pip install --upgrade pip
pip install ProFAST@git+https://github.com/NREL/ProFAST.git
pip install ".[develop]"
- name: Create env file
run: |
Expand Down
1 change: 0 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ pip install -e ".[all]"

```bash
conda install -y -c conda-forge glpk
pip install ProFAST@git+https://github.com/NREL/ProFAST.git
```

````{note}
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ dependencies:
- glpk
- pip
- pip:
- ProFAST@git+https://github.com/NREL/ProFAST.git
- "."
2 changes: 0 additions & 2 deletions greenheart/tools/eco/electrolysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

from greenheart.simulation.technologies.hydrogen.electrolysis.PEM_BOP.PEM_BOP import pem_bop

# from electrolyzer import run_electrolyzer


def run_electrolyzer_physics(
hopp_results,
Expand Down
90 changes: 0 additions & 90 deletions greenheart/tools/optimization/openmdao.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import numpy as np
import openmdao.api as om

import electrolyzer.inputs.validation as val
from electrolyzer import run_lcoh

from shapely.geometry import Polygon, Point
from hopp.simulation import HoppInterface
from greenheart.simulation.greenheart_simulation import GreenHeartSimulationConfig, run_simulation
Expand Down Expand Up @@ -305,90 +302,3 @@ def compute(self, inputs, outputs):

def setup_partials(self):
self.declare_partials('*', '*', method='fd', form='forward')

class ElectrolyzerComponent(om.ExplicitComponent):
"""
This is an OpenMDAO wrapper to the generic electrolyzer model.
It makes some assumptions about the number of electrolyzers, stack size, and
how to distribute electricity across the different electrolyzers. These
could be later made into modeling options to allow for more user configuration.
"""
def initialize(self):
self.options.declare("h2_modeling_options")
self.options.declare("h2_opt_options")
self.options.declare("modeling_options")
self.options.declare("design_variables",
# ["electrolyzer_rating_kw"],
types=list,
desc="List of design variables that should be included",
default=[],
recordable=False)

def setup(self):
self.add_input("power_signal", val=np.zeros(8760), units="W")
self.add_input("lcoe_real", units="USD/kW/h")

if "electrolyzer_rating_kw" in self.options["design_variables"]:
self.add_input("electrolyzer_rating_kw", val=15000, units="kW")

if self.options["h2_opt_options"]["control"]["system_rating_MW"]["flag"] \
or self.options["modeling_options"]["rating_equals_turbine_rating"]:
self.add_input("system_rating_MW", units="MW", val=self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"])
self.add_output("h2_produced", units="kg")
self.add_output("max_curr_density", units="A/cm**2")
self.add_output("electrolyzer_capex", units="USD")
self.add_output("electrolyzer_opex", units="USD")
self.add_output("lcoh", units="USD/kg")
self.add_output("h2_produced_hourly", units="kg", val=np.zeros(8760))
self.add_output("power_kW_curtailed", units="kW", val=np.zeros(8760))
self.add_output("power_kW_avail", units="kW", val=np.zeros(8760))
# self.add_output("deg_state", units="V", val=np.zeros(6)) # TODO we need a way to size this dynamically

def compute(self, inputs, outputs):
# Set electrolyzer parameters from model inputs
power_signal = inputs["power_signal"]
lcoe_real = inputs["lcoe_real"][0]

if "electrolyzer_rating_kw" in inputs:
self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = inputs["electrolyzer_rating_kw"][0]*1E-3

elif self.options["h2_opt_options"]["control"]["system_rating_MW"]["flag"] \
or self.options["modeling_options"]["rating_equals_turbine_rating"]:
self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = inputs["system_rating_MW"][0]

elif "electrolyzer_rating_MW" in self.options["modeling_options"]["overridden_values"]:
electrolyzer_rating_MW = self.options["modeling_options"]["overridden_values"]["electrolyzer_rating_MW"]
self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = electrolyzer_rating_MW

h2_prod, max_curr_density, lcoh, lcoh_dict, lcoh_options_dict, = run_lcoh(
self.options["h2_modeling_options"],
power_signal,
lcoe_real,
optimize=True
)

lt = lcoh_dict["LCOH Breakdown"]["Life Totals [$]"]
capex = lt["CapEx"]
opex = lt["OM"]

# msg = (
# f"\n====== Electrolyzer ======\n"
# f" - h2 produced (kg): {h2_prod}\n"
# f" - max current density (A/cm^2): {max_curr_density}\n"
# f" - LCOH ($/kg): {lcoh}\n"
# )

# logger.info(msg)
outputs["h2_produced"] = h2_prod
outputs["max_curr_density"] = max_curr_density
outputs["electrolyzer_capex"] = capex
outputs["electrolyzer_opex"] = opex
outputs["lcoh"] = lcoh
outputs["h2_produced_hourly"] = lcoh_options_dict["kg_produced"]
outputs["power_kW_curtailed"] = lcoh_options_dict["power_kW_curtailed"]
outputs["power_kW_avail"] = lcoh_options_dict["power_kW_avail"]
# outputs["deg_state"] = lcoh_options_dict["deg_state"] # TODO we need a way to size this dynamically

def setup_partials(self):
self.declare_partials('lcoh', '*', method='fd', form='forward')
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies = [
"HOPP>=3.0",
"orbit-nrel>=1.1",
"openmdao[all]",
"ProFAST",
]
keywords = [
"python3",
Expand Down

0 comments on commit 055119f

Please sign in to comment.