Parameter EditorΒΆ
[ ]:
from besos import pyehub_funcs as pf
from besos.parameters import Parameter, PathSelector
from pyehub.energy_hub.ehub_model import EHubModel
from pyehub.outputter import pretty_print
Parameters are provided as a list of key mapping lists for the different variables inside the model. Input values must be provided as a list of the appropriate datatypes (dictionaries for time series) that match the number of parameters wanted to be changed.
[ ]:
parameters = [
Parameter(PathSelector(["LINEAR_CAPITAL_COSTS", "Boiler"])),
Parameter(PathSelector(["LINEAR_CAPITAL_COSTS", "CHP"])),
]
values = [200, 600]
Setting up the underlying PyEHub model:
[ ]:
excel_file = "test_file_all_constraints_work.xlsx" # name of the excel file. [This must be in the current directory]
model = EHubModel(
excel=excel_file
) # instantiate our model. Nothing is solved at this point.
Editing the parameters requires only one function call to pyehub_funcs and the pyehub_parameter_editor providing the model, parameters, and values to be changed.
[ ]:
pf.pyehub_parameter_editor(model, parameters, values)
Running and outputing is as normal.
[ ]:
results = model.solve() # solve the model and get back our results
pretty_print(results) # print the results to the console
[ ]: