Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Model Library
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FOCUS
Model Library
Commits
1f2b04d0
Commit
1f2b04d0
authored
Aug 18, 2022
by
Christoph Henrik Meyer
Browse files
Options
Downloads
Patches
Plain Diff
Changing functions in main and BaseProsumert to be able to called from GUI and return Results
parent
43e80b68
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Prosumer/main.py
+14
-4
14 additions, 4 deletions
Prosumer/main.py
Prosumer/model/BaseProsumer.py
+6
-1
6 additions, 1 deletion
Prosumer/model/BaseProsumer.py
with
20 additions
and
5 deletions
Prosumer/main.py
+
14
−
4
View file @
1f2b04d0
...
...
@@ -283,12 +283,20 @@ class Main:
self
.
prosumer
[
self
.
name_list
[
0
]].
set_components
(
sector_matrices
[
self
.
name_list
[
0
]],
self
.
storage_states
,
comp_dict
[
self
.
name_list
[
0
]])
global_irradiance
,
temperature
=
use_db
.
config_profiles
(
input_profiles
[
name_list
[
0
]],
self
.
t_step
)
def
run_optimization
(
self
,
name_list
):
def
run_optimization
(
self
,
name_list
,
strategy_name
,
pareto_set_size
,
solver_name
):
# ToDo: callback, abbruchbedingung, maybe check the feasebility of the model before building,
# häufige fehler bei der eingabe prüfen usw
self
.
prosumer
[
name_list
].
run_optimization
(
strategy_name
=
[
'
annuity
'
],
solver_name
=
'
gurobi
'
,
commentary
=
self
.
commentary
)
self
.
prosumer
[
name_list
].
run_optimization
(
strategy_name
=
strategy_name
,
solver_name
=
solver_name
,
commentary
=
self
.
commentary
,
pareto_set_size
=
pareto_set_size
)
#def run_optimization(self, name_list):
# # ToDo: callback, abbruchbedingung, maybe check the feasebility of the model before building,
# # häufige fehler bei der eingabe prüfen usw
# self.prosumer[name_list].run_optimization(strategy_name=['annuity'],
# solver_name='gurobi',
# commentary=self.commentary)
def
show_results
(
self
,
name_list
,
inter_results
,
final_iteration
):
try
:
...
...
@@ -377,6 +385,8 @@ class Main:
if
comp_type
==
'
Storage
'
:
self
.
charge_status
[
name_list
][
components
[
0
]]
=
all_results
.
iloc
[
amount_results
-
1
][(
'
energy
'
,
components
[
0
])]
\
/
all_results
.
iloc
[
amount_results
-
1
][(
'
cap
'
,
components
[
0
])]
full_results
=
pd
.
read_excel
(
'
output_files/
'
+
name_list
+
'
/results_
'
+
name_list
+
'
.xlsx
'
)
return
full_results
except
ValueError
:
print
(
'
Results for prosumer
'
+
name_list
+
'
cannot be extracted or processed.
'
)
...
...
This diff is collapsed.
Click to expand it.
Prosumer/model/BaseProsumer.py
+
6
−
1
View file @
1f2b04d0
...
...
@@ -374,7 +374,7 @@ class BaseProsumer:
return
pd
.
DataFrame
(
np
.
array
(
results_lst
),
columns
=
columns
)
def
run_optimization
(
self
,
strategy_name
,
solver_name
=
'
gurobi
'
,
commentary
=
False
,
pareto_set_size
=
5
):
def
run_optimization
(
self
,
strategy_name
,
pareto_set_size
,
solver_name
,
commentary
=
False
,):
"""
The method XYZ adds ...
:param
...
...
@@ -382,6 +382,11 @@ class BaseProsumer:
:returns
XYZ
"""
print
(
'
======================================
'
)
print
(
'
Strategy chosen is
'
+
strategy_name
[
0
])
print
(
'
pareto_set_size is
'
+
str
(
pareto_set_size
))
print
(
'
solver_name is
'
+
solver_name
)
print
(
'
======================================
'
)
self
.
_build_math_model
(
strategy_name
,
components
)
# todo: necessary solver options (midgap, ...) should be available from runme.py
solver
=
pyo
.
SolverFactory
(
solver_name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment