Skip to content

Commit

Permalink
Squashed 'resources/hpxml-measures/' changes from c2cec15fe48..1e89f0…
Browse files Browse the repository at this point in the history
…60006

1e89f060006 Latest results.
357509ed95c fixes for timeseries tests of EVs
ed8cc5b1c92 Merge remote-tracking branch 'origin/master' into ev_batteries
14f026ec7b2 address unit test failures for EV batteries
aaecf51607c update in-line documentation for vehicles and batteries
52d07ddf3fa Fix unit tests for EV batteries
d591cad7673 Merge remote-tracking branch 'origin/master' into ev_batteries
a5a3fc7fa95 Fix merge conflict
7d04943785b Pull in latest HPXML schema for EVs
ea3d06f2f61 Merge remote-tracking branch 'origin/master' into ev_batteries
d0a554f749d Apply rubocop
b2d226a606e Fix bug iniitalizing DBT sensor
2bfc0f7b238 Fix for EV discharge offset object when EV location is garage
3291f9c659a Write EV fraction charged at home to HPXML
891f6095af3 Introduce miles/yr and hours/wk arguments for EVs, calculate the effective discharge power
0c8861cf6e2 Pull in latest Vehicles changes in HPXML schema, update HPXML classes as needed; expose fuel economy and vehicle miles traveled args
9c31908f129 Merge remote-tracking branch 'origin/master' into ev_batteries
2432bfb168d EMS program to adjust effective EV discharge power and offset that discharge power for reporting
a4135347c87 Update reporting measure to output EV energy
b1ef026fc63 Generate an ELCD object for each EV battery
5d21e323428 Update EV arguments for latest approach to argument handling
3228c7ae14c Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPXML into ev_batteries
b86a506dbef Merge remote-tracking branch 'origin/master' into ev_batteries
e279ea4426b Latest results.
cefa4e28739 Merge remote-tracking branch 'origin/master' into ev_batteries
35e8be48fd7 fix failing tests for ev batteries
bd3fbfe6f4e Merge remote-tracking branch 'origin/master' into ev_batteries
6fbd4f57cc1 update unit tests for EVs and chargers; apply rubocop
1effbc82974 Merge remote-tracking branch 'origin/master' into ev_batteries
f6b88a304f9 Refine inputs for EV battery and charger, update tests
0056e2c66d9 Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPXML into ev_batteries
22f00b2e2fe Merge remote-tracking branch 'origin/master' into ev_batteries
61d39b67361 Seperate EVs from batteries and leverage existing EV charger fields
dd4d5cfffa7 Merge remote-tracking branch 'origin/master' into ev_batteries
2a9b7bb6708 Latest results.
374aae8500f fix test for battery log message
357ba18deca Merge remote-tracking branch 'origin/master' into ev_batteries
da8dc17703f update log message tests for batteries
9db3aebb317 add missing ev battery schedule for tests
52bc3ab47b4 Merge remote-tracking branch 'origin/master' into ev_batteries
8f33e3d0556 initial tests for ev batteries
01437d08f71 always require schedule when modeling ev batteries
5c36fcb1483 Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML into ev_batteries
210c463549c make ev_battery_preset argument optional
4f1a37e0f81 update how battery ids are assigned in xml
744ad6638cf stub out defaults for EV batteries
3f943741530 allow one EV and one non-EV battery in schema
08c8c5a2b69 fix ev battery schedule generation, generalize for ev and non-ev battery schedules
36492fbf179 custom schedule columns for EV batteries
7b651b01367 new arguments and method to write EV battery to xml

git-subtree-dir: resources/hpxml-measures
git-subtree-split: 1e89f0600061f49f1f4e0be26942858e5d90a7c5
  • Loading branch information
aspeake committed Sep 6, 2024
1 parent c36b76c commit f588c82
Show file tree
Hide file tree
Showing 38 changed files with 15,730 additions and 582 deletions.
137 changes: 137 additions & 0 deletions BuildResidentialHPXML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4432,6 +4432,143 @@ The round trip efficiency of the lithium ion battery. If not provided, the OS-HP

<br/>

**Electric Vehicle: Present**

Whether there is an electric vehicle battery present.

- **Name:** ``ev_present``
- **Type:** ``Boolean``

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

<br/>

**Electric Vehicle: Rated Battery Power Output**

The rated power output of the EV battery. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_battery_discharge_power``
- **Type:** ``Double``

- **Units:** ``W``

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

<br/>

**Electric Vehicle: Nominal Battery Capacity**

The nominal capacity of the EV battery. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_battery_capacity``
- **Type:** ``Double``

- **Units:** ``kWh``

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

<br/>

**Electric Vehicle: Usable Battery Capacity**

The usable capacity of the EV battery. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_battery_usable_capacity``
- **Type:** ``Double``

- **Units:** ``kWh``

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

<br/>

**Electric Vehicle: Energy Efficiency**

The efficiency of the EV. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_energy_efficiency``
- **Type:** ``Double``

- **Units:** ``kWh/mile``

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

<br/>

**Electric Vehicle: Miles Traveled**

The annual miles traveled by the EV.

- **Name:** ``ev_miles_per_year``
- **Type:** ``Double``

- **Units:** ``miles``

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

<br/>

**Electric Vehicle: Hours Driven per Week**

The weekly hours traveled by the EV.

- **Name:** ``ev_hours_per_week``
- **Type:** ``Double``

- **Units:** ``hours``

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

<br/>

**Electric Vehicle: Fraction Charged at Home**

The fraction charging energy provided by the at-home charger.

- **Name:** ``ev_fraction_charged_home``
- **Type:** ``Double``

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

<br/>

**Electric Vehicle Charger: Present**

Whether there is an electric vehicle charger present.

- **Name:** ``ev_charger_present``
- **Type:** ``Boolean``

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

<br/>

**Electric Vehicle Charger: Rated Charger Power Output**

The rated power output of the EV charger. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_charger_power``
- **Type:** ``Double``

- **Units:** ``W``

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

<br/>

**Electric Vehicle Charger: Location**

The space type for the EV charger. If not provided, the OS-HPXML default is used.

- **Name:** ``ev_charger_location``
- **Type:** ``Choice``

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

- **Choices:** `garage`, `outside`

<br/>

**Battery: Number of Bedrooms Served**

Number of bedrooms served by the lithium ion battery. Only needed if single-family attached or apartment unit and it is a shared battery serving multiple dwelling units. Used to apportion battery charging/discharging to the unit of a SFA/MF building.
Expand Down
112 changes: 112 additions & 0 deletions BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2624,6 +2624,74 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setUnits('Frac')
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('ev_present', false)
arg.setDisplayName('Electric Vehicle: Present')
arg.setDescription('Whether there is an electric vehicle battery present.')
arg.setDefaultValue(false)
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_battery_discharge_power', false)
arg.setDisplayName('Electric Vehicle: Rated Battery Power Output')
arg.setDescription('The rated power output of the EV battery. If not provided, the OS-HPXML default is used.')
arg.setUnits('W')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_battery_capacity', false)
arg.setDisplayName('Electric Vehicle: Nominal Battery Capacity')
arg.setDescription('The nominal capacity of the EV battery. If not provided, the OS-HPXML default is used.')
arg.setUnits('kWh')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_battery_usable_capacity', false)
arg.setDisplayName('Electric Vehicle: Usable Battery Capacity')
arg.setDescription('The usable capacity of the EV battery. If not provided, the OS-HPXML default is used.')
arg.setUnits('kWh')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_energy_efficiency', false)
arg.setDisplayName('Electric Vehicle: Energy Efficiency')
arg.setDescription('The efficiency of the EV. If not provided, the OS-HPXML default is used.')
arg.setUnits('kWh/mile')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_miles_per_year', false)
arg.setDisplayName('Electric Vehicle: Miles Traveled')
arg.setDescription('The annual miles traveled by the EV.')
arg.setUnits('miles')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_hours_per_week', false)
arg.setDisplayName('Electric Vehicle: Hours Driven per Week')
arg.setDescription('The weekly hours traveled by the EV.')
arg.setUnits('hours')
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_fraction_charged_home', false)
arg.setDisplayName('Electric Vehicle: Fraction Charged at Home')
arg.setDescription('The fraction charging energy provided by the at-home charger.')
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('ev_charger_present', false)
arg.setDisplayName('Electric Vehicle Charger: Present')
arg.setDescription('Whether there is an electric vehicle charger present.')
arg.setDefaultValue(false)
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_charger_power', false)
arg.setDisplayName('Electric Vehicle Charger: Rated Charger Power Output')
arg.setDescription('The rated power output of the EV charger. If not provided, the OS-HPXML default is used.')
arg.setUnits('W')
args << arg

ev_charger_location_choices = OpenStudio::StringVector.new
ev_charger_location_choices << HPXML::LocationGarage
ev_charger_location_choices << HPXML::LocationOutside

arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('ev_charger_location', ev_charger_location_choices, false)
arg.setDisplayName('Electric Vehicle Charger: Location')
arg.setDescription('The space type for the EV charger. If not provided, the OS-HPXML default is used.')
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. Only needed if #{HPXML::ResidentialTypeSFA} or #{HPXML::ResidentialTypeApartment} and it is a shared battery serving multiple dwelling units. Used to apportion battery charging/discharging to the unit of a SFA/MF building.")
Expand Down Expand Up @@ -3868,6 +3936,7 @@ def self.create(runner, model, args, epw_path, hpxml_path, existing_hpxml_path)
set_solar_thermal(hpxml_bldg, args, weather)
set_pv_systems(hpxml_bldg, args, weather)
set_battery(hpxml_bldg, args)
set_electric_vehicle(hpxml_bldg, args)
set_lighting(hpxml_bldg, args)
set_dehumidifier(hpxml_bldg, args)
set_clothes_washer(hpxml_bldg, args)
Expand Down Expand Up @@ -6763,6 +6832,49 @@ def self.set_battery(hpxml_bldg, args)
number_of_bedrooms_served: number_of_bedrooms_served)
end

# Set the electric vehicle properties, including:
# - rated power output
# - nominal and usable capacity
# - driving efficiency
# - miles driven per year
# - hours driven per week
# - fraction charged at home
# - EV charger connection
#
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_electric_vehicle(hpxml_bldg, args)
if args[:ev_present] != true
return
end

charger_id = nil
if args[:ev_charger_present]
if args[:ev_charger_location].nil?
args[:ev_charger_location] = 'outside'
end
location = get_location(args[:ev_charger_location], hpxml_bldg.foundations[-1].foundation_type, hpxml_bldg.attics[-1].attic_type)

charger_id = "EVCharger#{hpxml_bldg.ev_chargers.size + 1}"
hpxml_bldg.ev_chargers.add(id: charger_id,
location: location,
charging_power: args[:ev_charger_power])
end

ev_ct = hpxml_bldg.vehicles.count { |vehicle| vehicle.id.include?('ElectricVehicle') }
hpxml_bldg.vehicles.add(id: "ElectricVehicle#{ev_ct + 1}",
type: HPXML::BatteryTypeLithiumIon,
rated_power_output: args[:ev_battery_discharge_power],
nominal_capacity_kwh: args[:ev_battery_capacity],
usable_capacity_kwh: args[:ev_battery_usable_capacity],
energy_efficiency: args[:ev_energy_efficiency],
miles_per_year: args[:ev_miles_per_year],
hours_per_week: args[:ev_hours_per_week],
fraction_charged_home: args[:ev_fraction_charged_home],
ev_charger_idref: charger_id)
end

# Set the lighting properties, including:
# - interior/exterior/garage fraction of lamps that are LFL/CFL/LED
# - interior/exterior/garage usage multipliers
Expand Down
Loading

0 comments on commit f588c82

Please sign in to comment.