Skip to content

Commit

Permalink
fix(hbjson_to_wufi_xml): Support unit conversion (IP / SI)
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-p-may committed Nov 15, 2022
1 parent 9a92695 commit 471cee5
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 320 deletions.
5 changes: 3 additions & 2 deletions PHX/from_HBJSON/read_HBJSON_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ def convert_hbjson_dict_to_hb_model(_data: Dict) -> model.Model:
--------
model.Model: A Honeybee Model, rebuilt from the HBJSON file.
"""

return model.Model.from_dict(_data)
hb_model: model.Model = model.Model.from_dict(_data)
hb_model.convert_to_units("Meters")
return hb_model
1 change: 0 additions & 1 deletion PHX/hbjson_to_phpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
f"> Reading in the HBJSON file: ./{SOURCE_FILE}")
hb_json_dict = read_HBJSON_file.read_hb_json_from_file(SOURCE_FILE)
hb_model = read_HBJSON_file.convert_hbjson_dict_to_hb_model(hb_json_dict)
hb_model.convert_to_units("Meters")

# --- Generate the PhxProject file.
# -------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion PHX/hbjson_to_wufi_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def resolve_paths(_args: List[str]) -> Tuple[pathlib.Path, pathlib.Path]:
print(f"> Reading in the HBJSON file: ./{SOURCE_FILE}")
hb_json_dict = read_HBJSON_file.read_hb_json_from_file(SOURCE_FILE)
hb_model = read_HBJSON_file.convert_hbjson_dict_to_hb_model(hb_json_dict)
hb_model.convert_to_units("Meters")

# --- Generate the WUFI Project file.
print(
Expand Down
1 change: 0 additions & 1 deletion _testing_to_WUFI.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def generate_xml_file(_source: pathlib.Path, _target_dir: pathlib.Path):
phx_project = create_project.convert_hb_model_to_PhxProject(
hb_model, group_components=True)


# --- Output the WUFI Project as an XML Text File
# -------------------------------------------------------------------------
print(
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 @@ -191,7 +191,7 @@
<Components count="3">
<Component index="0">
<IdentNr>5</IdentNr>
<Name>Room_1_a9af7a02..Face4</Name>
<Name>Room_5_bb414273..Face4</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>12</IdentNrColorI>
Expand All @@ -207,7 +207,7 @@
</Component>
<Component index="1">
<IdentNr>6</IdentNr>
<Name>Room_1_a9af7a02..Face5</Name>
<Name>Room_5_bb414273..Face5</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>7</IdentNrColorI>
Expand Down
10 changes: 5 additions & 5 deletions tests/_reference_xml/Multi_Room_Complete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@
</Component>
<Component index="4">
<IdentNr>49</IdentNr>
<Name>Shade_9f0bb8b7</Name>
<Name>Shade_2b51331d</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
Expand All @@ -667,7 +667,7 @@
</Component>
<Component index="5">
<IdentNr>50</IdentNr>
<Name>Shade_7cf1a9a5</Name>
<Name>Shade_c27f2fac</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
Expand All @@ -689,7 +689,7 @@
<IdentNr>1</IdentNr>
<RoomsVentilation count="2">
<Room index="0">
<Name>101-Room_3</Name>
<Name>101-Room_7</Name>
<Type>99</Type>
<IdentNrUtilizationPatternVent>1</IdentNrUtilizationPatternVent>
<IdentNrVentilationUnit>1</IdentNrVentilationUnit>
Expand All @@ -700,7 +700,7 @@
<DesignVolumeFlowRateExhaust unit="m³/h">14.2</DesignVolumeFlowRateExhaust>
</Room>
<Room index="1">
<Name>102-Room_4</Name>
<Name>102-Room_8</Name>
<Type>99</Type>
<IdentNrUtilizationPatternVent>1</IdentNrUtilizationPatternVent>
<IdentNrVentilationUnit>1</IdentNrVentilationUnit>
Expand Down Expand Up @@ -1070,7 +1070,7 @@
</PH_Parameters>
</Device>
<Device index="1">
<Name>ec68c4bd-f227-44f6-9436-e7336acfac22</Name>
<Name>5af285ae-7e7c-42fd-934a-e08de5ebfe73</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
@@ -1,6 +1,6 @@
{
"tolerance": 0.001,
"units": "Millimeters",
"units": "Meters",
"properties": {
"ph": {
"bldg_segments": [
Expand Down Expand Up @@ -41,7 +41,7 @@
"PHIUS2021_cooling_load": 10.0
},
"name": "Unnamed_Bldg_Segment",
"identifier": "c590558a-8cce-4a15-bfaa-e3c8a8fdb5c2",
"identifier": "55a8da32-50e6-45f3-8835-719f2c7a3e9f",
"site": {
"climate": {
"monthly_radiation": {
Expand Down Expand Up @@ -87,8 +87,8 @@
"june": 0.0,
"november": 0.0
},
"identifier": "4a2be0f1-0b63-471a-9a03-40257873e204",
"display_name": "4a2be0f1-0b63-471a-9a03-40257873e204",
"identifier": "c7de2855-da98-4554-abb8-aebd1fcb92dd",
"display_name": "c7de2855-da98-4554-abb8-aebd1fcb92dd",
"glob": {
"february": 0.0,
"july": 0.0,
Expand Down Expand Up @@ -134,8 +134,8 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "55acc057-0d23-4d4d-a158-3e2a82954486",
"display_name": "55acc057-0d23-4d4d-a158-3e2a82954486",
"identifier": "09ed688d-0ab3-48ff-854f-de7f1c4f89b4",
"display_name": "09ed688d-0ab3-48ff-854f-de7f1c4f89b4",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand All @@ -147,8 +147,8 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "3ffc130a-dade-4d82-9b10-a4de8df1949c",
"display_name": "3ffc130a-dade-4d82-9b10-a4de8df1949c",
"identifier": "b69b8d12-a826-417c-b0b2-22eefde51be7",
"display_name": "b69b8d12-a826-417c-b0b2-22eefde51be7",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand All @@ -160,23 +160,23 @@
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "df1c9e0c-ef3a-42fe-ba80-fcde570961ba",
"display_name": "df1c9e0c-ef3a-42fe-ba80-fcde570961ba",
"identifier": "40f4aab8-26b1-43fd-8b15-3880c4b646cb",
"display_name": "40f4aab8-26b1-43fd-8b15-3880c4b646cb",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
},
"identifier": "ffd4557a-5fd4-4ece-b3fb-deae56e2f616",
"display_name": "ffd4557a-5fd4-4ece-b3fb-deae56e2f616",
"identifier": "3da1a287-482e-4a2d-9ea8-7831dba73de1",
"display_name": "3da1a287-482e-4a2d-9ea8-7831dba73de1",
"cooling_load_2": {
"temp": 0.0,
"rad_global": 0.0,
"rad_east": 0.0,
"dewpoint": null,
"rad_west": 0.0,
"ground_temp": null,
"identifier": "ae9cb0ff-1882-4b72-9f4f-d01b56547731",
"display_name": "ae9cb0ff-1882-4b72-9f4f-d01b56547731",
"identifier": "862dc3d5-435d-4081-86bb-ae98ad75788c",
"display_name": "862dc3d5-435d-4081-86bb-ae98ad75788c",
"rad_south": 0.0,
"rad_north": 0.0,
"sky_temp": null
Expand Down Expand Up @@ -225,8 +225,8 @@
"june": 0.0,
"november": 0.0
},
"identifier": "7cbf745b-5434-4f8c-bb8c-1b632e0a0559",
"display_name": "7cbf745b-5434-4f8c-bb8c-1b632e0a0559",
"identifier": "9ba57268-0071-4b27-af7d-8b3d08f03394",
"display_name": "9ba57268-0071-4b27-af7d-8b3d08f03394",
"dewpoints": {
"february": 0.0,
"july": 0.0,
Expand All @@ -242,7 +242,7 @@
"november": 0.0
}
},
"identifier": "87b5c87d-4819-4596-b594-7dc0be39136c",
"identifier": "52bdcb5e-e70b-43a3-9cc6-55fbd5663d21",
"display_name": "New York",
"summer_daily_temperature_swing": 8.0,
"station_elevation": 0.0
Expand All @@ -252,17 +252,17 @@
"latitude": 40.600000000000001,
"longitude": -73.799999999999997,
"hours_from_UTC": -4,
"identifier": "bb9a5e14-4f0c-4feb-93ff-c80639de930b",
"display_name": "bb9a5e14-4f0c-4feb-93ff-c80639de930b",
"identifier": "63c4500d-99ad-4f1e-838e-82ec7802d921",
"display_name": "63c4500d-99ad-4f1e-838e-82ec7802d921",
"climate_zone": 1
},
"identifier": "366ece43-4654-42da-9395-422b23aebedc",
"display_name": "366ece43-4654-42da-9395-422b23aebedc",
"identifier": "5ffd8fb4-b497-447f-a7c5-6d1ca506bb5b",
"display_name": "5ffd8fb4-b497-447f-a7c5-6d1ca506bb5b",
"phpp_library_codes": {
"country_code": "US-United States of America",
"region_code": "New York",
"dataset_name": "US0055b-New York",
"identifier": "cc056d8d-e7b2-4788-9ae9-898133036452",
"identifier": "b1f98033-2382-46c5-bf27-3e147b8b66f3",
"display_name": "US0055b-New York"
}
},
Expand Down Expand Up @@ -309,7 +309,7 @@
},
"type": "IdealAirSystemProperties"
},
"identifier": "Room_1_a9af7a02 Ideal Loads Air System",
"identifier": "Room_5_bb414273 Ideal Loads Air System",
"cooling_air_temperature": 13.0,
"demand_controlled_ventilation": false,
"cooling_limit": {
Expand Down Expand Up @@ -2306,18 +2306,18 @@
}
},
"version": "1.51.6",
"identifier": "unnamed_31b47b9e",
"identifier": "unnamed_88a499d5",
"display_name": "unnamed",
"rooms": [
{
"properties": {
"ph": {
"type": "RoomPhPropertiesAbridged",
"ph_bldg_segment_id": "c590558a-8cce-4a15-bfaa-e3c8a8fdb5c2",
"ph_bldg_segment_id": "55a8da32-50e6-45f3-8835-719f2c7a3e9f",
"spaces": []
},
"energy": {
"hvac": "Room_1_a9af7a02 Ideal Loads Air System",
"hvac": "Room_5_bb414273 Ideal Loads Air System",
"type": "RoomEnergyPropertiesAbridged",
"program_type": "Generic Office Program"
},
Expand All @@ -2326,8 +2326,8 @@
"type": "RoomRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02",
"display_name": "Room_1",
"identifier": "Room_5_bb414273",
"display_name": "Room_5",
"faces": [
{
"boundary_condition": {
Expand Down Expand Up @@ -2395,8 +2395,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face0",
"display_name": "Room_1_a9af7a02..Face0",
"identifier": "Room_5_bb414273..Face0",
"display_name": "Room_5_bb414273..Face0",
"type": "Face"
},
{
Expand Down Expand Up @@ -2465,8 +2465,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face1",
"display_name": "Room_1_a9af7a02..Face1",
"identifier": "Room_5_bb414273..Face1",
"display_name": "Room_5_bb414273..Face1",
"type": "Face"
},
{
Expand Down Expand Up @@ -2535,8 +2535,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face2",
"display_name": "Room_1_a9af7a02..Face2",
"identifier": "Room_5_bb414273..Face2",
"display_name": "Room_5_bb414273..Face2",
"type": "Face"
},
{
Expand Down Expand Up @@ -2605,8 +2605,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face3",
"display_name": "Room_1_a9af7a02..Face3",
"identifier": "Room_5_bb414273..Face3",
"display_name": "Room_5_bb414273..Face3",
"type": "Face"
},
{
Expand Down Expand Up @@ -2670,8 +2670,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face4",
"display_name": "Room_1_a9af7a02..Face4",
"identifier": "Room_5_bb414273..Face4",
"display_name": "Room_5_bb414273..Face4",
"type": "Face"
},
{
Expand Down Expand Up @@ -2740,8 +2740,8 @@
"type": "FaceRadiancePropertiesAbridged"
}
},
"identifier": "Room_1_a9af7a02..Face5",
"display_name": "Room_1_a9af7a02..Face5",
"identifier": "Room_5_bb414273..Face5",
"display_name": "Room_5_bb414273..Face5",
"type": "Face"
}
],
Expand Down
Loading

0 comments on commit 471cee5

Please sign in to comment.