Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
simstadtpy
Commits
395018d0
Commit
395018d0
authored
Aug 04, 2026
by
Eric Duminil
Browse files
Add csv_export to heat_demand
parent
966f79b1
Changes
1
Show whitespace changes
Inline
Side-by-side
src/simstadt/workflows.py
View file @
395018d0
...
@@ -15,7 +15,9 @@ BUNDLED_TEMPLATES = Path(__file__).parent / "templates"
...
@@ -15,7 +15,9 @@ BUNDLED_TEMPLATES = Path(__file__).parent / "templates"
def
_set_weather_file
(
meteonorm_filename
:
str
)
->
dict
[
str
,
str
]:
def
_set_weather_file
(
meteonorm_filename
:
str
)
->
dict
[
str
,
str
]:
"""Build the params.xml replacement for the weather file."""
"""Build the params.xml replacement for the weather file."""
return
{
"<string>METEONORM_FILE</string>"
:
f
"<string>
{
Path
(
meteonorm_filename
).
name
}
</string>"
}
return
{
"<string>METEONORM_FILE</string>"
:
f
"<string>
{
Path
(
meteonorm_filename
).
name
}
</string>"
}
def
_set_calculation_mode
(
calculation_mode
:
str
)
->
dict
[
str
,
str
]:
def
_set_calculation_mode
(
calculation_mode
:
str
)
->
dict
[
str
,
str
]:
...
@@ -62,7 +64,13 @@ def photovoltaic_simulation(
...
@@ -62,7 +64,13 @@ def photovoltaic_simulation(
"<boolean>HOURLY_PV</boolean>"
:
f
"<boolean>
{
str
(
hourly_pv
).
lower
()
}
</boolean>"
,
"<boolean>HOURLY_PV</boolean>"
:
f
"<boolean>
{
str
(
hourly_pv
).
lower
()
}
</boolean>"
,
}
}
template
=
BUNDLED_TEMPLATES
/
(
"105_PVWithShadow"
if
with_shadows
else
"103_PV"
)
template
=
BUNDLED_TEMPLATES
/
(
"105_PVWithShadow"
if
with_shadows
else
"103_PV"
)
pv_results
=
run_workflow_with_citygml
(
template
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
)
pv_results
=
run_workflow_with_citygml
(
template
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
,
)
set_random_seed
(
remove_random_id
(
citygml_path
.
name
))
set_random_seed
(
remove_random_id
(
citygml_path
.
name
))
pv_results
.
_df
=
pv_results
.
dataframe
.
sample
(
frac
=
roof_percentage
/
100.0
)
pv_results
.
_df
=
pv_results
.
dataframe
.
sample
(
frac
=
roof_percentage
/
100.0
)
...
@@ -77,6 +85,7 @@ def heatdemand_simulation(
...
@@ -77,6 +85,7 @@ def heatdemand_simulation(
refurbishment_ratio
:
float
=
0.0
,
refurbishment_ratio
:
float
=
0.0
,
description
:
str
=
"Heat demand"
,
description
:
str
=
"Heat demand"
,
project_path
:
Path
|
None
=
None
,
project_path
:
Path
|
None
=
None
,
csv_export
:
bool
=
False
,
)
->
SimStadtResults
:
)
->
SimStadtResults
:
"""Run a HeatDemand workflow.
"""Run a HeatDemand workflow.
...
@@ -89,13 +98,22 @@ def heatdemand_simulation(
...
@@ -89,13 +98,22 @@ def heatdemand_simulation(
description: Label stored on the result object.
description: Label stored on the result object.
"""
"""
citygml_path
=
Path
(
citygml_path
)
citygml_path
=
Path
(
citygml_path
)
template
=
BUNDLED_TEMPLATES
/
(
"104_HeatDemandWithShadow"
if
with_shadows
else
"101_HeatDemand"
)
template
=
BUNDLED_TEMPLATES
/
(
"104_HeatDemandWithShadow"
if
with_shadows
else
"101_HeatDemand"
)
replaces
=
(
replaces
=
(
_set_weather_file
(
meteonorm_filename
)
_set_weather_file
(
meteonorm_filename
)
|
_set_calculation_mode
(
calculation_mode
)
|
_set_calculation_mode
(
calculation_mode
)
|
_set_refurbishment
(
refurbishment_ratio
)
|
_set_refurbishment
(
refurbishment_ratio
)
)
)
return
run_workflow_with_citygml
(
template
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
)
return
run_workflow_with_citygml
(
template
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
,
csv_export
=
csv_export
,
)
def
greenwater_simulation
(
def
greenwater_simulation
(
...
@@ -117,4 +135,10 @@ def greenwater_simulation(
...
@@ -117,4 +135,10 @@ def greenwater_simulation(
replaces
=
_set_weather_file
(
meteonorm_filename
)
|
{
replaces
=
_set_weather_file
(
meteonorm_filename
)
|
{
"<double>MAX_WATER_STRESS</double>"
:
f
"<double>
{
1
-
irrigation_ratio
}
</double>"
,
"<double>MAX_WATER_STRESS</double>"
:
f
"<double>
{
1
-
irrigation_ratio
}
</double>"
,
}
}
return
run_workflow_with_citygml
(
BUNDLED_TEMPLATES
/
"102_GreenWater"
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
)
return
run_workflow_with_citygml
(
BUNDLED_TEMPLATES
/
"102_GreenWater"
,
citygml_path
,
replaces
=
replaces
,
description
=
description
,
project_path
=
project_path
,
)
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