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

Model EV Batteries #1533

Draft
wants to merge 82 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7b651b0
new arguments and method to write EV battery to xml
aspeake Oct 27, 2023
36492fb
custom schedule columns for EV batteries
aspeake Oct 27, 2023
08c8c5a
fix ev battery schedule generation, generalize for ev and non-ev batt…
aspeake Oct 30, 2023
3f94374
allow one EV and one non-EV battery in schema
aspeake Oct 30, 2023
744ad66
stub out defaults for EV batteries
aspeake Oct 30, 2023
4f1a37e
update how battery ids are assigned in xml
aspeake Oct 30, 2023
210c463
make ev_battery_preset argument optional
aspeake Oct 31, 2023
5c36fcb
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Nov 2, 2023
01437d0
always require schedule when modeling ev batteries
aspeake Nov 9, 2023
8f33e3d
initial tests for ev batteries
aspeake Nov 9, 2023
52bc3ab
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Nov 9, 2023
9db3aeb
add missing ev battery schedule for tests
aspeake Nov 9, 2023
da8dc17
update log message tests for batteries
aspeake Nov 16, 2023
357ba18
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Nov 16, 2023
374aae8
fix test for battery log message
aspeake Nov 16, 2023
2a9b7bb
Latest results.
Nov 16, 2023
dd4d5cf
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Jan 11, 2024
61d39b6
Seperate EVs from batteries and leverage existing EV charger fields
aspeake Jan 23, 2024
22f00b2
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Jan 23, 2024
0056e2c
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPX…
aspeake Jan 23, 2024
f6b88a3
Refine inputs for EV battery and charger, update tests
aspeake Feb 5, 2024
1effbc8
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Feb 5, 2024
6fbd4f5
update unit tests for EVs and chargers; apply rubocop
aspeake Feb 28, 2024
bd3fbfe
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Feb 28, 2024
35e8be4
fix failing tests for ev batteries
aspeake Feb 29, 2024
cefa4e2
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Feb 29, 2024
e279ea4
Latest results.
Feb 29, 2024
b86a506
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Jun 6, 2024
3228c7a
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPX…
aspeake Jun 6, 2024
5d21e32
Update EV arguments for latest approach to argument handling
aspeake Jun 7, 2024
b1ef026
Generate an ELCD object for each EV battery
aspeake Jun 7, 2024
a413534
Update reporting measure to output EV energy
aspeake Jun 7, 2024
2432bfb
EMS program to adjust effective EV discharge power and offset that di…
aspeake Jun 7, 2024
9c31908
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Jun 25, 2024
0c8861c
Pull in latest Vehicles changes in HPXML schema, update HPXML classes…
aspeake Jun 25, 2024
891f609
Introduce miles/yr and hours/wk arguments for EVs, calculate the effe…
aspeake Jun 28, 2024
3291f9c
Write EV fraction charged at home to HPXML
aspeake Jun 28, 2024
2bfc0f7
Fix for EV discharge offset object when EV location is garage
aspeake Jul 1, 2024
b2d226a
Fix bug iniitalizing DBT sensor
aspeake Jul 12, 2024
d0a554f
Apply rubocop
aspeake Jul 12, 2024
ea3d06f
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Aug 13, 2024
7d04943
Pull in latest HPXML schema for EVs
aspeake Aug 13, 2024
a5a3fc7
Fix merge conflict
aspeake Aug 29, 2024
d591cad
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Aug 29, 2024
52d07dd
Fix unit tests for EV batteries
aspeake Aug 30, 2024
aaecf51
update in-line documentation for vehicles and batteries
aspeake Aug 30, 2024
14f026e
address unit test failures for EV batteries
aspeake Aug 30, 2024
ed8cc5b
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Aug 30, 2024
357509e
fixes for timeseries tests of EVs
aspeake Aug 30, 2024
1e89f06
Latest results.
Aug 31, 2024
50a8c47
prevent EVs modeled with a plug load and a battery at the same time
aspeake Sep 16, 2024
8cc6c93
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPX…
aspeake Sep 16, 2024
1198abd
pull in latest HPXML schema
aspeake Sep 16, 2024
9c373df
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Oct 15, 2024
cbc7fa1
Bugfix.
shorowit Oct 15, 2024
59d5594
discard EMS for offsetting EV discharge energy and handle it directly…
aspeake Oct 17, 2024
385c67b
new reporting measure class to output vehicle-specific variables that…
aspeake Oct 17, 2024
486f01f
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Oct 17, 2024
32e567b
apply RuboCop
aspeake Oct 17, 2024
28e1849
fix bug for vehicles in the reporting measures
aspeake Oct 18, 2024
d17000e
Include reporting measure arguments to trigger vehicle outputs
aspeake Oct 21, 2024
18bf8fc
Latest results.
Oct 21, 2024
14718f5
refrain from using object id to check if a battery is for a vehicle
aspeake Oct 23, 2024
e032b3e
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPX…
aspeake Oct 23, 2024
962797a
simplify access to vehicle objects when applying to model; some cleanup
aspeake Oct 25, 2024
5d21764
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Oct 25, 2024
d7e8f28
Merge branch 'master' into ev_batteries
rajeee Oct 30, 2024
5101e71
Default schedules for EV batteries and EV plug loads
aspeake Nov 5, 2024
7452d70
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPX…
aspeake Nov 5, 2024
67401df
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Nov 5, 2024
532abc2
Pull in latest HPXML schema changes to vehicles
aspeake Nov 8, 2024
ff17916
Account for vehicles specified as EV batteries and as plug loads
aspeake Nov 8, 2024
caf8114
Merge remote-tracking branch 'origin/master' into ev_batteries
aspeake Nov 21, 2024
8b29eab
New EMS variable to track unmet driving hours, report with Vehicle Ty…
aspeake Nov 26, 2024
d0bbdd4
Add check to avoid always trying to report unmet driving hours
aspeake Nov 26, 2024
5d3eeae
Always load EV discharge energy variable to adjust electricity meter.
aspeake Nov 27, 2024
1c20229
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Dec 10, 2024
81fa928
Accommodate new output.
shorowit Dec 10, 2024
e461f26
Fixed CI failures?
shorowit Dec 11, 2024
dae014e
A little cleanup.
shorowit Dec 11, 2024
0c5982f
Fixed CI failure? And some code cleanup.
shorowit Dec 11, 2024
e0b8da9
Latest results.
Dec 11, 2024
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
139 changes: 138 additions & 1 deletion BuildResidentialHPXML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4484,6 +4484,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. Cannot be included if an electric vehicle is modeled as a plug load as specified by the `misc_plug_loads_vehicle_present` argument.

- **Name:** ``ev_battery_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 Expand Up @@ -5504,7 +5641,7 @@ Multiplier on the well pump energy usage that can reflect, e.g., high/low usage

**Misc Plug Loads: Vehicle Present**

Whether there is an electric vehicle.
Whether there is an electric vehicle. Cannot be included if an electric vehicle is modeled as a battery as specified by the `ev_battery_present` argument.

- **Name:** ``misc_plug_loads_vehicle_present``
- **Type:** ``Boolean``
Expand Down
117 changes: 116 additions & 1 deletion BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,74 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setUnits('Frac')
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('ev_battery_present', false)
arg.setDisplayName('Electric Vehicle: Present')
arg.setDescription('Whether there is an electric vehicle battery present. Cannot be included if an electric vehicle is modeled as a plug load as specified by the `misc_plug_loads_vehicle_present` argument.')
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 @@ -3204,7 +3272,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('misc_plug_loads_vehicle_present', true)
arg.setDisplayName('Misc Plug Loads: Vehicle Present')
arg.setDescription('Whether there is an electric vehicle.')
arg.setDescription('Whether there is an electric vehicle. Cannot be included if an electric vehicle is modeled as a battery as specified by the `ev_battery_present` argument.')
arg.setDefaultValue(false)
args << arg

Expand Down Expand Up @@ -3866,6 +3934,9 @@ def argument_errors(args)
error = (args[:window_aspect_ratio] <= 0)
errors << 'Window aspect ratio must be greater than zero.' if error

error = args[:misc_plug_loads_vehicle_present] && args[:ev_battery_present]
errors << 'Cannot specify an electric vehicle as a plug load and as a battery.' if error

return errors
end
end
Expand Down Expand Up @@ -3935,6 +4006,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 @@ -6833,6 +6905,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_battery_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,
aspeake marked this conversation as resolved.
Show resolved Hide resolved
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
Loading