Skip to content

Commit

Permalink
An issue preventing the BuildingTemplate.DefaultWindowToWallRatio att…
Browse files Browse the repository at this point in the history
…ribute from being serialized to JSON has been fixed (#486)

* an issue preventing the BuildingTemplate.DefaultWindowToWallRatio attribute from being serialized to JSON has been fixed

* fix pathlib and expand

* fix test_template_to_template test
  • Loading branch information
samuelduchesne committed Sep 14, 2023
1 parent 72406ae commit 067edde
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions archetypal/template/building_template.py
Expand Up @@ -31,6 +31,7 @@ class BuildingTemplate(UmiBase):
.. image:: ../images/template/buildingtemplate.png
"""

_CREATED_OBJECTS = []

__slots__ = (
Expand Down Expand Up @@ -543,6 +544,7 @@ def to_dict(self):
data_dict["Perimeter"] = self.Perimeter.to_ref()
data_dict["Structure"] = self.Structure.to_ref()
data_dict["Windows"] = self.Windows.to_ref()
data_dict["DefaultWindowToWallRatio"] = self.DefaultWindowToWallRatio
data_dict["Category"] = validators.string(self.Category, allow_empty=True)
data_dict["Comments"] = validators.string(self.Comments, allow_empty=True)
data_dict["DataSource"] = self.DataSource
Expand Down
2 changes: 1 addition & 1 deletion archetypal/umi_template.py
Expand Up @@ -243,7 +243,7 @@ def from_idf_files(
)
for filename, res in results.items():
if isinstance(res, EnergyPlusProcessError):
filename = (settings.logs_folder / "failed_reduce.txt").expand()
filename = settings.logs_folder / "failed_reduce.txt"
with open(filename, "a") as file:
file.writelines(res.write())
log(
Expand Down
4 changes: 4 additions & 0 deletions tests/input_data/umi_samples/BostonTemplateLibrary_nodup.json
Expand Up @@ -4744,6 +4744,7 @@
"Windows": {
"$ref": "179"
},
"DefaultWindowToWallRatio": 0.4,
"Category": "Office Spaces",
"Comments": "Base building definition for MIT 4433",
"DataSource": "MIT_SDL",
Expand Down Expand Up @@ -4779,6 +4780,7 @@
"Windows": {
"$ref": "180"
},
"DefaultWindowToWallRatio": 0.4,
"Category": "Retail",
"Comments": "Base building definition for MIT 4433",
"DataSource": "MIT_SDL",
Expand Down Expand Up @@ -4814,6 +4816,7 @@
"Windows": {
"$ref": "181"
},
"DefaultWindowToWallRatio": 0.4,
"Category": "Residential and Lodging",
"Comments": "Base building definition for MIT 4433",
"DataSource": "MIT_SDL",
Expand Down Expand Up @@ -4849,6 +4852,7 @@
"Windows": {
"$ref": "181"
},
"DefaultWindowToWallRatio": 0.4,
"Category": "Residential and Lodging",
"Comments": "Base building definition for MIT 4433",
"DataSource": "MIT_SDL",
Expand Down

0 comments on commit 067edde

Please sign in to comment.