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 all commits
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
106 changes: 106 additions & 0 deletions hpxml_version_translator/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,112 @@ def get_event_type_from_building_id(building_id):
layer.InstallationType._setText(f'continuous - {str(insulation.InsulationLocation)}')
insulation.remove(insulation.InsulationLocation)

# Windows and Skylights
for i, win in enumerate(root.xpath('//h:Window|//h:Skylight', **xpkw)):
if hasattr(win, 'VisibleTransmittance'):
add_after(
win,
['Area',
'Quantity',
'Azimuth',
'Orientation',
'FrameType',
'GlassLayers',
'GlassType',
'GasFill',
'Condition',
'UFactor',
'SHGC'],
E.VisibleTransmittance(float(win.VisibleTransmittance))
)
win.remove(win.VisibleTransmittance[1]) # remove VisibleTransmittance of HPXML v2
if hasattr(win, 'ExteriorShading'):
ext_shade = str(win.ExteriorShading)
win.ExteriorShading.clear()
win.ExteriorShading.extend([
E.SystemIdentifier(id=f'exterior-shading-{i}'),
E.Type(ext_shade)
])
if hasattr(win, 'InteriorShading'): # insert ExteriorShading right before InteriorShading
win.InteriorShading.addprevious(win.ExteriorShading)
if hasattr(win, 'Treatments'):
if win.Treatments in ['shading', 'solar screen']:
treatment_shade = E.ExteriorShading(
E.SystemIdentifier(id=f'treatment-shading-{i}'),
)
if win.Treatments == 'solar screen':
treatment_shade.append(E.Type('solar screens'))
add_after(
win,
['UFactor',
'SHGC',
'VisibleTransmittance',
'NFRCCertified',
'ThirdPartyCertification',
'WindowFilm'],
treatment_shade
)
elif win.Treatments == 'window film':
add_after(
win,
['UFactor',
'SHGC',
'VisibleTransmittance',
'NFRCCertified',
'ThirdPartyCertification'],
E.WindowFilm(
E.SystemIdentifier(id=f'window-film-{i}')
)
)
win.remove(win.Treatments)
if hasattr(win, 'InteriorShading'):
int_shading = str(win.InteriorShading)
int_shading_factor = float(win.InteriorShadingFactor)
win.InteriorShading.clear()
win.InteriorShading.extend([
E.SystemIdentifier(id=f'interior-shading-{i}'),
E.Type(int_shading),
E.SummerShadingCoefficient(int_shading_factor),
E.WinterShadingCoefficient(int_shading_factor)
])
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)
if hasattr(win, 'GlassLayers'):
if win.GlassLayers in ['single-paned with low-e storms', 'single-paned with storms']:
storm_window = E.StormWindow(
E.SystemIdentifier(id=f'storm-window-{i}')
)
if win.GlassLayers == 'single-paned with low-e storms':
storm_window.append(E.GlassType('low-e'))
win.GlassLayers._setText('single-pane')
add_after(
win,
['UFactor',
'SHGC',
'VisibleTransmittance',
'NFRCCertified',
'ThirdPartyCertification',
'ExteriorShading',
'InteriorShading'],
storm_window
)

# TODO: Standardize Locations
# https://github.com/hpxmlwg/hpxml/pull/156

Expand Down
74 changes: 74 additions & 0 deletions test/hpxml_files/enclosure_windows_skylights.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?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>solar screen</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>
<Window>
<SystemIdentifier id='window-2'/>
<GlassLayers>single-paned with low-e storms</GlassLayers>
<UFactor>0.45</UFactor>
<SHGC>0.6</SHGC>
<VisibleTransmittance>0.8</VisibleTransmittance>
<ExteriorShading>solar film</ExteriorShading>
</Window>
<Window>
<SystemIdentifier id='window-3'/>
<Treatments>window film</Treatments>
<UFactor>0.45</UFactor>
<SHGC>0.6</SHGC>
</Window>
</Windows>
<Skylights>
<Skylight>
<SystemIdentifier id='skylight-1'/>
<Area>20.0</Area>
<Azimuth>0</Azimuth>
<Treatments>solar screen</Treatments>
<UFactor>0.25</UFactor>
<SHGC>0.60</SHGC>
<NFRCCertified>true</NFRCCertified>
<VisibleTransmittance>0.9</VisibleTransmittance>
<InteriorShading>dark shades</InteriorShading>
<InteriorShadingFactor>0.65</InteriorShadingFactor>
<ExteriorShading>building</ExteriorShading>
<MovableInsulationRValue>3.5</MovableInsulationRValue>
<Pitch>6.0</Pitch>
<AttachedToRoof idref='roof-1'/>
</Skylight>
</Skylights>
</Enclosure>
</BuildingDetails>
</Building>
</HPXML>
45 changes: 45 additions & 0 deletions test/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,48 @@ def test_walls():
assert wall1.Insulation.Layer[1].InsulationMaterial.Batt == 'fiberglass'
assert wall1.Insulation.Layer[1].NominalRValue == 12.0
assert wall1.Insulation.Layer[1].Thickness == 3.5


def test_windows():
root = convert_hpxml_and_parse(hpxml_dir / 'enclosure_windows_skylights.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[0].Type == 'solar screens'
assert win1.ExteriorShading[1].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')

win2 = root.Building.BuildingDetails.Enclosure.Windows.Window[1]
assert win2.GlassLayers == 'single-pane'
assert win2.StormWindow.GlassType == 'low-e'
assert win2.ExteriorShading[0].Type == 'solar film'

win3 = root.Building.BuildingDetails.Enclosure.Windows.Window[2]
assert hasattr(win3, 'WindowFilm')

skylight1 = root.Building.BuildingDetails.Enclosure.Skylights.Skylight[0]
assert skylight1.Area == 20.0
assert skylight1.UFactor == 0.25
assert skylight1.SHGC == 0.60
assert skylight1.ExteriorShading[0].Type == 'solar screens'
assert skylight1.ExteriorShading[1].Type == 'building'
assert skylight1.InteriorShading.Type == 'dark shades'
assert skylight1.InteriorShading.SummerShadingCoefficient == 0.65
assert skylight1.InteriorShading.WinterShadingCoefficient == 0.65
assert skylight1.MoveableInsulation.RValue == 3.5
assert skylight1.Pitch == 6.0
assert not hasattr(skylight1, 'Treatments')
assert not hasattr(skylight1, 'InteriorShadingFactor')
assert not hasattr(skylight1, 'MovableInsulationRValue')