Commit f704c6b4 authored by Matthias Betz's avatar Matthias Betz
Browse files

Merge branch 'master' of transfer.hft-stuttgart.de:circulargreensimcity/circulargreensimcity

parents f0f212e1 e6ba2d4d
...@@ -13,6 +13,7 @@ import org.locationtech.jts.geom.Polygon; ...@@ -13,6 +13,7 @@ import org.locationtech.jts.geom.Polygon;
import org.xmlobjects.gml.model.basictypes.Code; import org.xmlobjects.gml.model.basictypes.Code;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
import org.xmlobjects.gml.model.measures.Length;
public class TreeUtils { public class TreeUtils {
...@@ -96,6 +97,8 @@ public class TreeUtils { ...@@ -96,6 +97,8 @@ public class TreeUtils {
crownRadius, crownHeight); crownRadius, crownHeight);
SolitaryVegetationObject cover = new SolitaryVegetationObject(); SolitaryVegetationObject cover = new SolitaryVegetationObject();
cover.setSpecies(new Code(tree.getType())); cover.setSpecies(new Code(tree.getType()));
cover.setCrownDiameter(new Length(crownRadius * 2));
cover.setHeight(new Length(trunkHeight + crownHeight));
cover.setId(UUID.randomUUID().toString()); cover.setId(UUID.randomUUID().toString());
cover.setLod2MultiSurface(new MultiSurfaceProperty(generatedTree)); cover.setLod2MultiSurface(new MultiSurfaceProperty(generatedTree));
cityModel.getCityObjectMembers().add(new AbstractCityObjectProperty(cover)); cityModel.getCityObjectMembers().add(new AbstractCityObjectProperty(cover));
......
digraph G {
ratio="fill";
size="10,6!";
margin=0;
dpi=180;
rankdir="LR";
graph [fontname = "Ubuntu"];
node [fontname = "Ubuntu"];
edge [fontname = "Ubuntu"];
node [shape=ellipse];
compound=true;
citygml [label="CityGML", shape=box3d];
trees [label="Trees.shp", shape=note];
floors [label="Floors.csv", shape=note];
dreso [label="DreSo.csv", shape=note];
lib [label="Physics.lib", shape=component];
weather [label="Weather.csv", shape=component];
simstadt [label="SimStadt", style=filled, shape=cylinder];
citygml -> simstadt;
trees -> citygml [label="add-trees.py"];
dreso -> citygml [label="?"];
floors -> citygml [label="add-floor.py"];
lib -> simstadt [label="window_ratio.py"];
weather -> simstadt;
shp [label="Results.shp", shape=note];
subgraph cluster_1 {
label="Demands";
node [shape=note];
csv1 [label="Heat.csv"];
csv2 [label="Cooling.csv"];
csv3 [label="Water.csv"];
color=lightgrey;
}
optimizer [label="TUM optimizer.py", style=filled, shape=cylinder];
gis [label="ArcGIS", style=filled, shape=cylinder];
csv3 -> optimizer [ltail=cluster_1];
csv3 -> gis [ltail=cluster_1];
simstadt -> shp;
simstadt -> csv1;
simstadt -> csv2;
simstadt -> csv3;
shp -> gis;
optimizer -> lib [style=dotted];
optimizer -> floors [style=dotted];
gis -> trees [style=dotted];
{ rank=min; floors; trees; dreso}
{ rank=max; gis; optimizer}
}
...@@ -150,7 +150,7 @@ def run_simstadt(simstadt_path: Path, workflow_path:Path , name: str): ...@@ -150,7 +150,7 @@ def run_simstadt(simstadt_path: Path, workflow_path:Path , name: str):
os.chdir(simstadt_path) os.chdir(simstadt_path)
try: try:
logging.info("\n# Launching %s:", name) logging.info("\n# Launching %s:", name)
result = subprocess.run(' '.join([simstadt_script(), str(workflow_path)]), result = subprocess.run([simstadt_script(), str(workflow_path)],
text=True, text=True,
capture_output=True, capture_output=True,
check=True check=True
......
...@@ -12,6 +12,7 @@ logging.getLogger().setLevel(logging.WARN) ...@@ -12,6 +12,7 @@ logging.getLogger().setLevel(logging.WARN)
####################################################################### #######################################################################
# User params # User params
SIMSTADT2_GLOB = 'Desktop/SimStadt2_0.*/' SIMSTADT2_GLOB = 'Desktop/SimStadt2_0.*/'
# Check env variable?
REPO_PATH = Path.home() / 'git' / 'simstadt2' / 'TestRepository' REPO_PATH = Path.home() / 'git' / 'simstadt2' / 'TestRepository'
PROJECT_NAME = 'Gruenbuehl' PROJECT_NAME = 'Gruenbuehl'
CITYGML = 'Gruenbuehl_LOD2_ALKIS_1010.gml' CITYGML = 'Gruenbuehl_LOD2_ALKIS_1010.gml'
...@@ -62,7 +63,7 @@ def parse_library(library_path: Path) -> et.ElementTree: ...@@ -62,7 +63,7 @@ def parse_library(library_path: Path) -> et.ElementTree:
return et.parse(library_path) return et.parse(library_path)
def set_custom_window_ratio(tree: et.ElementTree, window_ratio_node: float, export_path: Path): def set_custom_window_ratio(window_ratio: float, tree: et.ElementTree, window_ratio_node: float, export_path: Path):
root = tree.getroot() root = tree.getroot()
root.find('name', NAMESPACE).text = f"Custom Physics Library with Window Ratio : {window_ratio}" root.find('name', NAMESPACE).text = f"Custom Physics Library with Window Ratio : {window_ratio}"
for surface in SURFACES: for surface in SURFACES:
...@@ -90,14 +91,15 @@ def parse_results(window_ratio, heat_demand_csv): ...@@ -90,14 +91,15 @@ def parse_results(window_ratio, heat_demand_csv):
'CoolingDemand': cooling_demand_MWh} 'CoolingDemand': cooling_demand_MWh}
workflow_path, physics_processor_step = copy_workflow_from_template(TEMPLATE_NAME, PROJECT_PATH) def main():
custom_library_path = set_custom_library(physics_processor_step) workflow_path, physics_processor_step = copy_workflow_from_template(TEMPLATE_NAME, PROJECT_PATH)
lib_tree = parse_library(custom_library_path) custom_library_path = set_custom_library(physics_processor_step)
lib_tree = parse_library(custom_library_path)
all_results = [] all_results = []
for window_ratio in WINDOW_RATIOS: for window_ratio in WINDOW_RATIOS:
# TODO: Status quo too # TODO: Status quo too
set_custom_window_ratio(lib_tree, window_ratio, custom_library_path) set_custom_window_ratio(window_ratio, lib_tree, window_ratio, custom_library_path)
output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, [CITYGML]) output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, [CITYGML])
...@@ -107,9 +109,13 @@ for window_ratio in WINDOW_RATIOS: ...@@ -107,9 +109,13 @@ for window_ratio in WINDOW_RATIOS:
all_results.append(parse_results(window_ratio, heat_demand_csv)) all_results.append(parse_results(window_ratio, heat_demand_csv))
df = pd.DataFrame(all_results).set_index('WindowRatio') df = pd.DataFrame(all_results).set_index('WindowRatio')
print(df) print(df)
df.plot() df.plot()
plt.ylabel('MWh') plt.ylabel('MWh')
plt.title("Demands depending on Window Ratio") plt.title("Demands depending on Window Ratio")
plt.show() plt.show()
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment