Skip to content

Commit

Permalink
Bugixing Szenario 1b 1a
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristofBernsteiner committed Apr 23, 2024
1 parent 8ed6111 commit 5d2a8ad
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
5 changes: 2 additions & 3 deletions examples/Cell4LifeSimulationExecutorvII.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
sys.path.append("C://Users//Standard//Desktop//hisim//HiSim//")

#Import of different hisim examples for the Cell4Life project ("Gesamtmodelle" in HiSim)
import Cell4LifeSzenariovII
import Cell4LifeSzenario1a_1b
import Cell4LifeSzenario2a
from hisim.result_path_provider import ResultPathProviderSingleton
Expand Down Expand Up @@ -178,7 +177,7 @@
# Cell4Life_Postprocessing.saveInputdata(input_variablen)
# #Cell4Life_Postprocessing.saveexcelforevaluations(input_variablen, excelfilepathallresults1, excel_filename1)
# Cell4Life_Postprocessing.save_data_in_excel_for_economic_assessment(input_variablen, excelfilepathresults2)
# Cell4Life_ControllExcelSheet.ControllSheetExcel(excelfilepathresults3)
# Cell4Life_ControllExcelSheet.ControllSheetExcel(excelfilepathresults3, input_variablen)

# del excelfilepathresults2, excelfilepathresults3
# finishtext = "---Parametervariation --vII: " + input_variablen["szenario"]["value"] + "-- abgeschlossen---"
Expand Down Expand Up @@ -307,7 +306,7 @@
Cell4Life_Postprocessing.saveInputdata(input_variablen)
#Cell4Life_Postprocessing.saveexcelforevaluations(input_variablen, excelfilepathallresults1, excel_filename1)
Cell4Life_Postprocessing.save_data_in_excel_for_economic_assessment(input_variablen, excelfilepathresults2)
Cell4Life_ControllExcelSheet.ControllSheetExcel(excelfilepathresults3)
Cell4Life_ControllExcelSheet.ControllSheetExcel(excelfilepathresults3, input_variablen)

del excelfilepathresults2, excelfilepathresults3
finishtext = "---Parametervariation --vII: " + input_variablen["szenario"]["value"] + "-- abgeschlossen---"
Expand Down
11 changes: 6 additions & 5 deletions examples/Cell4LifeSzenario1a_1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ def Cell4Life(


# Build Results Path
name = "VII_" + input_variablen["szenario"]["value"] + "_S" + str(input_variablen["PreResultNumber"]["value"])+"_BCap._" + str(math.ceil(input_variablen["battery_capacity"]["value"])) + "kWh_Inv_" + str(math.ceil(input_variablen["battery_inverter_power"]["value"]/1000)) + "kW_FCPow_" + str(math.ceil(input_variablen["fuel_cell_power"]["value"]/1000)) +"kW"
name = input_variablen["szenario"]["value"] + "_S" + str(input_variablen["PreResultNumber"]["value"])+"_BCap._" + str(math.ceil(input_variablen["battery_capacity"]["value"])) + "kWh_Inv_" + str(math.ceil(input_variablen["battery_inverter_power"]["value"]/1000)) + "kW_FCPow_" + str(math.ceil(input_variablen["fuel_cell_power"]["value"]/1000)) +"kW"


name = "TestvI1"

ResultPathProviderSingleton().set_important_result_path_information(
module_directory = "C://Users//Standard//Desktop//hisim//C4LResults",
model_name= name,
variant_name=my_sim.setup_function,
#variant_name=my_sim.setup_function,
variant_name = '',
sorting_option=SortingOptionEnum.VARPARAMETERNAMED,
hash_number=None,
)
Expand All @@ -94,7 +95,7 @@ def Cell4Life(

my_simulation_parameters.post_processing_options.append(postprocessingoptions.PostProcessingOptions.EXPORT_TO_CSV)
my_simulation_parameters.post_processing_options.append(postprocessingoptions.PostProcessingOptions.PLOT_LINE)
#my_simulation_parameters.post_processing_options.append(postprocessingoptions.PostProcessingOptions.MAKE_NETWORK_CHARTS)
my_simulation_parameters.post_processing_options.append(postprocessingoptions.PostProcessingOptions.MAKE_NETWORK_CHARTS)
my_simulation_parameters.post_processing_options.append(postprocessingoptions.PostProcessingOptions.PLOT_CARPET)


Expand Down Expand Up @@ -436,7 +437,7 @@ def InputParameter():
h2_storage_losses = 0 # % of Hydrogen Losses per day in %
h2_storage_lossesUnit = "%"

h2_soc_upper_threshold_electrolyzer = 50 #Electrolyzer works just until H2 storage goes up to this threshold
h2_soc_upper_threshold_electrolyzer = 99.9 #Electrolyzer works just until H2 storage goes up to this threshold
h2_soc_upper_threshold_electrolyzerUnit = "%"

#H2 storage energy demands; the energy demand is covered by electricit;
Expand Down
7 changes: 3 additions & 4 deletions examples/Cell4LifeSzenario2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ def Cell4Life(


# Build Results Path
name = "VII_" + input_variablen["szenario"]["value"] + "_S" + str(input_variablen["PreResultNumber"]["value"])+"_BCap._" + str(math.ceil(input_variablen["battery_capacity"]["value"])) + "kWh_Inv_" + str(math.ceil(input_variablen["battery_inverter_power"]["value"]/1000)) + "kW_FCPow_" + str(math.ceil(input_variablen["fuel_cell_power"]["value"]/1000)) +"kW"
name = input_variablen["szenario"]["value"] + "_S" + str(input_variablen["PreResultNumber"]["value"])+"_BCap._" + str(math.ceil(input_variablen["battery_capacity"]["value"])) + "kWh_Inv_" + str(math.ceil(input_variablen["battery_inverter_power"]["value"]/1000)) + "kW_FCPow_" + str(math.ceil(input_variablen["fuel_cell_power"]["value"]/1000)) +"kW"

name = "TestvII2"

ResultPathProviderSingleton().set_important_result_path_information(
module_directory = "C://Users//Standard//Desktop//hisim//C4LResults",
model_name= name,
variant_name=my_sim.setup_function,
#variant_name=my_sim.setup_function,
variant_name = '',
sorting_option=SortingOptionEnum.VARPARAMETERNAMED,
hash_number=None,
)
Expand Down
3 changes: 1 addition & 2 deletions hisim/components/generic_CHP.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ def i_simulate(
stsv.set_output_value(self.fuel_consumption_channel, self.state.state * self.p_fuel)
stsv.set_output_value(self.FuelCellElectricityInputStandby_channel, 0)

if timestep == 7549:
print('Fuel Cell state in Fuel Cell ', self.state.state)


def get_default_connections_from_chp_controller(self,) -> List[cp.ComponentConnection]:
"""Sets default connections of the controller in the Fuel Cell / CHP."""
Expand Down
24 changes: 15 additions & 9 deletions hisim/postprocessing/Cell4Life_ControllExcelSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from openpyxl.styles import NamedStyle
from hisim.result_path_provider import ResultPathProviderSingleton

def ControllSheetExcel(excelfilepathresults3):
def ControllSheetExcel(excelfilepathresults3, input_variablen):


# #----Save all Input Data in a .txt ----
Expand Down Expand Up @@ -131,26 +131,32 @@ def ControllSheetExcel(excelfilepathresults3):
for row in csvreader:
EnergyInputData11.append(row[1])

# Load data from "PV to grid if CHP is running" (column 2) and add the collected data to list
# Load data from "Electricity which needs Fuel Cell in Standby" (column 2) and add the collected data to list
csv_datei12 = os.path.join(path, 'FuelCellElectricityInputStandby_CHP_w2.csv')
with open(csv_datei12, 'r') as csvfile:
csvreader = csv.reader(csvfile, delimiter=';') # Verwende Semikolon als Trennzeichen
for row in csvreader:
EnergyInputData12.append(row[1])

# Load data from "PV to grid if CHP is running" (column 2) and add the collected data to list
csv_datei13 = os.path.join(path, 'QuantitiyShare_electricity_from_Battery_to_CHPinStandby_Elect_Controller.csv')
with open(csv_datei13, 'r') as csvfile:
csvreader = csv.reader(csvfile, delimiter=';') # Verwende Semikolon als Trennzeichen
for row in csvreader:
EnergyInputData13.append(row[1])
if input_variablen["szenario"]["value"] == '2a':
# Load data from "the amount of energy which is delivered from the battery to the CHP/Fuel Cell in Standbymode" (column 2) and add the collected data to list
csv_datei13 = os.path.join(path, 'QuantitiyShare_electricity_from_Battery_to_CHPinStandby_Elect_Controller.csv')
with open(csv_datei13, 'r') as csvfile:
csvreader = csv.reader(csvfile, delimiter=';') # Verwende Semikolon als Trennzeichen
for row in csvreader:
EnergyInputData13.append(row[1])






#Add all data in prepared list
model_energy_input_data = [(x[0], x[1], x[2], EnergyInputData2[i], EnergyInputData3[i], EnergyInputData4[i], EnergyInputData5[i], EnergyInputData6[i], EnergyInputData7[i], EnergyInputData8[i], EnergyInputData9[i], EnergyInputData10[i], EnergyInputData11[i], EnergyInputData12[i], EnergyInputData13[i]) for i, x in enumerate(model_energy_input_data)]
if input_variablen["szenario"]["value"] == '1a' or input_variablen["szenario"]["value"] == '1b':
model_energy_input_data = [(x[0], x[1], x[2], EnergyInputData2[i], EnergyInputData3[i], EnergyInputData4[i], EnergyInputData5[i], EnergyInputData6[i], EnergyInputData7[i], EnergyInputData8[i], EnergyInputData9[i], EnergyInputData10[i], EnergyInputData11[i], EnergyInputData12[i]) for i, x in enumerate(model_energy_input_data)]
elif input_variablen["szenario"]["value"] == '2a':
model_energy_input_data = [(x[0], x[1], x[2], EnergyInputData2[i], EnergyInputData3[i], EnergyInputData4[i], EnergyInputData5[i], EnergyInputData6[i], EnergyInputData7[i], EnergyInputData8[i], EnergyInputData9[i], EnergyInputData10[i], EnergyInputData11[i], EnergyInputData12[i], EnergyInputData13[i]) for i, x in enumerate(model_energy_input_data)]



# Durchlaufen der Daten und Einfügen in die Excel-Datei
Expand Down
2 changes: 1 addition & 1 deletion hisim/postprocessing/Cell4Life_Postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def save_data_in_excel_for_economic_assessment(input_variablen,excelfilepathresu
for row in csvreader:
Data11.append(row[1])

# Load data from "from Fuel Cell Standby" (column 2) and add the collected data to list
# Load data from "Fuel Cell Standby" (column 2) and add the collected data to list
csv_datei12 = os.path.join(path, 'FuelCellElectricityInputStandby_CHP_w2.csv')
with open(csv_datei12, 'r') as csvfile:
csvreader = csv.reader(csvfile, delimiter=';') # Verwende Semikolon als Trennzeichen
Expand Down

0 comments on commit 5d2a8ad

Please sign in to comment.