33from oemof .tools import logger
44
55logger .define_logging (
6- logpath = "." , logfile = "log" , file_level = logging .DEBUG , screen_level = "DEBUG " ,
6+ logpath = "." , logfile = "log" , file_level = logging .INFO , screen_level = "INFO " ,
77)
88
99from multi_vector_simulator .utils .constants_json_strings import (
@@ -544,6 +544,38 @@ def postprocessing_kpi(
544544
545545 senstivitiy_data = pd .DataFrame (index = KEY_INTEREST_KPI )
546546
547+ json_parameter_paths = {
548+ "diesel_fuel_consumption" : (
549+ "energyProduction" ,
550+ "Diesel" ,
551+ "total_flow" ,
552+ "value" ,
553+ ),
554+ "diesel_fuel_expenses" : ("energyProduction" , "Diesel" , "annuity_om" , "value" ),
555+ "capacity_h2_electrolyzer" : (
556+ "energyConversion" ,
557+ "Electrolyzer" ,
558+ "optimizedAddCap" ,
559+ "value" ,
560+ ),
561+ "capacity_h2_tank" : (
562+ "energyStorage" ,
563+ "H2 storage" ,
564+ "storage capacity" ,
565+ "optimizedAddCap" ,
566+ "value" ,
567+ ),
568+ }
569+
570+ other_scalars = pd .DataFrame (
571+ index = [
572+ "diesel_fuel_consumption" ,
573+ "diesel_fuel_expenses" ,
574+ "capacity_h2_electrolyzer" ,
575+ "capacity_h2_tank" ,
576+ ]
577+ )
578+
547579 for item in range (0 , len (output_path_vector )):
548580 output_json = os .path .join (
549581 output_path_vector [item ], JSON_WITH_RESULTS + JSON_FILE_EXTENSION
@@ -552,7 +584,14 @@ def postprocessing_kpi(
552584 sensitivity_results = [json [KPI ][KPI_SCALARS_DICT ][i ] for i in KEY_INTEREST_KPI ]
553585 senstivitiy_data [variable_value_vector [item ]] = sensitivity_results
554586 logging .info (
555- f"Gathered simulation results from { variable_name } ={ variable_value_vector [item ]} , output folder { output_path_vector [item ]} "
587+ f"Gathered simulation results (KPIS) from { variable_name } ={ variable_value_vector [item ]} , output folder { output_path_vector [item ]} "
588+ )
589+
590+ other_scalars = get_asset_results (
591+ json , json_parameter_paths , other_scalars , variable_value_vector [item ]
592+ )
593+ logging .info (
594+ f"Gathered simulation results (assets) from { variable_name } ={ variable_value_vector [item ]} , output folder { output_path_vector [item ]} "
556595 )
557596
558597 senstivitiy_data = senstivitiy_data .transpose ()
@@ -567,7 +606,35 @@ def postprocessing_kpi(
567606 )
568607 plt .close ()
569608
570- senstivitiy_data .to_csv (output_path_summary + "summary.csv" )
609+ senstivitiy_data .to_csv (output_path_summary + "kpi_summary.csv" )
610+
611+ other_scalars = other_scalars .transpose ()
612+
613+ for scalar in [
614+ "diesel_fuel_consumption" ,
615+ "diesel_fuel_expenses" ,
616+ "capacity_h2_electrolyzer" ,
617+ "capacity_h2_tank" ,
618+ ]:
619+ plot_data = pd .Series (other_scalars [scalar ], index = other_scalars .index )
620+ plot_data .plot ()
621+ plt .xlabel (variable_name )
622+ plt .ylabel (scalar )
623+ plt .savefig (
624+ os .path .join (output_path_summary , f"{ variable_name } _effect_on_{ scalar } .png" )
625+ )
626+ plt .close ()
627+
628+ other_scalars .to_csv (output_path_summary + "other_scalars_summary.csv" )
629+
630+
631+ def get_asset_results (json , parameters , df , value ):
632+ results = []
633+ for key in parameters :
634+ key_value = get_nested_value (json , parameters [key ])
635+ results .append (key_value )
636+ df [value ] = results
637+ return df
571638
572639
573640"""
@@ -589,7 +656,7 @@ def postprocessing_kpi(
589656 variable_column = "Diesel" ,
590657 csv_file_variable = "energyProduction.csv" ,
591658 start = 0.8 ,
592- stop = 1.8 ,
659+ stop = 0.9 ,
593660 step = 0.1 ,
594661 scenario_name = "diesel_price" ,
595662 original_input_directory = "Aysen/two_storages" ,
@@ -600,8 +667,8 @@ def postprocessing_kpi(
600667 variable_name = "H2_storage_tank" ,
601668 variable_column = "specific_costs" ,
602669 csv_file_variable = "H2_storage_tank.csv" ,
603- start = 1800 ,
604- stop = 2800 ,
670+ start = 2300 ,
671+ stop = 2400 ,
605672 step = 100 ,
606673 scenario_name = "H2_tank_costs" ,
607674 original_input_directory = "Aysen/two_storages" ,
0 commit comments