Skip to content

Commit

Permalink
Merge commit 'e839ec349fa9f6d575be3ee181996fe790470177' into ansi_301…
Browse files Browse the repository at this point in the history
…_2022

# Conflicts:
#	hpxml-measures/HPXMLtoOpenStudio/measure.xml
#	hpxml-measures/workflow/tests/base_results/results_workflow_simulations1.csv
#	hpxml-measures/workflow/tests/base_results/results_workflow_simulations1_bills.csv
  • Loading branch information
shorowit committed Jan 19, 2024
2 parents 8c8ff87 + e839ec3 commit 5169bc8
Show file tree
Hide file tree
Showing 19 changed files with 680 additions and 51 deletions.
13 changes: 13 additions & 0 deletions hpxml-measures/BuildResidentialHPXML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4075,6 +4075,19 @@ The round trip efficiency of the lithium ion battery. If not provided, the OS-HP

<br/>

**Battery: Number of Bedrooms Served**

Number of bedrooms served by the lithium ion battery. Required if single-family attached or apartment unit. Used to apportion battery charging/discharging to the unit of a SFA/MF building.

- **Name:** ``battery_num_bedrooms_served``
- **Type:** ``Integer``

- **Units:** ``#``

- **Required:** ``false``

<br/>

**Lighting: Present**

Whether there is lighting energy use.
Expand Down
17 changes: 16 additions & 1 deletion hpxml-measures/BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,12 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setUnits('Frac')
args << arg

arg = OpenStudio::Measure::OSArgument::makeIntegerArgument('battery_num_bedrooms_served', false)
arg.setDisplayName('Battery: Number of Bedrooms Served')
arg.setDescription("Number of bedrooms served by the lithium ion battery. Required if #{HPXML::ResidentialTypeSFA} or #{HPXML::ResidentialTypeApartment}. Used to apportion battery charging/discharging to the unit of a SFA/MF building.")
arg.setUnits('#')
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('lighting_present', true)
arg.setDisplayName('Lighting: Present')
arg.setDescription('Whether there is lighting energy use.')
Expand Down Expand Up @@ -6390,13 +6396,22 @@ def self.set_battery(hpxml_bldg, args)
round_trip_efficiency = args[:battery_round_trip_efficiency].get
end

if [HPXML::ResidentialTypeSFA, HPXML::ResidentialTypeApartment].include? args[:geometry_unit_type]
if args[:battery_num_bedrooms_served].get > args[:geometry_unit_num_bedrooms]
is_shared_system = true
number_of_bedrooms_served = args[:battery_num_bedrooms_served].get
end
end

hpxml_bldg.batteries.add(id: "Battery#{hpxml_bldg.batteries.size + 1}",
type: HPXML::BatteryTypeLithiumIon,
location: location,
rated_power_output: rated_power_output,
nominal_capacity_kwh: nominal_capacity_kwh,
usable_capacity_kwh: usable_capacity_kwh,
round_trip_efficiency: round_trip_efficiency)
round_trip_efficiency: round_trip_efficiency,
is_shared_system: is_shared_system,
number_of_bedrooms_served: number_of_bedrooms_served)
end

def self.set_lighting(hpxml_bldg, args)
Expand Down
17 changes: 13 additions & 4 deletions hpxml-measures/BuildResidentialHPXML/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>build_residential_hpxml</name>
<uid>a13a8983-2b01-4930-8af2-42030b6e4233</uid>
<version_id>54215a14-93ab-4f56-b310-4fdb6cc374e9</version_id>
<version_modified>2024-01-17T16:52:35Z</version_modified>
<version_id>14e4a09f-8529-4fb6-9740-1867d68359f5</version_id>
<version_modified>2024-01-19T02:09:32Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -5111,6 +5111,15 @@
<required>false</required>
<model_dependent>false</model_dependent>
</argument>
<argument>
<name>battery_num_bedrooms_served</name>
<display_name>Battery: Number of Bedrooms Served</display_name>
<description>Number of bedrooms served by the lithium ion battery. Required if single-family attached or apartment unit. Used to apportion battery charging/discharging to the unit of a SFA/MF building.</description>
<type>Integer</type>
<units>#</units>
<required>false</required>
<model_dependent>false</model_dependent>
</argument>
<argument>
<name>lighting_present</name>
<display_name>Lighting: Present</display_name>
Expand Down Expand Up @@ -7110,7 +7119,7 @@
<filename>README.md</filename>
<filetype>md</filetype>
<usage_type>readme</usage_type>
<checksum>3BA4B197</checksum>
<checksum>D620D278</checksum>
</file>
<file>
<filename>README.md.erb</filename>
Expand All @@ -7127,7 +7136,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>EEE134EA</checksum>
<checksum>FCA4D8A0</checksum>
</file>
<file>
<filename>geometry.rb</filename>
Expand Down
1 change: 1 addition & 0 deletions hpxml-measures/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __New Features__
- Allows optional ground diffusivity input.
- Updates to using G-Functions from the [G-Function Library for Modeling Vertical Bore Ground Heat Exchanger](https://gdr.openei.org/submissions/1325).
- Updated heating/cooling performance curves to reflect newer equipment.
- Allows shared batteries (batteries serving multiple dwelling units).
- BuildResidentialHPXML measure:
- **Breaking change**: Replaces `roof_radiant_barrier`/`roof_radiant_barrier_grade` arguments with `radiant_barrier_attic_location`/`radiant_barrier_grade`.
- Adds detailed performance data inputs for variable-speed air source HVAC systems.
Expand Down
2 changes: 1 addition & 1 deletion hpxml-measures/HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@ def add_batteries(runner, model, spaces)
@hpxml_bldg.batteries.each do |battery|
# Assign space
battery.additional_properties.space = get_space_from_location(battery.location, spaces)
Battery.apply(runner, model, @hpxml_bldg.pv_systems, battery, @schedules_file, @hpxml_bldg.building_construction.number_of_units)
Battery.apply(runner, model, @nbeds, @hpxml_bldg.pv_systems, battery, @schedules_file, @hpxml_bldg.building_construction.number_of_units)
end
end

Expand Down
20 changes: 10 additions & 10 deletions hpxml-measures/HPXMLtoOpenStudio/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>hpxm_lto_openstudio</name>
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
<version_id>c5a79091-3893-4ec7-8f76-b3bb56f97723</version_id>
<version_modified>2024-01-17T23:38:34Z</version_modified>
<version_id>94cfaa83-f3d9-4156-b7d8-9aeaa2c3d858</version_id>
<version_modified>2024-01-19T02:09:35Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -142,7 +142,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>045BD8A9</checksum>
<checksum>E51BE929</checksum>
</file>
<file>
<filename>airflow.rb</filename>
Expand All @@ -154,7 +154,7 @@
<filename>battery.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>3B7B4DDF</checksum>
<checksum>464DA35E</checksum>
</file>
<file>
<filename>constants.rb</filename>
Expand Down Expand Up @@ -304,19 +304,19 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>44987E3C</checksum>
<checksum>1C3068E9</checksum>
</file>
<file>
<filename>hpxml_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>82EC6915</checksum>
<checksum>A1BF056D</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
<filetype>xsd</filetype>
<usage_type>resource</usage_type>
<checksum>BB0FF5BB</checksum>
<checksum>A3BC985E</checksum>
</file>
<file>
<filename>hpxml_schema/README.md</filename>
Expand All @@ -328,7 +328,7 @@
<filename>hpxml_schematron/EPvalidator.xml</filename>
<filetype>xml</filetype>
<usage_type>resource</usage_type>
<checksum>C4F99B75</checksum>
<checksum>0E897AE1</checksum>
</file>
<file>
<filename>hpxml_schematron/iso-schematron.xsd</filename>
Expand Down Expand Up @@ -370,7 +370,7 @@
<filename>meta_measure.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>17DD9336</checksum>
<checksum>3FCE13DD</checksum>
</file>
<file>
<filename>minitest_helper.rb</filename>
Expand Down Expand Up @@ -586,7 +586,7 @@
<filename>test_battery.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>B10A6D1C</checksum>
<checksum>06598B29</checksum>
</file>
<file>
<filename>test_defaults.rb</filename>
Expand Down
12 changes: 11 additions & 1 deletion hpxml-measures/HPXMLtoOpenStudio/resources/battery.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Battery
def self.apply(runner, model, pv_systems, battery, schedules_file, unit_multiplier)
def self.apply(runner, model, nbeds, pv_systems, battery, schedules_file, unit_multiplier)
charging_schedule = nil
discharging_schedule = nil
if not schedules_file.nil?
Expand Down Expand Up @@ -37,6 +37,15 @@ def self.apply(runner, model, pv_systems, battery, schedules_file, unit_multipli

return if rated_power_output <= 0 || nominal_capacity_kwh <= 0 || battery.nominal_voltage <= 0

if battery.is_shared_system
# Apportion to single dwelling unit by # bedrooms
fail if battery.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.xml should prevent this

nominal_capacity_kwh = nominal_capacity_kwh * nbeds.to_f / battery.number_of_bedrooms_served.to_f
usable_capacity_kwh = usable_capacity_kwh * nbeds.to_f / battery.number_of_bedrooms_served.to_f
rated_power_output = rated_power_output * nbeds.to_f / battery.number_of_bedrooms_served.to_f
end

nominal_capacity_kwh *= unit_multiplier
usable_capacity_kwh *= unit_multiplier
rated_power_output *= unit_multiplier
Expand Down Expand Up @@ -79,6 +88,7 @@ def self.apply(runner, model, pv_systems, battery, schedules_file, unit_multipli
elcs.setNumberofStringsinParallel(number_of_strings_in_parallel)
elcs.setInitialFractionalStateofCharge(0.0)
elcs.setBatteryMass(battery_mass)
elcs.setDCtoDCChargingEfficiency(battery.round_trip_efficiency) # Note: This is currently unused in E+, so we use an EMS program below instead
elcs.setBatterySurfaceArea(battery_surface_area)
elcs.setDefaultNominalCellVoltage(default_nominal_cell_voltage)
elcs.setFullyChargedCellCapacity(default_cell_capacity)
Expand Down
10 changes: 7 additions & 3 deletions hpxml-measures/HPXMLtoOpenStudio/resources/hpxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6180,9 +6180,9 @@ def from_doc(building)
end

class Battery < BaseElement
ATTRS = [:id, :type, :location, :lifetime_model, :rated_power_output,
:nominal_capacity_kwh, :nominal_capacity_ah, :nominal_voltage,
:round_trip_efficiency, :usable_capacity_kwh, :usable_capacity_ah]
ATTRS = [:id, :type, :location, :lifetime_model, :rated_power_output, :nominal_capacity_kwh, :nominal_capacity_ah,
:nominal_voltage, :round_trip_efficiency, :usable_capacity_kwh, :usable_capacity_ah, :is_shared_system,
:number_of_bedrooms_served]
attr_accessor(*ATTRS)

def delete
Expand All @@ -6201,6 +6201,7 @@ def to_doc(building)
battery = XMLHelper.add_element(batteries, 'Battery')
sys_id = XMLHelper.add_element(battery, 'SystemIdentifier')
XMLHelper.add_attribute(sys_id, 'id', @id)
XMLHelper.add_element(battery, 'IsSharedSystem', @is_shared_system, :boolean, @is_shared_system_isdefaulted) unless @is_shared_system.nil?
XMLHelper.add_element(battery, 'Location', @location, :string, @location_isdefaulted) unless @location.nil?
XMLHelper.add_element(battery, 'BatteryType', @type, :string) unless @type.nil?
if not @nominal_capacity_kwh.nil?
Expand All @@ -6227,12 +6228,14 @@ def to_doc(building)
XMLHelper.add_element(battery, 'NominalVoltage', @nominal_voltage, :float, @nominal_voltage_isdefaulted) unless @nominal_voltage.nil?
XMLHelper.add_element(battery, 'RoundTripEfficiency', @round_trip_efficiency, :float, @round_trip_efficiency_isdefaulted) unless @round_trip_efficiency.nil?
XMLHelper.add_extension(battery, 'LifetimeModel', @lifetime_model, :string, @lifetime_model_isdefaulted) unless @lifetime_model.nil?
XMLHelper.add_extension(battery, 'NumberofBedroomsServed', @number_of_bedrooms_served, :integer) unless @number_of_bedrooms_served.nil?
end

def from_doc(battery)
return if battery.nil?

@id = HPXML::get_id(battery)
@is_shared_system = XMLHelper.get_value(battery, 'IsSharedSystem', :boolean)
@location = XMLHelper.get_value(battery, 'Location', :string)
@type = XMLHelper.get_value(battery, 'BatteryType', :string)
@nominal_capacity_kwh = XMLHelper.get_value(battery, "NominalCapacity[Units='#{UnitsKwh}']/Value", :float)
Expand All @@ -6243,6 +6246,7 @@ def from_doc(battery)
@nominal_voltage = XMLHelper.get_value(battery, 'NominalVoltage', :float)
@round_trip_efficiency = XMLHelper.get_value(battery, 'RoundTripEFficiency', :float)
@lifetime_model = XMLHelper.get_value(battery, 'extension/LifetimeModel', :string)
@number_of_bedrooms_served = XMLHelper.get_value(battery, 'extension/NumberofBedroomsServed', :integer)
end
end

Expand Down
4 changes: 4 additions & 0 deletions hpxml-measures/HPXMLtoOpenStudio/resources/hpxml_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,10 @@ def self.apply_batteries(hpxml_bldg)
battery.location = default_values[:location]
battery.location_isdefaulted = true
end
if battery.is_shared_system.nil?
battery.is_shared_system = false
battery.is_shared_system_isdefaulted = true
end
# if battery.lifetime_model.nil?
# battery.lifetime_model = default_values[:lifetime_model]
# battery.lifetime_model_isdefaulted = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,12 @@
<xs:element minOccurs="0" name="ModelNumber" type="Model"/>
<xs:element minOccurs="0" name="SerialNumber" type="HPXMLString"/>
<xs:element minOccurs="0" ref="ConnectedDevice"/>
<xs:element minOccurs="0" name="IsSharedSystem" type="HPXMLBoolean">
<xs:annotation>
<xs:documentation>Does the system serve multiple building/dwelling units?</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="NumberofUnitsServed" type="HPXMLInteger"/>
<xs:element minOccurs="0" name="YearInstalled" type="Year"/>
<xs:element minOccurs="0" name="Count" type="IntegerGreaterThanZero">
<xs:annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,7 @@
<sch:pattern>
<sch:title>[Battery]</sch:title>
<sch:rule context='/h:HPXML/h:Building/h:BuildingDetails/h:Systems/h:Batteries/h:Battery'>
<sch:assert role='ERROR' test='count(h:IsSharedSystem) &lt;= 1'>Expected 0 or 1 element(s) for xpath: IsSharedSystem</sch:assert> <!-- See [BatteryType=Shared] -->
<sch:assert role='ERROR' test='count(h:BatteryType[text()="Li-ion"]) = 1'>Expected 1 element(s) for xpath: BatteryType[text()="Li-ion"]</sch:assert>
<sch:assert role='ERROR' test='count(h:Location) &lt;= 1'>Expected 0 or 1 element(s) for xpath: Location</sch:assert>
<sch:assert role='ERROR' test='h:Location[text()="conditioned space" or text()="basement - conditioned" or text()="basement - unconditioned" or text()="crawlspace - vented" or text()="crawlspace - unvented" or text()="crawlspace - conditioned" or text()="attic - vented" or text()="attic - unvented" or text()="garage" or text()="outside"] or not(h:Location)'>Expected Location to be 'conditioned space' or 'basement - conditioned' or 'basement - unconditioned' or 'crawlspace - vented' or 'crawlspace - unvented' or 'crawlspace - conditioned' or 'attic - vented' or 'attic - unvented' or 'garage' or 'outside'</sch:assert>
Expand All @@ -2125,6 +2126,15 @@
</sch:rule>
</sch:pattern>

<sch:pattern>
<sch:title>[BatteryType=Shared]</sch:title>
<sch:rule context='/h:HPXML/h:Building/h:BuildingDetails/h:Systems/h:Batteries/h:Battery[h:IsSharedSystem="true"]'>
<sch:assert role='ERROR' test='count(../../../h:BuildingSummary/h:BuildingConstruction[h:ResidentialFacilityType[text()="single-family attached" or text()="apartment unit"]]) = 1'>Expected 1 element(s) for xpath: ../../../BuildingSummary/BuildingConstruction[ResidentialFacilityType[text()="single-family attached" or text()="apartment unit"]]</sch:assert>
<sch:assert role='ERROR' test='count(h:extension/h:NumberofBedroomsServed) = 1'>Expected 1 element(s) for xpath: extension/NumberofBedroomsServed</sch:assert>
<sch:assert role='ERROR' test='number(h:extension/h:NumberofBedroomsServed) &gt; number(../../../h:BuildingSummary/h:BuildingConstruction/h:NumberofBedrooms) or not(h:extension/h:NumberofBedroomsServed) or not(../../../h:BuildingSummary/h:BuildingConstruction/h:NumberofBedrooms)'>Expected extension/NumberofBedroomsServed to be greater than ../../../BuildingSummary/BuildingConstruction/NumberofBedrooms</sch:assert>
</sch:rule>
</sch:pattern>

<sch:pattern>
<sch:title>[Generator]</sch:title>
<sch:rule context='/h:HPXML/h:Building/h:BuildingDetails/h:Systems/h:extension/h:Generators/h:Generator'>
Expand Down
Loading

0 comments on commit 5169bc8

Please sign in to comment.