Removed remaining naming dependencies#654
Conversation
elenya-grant
left a comment
There was a problem hiding this comment.
Thanks for this PR John! I had a few small questions but thanks for making this PR to finally remove all naming-specific logic!
| continue | ||
| if tech_name == "cable" or tech_name == "pipe": | ||
| # Skip technologies whose models doesn't add costs | ||
| perf_model = tech_configs[tech_name].get("performance_model").get("model") |
There was a problem hiding this comment.
would using dictionary defaults prevent issues in case a technology (maybe not one that exists now) has a cost model but not a performance model?
perf_model = tech_configs[tech_name].get("performance_model", {}).get("model", None)There was a problem hiding this comment.
Good consideration. This would avoid issues in the future for models that don't necessarily exist now, but it may also obfuscate the issue. Or at least I'd want to catch it sooner than this (connection time). So based on this comment, I've added required: [performance_model] to the tech_schema.yaml to require models there and do the checking.
There was a problem hiding this comment.
Okay - I think requiring the performance model makes sense for now (I was spooked when you said performance and cost model since splitters and combiners can be defined in the tech config but don't have an associated cost model). Thanks for explaining!
There was a problem hiding this comment.
Yeah, I underthought it at first and thought we could require both but you're exactly right!
| ) | ||
|
|
||
| # Model classes that do not contribute costs to the finance stackup | ||
| no_cost_models = { |
There was a problem hiding this comment.
could you extend this comment to mention that these models are like "internal models" so that's why they don't contribute to the costs for the finance modeling?
| no_cost_models = { | ||
| "GenericSplitterPerformanceModel", | ||
| "GenericCombinerPerformanceModel", | ||
| "GasStreamCombinerPerformanceModel", |
There was a problem hiding this comment.
why did you put these in h2integrate_model.py instead of supported_models.py? I almost think that I'd be nice to have these in supported models so its a bit more "upfront" than buried within a class method but I'd love to hear your reasoning
There was a problem hiding this comment.
I love your suggestion! That makes total sense. I didn't have a great reason for putting them here; I think with your suggestion, we'll also have a good setup for other similar groupings. Will change it now, thank you!
There was a problem hiding this comment.
Yay! Love that this file can be removed!
elenya-grant
left a comment
There was a problem hiding this comment.
Thanks for making these changes!
Use model class instead of tech name to skip no-cost technologies in finance connections
Previously, the finance connection logic in
connect_technologiesused string-based checks on the technology name (e.g.,"splitter" in tech_name,tech_name == "cable") to decide which technologies to skip when connecting CapEx/OpEx/VarOpEx to finance subgroups. This was fragile because renaming a technology could silently break the skip logic.Now the code looks up each technology's
performance_model.modelfrom the tech config and checks it against a set of known no-cost model classes. This decouples the behavior from naming conventions.Section 1: Type of Contribution
Section 2: 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 3: Related Issues
Fully resolved #374
Section 4: Impacted Areas of the Software
Section 4.1: New Files
N/A
Section 4.2: Modified Files
h2integrate/core/h2integrate_model.pyconnect_technologies: Replaced name-based"splitter"/"combiner"/"cable"/"pipe"string checks with a lookup againstno_cost_modelsusing the technology's configured model class.Section 5: Additional Supporting Information
N/A
Section 6: Test Results, if applicable
N/A
Section 7 (Optional): New Model Checklist
N/A