@@ -279,11 +279,11 @@ def create_financial_model(self):
279279 Creates and configures the financial model for the plant.
280280
281281 - If subgroups are defined in finance_parameters:
282- * The first tuple in each subgroup is (commodity_type , finance_model).
282+ * The first tuple in each subgroup is (commodity , finance_model).
283283 * The remaining tuples list technologies belonging to that subgroup.
284284 - If no subgroups are defined:
285285 * A default subgroup is created with all technologies.
286- * commodity_type and finance_model are pulled from finance_parameters.
286+ * commodity and finance_model are pulled from finance_parameters.
287287 """
288288
289289 if "finance_parameters" not in self .plant_config :
@@ -316,20 +316,24 @@ def create_financial_model(self):
316316
317317 if subgroups is None :
318318 # --- Default behavior ---
319- commodity_type = self .plant_config ["finance_parameters" ].get ("commodity_type" )
320- finance_model_name = self .plant_config ["finance_parameters" ].get ("finance_model" )
319+ commodity = self .plant_config ["finance_parameters" ].get ("commodity" )
320+ finance_model_name = (
321+ self .plant_config ["finance_parameters" ]
322+ .get (default_finance_model_nickname , {})
323+ .get ("finance_model" )
324+ )
321325
322- if not commodity_type or not finance_model_name :
326+ if not commodity or not finance_model_name :
323327 raise ValueError (
324- "finance_parameters must define 'commodity_type ' and 'finance_model' "
328+ "finance_parameters must define 'commodity ' and 'finance_model' "
325329 "if no subgroups are provided."
326330 )
327331
328332 # NOTE: should we group all the technologies no?
329333 # Collect all technologies into one subgroup
330334 all_techs = list (self .technology_config ["technologies" ].keys ())
331335 subgroup = {
332- "commodity" : commodity_type ,
336+ "commodity" : commodity ,
333337 "finance_groups" : [default_finance_model_nickname ],
334338 "technologies" : all_techs ,
335339 }
@@ -341,7 +345,7 @@ def create_financial_model(self):
341345 # financial_groups["default"][tech_name] = tech_config
342346 # --- Normal subgroup handling ---
343347 for subgroup_name , subgroup_params in subgroups .items ():
344- commodity_type = subgroup_params .get ("commodity" , None )
348+ commodity = subgroup_params .get ("commodity" , None )
345349 commodity_desc = subgroup_params .get ("commodity_desc" , "" )
346350 finance_model_nicknames = subgroup_params .get (
347351 "finance_groups" , [default_finance_model_nickname ]
@@ -352,7 +356,7 @@ def create_financial_model(self):
352356 finance_model_nicknames = [finance_model_nicknames ]
353357
354358 # check commodity type
355- if commodity_type is None :
359+ if commodity is None :
356360 raise ValueError (f"Missing ``commodity`` provided in subgroup { subgroup_name } " )
357361
358362 tech_configs = {
@@ -371,7 +375,7 @@ def create_financial_model(self):
371375 {
372376 subgroup_name : {
373377 "tech_configs" : tech_configs ,
374- "commodity" : commodity_type ,
378+ "commodity" : commodity ,
375379 }
376380 }
377381 )
@@ -439,15 +443,15 @@ def create_financial_model(self):
439443 driver_config = self .driver_config ,
440444 tech_config = tech_configs ,
441445 plant_config = filtered_plant_config ,
442- commodity_type = commodity_type ,
446+ commodity_type = commodity ,
443447 description = commodity_desc ,
444448 )
445449
446450 if not skip_model :
447451 finance_subsystem_name = (
448- f"{ finance_model_nickname } _{ commodity_type } "
452+ f"{ finance_model_nickname } _{ commodity } "
449453 if commodity_desc == ""
450- else f"{ finance_model_nickname } _{ commodity_type } _{ commodity_desc } "
454+ else f"{ finance_model_nickname } _{ commodity } _{ commodity_desc } "
451455 )
452456
453457 financial_group .add_subsystem (finance_subsystem_name , fin_comp , promotes = ["*" ])
0 commit comments