Skip to content

Commit

Permalink
merged run_direct and _run function into one run function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Pemsel committed Jul 29, 2024
1 parent d9328a1 commit 1974b21
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions wattadvisor/optimization_model/run_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def _get_config(base_path: str = "wattadvisor/optimization_model") -> ConfigMode
config = config_loader.load_config(Path().absolute().joinpath(base_path))
return config

def _run(config: ConfigModel, inputdata: InputModel, export: bool = False) -> OptimizationResultsModel:
"""Starts an optimization.
def run(config: ConfigModel, inputdata: InputModel, export: bool = False) -> OptimizationResultsModel:
"""Starts an optimization by using static input data from memory.
Parameters
----------
Expand All @@ -46,30 +46,11 @@ def _run(config: ConfigModel, inputdata: InputModel, export: bool = False) -> Op
pydantic object representing optimization results
"""

config = _get_config()

optimization = opt_model.OptModel(inputdata, config)

#Start the optimization
results = optimization.run_calculation(export=export)

return results

def run_direct(inputdata: InputModel, export: bool = False) -> OptimizationResultsModel:
"""Starts the optimization by using static input data from memory.
Parameters
----------
inputdata : InputModel
input data to build the optimization model
export : bool, optional
whether to export detailed result time series to separate excel file, by default False
Returns
-------
OptimizationResultsModel
pydantic object representing optimization results
"""

config = _get_config()
results = _run(config, inputdata, export=export)

return results

0 comments on commit 1974b21

Please sign in to comment.