Last active
October 24, 2015 02:14
-
-
Save uhjish/3536da3b2c723c414539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:befe62f45cfc69e2d2222a5f7eefffaa1bf43c3b6be3e93bde97a560dec299c5" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Fun times with HPXML\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import sys\n", | |
"import os\n", | |
"\n", | |
"from lxml import etree\n", | |
"\n", | |
"\n", | |
"fpath = 'validhpxml'\n", | |
"root = etree.parse(fpath)\n", | |
"\n", | |
"print etree.tostring(root, pretty_print=True)\n", | |
"\n", | |
"#cheap validation using the stuff already built by NREL.\n", | |
"\n", | |
"tx = HPXMLtoHEScoreTranslator(fpath)\n", | |
"\n" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"<HPXML xmlns=\"http://hpxmlonline.com/2014/6\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" schemaVersion=\"2.1\"> \n", | |
" <XMLTransactionHeaderInformation>\n", | |
" <XMLType/>\n", | |
" <XMLGeneratedBy/>\n", | |
" <CreatedDateAndTime>2014-10-20T16:02:04</CreatedDateAndTime>\n", | |
" <Transaction>create</Transaction>\n", | |
" </XMLTransactionHeaderInformation>\n", | |
" <SoftwareInfo/>\n", | |
" <Building>\n", | |
" <BuildingID id=\"blg1\"/>\n", | |
" <Site>\n", | |
" <SiteID id=\"site1\"/>\n", | |
" <Address>\n", | |
" <AddressType>street</AddressType>\n", | |
" <Address1>123 Main Street</Address1>\n", | |
" <Address2/>\n", | |
" <CityMunicipality>Winterfell</CityMunicipality>\n", | |
" <StateCode>VA</StateCode>\n", | |
" <ZipCode>22044</ZipCode>\n", | |
" </Address>\n", | |
" </Site>\n", | |
" <ContractorID/>\n", | |
" <ProjectStatus>\n", | |
" <EventType>audit</EventType>\n", | |
" </ProjectStatus>\n", | |
" <BuildingDetails>\n", | |
" <BuildingSummary>\n", | |
" <BuildingConstruction>\n", | |
" <YearBuilt>1982</YearBuilt>\n", | |
" <NumberofRooms>6</NumberofRooms>\n", | |
" <NetFloorArea>2100</NetFloorArea>\n", | |
" </BuildingConstruction>\n", | |
" </BuildingSummary>\n", | |
" <Enclosure>\n", | |
" <AtticAndRoof>\n", | |
" <Attics>\n", | |
" <Attic>\n", | |
" <SystemIdentifier id=\"attic1\"/>\n", | |
" <AtticFloorInsulation>\n", | |
" <SystemIdentifier id=\"atticinsulation2\"/>\n", | |
" <Layer>\n", | |
" <InsulationMaterial>\n", | |
" <LooseFill>fiberglass</LooseFill>\n", | |
" </InsulationMaterial>\n", | |
" <NominalRValue>49</NominalRValue>\n", | |
" </Layer>\n", | |
" </AtticFloorInsulation>\n", | |
" </Attic>\n", | |
" </Attics>\n", | |
" </AtticAndRoof>\n", | |
" <Windows>\n", | |
" <Window>\n", | |
" <SystemIdentifier id=\"w2\"/>\n", | |
" <FrameType><Vinyl/></FrameType>\n", | |
" <GlassLayers>triple-pane</GlassLayers>\n", | |
" </Window>\n", | |
" </Windows>\n", | |
" </Enclosure>\n", | |
" <Systems>\n", | |
" <HVAC>\n", | |
" <HVACPlant>\n", | |
" <HeatingSystem>\n", | |
" <SystemIdentifier id=\"h2\"/>\n", | |
" <HeatingSystemType>\n", | |
" <Furnace>\n", | |
" <SealedCombustion>1</SealedCombustion>\n", | |
" </Furnace>\n", | |
" </HeatingSystemType>\n", | |
" <AnnualHeatingEfficiency>\n", | |
" <Units>AFUE</Units>\n", | |
" <Value>90.0</Value>\n", | |
" </AnnualHeatingEfficiency>\n", | |
" </HeatingSystem>\n", | |
" <CoolingSystem>\n", | |
" <SystemIdentifier id=\"c2\"/>\n", | |
" <CoolingSystemType>central air conditioning</CoolingSystemType>\n", | |
" <AnnualCoolingEfficiency>\n", | |
" <Units>SEER</Units>\n", | |
" <Value>17.0</Value>\n", | |
" </AnnualCoolingEfficiency>\n", | |
" </CoolingSystem>\n", | |
" </HVACPlant>\n", | |
" </HVAC>\n", | |
" </Systems>\n", | |
" </BuildingDetails>\n", | |
" </Building>\n", | |
"</HPXML>\n", | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from hpxml import HPXMLtoHEScoreTranslator, TranslationError, InputOutOfBounds\n", | |
"import StringIO\n", | |
"import json\n", | |
"from copy import deepcopy\n", | |
"\n", | |
"\n", | |
"pp = pprint.PrettyPrinter(indent=2)\n", | |
"\n", | |
"#our custom hpxml passes validation but is missing\n", | |
"# items assumed by HEScore such as ResidentialType\n", | |
"\n", | |
"tx = HPXMLtoHEScoreTranslator('house2.xml')\n", | |
"\n", | |
"print json.dumps(tx.hpxml_to_hescore_dict(), indent=2)\n" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"{\n", | |
" \"building_address\": {\n", | |
" \"address\": \"2 API House\", \n", | |
" \"city\": \"Tulsa\", \n", | |
" \"state\": \"OK\", \n", | |
" \"zip_code\": \"74132\", \n", | |
" \"assessment_type\": \"initial\"\n", | |
" }, \n", | |
" \"building\": {\n", | |
" \"about\": {\n", | |
" \"assessment_date\": \"2014-10-28\", \n", | |
" \"shape\": \"rectangle\", \n", | |
" \"year_built\": 1953, \n", | |
" \"number_bedrooms\": 3, \n", | |
" \"num_floor_above_grade\": 2, \n", | |
" \"floor_to_ceiling_height\": 11, \n", | |
" \"conditioned_floor_area\": 1620, \n", | |
" \"orientation\": \"east\", \n", | |
" \"blower_door_test\": false, \n", | |
" \"air_sealing_present\": false\n", | |
" }, \n", | |
" \"zone\": {\n", | |
" \"zone_roof\": [\n", | |
" {\n", | |
" \"roof_name\": \"roof1\", \n", | |
" \"roof_area\": 810, \n", | |
" \"roof_assembly_code\": \"rfrb00co\", \n", | |
" \"roof_color\": \"dark\", \n", | |
" \"roof_type\": \"vented_attic\", \n", | |
" \"ceiling_assembly_code\": \"ecwf11\", \n", | |
" \"zone_skylight\": {\n", | |
" \"skylight_area\": 0\n", | |
" }\n", | |
" }\n", | |
" ], \n", | |
" \"zone_floor\": [\n", | |
" {\n", | |
" \"floor_name\": \"floor1\", \n", | |
" \"floor_area\": 810.0, \n", | |
" \"foundation_type\": \"vented_crawl\", \n", | |
" \"foundation_insulation_level\": 0, \n", | |
" \"floor_assembly_code\": \"efwf30ca\"\n", | |
" }\n", | |
" ], \n", | |
" \"wall_construction_same\": false, \n", | |
" \"window_construction_same\": false, \n", | |
" \"zone_wall\": [\n", | |
" {\n", | |
" \"side\": \"right\", \n", | |
" \"wall_assembly_code\": \"ewwf00br\", \n", | |
" \"zone_window\": {\n", | |
" \"window_area\": 45.0, \n", | |
" \"window_method\": \"custom\", \n", | |
" \"window_u_value\": 0.65, \n", | |
" \"window_shgc\": 0.8\n", | |
" }\n", | |
" }, \n", | |
" {\n", | |
" \"side\": \"front\", \n", | |
" \"wall_assembly_code\": \"ewwf00br\", \n", | |
" \"zone_window\": {\n", | |
" \"window_area\": 108.0, \n", | |
" \"window_method\": \"custom\", \n", | |
" \"window_u_value\": 0.51, \n", | |
" \"window_shgc\": 0.35\n", | |
" }\n", | |
" }, \n", | |
" {\n", | |
" \"side\": \"left\", \n", | |
" \"wall_assembly_code\": \"ewwf00br\", \n", | |
" \"zone_window\": {\n", | |
" \"window_area\": 60.0, \n", | |
" \"window_method\": \"custom\", \n", | |
" \"window_u_value\": 0.67, \n", | |
" \"window_shgc\": 0.55\n", | |
" }\n", | |
" }, \n", | |
" {\n", | |
" \"side\": \"back\", \n", | |
" \"wall_assembly_code\": \"ewwf00br\", \n", | |
" \"zone_window\": {\n", | |
" \"window_area\": 135.3333333, \n", | |
" \"window_method\": \"custom\", \n", | |
" \"window_u_value\": 0.25, \n", | |
" \"window_shgc\": 0.42000000000000004\n", | |
" }\n", | |
" }\n", | |
" ]\n", | |
" }, \n", | |
" \"systems\": {\n", | |
" \"hvac\": [\n", | |
" {\n", | |
" \"hvac_name\": \"hvac1\", \n", | |
" \"hvac_fraction\": 1.0, \n", | |
" \"heating\": {\n", | |
" \"fuel_primary\": \"natural_gas\", \n", | |
" \"type\": \"central_furnace\", \n", | |
" \"efficiency_method\": \"user\", \n", | |
" \"efficiency\": 0.92\n", | |
" }, \n", | |
" \"cooling\": {\n", | |
" \"type\": \"split_dx\", \n", | |
" \"efficiency_method\": \"user\", \n", | |
" \"efficiency\": 13.0\n", | |
" }, \n", | |
" \"hvac_distribution\": [\n", | |
" {\n", | |
" \"name\": \"duct1\", \n", | |
" \"location\": \"cond_space\", \n", | |
" \"fraction\": 50, \n", | |
" \"insulated\": false, \n", | |
" \"sealed\": false\n", | |
" }, \n", | |
" {\n", | |
" \"name\": \"duct2\", \n", | |
" \"location\": \"vented_crawl\", \n", | |
" \"fraction\": 50, \n", | |
" \"insulated\": true, \n", | |
" \"sealed\": false\n", | |
" }\n", | |
" ]\n", | |
" }\n", | |
" ], \n", | |
" \"domestic_hot_water\": {\n", | |
" \"category\": \"unit\", \n", | |
" \"type\": \"storage\", \n", | |
" \"fuel_primary\": \"electric\", \n", | |
" \"efficiency_method\": \"user\", \n", | |
" \"energy_factor\": 0.8\n", | |
" }\n", | |
" }\n", | |
" }\n", | |
"}\n" | |
] | |
} | |
], | |
"prompt_number": 13 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HPXML xmlns="http://hpxmlonline.com/2014/6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="2.1"> | |
<XMLTransactionHeaderInformation> | |
<XMLType/> | |
<XMLGeneratedBy/> | |
<CreatedDateAndTime>2014-10-20T16:02:04</CreatedDateAndTime> | |
<Transaction>create</Transaction> | |
</XMLTransactionHeaderInformation> | |
<SoftwareInfo/> | |
<Building> | |
<Residential | |
<BuildingID id="blg1"></BuildingID> | |
<Site> | |
<SiteID id="site1"/> | |
<Address> | |
<AddressType>street</AddressType> | |
<Address1>123 Main Street</Address1> | |
<Address2></Address2> | |
<CityMunicipality>Winterfell</CityMunicipality> | |
<StateCode>VA</StateCode> | |
<ZipCode>22044</ZipCode> | |
</Address> | |
</Site> | |
<ContractorID></ContractorID> | |
<ProjectStatus> | |
<EventType>audit</EventType> | |
</ProjectStatus> | |
<BuildingDetails> | |
<BuildingSummary> | |
<BuildingConstruction> | |
<YearBuilt>1982</YearBuilt> | |
<NumberofRooms>6</NumberofRooms> | |
<NetFloorArea>2100</NetFloorArea> | |
</BuildingConstruction> | |
</BuildingSummary> | |
<Enclosure> | |
<AtticAndRoof> | |
<Attics> | |
<Attic> | |
<SystemIdentifier id="attic1"/> | |
<AtticFloorInsulation> | |
<SystemIdentifier id="atticinsulation2"/> | |
<Layer> | |
<InsulationMaterial> | |
<LooseFill>fiberglass</LooseFill> | |
</InsulationMaterial> | |
<NominalRValue>49</NominalRValue> | |
</Layer> | |
</AtticFloorInsulation> | |
</Attic> | |
</Attics> | |
</AtticAndRoof> | |
<Windows> | |
<Window> | |
<SystemIdentifier id="w2"/> | |
<FrameType><Vinyl></Vinyl></FrameType> | |
<GlassLayers>triple-pane</GlassLayers> | |
</Window> | |
</Windows> | |
</Enclosure> | |
<Systems> | |
<HVAC> | |
<HVACPlant> | |
<HeatingSystem> | |
<SystemIdentifier id="h2"/> | |
<HeatingSystemType> | |
<Furnace> | |
<SealedCombustion>1</SealedCombustion> | |
</Furnace> | |
</HeatingSystemType> | |
<AnnualHeatingEfficiency> | |
<Units>AFUE</Units> | |
<Value>90.0</Value> | |
</AnnualHeatingEfficiency> | |
</HeatingSystem> | |
<CoolingSystem> | |
<SystemIdentifier id="c2"/> | |
<CoolingSystemType>central air conditioning</CoolingSystemType> | |
<AnnualCoolingEfficiency> | |
<Units>SEER</Units> | |
<Value>17.0</Value> | |
</AnnualCoolingEfficiency> | |
</CoolingSystem> | |
</HVACPlant> | |
</HVAC> | |
</Systems> | |
</BuildingDetails> | |
</Building> | |
</HPXML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment