Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enclosure windows and skylights #19

Merged
merged 15 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion hpxml_version_translator/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,66 @@ def get_event_type_from_building_id(building_id):
# TODO: Deprecated items
# https://github.com/hpxmlwg/hpxml/pull/167

# TODO: Enclosure
# Enclosure
# https://github.com/hpxmlwg/hpxml/pull/181

# Windows
for i, win in enumerate(root.xpath(
'h:Building/h:BuildingDetails/h:Enclosure/h:Windows/h:Window', **xpkw
)):
if hasattr(win, 'Treatments'):
win.remove(win.Treatments)
bpark1327 marked this conversation as resolved.
Show resolved Hide resolved
if hasattr(win, 'VisibleTransmittance'):
add_after(
win,
['UFactor',
'SHGC'],
E.VisibleTransmittance(float(win.VisibleTransmittance))
)
win.remove(win.VisibleTransmittance[1]) # remove VisibleTransmittance of HPXML v2
if hasattr(win, 'ExteriorShading'):
add_after(
win,
['UFactor',
'SHGC',
'VisibleTransmittance',
'NFRCCertified',
'ThirdPartyCertification'],
E.ExteriorShading(
E.SystemIdentifier(id=f'exterior-shading-{i}'),
E.Type(str(win.ExteriorShading))
)
)
win.remove(win.ExteriorShading[1]) # remove ExteriorShading of HPXML v2
if hasattr(win, 'InteriorShading'):
win.InteriorShading.addnext(
E.InteriorShading(
E.SystemIdentifier(id=f'interior-shading-{i}'),
E.Type(str(win.InteriorShading)),
E.SummerShadingCoefficient(float(win.InteriorShadingFactor)),
E.WinterShadingCoefficient(float(win.InteriorShadingFactor))
)
)
win.remove(win.InteriorShading[0]) # remove InteriorShading of HPXML v2
win.remove(win.InteriorShadingFactor)
if hasattr(win, 'MovableInsulationRValue'):
add_after(
win,
['UFactor',
'SHGC',
'VisibleTransmittance',
'NFRCCertified',
'ThirdPartyCertification',
'ExteriorShading',
'InteriorShading',
'StormWindow'],
E.MoveableInsulation(
E.SystemIdentifier(id=f'movable-insulation-{i}'),
E.RValue(float(win.MovableInsulationRValue))
)
)
win.remove(win.MovableInsulationRValue)

# TODO: Adds desuperheater flexibility
# https://github.com/hpxmlwg/hpxml/pull/184

Expand Down
42 changes: 42 additions & 0 deletions test/hpxml_files/enclosure_windows.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<HPXML xmlns="http://hpxmlonline.com/2014/6" schemaVersion="2.3">
<XMLTransactionHeaderInformation>
<XMLType></XMLType>
<XMLGeneratedBy></XMLGeneratedBy>
<CreatedDateAndTime>2021-04-05T14:17:07.685077</CreatedDateAndTime>
<Transaction>create</Transaction>
</XMLTransactionHeaderInformation>
<SoftwareInfo/>
<Building>
<BuildingID id="bldg1"></BuildingID>
<ProjectStatus>
<EventType>audit</EventType>
</ProjectStatus>
<BuildingDetails>
<Enclosure>
<Walls>
<Wall>
<SystemIdentifier id='wall-1'/>
</Wall>
</Walls>
<Windows>
<Window>
<SystemIdentifier id='window-1'/>
<Area>108.0</Area>
<Azimuth>0</Azimuth>
<Treatments>window film</Treatments>
<UFactor>0.33</UFactor>
<SHGC>0.45</SHGC>
<NFRCCertified>true</NFRCCertified>
<VisibleTransmittance>0.9</VisibleTransmittance>
<InteriorShading>light shades</InteriorShading>
<InteriorShadingFactor>0.7</InteriorShadingFactor>
<ExteriorShading>evergreen tree</ExteriorShading>
<MovableInsulationRValue>5.5</MovableInsulationRValue>
<AttachedToWall idref='wall-1'/>
</Window>
</Windows>
</Enclosure>
</BuildingDetails>
</Building>
</HPXML>
21 changes: 21 additions & 0 deletions test/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,24 @@ def test_clothes_dryer():
assert dryer2.EnergyFactor == 5.0
assert dryer2.ControlType == 'temperature'
assert not hasattr(dryer2, 'EfficiencyFactor')


def test_windows():
root = convert_hpxml_and_parse(hpxml_dir / 'enclosure_windows.xml')

win1 = root.Building.BuildingDetails.Enclosure.Windows.Window[0]
assert win1.Area == 108.0
assert win1.Azimuth == 0
assert win1.UFactor == 0.33
assert win1.SHGC == 0.45
assert win1.NFRCCertified
assert win1.VisibleTransmittance == 0.9
assert win1.ExteriorShading.Type == 'evergreen tree'
assert win1.InteriorShading.Type == 'light shades'
assert win1.InteriorShading.SummerShadingCoefficient == 0.7
assert win1.InteriorShading.WinterShadingCoefficient == 0.7
assert win1.MoveableInsulation.RValue == 5.5
assert win1.AttachedToWall.attrib['idref'] == 'wall-1'
assert not hasattr(win1, 'Treatments')
assert not hasattr(win1, 'InteriorShadingFactor')
assert not hasattr(win1, 'MovableInsulationRValue')