Thermodynamic NGCT model - #805
Conversation
There was a problem hiding this comment.
I've added both the optional dependency as well as the mainline dependency here; one should be removed, at the discretion of the H2I devs. I actually thought at first (said this to @johnjasa) that pyfluids was already in the dependency chain, but I was apparently incorrect in that understanding.
…n/H2Integrate into feature/thermodynamic_NGCT_model
| extras = ["h2integrate[gis,ard]"] | ||
| all = ["h2integrate[develop,extras,examples]"] |
There was a problem hiding this comment.
| extras = ["h2integrate[gis,ard]"] | |
| all = ["h2integrate[develop,extras,examples]"] | |
| extras = ["h2integrate[gis,ard,thermo]"] | |
| all = ["h2integrate[develop,extras,examples]"] |
| state_outlet, | ||
| mass_flow_fluid=1.0, # by default unity, returns unit-mass kJ/kg | ||
| ): | ||
| # heat transfer to a system should be positive |
There was a problem hiding this comment.
Should there be a user warning or error message if this isn't true?
| return state_outlet | ||
|
|
||
|
|
||
| class ThermodynamicCycleResult: |
There was a problem hiding this comment.
could you add a docstring to this?
|
|
||
|
|
||
| @define(kw_only=True) | ||
| class SimpleCycleTurbinePerformanceConfig(BaseConfig): |
There was a problem hiding this comment.
It seems useful to add design_conditions as an input to the config to be able to use all of the functionality of the NGCT model
| return float(np.min(mass_flowrate_candidates)) | ||
|
|
||
|
|
||
| class GE_7FA05_NGCT(NGCT): |
There was a problem hiding this comment.
I'd be inclined to see the GE_7FA05_NGCT and GE_7EA_NGCT_2014 classes be converted to yaml files for easy inclusion when running the SimpleCycleTurbinePerformanceModel. It seems right now their functionality is limited to this particular file and not as something that would be able to be used within the larger H2I system.
| ) # (min, max) time step lengths (in seconds) compatible with this model | ||
| _control_classifier = "dispatchable" | ||
|
|
||
| def initialize(self, fuel_source="natural_gas"): |
There was a problem hiding this comment.
Is there a reason to initialize the fuel_source here vs using the typical feedstocks? Is this to limit the fuel source type?
| m * q for m, q in zip(mass_flowrates, unit_mass_net_heat_input_vec) | ||
| ] # kJ/s | ||
|
|
||
| # import matplotlib.pyplot as plt |
There was a problem hiding this comment.
You could functionalize this and add a show_plots attribute to the base config for folks to be able to see these outputs if they want.
| Q_fluid_max=1.0, # (explicitly) unit-mass analysis | ||
| ) | ||
|
|
||
| # try to run NGCT cycle here expensively, and all compute variations |
There was a problem hiding this comment.
Is there that big of a computational advantage precomputing this in the setup method versus using the given temperature and pressure data based on the solar resource in the actual compute method? It seems slightly redundant but maybe I'm missing something?
| for T, P in wx_data | ||
| ] | ||
| self.fundamental_cycle = self.ngct.run_turbine_model(self.ambient_fluid_list) | ||
| # print("DEBUG!!!!! RE-COMPUTING UNIT-MASS CYCLE B/C AMBIENT FLUID STATES CHANGED") |
There was a problem hiding this comment.
can we remove these print statements but keep the comment of what's happening in the if statement?
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
I'd love to see this as a test and remove everything after if __name__ == "__main__": in this file
elenya-grant
left a comment
There was a problem hiding this comment.
This is just a partial review that I wanted to submit before reviewing the whole thing! Mostly had minor questions and suggestions! I can do a more full review later!
| Attributes: | ||
| ----------- |
There was a problem hiding this comment.
| Attributes: | |
| ----------- | |
| Attributes: |
| ) # (min, max) time step lengths (in seconds) compatible with this model | ||
| _control_classifier = "dispatchable" | ||
|
|
||
| def initialize(self, fuel_source="natural_gas"): |
There was a problem hiding this comment.
Could this fuel_source input be removed from the initialize() method and be moved as an input to the SimpleCycleTurbinePerformanceConfig? With a contains validator?
| self.ngct = NGCT.NGCT( | ||
| ratio_P=self.config.pressure_ratio, | ||
| Trel_firing=self.config.firing_temp_C, | ||
| isentropic_efficiency_compressor=self.config.isentropic_efficiency_compressor, | ||
| isentropic_efficiency_turbine=self.config.isentropic_efficiency_turbine, | ||
| Q_fluid_max=1.0, # (explicitly) unit-mass analysis | ||
| ) |
There was a problem hiding this comment.
would any of the inputs to NGCT be optimization variables or swept in a parameter sweep for any foreseeable use-case? If so - then I think these should be inputs and then this could be moved to the compute() method.
|
|
||
| # extract from the solar resource data | ||
| temperature_degC = discrete_inputs["solar_resource_data"]["temperature"] | ||
| pressure_Pa = ( |
There was a problem hiding this comment.
I think the pressure data output by the solar resource data defaults to mbar - not hPa?
| else: | ||
| pass |
There was a problem hiding this comment.
| else: | |
| pass |
There was a problem hiding this comment.
this file should live in h2integrate/converters/combustion_machines/test/
| val=0.0, | ||
| shape=self.n_timesteps, | ||
| units="kJ/s", | ||
| desc="fuel input energy to the turbine/plant in MMBtu/h", |
There was a problem hiding this comment.
description says different units than the units defined. I'd suggestion removing the MMbBtu/h part from the description.
| # try to run NGCT cycle here expensively, and all compute variations | ||
| # should be derivable w/o major new computation after that | ||
| P_ambient = 101325.0 # Pa | ||
| T_ambient = 15.0 # °C | ||
| self.working_fluid = NGCT.pyfluids.Fluid(NGCT.pyfluids.FluidsList.Air) | ||
| wx_data = [(T_ambient, P_ambient)] | ||
| self.wx_checksums = [hash(wxd) for wxd in wx_data] | ||
| self.ambient_fluid_list = [ | ||
| self.working_fluid.with_state( | ||
| NGCT.pyfluids.Input.pressure(P), | ||
| NGCT.pyfluids.Input.temperature(T), | ||
| ) | ||
| for T, P in wx_data | ||
| ] | ||
| self.fundamental_cycle = self.ngct.run_turbine_model(self.ambient_fluid_list) |
There was a problem hiding this comment.
I'm confused by this comment and the code itself. If the first run is always with the ambient temperature and pressure - then the self.wx_checksums and wx_checksums will always be different the first time compute() is called. Why not just initialize the self.wx_checksums to a list of empty strings or Nones and not run the NGCT model in the setup() method?
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
reminder to remove this before it gets merged
Thermodynamic models for NGCT (w/ support for future
combustion_machines)The performance of combustion machines, including both combustion turbines, combined cycle turbines, and reciprocating internal combustion engines, has significant dependence on ambient conditions (real time and design-specified).
These models use standard thermodynamic cycles to increase the fidelity of ICE combustion systems in H2I. These are critical for understanding complementarity of renewables and fuel combustion systems in hybrid energy generation, where ambient conditions determine the performance of nominally firm power sources as well as renewables, often in mutually complimentary ways.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.md"A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
XYZshould be replaced with the actual number.Section 4: Related Issues
Section 5: Impacted Areas of the Software
Section 5.1: New Files
h2integrate/converters/combustion_machines/__init__.pyh2integrate/converters/combustion_machines/NGCT_thermo_model.pyh2integrate/converters/combustion_machines/test_NGCT_thermo_model.pyh2integrate/converters/combustion_machines/turbine_simple_cycle.pySection 5.2: Modified Files
h2integrate/core/supported_models.pySection 6: Additional Supporting Information
Section 7: Test Results, if applicable
Section 8 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClasssupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.ymlgenerate_class_hierarchy.pyto update the class hierarchy diagram indocs/developer_guide/class_structure.md