Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
50727aaa
Commit
50727aaa
authored
Jun 13, 2023
by
Eric Duminil
Browse files
Repaired comparison SimStadt vs Urbi
parent
106e0f17
Changes
2
Hide whitespace changes
Inline
Side-by-side
python_scripts/simstadt_urbi/compare_heat_demands.py
View file @
50727aaa
...
@@ -5,15 +5,15 @@ import matplotlib.pyplot as plt
...
@@ -5,15 +5,15 @@ import matplotlib.pyplot as plt
PROJ_DIR
=
Path
(
__file__
).
parent
PROJ_DIR
=
Path
(
__file__
).
parent
CITYGML
=
'Grombühl_v2'
CITYGML
=
'Grombühl_v2'
URBI_HEAT_DEMAND
=
'totalPrimaryEnergyDemandHeating [kWh/a]'
URBI_HEAT_DEMAND
=
'totalPrimaryEnergyDemandHeating [kWh/a]'
S_DEMAND
=
'Simstadt heat demand [MWh / a]'
# Inkl Warmwasser?
S_DEMAND
=
'Simstadt heat demand [MWh / a]'
# Inkl Warmwasser?
U_DEMAND
=
'Urbi+ heat demand [MWh / a]'
U_DEMAND
=
'Urbi+ heat demand [MWh / a]'
AREA
=
'Area [m²]'
AREA
=
'Area [m²]'
TYPE
=
'Usage Type'
TYPE
=
'Usage Type'
SUFFIX
=
'
_Bensfeld'
SUFFIX
=
'
'
# Could be 'Bensheim', for example
# Feldberg : 2.493 (Average : 3.0°C, Min : -18°C)
# Feldberg : 2.493 (Average : 3.0°C, Min : -18°C)
# Original : 2.487 (Average : 7.9°C, Min : -12°C), Würzburg
# Original : 2.487 (Average : 7.9°C, Min : -12°C), Würzburg
# Bens
feld
: 2.475 (Average : 10.2°C, Min : -10°C)
# Bens
heim
: 2.475 (Average : 10.2°C, Min : -10°C)
def
get_simstadt_heat_demand
():
def
get_simstadt_heat_demand
():
...
@@ -26,17 +26,19 @@ def get_simstadt_heat_demand():
...
@@ -26,17 +26,19 @@ def get_simstadt_heat_demand():
decimal
=
'.'
)
decimal
=
'.'
)
simstadt_df
=
simstadt_df
.
rename
({
simstadt_df
=
simstadt_df
.
rename
({
'Total Yearly Heat+DHW demand'
:
S_DEMAND
,
'Total Yearly Heat+DHW demand'
:
S_DEMAND
,
'PrimaryUsageZoneArea'
:
AREA
,
'PrimaryUsageZoneArea'
:
AREA
,
'PrimaryUsageZoneType'
:
TYPE
,
'PrimaryUsageZoneType'
:
TYPE
,
},
axis
=
'columns'
)
},
axis
=
'columns'
)
simstadt_df
[
S_DEMAND
]
=
simstadt_df
[
S_DEMAND
]
/
1000
# kWh -> MWh
simstadt_df
[
S_DEMAND
]
=
simstadt_df
[
S_DEMAND
]
/
1000
# kWh -> MWh
simstadt_df
=
simstadt_df
.
set_index
(
'GMLId'
)
simstadt_df
=
simstadt_df
.
set_index
(
'GMLId'
)
by_type_df
=
simstadt_df
.
groupby
([
TYPE
]).
sum
(
numeric_only
=
True
)[[
AREA
,
S_DEMAND
]]
by_type_df
=
simstadt_df
.
groupby
([
TYPE
]).
sum
(
numeric_only
=
True
)[[
AREA
,
S_DEMAND
]]
by_type_df
[
'Specific heat demand [kWh / (m².a)]'
]
=
by_type_df
[
S_DEMAND
]
/
by_type_df
[
AREA
]
*
1000
by_type_df
[
'Specific heat demand [kWh / (m².a)]'
]
=
by_type_df
[
S_DEMAND
]
/
\
by_type_df
[
AREA
]
*
1000
print
(
by_type_df
.
round
(
1
).
to_string
())
print
(
by_type_df
.
round
(
1
).
to_string
())
...
@@ -67,14 +69,17 @@ def compare_results(simstadt_df, urbi_df):
...
@@ -67,14 +69,17 @@ def compare_results(simstadt_df, urbi_df):
simstadt_urbi
=
simstadt_df
.
join
(
urbi_df
)[[
S_DEMAND
,
U_DEMAND
]]
simstadt_urbi
=
simstadt_df
.
join
(
urbi_df
)[[
S_DEMAND
,
U_DEMAND
]]
simstadt_urbi
=
simstadt_urbi
.
dropna
()
simstadt_urbi
=
simstadt_urbi
.
dropna
()
simstadt_urbi
.
round
(
1
).
to_csv
(
f
'simstadt_vs_urbi_heat_demands_
{
CITYGML
}{
SUFFIX
}
.csv'
,
sep
=
';'
,
decimal
=
'.'
)
simstadt_urbi
.
round
(
1
).
to_csv
(
f
'simstadt_vs_urbi_heat_demands_
{
CITYGML
}{
SUFFIX
}
.csv'
,
sep
=
';'
,
decimal
=
'.'
)
plt
.
rcParams
[
"figure.figsize"
]
=
(
10
,
10
)
plt
.
rcParams
[
"figure.figsize"
]
=
(
10
,
10
)
ax
=
simstadt_urbi
.
plot
.
scatter
(
x
=
S_DEMAND
,
y
=
U_DEMAND
,
title
=
f
'Urbi vs SimStadt Heat-demand
\n
{
CITYGML
}{
SUFFIX
}
'
)
fig
=
simstadt_urbi
.
plot
.
scatter
(
x
=
S_DEMAND
,
y
=
U_DEMAND
,
title
=
f
'Urbi vs SimStadt Heat-demand
\n
{
CITYGML
}{
SUFFIX
}
'
)
max_heat_demand
=
simstadt_urbi
.
max
().
max
()
max_heat_demand
=
simstadt_urbi
.
max
().
max
()
ax
.
plot
([
0
,
max_heat_demand
],
[
0
,
max_heat_demand
])
fig
.
plot
([
0
,
max_heat_demand
],
[
0
,
max_heat_demand
])
ax
.
axis
(
'equal'
)
fig
.
axis
(
'equal'
)
plt
.
savefig
(
f
'simstadt_vs_urbi_heat_demands_
{
CITYGML
}{
SUFFIX
}
.png'
,
bbox_inches
=
'tight'
)
plt
.
savefig
(
f
'simstadt_vs_urbi_heat_demands_
{
CITYGML
}{
SUFFIX
}
.png'
,
bbox_inches
=
'tight'
)
print
(
"Correlation:"
)
print
(
"Correlation:"
)
print
(
simstadt_urbi
.
corr
())
print
(
simstadt_urbi
.
corr
())
...
...
python_scripts/simstadt_urbi/simstadt_vs_urbi_heat_demands_Grombühl_v2.png
View replaced file @
106e0f17
View file @
50727aaa
43.5 KB
|
W:
|
H:
43.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment