shared wall implementation and code refactoring.

This commit is contained in:
Guille Gutierrez 2020-05-28 15:22:46 -04:00
parent 4f57ff3ddf
commit 8995b30ae3
2 changed files with 3 additions and 362 deletions

View File

@ -1,332 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<CitySim name="SRA.xml">
<Simulation beginMonth="1" beginDay="1" endMonth="12" endDay="31"/>
<Climate location="/home/pilar/PycharmProjects/DynamicBuildingSimulation/examples/NYC_2buildings/inputs/inseldb_New_York_City.cli" city="New York City"/>
<District>
<FarFieldObstructions/>
<Building Name="GBP__169" id="0" key="GBP__169" Simulate="True">
<Wall id="10" ShortWaveReflectance="0.2">
<V0 x="1399.46142578125" y="1964.59521484375" z="10.786276534199727"/>
<V1 x="1399.46142578125" y="1964.59521484375" z="0.0"/>
<V2 x="1395.708984375" y="1957.1826171875" z="10.786276534199727"/>
</Wall>
<Wall id="11" ShortWaveReflectance="0.2">
<V0 x="1395.708984375" y="1957.1826171875" z="10.786276534199727"/>
<V1 x="1399.46142578125" y="1964.59521484375" z="0.0"/>
<V2 x="1395.708984375" y="1957.1826171875" z="0.0"/>
</Wall>
<Wall id="22" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
<V1 x="1407.73974609375" y="1960.412109375" z="0.0"/>
<V2 x="1399.46142578125" y="1964.59521484375" z="10.786276534199727"/>
</Wall>
<Wall id="23" ShortWaveReflectance="0.2">
<V0 x="1399.46142578125" y="1964.59521484375" z="10.786276534199727"/>
<V1 x="1407.73974609375" y="1960.412109375" z="0.0"/>
<V2 x="1399.46142578125" y="1964.59521484375" z="0.0"/>
</Wall>
<Wall id="24" ShortWaveReflectance="0.2">
<V0 x="1410.73974609375" y="1966.33837890625" z="10.786276534199727"/>
<V1 x="1410.73974609375" y="1966.33837890625" z="0.0"/>
<V2 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
</Wall>
<Wall id="25" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
<V1 x="1410.73974609375" y="1966.33837890625" z="0.0"/>
<V2 x="1407.73974609375" y="1960.412109375" z="0.0"/>
</Wall>
<Wall id="26" ShortWaveReflectance="0.2">
<V0 x="1395.708984375" y="1957.1826171875" z="10.786276534199727"/>
<V1 x="1395.708984375" y="1957.1826171875" z="0.0"/>
<V2 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
</Wall>
<Wall id="27" ShortWaveReflectance="0.2">
<V0 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
<V1 x="1395.708984375" y="1957.1826171875" z="0.0"/>
<V2 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
</Wall>
<Wall id="28" ShortWaveReflectance="0.2">
<V0 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
<V1 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V2 x="1410.73974609375" y="1966.33837890625" z="10.786276534199727"/>
</Wall>
<Wall id="29" ShortWaveReflectance="0.2">
<V0 x="1410.73974609375" y="1966.33837890625" z="10.786276534199727"/>
<V1 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V2 x="1410.73974609375" y="1966.33837890625" z="0.0"/>
</Wall>
<Wall id="30" ShortWaveReflectance="0.2">
<V0 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
<V1 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
<V2 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
</Wall>
<Wall id="31" ShortWaveReflectance="0.2">
<V0 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
<V1 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
<V2 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
</Wall>
<Wall id="32" ShortWaveReflectance="0.2">
<V0 x="1390.837890625" y="1926.99951171875" z="10.786276534199727"/>
<V1 x="1390.837890625" y="1926.99951171875" z="0.0"/>
<V2 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
</Wall>
<Wall id="33" ShortWaveReflectance="0.2">
<V0 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
<V1 x="1390.837890625" y="1926.99951171875" z="0.0"/>
<V2 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
</Wall>
<Wall id="34" ShortWaveReflectance="0.2">
<V0 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
<V1 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
<V2 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
</Wall>
<Wall id="35" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V1 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
<V2 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
</Wall>
<Wall id="36" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V1 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
<V2 x="1389.3896484375" y="1944.67919921875" z="10.786276534199727"/>
</Wall>
<Wall id="37" ShortWaveReflectance="0.2">
<V0 x="1389.3896484375" y="1944.67919921875" z="10.786276534199727"/>
<V1 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
<V2 x="1389.3896484375" y="1944.67919921875" z="0.0"/>
</Wall>
<Wall id="38" ShortWaveReflectance="0.2">
<V0 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
<V1 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
<V2 x="1390.837890625" y="1926.99951171875" z="10.786276534199727"/>
</Wall>
<Wall id="39" ShortWaveReflectance="0.2">
<V0 x="1390.837890625" y="1926.99951171875" z="10.786276534199727"/>
<V1 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
<V2 x="1390.837890625" y="1926.99951171875" z="0.0"/>
</Wall>
<Wall id="40" ShortWaveReflectance="0.2">
<V0 x="1389.3896484375" y="1944.67919921875" z="10.786276534199727"/>
<V1 x="1389.3896484375" y="1944.67919921875" z="0.0"/>
<V2 x="1385.595703125" y="1937.19140625" z="10.786276534199727"/>
</Wall>
<Wall id="41" ShortWaveReflectance="0.2">
<V0 x="1385.595703125" y="1937.19140625" z="10.786276534199727"/>
<V1 x="1389.3896484375" y="1944.67919921875" z="0.0"/>
<V2 x="1385.595703125" y="1937.19140625" z="0.0"/>
</Wall>
<Wall id="42" ShortWaveReflectance="0.2">
<V0 x="1385.595703125" y="1937.19140625" z="10.786276534199727"/>
<V1 x="1385.595703125" y="1937.19140625" z="0.0"/>
<V2 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
</Wall>
<Wall id="43" ShortWaveReflectance="0.2">
<V0 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
<V1 x="1385.595703125" y="1937.19140625" z="0.0"/>
<V2 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
</Wall>
<Roof id="0" ShortWaveReflectance="0.2">
<V0 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
<V1 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V2 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
</Roof>
<Roof id="1" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
<V1 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
<V2 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
</Roof>
<Roof id="2" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V1 x="1385.595703125" y="1937.19140625" z="10.786276534199727"/>
<V2 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
</Roof>
<Roof id="3" ShortWaveReflectance="0.2">
<V0 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
<V1 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V2 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
</Roof>
<Roof id="4" ShortWaveReflectance="0.2">
<V0 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
<V1 x="1390.837890625" y="1926.99951171875" z="10.786276534199727"/>
<V2 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
</Roof>
<Roof id="5" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
<V1 x="1393.88134765625" y="1932.99951171875" z="10.786276534199727"/>
<V2 x="1398.08251953125" y="1923.3291015625" z="10.786276534199727"/>
</Roof>
<Roof id="6" ShortWaveReflectance="0.2">
<V0 x="1410.73974609375" y="1966.33837890625" z="10.786276534199727"/>
<V1 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
<V2 x="1417.9833984375" y="1962.68603515625" z="10.786276534199727"/>
</Roof>
<Roof id="7" ShortWaveReflectance="0.2">
<V0 x="1399.46142578125" y="1964.59521484375" z="10.786276534199727"/>
<V1 x="1395.708984375" y="1957.1826171875" z="10.786276534199727"/>
<V2 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
</Roof>
<Roof id="8" ShortWaveReflectance="0.2">
<V0 x="1389.3896484375" y="1944.67919921875" z="10.786276534199727"/>
<V1 x="1385.595703125" y="1937.19140625" z="10.786276534199727"/>
<V2 x="1397.66845703125" y="1940.4970703125" z="10.786276534199727"/>
</Roof>
<Roof id="9" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="10.786276534199727"/>
<V1 x="1395.708984375" y="1957.1826171875" z="10.786276534199727"/>
<V2 x="1403.9873046875" y="1952.99853515625" z="10.786276534199727"/>
</Roof>
<Floor id="12" ShortWaveReflectance="0.2">
<V0 x="1410.73974609375" y="1966.33837890625" z="0.0"/>
<V1 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V2 x="1407.73974609375" y="1960.412109375" z="0.0"/>
</Floor>
<Floor id="13" ShortWaveReflectance="0.2">
<V0 x="1399.46142578125" y="1964.59521484375" z="0.0"/>
<V1 x="1407.73974609375" y="1960.412109375" z="0.0"/>
<V2 x="1395.708984375" y="1957.1826171875" z="0.0"/>
</Floor>
<Floor id="14" ShortWaveReflectance="0.2">
<V0 x="1389.3896484375" y="1944.67919921875" z="0.0"/>
<V1 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
<V2 x="1385.595703125" y="1937.19140625" z="0.0"/>
</Floor>
<Floor id="15" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="0.0"/>
<V1 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
<V2 x="1395.708984375" y="1957.1826171875" z="0.0"/>
</Floor>
<Floor id="16" ShortWaveReflectance="0.2">
<V0 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
<V1 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V2 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
</Floor>
<Floor id="17" ShortWaveReflectance="0.2">
<V0 x="1407.73974609375" y="1960.412109375" z="0.0"/>
<V1 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V2 x="1403.9873046875" y="1952.99853515625" z="0.0"/>
</Floor>
<Floor id="18" ShortWaveReflectance="0.2">
<V0 x="1417.9833984375" y="1962.68603515625" z="0.0"/>
<V1 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
<V2 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
</Floor>
<Floor id="19" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
<V1 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
<V2 x="1385.595703125" y="1937.19140625" z="0.0"/>
</Floor>
<Floor id="20" ShortWaveReflectance="0.2">
<V0 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
<V1 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
<V2 x="1390.837890625" y="1926.99951171875" z="0.0"/>
</Floor>
<Floor id="21" ShortWaveReflectance="0.2">
<V0 x="1397.66845703125" y="1940.4970703125" z="0.0"/>
<V1 x="1398.08251953125" y="1923.3291015625" z="0.0"/>
<V2 x="1393.88134765625" y="1932.99951171875" z="0.0"/>
</Floor>
</Building>
<Building Name="GBP__15" id="1" key="GBP__15" Simulate="True">
<Wall id="0" ShortWaveReflectance="0.2">
<V0 x="1300.009765625" y="832.8330078125" z="7.9999997168779355"/>
<V1 x="1291.09521484375" y="819.13916015625" z="7.9999997168779355"/>
<V2 x="1300.009765625" y="832.8330078125" z="0.0"/>
</Wall>
<Wall id="1" ShortWaveReflectance="0.2">
<V0 x="1291.09521484375" y="819.13916015625" z="7.9999997168779355"/>
<V1 x="1291.09521484375" y="819.13916015625" z="0.0"/>
<V2 x="1300.009765625" y="832.8330078125" z="0.0"/>
</Wall>
<Wall id="6" ShortWaveReflectance="0.2">
<V0 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
<V1 x="1276.89013671875" y="847.8828125" z="0.0"/>
<V2 x="1289.62548828125" y="867.447265625" z="7.9999997168779355"/>
</Wall>
<Wall id="7" ShortWaveReflectance="0.2">
<V0 x="1289.62548828125" y="867.447265625" z="7.9999997168779355"/>
<V1 x="1276.89013671875" y="847.8828125" z="0.0"/>
<V2 x="1289.62548828125" y="867.447265625" z="0.0"/>
</Wall>
<Wall id="8" ShortWaveReflectance="0.2">
<V0 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
<V1 x="1300.009765625" y="832.8330078125" z="7.9999997168779355"/>
<V2 x="1276.89013671875" y="847.8828125" z="0.0"/>
</Wall>
<Wall id="9" ShortWaveReflectance="0.2">
<V0 x="1300.009765625" y="832.8330078125" z="7.9999997168779355"/>
<V1 x="1300.009765625" y="832.8330078125" z="0.0"/>
<V2 x="1276.89013671875" y="847.8828125" z="0.0"/>
</Wall>
<Wall id="14" ShortWaveReflectance="0.2">
<V0 x="1276.5048828125" y="875.98779296875" z="7.9999997168779355"/>
<V1 x="1289.62548828125" y="867.447265625" z="7.9999997168779355"/>
<V2 x="1276.5048828125" y="875.98779296875" z="0.0"/>
</Wall>
<Wall id="15" ShortWaveReflectance="0.2">
<V0 x="1289.62548828125" y="867.447265625" z="7.9999997168779355"/>
<V1 x="1289.62548828125" y="867.447265625" z="0.0"/>
<V2 x="1276.5048828125" y="875.98779296875" z="0.0"/>
</Wall>
<Wall id="16" ShortWaveReflectance="0.2">
<V0 x="1276.5048828125" y="875.98779296875" z="7.9999997168779355"/>
<V1 x="1276.5048828125" y="875.98779296875" z="0.0"/>
<V2 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
</Wall>
<Wall id="17" ShortWaveReflectance="0.2">
<V0 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
<V1 x="1276.5048828125" y="875.98779296875" z="0.0"/>
<V2 x="1254.85498046875" y="842.72900390625" z="0.0"/>
</Wall>
<Wall id="18" ShortWaveReflectance="0.2">
<V0 x="1291.09521484375" y="819.13916015625" z="7.9999997168779355"/>
<V1 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
<V2 x="1291.09521484375" y="819.13916015625" z="0.0"/>
</Wall>
<Wall id="19" ShortWaveReflectance="0.2">
<V0 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
<V1 x="1254.85498046875" y="842.72900390625" z="0.0"/>
<V2 x="1291.09521484375" y="819.13916015625" z="0.0"/>
</Wall>
<Roof id="2" ShortWaveReflectance="0.2">
<V0 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
<V1 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
<V2 x="1291.09521484375" y="819.13916015625" z="7.9999997168779355"/>
</Roof>
<Roof id="3" ShortWaveReflectance="0.2">
<V0 x="1300.009765625" y="832.8330078125" z="7.9999997168779355"/>
<V1 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
<V2 x="1291.09521484375" y="819.13916015625" z="7.9999997168779355"/>
</Roof>
<Roof id="4" ShortWaveReflectance="0.2">
<V0 x="1289.62548828125" y="867.447265625" z="7.9999997168779355"/>
<V1 x="1276.5048828125" y="875.98779296875" z="7.9999997168779355"/>
<V2 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
</Roof>
<Roof id="5" ShortWaveReflectance="0.2">
<V0 x="1276.5048828125" y="875.98779296875" z="7.9999997168779355"/>
<V1 x="1254.85498046875" y="842.72900390625" z="7.9999997168779355"/>
<V2 x="1276.89013671875" y="847.8828125" z="7.9999997168779355"/>
</Roof>
<Floor id="10" ShortWaveReflectance="0.2">
<V0 x="1289.62548828125" y="867.447265625" z="0.0"/>
<V1 x="1276.89013671875" y="847.8828125" z="0.0"/>
<V2 x="1276.5048828125" y="875.98779296875" z="0.0"/>
</Floor>
<Floor id="11" ShortWaveReflectance="0.2">
<V0 x="1276.5048828125" y="875.98779296875" z="0.0"/>
<V1 x="1276.89013671875" y="847.8828125" z="0.0"/>
<V2 x="1254.85498046875" y="842.72900390625" z="0.0"/>
</Floor>
<Floor id="12" ShortWaveReflectance="0.2">
<V0 x="1276.89013671875" y="847.8828125" z="0.0"/>
<V1 x="1291.09521484375" y="819.13916015625" z="0.0"/>
<V2 x="1254.85498046875" y="842.72900390625" z="0.0"/>
</Floor>
<Floor id="13" ShortWaveReflectance="0.2">
<V0 x="1300.009765625" y="832.8330078125" z="0.0"/>
<V1 x="1291.09521484375" y="819.13916015625" z="0.0"/>
<V2 x="1276.89013671875" y="847.8828125" z="0.0"/>
</Floor>
</Building>
</District>
</CitySim>

33
init.py
View File

@ -9,40 +9,13 @@ class Init:
def __init__(self, geometry_path):
self._geometry_path = geometry_path
self._city = None
# todo: right now extracted at city level, in the future should be extracted also at building level if exist
self._location = None
@property
def location(self):
if self._location is None:
gps = pyproj.CRS('EPSG:4326') # LatLon with WGS84 datum used by GPS units and Google Earth
input_reference = None
try:
input_reference = pyproj.CRS(self._city.srs_name) # Projected coordinate system from input data
except pyproj.exceptions.CRSError:
print('Invalid projection reference system, please check the input data. (e.g. in CityGML files: srs_name)')
quit()
coordinates = pyproj.transform(input_reference, gps, self._city.lower_corner[0], self._city.lower_corner[1])
self._location = rg.search(coordinates)
return self._location
@property
def handler(self):
if self.city_name == 'New York City':
if self.city.name == 'New York City':
handler = '{0}_{1}'
return handler.format(self.country_code, self.city_name.lower().replace(' ', '_'))
return self.country_code
@property
def country_code(self):
return self.location[0]['cc']
@property
def city_name(self):
if self._city.name is None:
self._city.name = self.location[0]['name']
return self._city.name
return handler.format(self.city.country_code, self.city.name.lower().replace(' ', '_'))
return self.city.country_code
@property
def city(self):