Skip to content

Commit

Permalink
Add OEM offset generator
Browse files Browse the repository at this point in the history
  • Loading branch information
smartie2076 committed Mar 30, 2021
1 parent 6a16856 commit 658091f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/G1_oemof_create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def build(experiment, case_dict):
sys.exit()
# genset = generate.genset_oem_minload(micro_grid_system, bus_fuel, bus_electricity_ac, experiment, case_dict['number_of_equal_generators'])
else:
genset = generate.genset_oem(
genset = generate.genset_oem_offset(
micro_grid_system,
bus_fuel,
bus_electricity_ac,
Expand Down
49 changes: 49 additions & 0 deletions src/G2a_oemof_busses_and_componets.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,55 @@ def genset_fix_minload(

return dict_of_generators

def genset_oem_offset(
micro_grid_system, bus_fuel, bus_electricity_ac, experiment, number_of_generators,
):
eta_min = experiment["genset_efficiency"] / 2 # efficiency at minimal operation point
eta_max = experiment["genset_efficiency"] # efficiency at nominal operation point

min = experiment["genset_min_loading"]
max = experiment["genset_max_loading"]

P_out_min = 100 * min # absolute minimal output power
P_out_max = 100 * max # absolute nominal output power

# calculate limits of input power flow
P_in_min = P_out_min / eta_min
P_in_max = P_out_max / eta_max

# calculate coefficients of input-output line equation
c1 = (P_out_max - P_out_min) / (P_in_max - P_in_min)
c0 = P_out_max - c1 * P_in_max

logging.info(f"The diesel generator is simulated as an OffsetTransformer "
f"with a minimal output of {P_out_min} and maximal output of {P_out_max}.")

print(P_in_max, P_in_max, experiment["genset_cost_var"], c1, c0)
logging.debug("Added to oemof model: genset Offset transformer")
dict_of_generators = {}
for number in range(1, number_of_generators + 1):
genset = solph.OffsetTransformer(
label="transformer_genset_" + str(number),
inputs={bus_fuel: solph.Flow(
nominal_value=P_in_max,
min=P_in_min / P_in_max,
max=1,
nonconvex=solph.NonConvex()
)},
outputs={
bus_electricity_ac: solph.Flow(variable_costs=experiment["genset_cost_var"],
investment=solph.Investment(
ep_costs=experiment["genset_cost_annuity"]
))
},
coefficients=(c0, c1)
)

micro_grid_system.add(genset)
dict_of_generators.update({number: genset})

logging.debug("Added to oemof model: genset oem no minload with load curve")
return dict_of_generators

def genset_oem(
micro_grid_system,
Expand Down

0 comments on commit 658091f

Please sign in to comment.