Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bi-Level_EVA
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
Daniel Strach
Bi-Level_EVA
Commits
625a389d
Commit
625a389d
authored
2 years ago
by
Christoph von Oy
Browse files
Options
Downloads
Patches
Plain Diff
Removed t_history
parent
7521e006
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
Model_Library
+1
-1
1 addition, 1 deletion
Model_Library
runme_community.py
+5
-6
5 additions, 6 deletions
runme_community.py
with
6 additions
and
7 deletions
Model_Library
@
c3fb8e02
Compare
ebf6f6bb
...
c3fb8e02
Subproject commit
ebf6f6bbbd721cd1a91c1f51bd460896aee297a9
Subproject commit
c3fb8e02ab0938692ad3695e4deedb3d59aa6ad4
This diff is collapsed.
Click to expand it.
runme_community.py
+
5
−
6
View file @
625a389d
...
@@ -12,11 +12,11 @@ from Model_Library.Prosumer.scripts.results_evaluation.results_evaluation import
...
@@ -12,11 +12,11 @@ from Model_Library.Prosumer.scripts.results_evaluation.results_evaluation import
import
Model_Library.District.main_district
as
main_district
import
Model_Library.District.main_district
as
main_district
def
process_each_prosumer
(
prosumer_name
,
prosumer_specification
,
commentary
,
t_start
,
t_horizon
,
t_step
,
t_history
,
prosumer_strategy
):
def
process_each_prosumer
(
prosumer_name
,
prosumer_specification
,
commentary
,
t_start
,
t_horizon
,
t_step
,
prosumer_strategy
):
try
:
try
:
before_setup
=
time
.
time
()
before_setup
=
time
.
time
()
# Start main programme
# Start main programme
prosumer
=
main
.
Main
(
prosumer_name
,
prosumer_specification
,
t_start
,
t_horizon
,
t_step
,
t_history
,
commentary
)
prosumer
=
main
.
Main
(
prosumer_name
,
prosumer_specification
,
t_start
,
t_horizon
,
t_step
,
commentary
)
after_setup
=
time
.
time
()
after_setup
=
time
.
time
()
print
(
"
process_each_prosumer:
\t
Prosumer Construction [s]:
\t
"
+
str
(
after_setup
-
before_setup
))
print
(
"
process_each_prosumer:
\t
Prosumer Construction [s]:
\t
"
+
str
(
after_setup
-
before_setup
))
...
@@ -40,7 +40,6 @@ if __name__ == "__main__":
...
@@ -40,7 +40,6 @@ if __name__ == "__main__":
t_start
=
pd
.
Timestamp
(
"
2019-05-10 00:00:00
"
)
# start time of simulation
t_start
=
pd
.
Timestamp
(
"
2019-05-10 00:00:00
"
)
# start time of simulation
t_horizon
=
240
# number of time steps to be simulated
t_horizon
=
240
# number of time steps to be simulated
t_step
=
1
# length of a time step in hours
t_step
=
1
# length of a time step in hours
t_history
=
0
# number of hours before actual simulation interval for the demand generator to be able to make required predictions
# Path to local data - this is only used when selecting local mode
# Path to local data - this is only used when selecting local mode
# 'data_path': path to file specifying where input profiles are located
# 'data_path': path to file specifying where input profiles are located
...
@@ -73,12 +72,12 @@ if __name__ == "__main__":
...
@@ -73,12 +72,12 @@ if __name__ == "__main__":
if
parallel_processing
:
if
parallel_processing
:
count_processes
=
len
(
prosumer_dict
.
keys
())
count_processes
=
len
(
prosumer_dict
.
keys
())
pool
=
Pool
(
os
.
cpu_count
())
pool
=
Pool
(
os
.
cpu_count
())
parallel_func
=
partial
(
process_each_prosumer
,
commentary
=
commentary
,
t_start
=
t_start
,
t_horizon
=
t_horizon
,
t_step
=
t_step
,
t_history
=
t_history
,
prosumer_strategy
=
ps_strategy
)
parallel_func
=
partial
(
process_each_prosumer
,
commentary
=
commentary
,
t_start
=
t_start
,
t_horizon
=
t_horizon
,
t_step
=
t_step
,
prosumer_strategy
=
ps_strategy
)
mapped_values
=
list
(
tqdm
(
pool
.
map
(
parallel_func
,
list
(
prosumer_dict
.
keys
()),
list
(
prosumer_dict
.
values
())),
total
=
count_processes
))
mapped_values
=
list
(
tqdm
(
pool
.
map
(
parallel_func
,
list
(
prosumer_dict
.
keys
()),
list
(
prosumer_dict
.
values
())),
total
=
count_processes
))
# Normal processing, one core only
# Normal processing, one core only
else
:
else
:
for
prosumer_name
in
list
(
prosumer_dict
.
keys
()):
for
prosumer_name
in
list
(
prosumer_dict
.
keys
()):
final_prosumer_dict
[
prosumer_name
]
=
process_each_prosumer
(
prosumer_name
,
prosumer_dict
[
prosumer_name
],
commentary
,
t_start
,
t_horizon
,
t_step
,
t_history
,
ps_strategy
)
final_prosumer_dict
[
prosumer_name
]
=
process_each_prosumer
(
prosumer_name
,
prosumer_dict
[
prosumer_name
],
commentary
,
t_start
,
t_horizon
,
t_step
,
ps_strategy
)
after_optimization
=
time
.
time
()
after_optimization
=
time
.
time
()
print
(
"
runme:
\t\t\t
Prosumer Optimization [s]:
\t
"
+
str
(
after_optimization
-
before_optimization
))
print
(
"
runme:
\t\t\t
Prosumer Optimization [s]:
\t
"
+
str
(
after_optimization
-
before_optimization
))
...
@@ -110,7 +109,7 @@ print("runme:\t\t\tCommunity Assets Setup [s]: \t" + str(before_community_assets
...
@@ -110,7 +109,7 @@ print("runme:\t\t\tCommunity Assets Setup [s]: \t" + str(before_community_assets
# initialize community component in the same way prosumers are.
# initialize community component in the same way prosumers are.
# The difference is that they are not directly optimized
# The difference is that they are not directly optimized
comm_assets
=
main
.
Main_CA
(
ca_dict
,
t_start
,
t_horizon
,
t_step
,
t_history
,
commentary
)
comm_assets
=
main
.
Main_CA
(
ca_dict
,
t_start
,
t_horizon
,
t_step
,
commentary
)
after_community_assets
=
time
.
time
()
after_community_assets
=
time
.
time
()
print
(
"
runme:
\t\t\t
Community Assets Constr. [s]:
\t
"
+
str
(
after_community_assets
-
before_community_assets
))
print
(
"
runme:
\t\t\t
Community Assets Constr. [s]:
\t
"
+
str
(
after_community_assets
-
before_community_assets
))
...
...
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