Skip to content

Commit

Permalink
Calculate EFFICIENCY_GENSET_TIMESERIES
Browse files Browse the repository at this point in the history
- Add `EFFICIENCY_GENSET_TIMESERIES` to `constants.py
- Create function `G3.get_efficiency_genset` to calculate the effective
generator efficiency. In case that multiple generators are present, it
represents the average efficiency, as it is based on the aggregated
generator dispatch.
- Store timeseries to `electricity-mg`-csv but exclude from energy
dispatch plot
- If `GENSET_WITH_EFFICIENCY_CURVE==True` store additionally a plot of
the generator efficiency curve over the installed capacity. This curve
is only exact if a single generator is used!
  • Loading branch information
smartie2076 authored and smartie2076 committed Apr 8, 2021
1 parent 6867d25 commit 131fbc7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/G0_oemof_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def run(experiment, case_dict):
case_dict, oemof_results, electricity_bus_ac, e_flows_df
)

e_flows_df = timeseries.get_efficiency_genset(e_flows_df)

e_flows_df = timeseries.get_national_grid(
case_dict,
oemof_results,
Expand Down
19 changes: 19 additions & 0 deletions src/G3_oemof_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
DEMAND_AC,
DEMAND_DC,
CONSUMPTION_FUEL_TIMESERIES_KWH,
EFFICIENCY_GENSET_TIMESERIES,
)


Expand Down Expand Up @@ -524,6 +525,24 @@ def get_fuel(case_dict, oemof_results, results, e_flows_df):
return e_flows_df


def get_efficiency_genset(e_flows_df):
if (
CONSUMPTION_FUEL_TIMESERIES_KWH in e_flows_df.columns
and GENSET_GENERATION in e_flows_df.columns
):
logging.debug("Evaluate diesel generator efficiency:")
efficiency_timeseries = (
e_flows_df[GENSET_GENERATION] / e_flows_df[CONSUMPTION_FUEL_TIMESERIES_KWH]
)
average_efficiency = efficiency_timeseries.values.mean()
e_flows_df = join_e_flows_df(
efficiency_timeseries, EFFICIENCY_GENSET_TIMESERIES, e_flows_df
)
logging.debug(
f"The average efficiency of the diesel generators is {average_efficiency}. Please note that this is based on the aggregated generation of all diesel generators, and may or may not include a fix efficiency, minimal loading or efficiency curve. Check column {EFFICIENCY_GENSET_TIMESERIES} in the csv output of the electricity side of the MG for details."
)
return e_flows_df


def get_storage(case_dict, oemof_results, experiment, results, e_flows_df):
logging.debug("Evaluate flow: storage")
Expand Down
34 changes: 31 additions & 3 deletions src/G4_output_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
SUFFIX_STORAGE_PNG,
SUFFIX_STORAGE_4DAYS_PNG,
CONSUMPTION_FUEL_TIMESERIES_KWH,
EFFICIENCY_GENSET_TIMESERIES,
GENSET_WITH_EFFICIENCY_CURVE,
)


Expand Down Expand Up @@ -112,6 +114,7 @@ def save_mg_flows(experiment, case_dict, e_flows_df, filename):
GENSET_GENERATION,
GRID_AVAILABILITY,
CONSUMPTION_FUEL_TIMESERIES_KWH,
EFFICIENCY_GENSET_TIMESERIES,
]

negative_list = [
Expand All @@ -136,12 +139,11 @@ def save_mg_flows(experiment, case_dict, e_flows_df, filename):
STORAGE_CHARGE_AC,
STORAGE_CHARGE_DC,
CONSUMPTION_FUEL_TIMESERIES_KWH,
EFFICIENCY_GENSET_TIMESERIES,
]

mg_flows = pd.DataFrame(
e_flows_df[DEMAND].values,
columns=[DEMAND],
index=e_flows_df[DEMAND].index,
e_flows_df[DEMAND].values, columns=[DEMAND], index=e_flows_df[DEMAND].index,
)
for entry in flows_connected_to_electricity_mg_bus:
if entry in e_flows_df.columns:
Expand Down Expand Up @@ -191,6 +193,32 @@ def save_mg_flows(experiment, case_dict, e_flows_df, filename):
+ filename
+ SUFFIX_ELECTRICITY_MG_CSV
)
if (
experiment[SAVE_TO_PNG_FLOWS_ELECTRICITY_MG] is True
and case_dict[GENSET_WITH_EFFICIENCY_CURVE] is True
):
if (
EFFICIENCY_GENSET_TIMESERIES in e_flows_df.columns
and GENSET_GENERATION in e_flows_df.columns
):
logging.debug(f"Plotting efficiency curve of the diesel generator.")
plt.scatter(
x=e_flows_df[GENSET_GENERATION],
y=e_flows_df[EFFICIENCY_GENSET_TIMESERIES],
)
plt.xlabel(GENSET_GENERATION)
plt.ylabel("Generator efficiency curve")
plt.savefig(
experiment[OUTPUT_FOLDER]
+ "/electricity_mg/"
+ case_dict[CASE_NAME]
+ filename
+ "_efficiency_curve_genset.png",
bbox_inches="tight",
)
plt.close()
plt.clf()
plt.cla()

if experiment[SAVE_TO_PNG_FLOWS_ELECTRICITY_MG] is True:
number_of_subplots = 0
Expand Down
1 change: 1 addition & 0 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
TRANSFORMER_GENSET_1 = "transformer_genset_1"
GENSET_1_GENERATION = "Genset 1 generation"
CONSUMPTION_FUEL_TIMESERIES_KWH = "consumption_fuel_kWh"
EFFICIENCY_GENSET_TIMESERIES = "efficiency_generator"
CONSUMPTION_FUEL_ANNUAL_KWH = "consumption_fuel_annual_kWh"
CAPACITY = "capacity"
TOTAL_STORAGE_THOUGHPUT_KWH = "total_storage_throughput_kWh"
Expand Down

0 comments on commit 131fbc7

Please sign in to comment.