|
1 | 1 | import numpy as np |
2 | 2 | import openmdao.api as om |
3 | 3 |
|
4 | | -import electrolyzer.inputs.validation as val |
5 | | -from electrolyzer import run_lcoh |
6 | | - |
7 | 4 | from shapely.geometry import Polygon, Point |
8 | 5 | from hopp.simulation import HoppInterface |
9 | 6 | from greenheart.simulation.greenheart_simulation import GreenHeartSimulationConfig, run_simulation |
@@ -305,90 +302,3 @@ def compute(self, inputs, outputs): |
305 | 302 |
|
306 | 303 | def setup_partials(self): |
307 | 304 | self.declare_partials('*', '*', method='fd', form='forward') |
308 | | - |
309 | | -class ElectrolyzerComponent(om.ExplicitComponent): |
310 | | - """ |
311 | | - This is an OpenMDAO wrapper to the generic electrolyzer model. |
312 | | -
|
313 | | - It makes some assumptions about the number of electrolyzers, stack size, and |
314 | | - how to distribute electricity across the different electrolyzers. These |
315 | | - could be later made into modeling options to allow for more user configuration. |
316 | | - """ |
317 | | - def initialize(self): |
318 | | - self.options.declare("h2_modeling_options") |
319 | | - self.options.declare("h2_opt_options") |
320 | | - self.options.declare("modeling_options") |
321 | | - self.options.declare("design_variables", |
322 | | - # ["electrolyzer_rating_kw"], |
323 | | - types=list, |
324 | | - desc="List of design variables that should be included", |
325 | | - default=[], |
326 | | - recordable=False) |
327 | | - |
328 | | - def setup(self): |
329 | | - self.add_input("power_signal", val=np.zeros(8760), units="W") |
330 | | - self.add_input("lcoe_real", units="USD/kW/h") |
331 | | - |
332 | | - if "electrolyzer_rating_kw" in self.options["design_variables"]: |
333 | | - self.add_input("electrolyzer_rating_kw", val=15000, units="kW") |
334 | | - |
335 | | - if self.options["h2_opt_options"]["control"]["system_rating_MW"]["flag"] \ |
336 | | - or self.options["modeling_options"]["rating_equals_turbine_rating"]: |
337 | | - self.add_input("system_rating_MW", units="MW", val=self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"]) |
338 | | - self.add_output("h2_produced", units="kg") |
339 | | - self.add_output("max_curr_density", units="A/cm**2") |
340 | | - self.add_output("electrolyzer_capex", units="USD") |
341 | | - self.add_output("electrolyzer_opex", units="USD") |
342 | | - self.add_output("lcoh", units="USD/kg") |
343 | | - self.add_output("h2_produced_hourly", units="kg", val=np.zeros(8760)) |
344 | | - self.add_output("power_kW_curtailed", units="kW", val=np.zeros(8760)) |
345 | | - self.add_output("power_kW_avail", units="kW", val=np.zeros(8760)) |
346 | | - # self.add_output("deg_state", units="V", val=np.zeros(6)) # TODO we need a way to size this dynamically |
347 | | - |
348 | | - def compute(self, inputs, outputs): |
349 | | - # Set electrolyzer parameters from model inputs |
350 | | - power_signal = inputs["power_signal"] |
351 | | - lcoe_real = inputs["lcoe_real"][0] |
352 | | - |
353 | | - if "electrolyzer_rating_kw" in inputs: |
354 | | - self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = inputs["electrolyzer_rating_kw"][0]*1E-3 |
355 | | - |
356 | | - elif self.options["h2_opt_options"]["control"]["system_rating_MW"]["flag"] \ |
357 | | - or self.options["modeling_options"]["rating_equals_turbine_rating"]: |
358 | | - self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = inputs["system_rating_MW"][0] |
359 | | - |
360 | | - elif "electrolyzer_rating_MW" in self.options["modeling_options"]["overridden_values"]: |
361 | | - electrolyzer_rating_MW = self.options["modeling_options"]["overridden_values"]["electrolyzer_rating_MW"] |
362 | | - self.options["h2_modeling_options"]["electrolyzer"]["control"]["system_rating_MW"] = electrolyzer_rating_MW |
363 | | - |
364 | | - h2_prod, max_curr_density, lcoh, lcoh_dict, lcoh_options_dict, = run_lcoh( |
365 | | - self.options["h2_modeling_options"], |
366 | | - power_signal, |
367 | | - lcoe_real, |
368 | | - optimize=True |
369 | | - ) |
370 | | - |
371 | | - lt = lcoh_dict["LCOH Breakdown"]["Life Totals [$]"] |
372 | | - capex = lt["CapEx"] |
373 | | - opex = lt["OM"] |
374 | | - |
375 | | - # msg = ( |
376 | | - # f"\n====== Electrolyzer ======\n" |
377 | | - # f" - h2 produced (kg): {h2_prod}\n" |
378 | | - # f" - max current density (A/cm^2): {max_curr_density}\n" |
379 | | - # f" - LCOH ($/kg): {lcoh}\n" |
380 | | - # ) |
381 | | - |
382 | | - # logger.info(msg) |
383 | | - outputs["h2_produced"] = h2_prod |
384 | | - outputs["max_curr_density"] = max_curr_density |
385 | | - outputs["electrolyzer_capex"] = capex |
386 | | - outputs["electrolyzer_opex"] = opex |
387 | | - outputs["lcoh"] = lcoh |
388 | | - outputs["h2_produced_hourly"] = lcoh_options_dict["kg_produced"] |
389 | | - outputs["power_kW_curtailed"] = lcoh_options_dict["power_kW_curtailed"] |
390 | | - outputs["power_kW_avail"] = lcoh_options_dict["power_kW_avail"] |
391 | | - # outputs["deg_state"] = lcoh_options_dict["deg_state"] # TODO we need a way to size this dynamically |
392 | | - |
393 | | - def setup_partials(self): |
394 | | - self.declare_partials('lcoh', '*', method='fd', form='forward') |
0 commit comments