Skip to content

Commit c9ea523

Browse files
committed
clarify finance groups
1 parent 2144f3d commit c9ea523

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

h2integrate/core/h2integrate_model.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,14 @@ def create_finance_model(self):
416416

417417
finance_subgroups = {}
418418

419-
default_finance_model_name = "default"
419+
default_finance_group_name = "default"
420420
# only one finance model is being used with subgroups
421421
if (
422422
"finance_model" in self.plant_config["finance_parameters"]["finance_groups"]
423423
and "model_inputs" in self.plant_config["finance_parameters"]["finance_groups"]
424424
):
425425
if (
426-
default_finance_model_name
426+
default_finance_group_name
427427
in self.plant_config["finance_parameters"]["finance_groups"]
428428
):
429429
# throw an error if the user has an unused finance group named "default".
@@ -441,7 +441,7 @@ def create_finance_model(self):
441441
"model_inputs"
442442
)
443443
default_model_dict = {
444-
default_finance_model_name: {
444+
default_finance_group_name: {
445445
"finance_model": default_model_name,
446446
"model_inputs": default_model_inputs,
447447
}
@@ -453,7 +453,7 @@ def create_finance_model(self):
453453
commodity = self.plant_config["finance_parameters"]["finance_groups"].get("commodity")
454454
finance_model_name = (
455455
self.plant_config["finance_parameters"]["finance_groups"]
456-
.get(default_finance_model_name, {})
456+
.get(default_finance_group_name, {})
457457
.get("finance_model")
458458
)
459459

@@ -468,22 +468,22 @@ def create_finance_model(self):
468468
all_techs = list(self.technology_config["technologies"].keys())
469469
subgroup = {
470470
"commodity": commodity,
471-
"finance_groups": [default_finance_model_name],
471+
"finance_groups": [default_finance_group_name],
472472
"technologies": all_techs,
473473
}
474-
subgroups = {default_finance_model_name: subgroup}
474+
subgroups = {default_finance_group_name: subgroup}
475475

476476
# --- Normal subgroup handling ---
477477
for subgroup_name, subgroup_params in subgroups.items():
478478
commodity = subgroup_params.get("commodity", None)
479479
commodity_desc = subgroup_params.get("commodity_desc", "")
480-
finance_model_names = subgroup_params.get(
481-
"finance_groups", [default_finance_model_name]
480+
finance_group_names = subgroup_params.get(
481+
"finance_groups", [default_finance_group_name]
482482
)
483483
tech_names = subgroup_params.get("technologies")
484484

485-
if isinstance(finance_model_names, str):
486-
finance_model_names = [finance_model_names]
485+
if isinstance(finance_group_names, str):
486+
finance_group_names = [finance_group_names]
487487

488488
# check commodity type
489489
if commodity is None:
@@ -527,29 +527,29 @@ def create_finance_model(self):
527527
"adjusted_capex_opex_comp", adjusted_capex_opex_comp, promotes=["*"]
528528
)
529529

530-
for finance_model_name in finance_model_names:
530+
for finance_group_name in finance_group_names:
531531
# check if using tech-specific finance model
532532
if any(
533-
tech_name == finance_model_name
533+
tech_name == finance_group_name
534534
for tech_name, tech_params in tech_configs.items()
535535
):
536-
tech_finance_model_name = (
537-
tech_configs.get(finance_model_name).get("finance_model", {}).get("model")
536+
tech_finance_group_name = (
537+
tech_configs.get(finance_group_name).get("finance_model", {}).get("model")
538538
)
539539

540540
# this is created in create_technologies()
541-
if tech_finance_model_name is not None:
541+
if tech_finance_group_name is not None:
542542
# tech specific finance models are created in create_technologies()
543543
# and do not need to be included in the general finance models
544544
continue
545545

546-
# if not using a tech-specific finance model, get the finance model and inputs for
547-
# the finance model group specified by finance_model_name
548-
finance_model_config = self.plant_config["finance_parameters"][
546+
# if not using a tech-specific finance group, get the finance model and inputs for
547+
# the finance model group specified by finance_group_name
548+
finance_group_config = self.plant_config["finance_parameters"][
549549
"finance_groups"
550-
].get(finance_model_name)
551-
model_name = finance_model_config.get("finance_model") # finance model
552-
fin_model_inputs = finance_model_config.get(
550+
].get(finance_group_name)
551+
model_name = finance_group_config.get("finance_model") # finance model
552+
fin_model_inputs = finance_group_config.get(
553553
"model_inputs"
554554
) # inputs to finance model
555555

@@ -568,7 +568,7 @@ def create_finance_model(self):
568568
}
569569

570570
# then, reformat the finance_parameters to only include inputs for the
571-
# finance group specified by finance_model_name
571+
# finance group specified by finance_group_name
572572
filtered_plant_config.update(
573573
{
574574
"finance_parameters": {
@@ -582,11 +582,11 @@ def create_finance_model(self):
582582
commodity_output_desc = subgroup_params.get("commodity_desc", "")
583583

584584
# check if multiple finance models are specified for the subgroup
585-
if len(finance_model_names) > 1:
585+
if len(finance_group_names) > 1:
586586
# check that the finance model groups do not include tech-specific finances
587587
non_tech_finances = [
588588
k
589-
for k in finance_model_names
589+
for k in finance_group_names
590590
if k in self.plant_config["finance_parameters"]["finance_groups"]
591591
]
592592

@@ -597,7 +597,7 @@ def create_finance_model(self):
597597
# finance models name their outputs based on the description and commodity
598598
# update the description to include the finance model name to ensure
599599
# uniquely named outputs
600-
commodity_output_desc = commodity_output_desc + f"_{finance_model_name}"
600+
commodity_output_desc = commodity_output_desc + f"_{finance_group_name}"
601601

602602
# create the finance component
603603
fin_comp = fin_model(
@@ -610,9 +610,9 @@ def create_finance_model(self):
610610

611611
# name the finance component based on the commodity and description
612612
finance_subsystem_name = (
613-
f"{finance_model_name}_{commodity}"
613+
f"{commodity}_finance_{finance_group_name}"
614614
if commodity_desc == ""
615-
else f"{finance_model_name}_{commodity}_{commodity_desc}"
615+
else f"{commodity}_{commodity_desc}_finance_{finance_group_name}"
616616
)
617617

618618
# add the finance component to the finance group

0 commit comments

Comments
 (0)