Skip to content

Commit

Permalink
fix(cleanup): Fix num dwelling property error
Browse files Browse the repository at this point in the history
- fix name of property
  • Loading branch information
ed-p-may committed Mar 8, 2023
1 parent 50efa98 commit 1c73ad8
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 339 deletions.
10 changes: 5 additions & 5 deletions PHX/from_HBJSON/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _get_room_exposed_face_area(_hb_room: room.Room) -> float:


def all_unique_ph_dwelling_objects(_hb_rooms: List[room.Room]) -> List[PhDwellings]:
"""
"""Return a list of all the unique PhDwelling objects from a set of HB-Rooms.
Arguments:
----------
Expand Down Expand Up @@ -171,10 +171,11 @@ def merge_occupancies(_hb_rooms: List[room.Room]) -> people.People:
"""

# -------------------------------------------------------------------------
# Calculate the total dwelling-unit count
# Calculate the total dwelling-unit count. Ensure always at least 1 (even Non-Res)
total_ph_dwellings = 0
for dwelling_obj in all_unique_ph_dwelling_objects(_hb_rooms):
total_ph_dwellings += int(dwelling_obj.num_dwellings)
merged_ph_dwellings = PhDwellings(_num_dwellings=max(total_ph_dwellings, 1))

# -------------------------------------------------------------------------
# -- Merge all the Rooms
Expand All @@ -195,17 +196,16 @@ def merge_occupancies(_hb_rooms: List[room.Room]) -> people.People:
total_ph_people += float(hbph_people_prop_ph.number_people)
total_hb_people += hb_ppl_obj.people_per_area * hb_room.floor_area


# -------------------------------------------------------------------------
# -- Build up the new Peopler object's attributes
# -- Build up the new People object's attributes
total_floor_area = sum(rm.floor_area for rm in _hb_rooms)
new_hb_prop_energy = _hb_rooms[0].properties.energy # type: RoomEnergyProperties # type: ignore
new_hb_ppl = new_hb_prop_energy.people.duplicate() # type: people.People # type: ignore
new_hb_ppl_prop_ph = new_hb_ppl.properties.ph # type: PeoplePhProperties # type: ignore
new_hb_ppl.people_per_area = total_hb_people / total_floor_area
new_hb_ppl_prop_ph.number_bedrooms = total_ph_bedrooms
new_hb_ppl_prop_ph.number_people = total_ph_people
new_hb_ppl_prop_ph.number_dwelling_units = total_ph_dwellings
new_hb_ppl_prop_ph.dwellings = merged_ph_dwellings

return new_hb_ppl

Expand Down
4 changes: 2 additions & 2 deletions tests/_reference_xml/Default_Model_Single_Zone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<Components count="3">
<Component index="0">
<IdentNr>5</IdentNr>
<Name>Room_1_919b897c..Face4</Name>
<Name>Room_1_a525cb97..Face4</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>12</IdentNrColorI>
Expand All @@ -219,7 +219,7 @@
</Component>
<Component index="1">
<IdentNr>6</IdentNr>
<Name>Room_1_919b897c..Face5</Name>
<Name>Room_1_a525cb97..Face5</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>7</IdentNrColorI>
Expand Down
36 changes: 18 additions & 18 deletions tests/_reference_xml/Multi_Room_Complete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@
</Component>
<Component index="4">
<IdentNr>49</IdentNr>
<Name>Shade_993438fc</Name>
<Name>Shade_c89a47c0</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
Expand All @@ -680,7 +680,7 @@
</Component>
<Component index="5">
<IdentNr>50</IdentNr>
<Name>Shade_f670adf0</Name>
<Name>Shade_2c89d08a</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
Expand Down Expand Up @@ -826,58 +826,58 @@
<ExhaustVents count="0"/>
<ThermalBridges count="8">
<ThermalBridge index="0">
<Name>_unnamed_bldg_segment__3316a4f1</Name>
<Name>_unnamed_bldg_segment__9363dcd8</Name>
<Type>-15</Type>
<Length>18.0</Length>
<Length>14.0</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="1">
<Name>_unnamed_bldg_segment__552fea2c</Name>
<Name>_unnamed_bldg_segment__9749eff3</Name>
<Type>-15</Type>
<Length>9.391485505499118</Length>
<Length>10.733126291998989</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="2">
<Name>_unnamed_bldg_segment__b765facf</Name>
<Name>_unnamed_bldg_segment__a6447dab</Name>
<Type>-15</Type>
<Length>22.0</Length>
<Length>18.0</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="3">
<Name>_unnamed_bldg_segment__bac20572</Name>
<Name>_unnamed_bldg_segment__bd212f70</Name>
<Type>-15</Type>
<Length>14.0</Length>
<Length>22.0</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="4">
<Name>_unnamed_bldg_segment__c2fa42b4</Name>
<Name>_unnamed_bldg_segment__c022de4a</Name>
<Type>-15</Type>
<Length>16.0</Length>
<Length>9.391485505499118</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="5">
<Name>_unnamed_bldg_segment__ebcf0177</Name>
<Name>_unnamed_bldg_segment__efc9ea4f</Name>
<Type>-15</Type>
<Length>10.733126291998989</Length>
<Length>9.391485505499118</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="6">
<Name>_unnamed_bldg_segment__ec8e4532</Name>
<Name>_unnamed_bldg_segment__f402cd77</Name>
<Type>-15</Type>
<Length>13.416407864998739</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
<ThermalBridge index="7">
<Name>_unnamed_bldg_segment__ef601f9c</Name>
<Name>_unnamed_bldg_segment__f77a0042</Name>
<Type>-15</Type>
<Length>9.391485505499118</Length>
<Length>16.0</Length>
<PsiValue>0.01</PsiValue>
<IdentNrOptionalClimate>-1</IdentNrOptionalClimate>
</ThermalBridge>
Expand Down Expand Up @@ -1167,7 +1167,7 @@
</PH_Parameters>
</Device>
<Device index="1">
<Name>5427684d-25a4-4ac6-862c-bd6aab34c352</Name>
<Name>d24ca25c-be9e-4ab1-a0d2-40cfe14094a9</Name>
<IdentNr>1</IdentNr>
<SystemType>5</SystemType>
<TypeDevice>5</TypeDevice>
Expand Down
Binary file modified tests/_source_gh/hbph_test_models.gh
Binary file not shown.
80 changes: 40 additions & 40 deletions tests/_source_hbjson/Default_Model_Single_Zone.hbjson
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"PHIUS2021_cooling_load": 10.0
},
"name": "Unnamed_Bldg_Segment",
"identifier": "a02ca59b-8333-46c0-beea-acf12f1acb35",
"identifier": "0180061f-e5e1-46f2-9b9b-af328e63fcf4",
"site": {
"climate": {
"monthly_radiation": {
Expand Down Expand Up @@ -89,8 +89,8 @@
"june": 0.0,
"november": 0.0
},
"identifier": "5e0af0b2-4d29-43fc-98f5-6358421e8b85",
"display_name": "5e0af0b2-4d29-43fc-98f5-6358421e8b85",
"identifier": "94e9655e-b201-45ef-a361-4c11e71cdc74",
"display_name": "94e9655e-b201-45ef-a361-4c11e71cdc74",
"glob": {
"february": 0.0,
"july": 0.0,
Expand Down Expand Up @@ -136,8 +136,8 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "100f5288-23cb-4b2c-9936-41949aff99bb",
"display_name": "100f5288-23cb-4b2c-9936-41949aff99bb",
"identifier": "2a2cfb7c-29dd-4bd6-a777-e35787d82d7f",
"display_name": "2a2cfb7c-29dd-4bd6-a777-e35787d82d7f",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand All @@ -149,8 +149,8 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "4e37e8f5-4526-435f-870e-374f451161ae",
"display_name": "4e37e8f5-4526-435f-870e-374f451161ae",
"identifier": "9267a296-62a1-4aa8-9e97-9fa6de05dba0",
"display_name": "9267a296-62a1-4aa8-9e97-9fa6de05dba0",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand All @@ -162,23 +162,23 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "3ba5aa72-8405-4801-9bbd-640a5b219d15",
"display_name": "3ba5aa72-8405-4801-9bbd-640a5b219d15",
"identifier": "9c2bda03-24e1-476d-9ff2-932f6069edb7",
"display_name": "9c2bda03-24e1-476d-9ff2-932f6069edb7",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
},
"identifier": "9f64e6de-d1e4-4f71-b491-b1d25cdc1f39",
"display_name": "9f64e6de-d1e4-4f71-b491-b1d25cdc1f39",
"identifier": "6e1c8a2d-3bdf-4016-a042-5c94cf4a182a",
"display_name": "6e1c8a2d-3bdf-4016-a042-5c94cf4a182a",
"cooling_load_2": {
"temp": 0.0,
"rad_global": 0.0,
"rad_east": 0.0,
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "286aa8a0-d711-45b1-9ae7-eb8993760d92",
"display_name": "286aa8a0-d711-45b1-9ae7-eb8993760d92",
"identifier": "a44b7946-e99c-4e05-95b0-ee1e0f24b976",
"display_name": "a44b7946-e99c-4e05-95b0-ee1e0f24b976",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand Down Expand Up @@ -227,8 +227,8 @@
"june": 0.0,
"november": 0.0
},
"identifier": "152b5516-b01f-4441-b0d3-a11fa2aa5eea",
"display_name": "152b5516-b01f-4441-b0d3-a11fa2aa5eea",
"identifier": "1cec77e9-b967-49b8-823e-3bd0fc447eb3",
"display_name": "1cec77e9-b967-49b8-823e-3bd0fc447eb3",
"dewpoints": {
"february": 0.0,
"july": 0.0,
Expand All @@ -244,7 +244,7 @@
"november": 0.0
}
},
"identifier": "e9c44b2f-f761-4b38-aed9-dff61d1a2388",
"identifier": "c6f3496b-7e08-4fc7-a399-ca964e8800d0",
"display_name": "New York",
"summer_daily_temperature_swing": 8.0,
"station_elevation": 0.0
Expand All @@ -254,17 +254,17 @@
"latitude": 40.600000000000001,
"longitude": -73.799999999999997,
"hours_from_UTC": -4,
"identifier": "b13e2e20-eb55-46e2-a7a4-95cbe8a3b807",
"display_name": "b13e2e20-eb55-46e2-a7a4-95cbe8a3b807",
"identifier": "772ab6c7-4c87-4287-a62c-6806c057166c",
"display_name": "772ab6c7-4c87-4287-a62c-6806c057166c",
"climate_zone": 1
},
"identifier": "386982c4-3981-49d5-8284-b36c468e91bb",
"display_name": "386982c4-3981-49d5-8284-b36c468e91bb",
"identifier": "0829a6f2-f63e-4026-9c60-bdf578548fb3",
"display_name": "0829a6f2-f63e-4026-9c60-bdf578548fb3",
"phpp_library_codes": {
"country_code": "US-United States of America",
"region_code": "New York",
"dataset_name": "US0055b-New York",
"identifier": "707df99e-718f-441d-a04f-159ed8837317",
"identifier": "aa8d3b0d-e14b-43c5-9ddf-169bf2742ea4",
"display_name": "US0055b-New York"
}
},
Expand Down Expand Up @@ -312,7 +312,7 @@
},
"type": "IdealAirSystemProperties"
},
"identifier": "Room_1_919b897c Ideal Loads Air System",
"identifier": "Room_1_a525cb97 Ideal Loads Air System",
"cooling_air_temperature": 13.0,
"demand_controlled_ventilation": false,
"cooling_limit": {
Expand Down Expand Up @@ -2109,8 +2109,8 @@
"ph": {
"type": "PeoplePhProperties",
"dwellings": {
"identifier": "169e3bac-9059-49fc-ade6-510ce9364eb1",
"num_dwellings": 1
"identifier": "0c8d563c-7333-4dc3-bfa7-cd9c08d35f18",
"num_dwellings": 0
},
"id_num": 0,
"number_bedrooms": 0,
Expand Down Expand Up @@ -2312,18 +2312,18 @@
}
},
"version": "1.53.1",
"identifier": "unnamed_f1a12fa7",
"identifier": "unnamed_97678b08",
"display_name": "unnamed",
"rooms": [
{
"properties": {
"ph": {
"type": "RoomPhPropertiesAbridged",
"ph_bldg_segment_id": "a02ca59b-8333-46c0-beea-acf12f1acb35",
"ph_bldg_segment_id": "0180061f-e5e1-46f2-9b9b-af328e63fcf4",
"spaces": []
},
"energy": {
"hvac": "Room_1_919b897c Ideal Loads Air System",
"hvac": "Room_1_a525cb97 Ideal Loads Air System",
"type": "RoomEnergyPropertiesAbridged",
"program_type": "Generic Office Program"
},
Expand All @@ -2332,7 +2332,7 @@
"type": "RoomRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c",
"identifier": "Room_1_a525cb97",
"display_name": "Room_1",
"faces": [
{
Expand Down Expand Up @@ -2401,8 +2401,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face0",
"display_name": "Room_1_919b897c..Face0",
"identifier": "Room_1_a525cb97..Face0",
"display_name": "Room_1_a525cb97..Face0",
"type": "Face"
},
{
Expand Down Expand Up @@ -2471,8 +2471,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face1",
"display_name": "Room_1_919b897c..Face1",
"identifier": "Room_1_a525cb97..Face1",
"display_name": "Room_1_a525cb97..Face1",
"type": "Face"
},
{
Expand Down Expand Up @@ -2541,8 +2541,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face2",
"display_name": "Room_1_919b897c..Face2",
"identifier": "Room_1_a525cb97..Face2",
"display_name": "Room_1_a525cb97..Face2",
"type": "Face"
},
{
Expand Down Expand Up @@ -2611,8 +2611,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face3",
"display_name": "Room_1_919b897c..Face3",
"identifier": "Room_1_a525cb97..Face3",
"display_name": "Room_1_a525cb97..Face3",
"type": "Face"
},
{
Expand Down Expand Up @@ -2676,8 +2676,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face4",
"display_name": "Room_1_919b897c..Face4",
"identifier": "Room_1_a525cb97..Face4",
"display_name": "Room_1_a525cb97..Face4",
"type": "Face"
},
{
Expand Down Expand Up @@ -2746,8 +2746,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_919b897c..Face5",
"display_name": "Room_1_919b897c..Face5",
"identifier": "Room_1_a525cb97..Face5",
"display_name": "Room_1_a525cb97..Face5",
"type": "Face"
}
],
Expand Down
Loading

0 comments on commit 1c73ad8

Please sign in to comment.