-
Notifications
You must be signed in to change notification settings - Fork 17
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
base: master
Are you sure you want to change the base?
Model EV Batteries #1533
Changes from 106 commits
7b651b0
36492fb
08c8c5a
3f94374
744ad66
4f1a37e
210c463
5c36fcb
01437d0
8f33e3d
52bc3ab
9db3aeb
da8dc17
357ba18
374aae8
2a9b7bb
dd4d5cf
61d39b6
22f00b2
0056e2c
f6b88a3
1effbc8
6fbd4f5
bd3fbfe
35e8be4
cefa4e2
e279ea4
b86a506
3228c7a
5d21e32
b1ef026
a413534
2432bfb
9c31908
0c8861c
891f609
3291f9c
2bfc0f7
b2d226a
d0a554f
ea3d06f
7d04943
a5a3fc7
d591cad
52d07dd
aaecf51
14f026e
ed8cc5b
357509e
1e89f06
50a8c47
8cc6c93
1198abd
9c373df
cbc7fa1
59d5594
385c67b
486f01f
32e567b
28e1849
d17000e
18bf8fc
14718f5
e032b3e
962797a
5d21764
d7e8f28
5101e71
7452d70
67401df
532abc2
ff17916
caf8114
8b29eab
d0bbdd4
5d3eeae
1c20229
81fa928
e461f26
dae014e
0c5982f
e0b8da9
4cdcad3
859d4f5
22344b0
71cdc88
d16f0d1
8c2772e
f0976f0
c27fde0
23edb30
2c84e01
b8c6ab5
83d9148
922cdea
9af936f
4776c31
2292c06
d44ac99
e444f74
5e5e107
792f79e
35104b2
4892769
0ff6acb
d9ffc48
d8605a9
c6db1ac
39492f3
0bff0a9
5ed1495
5070b3d
f49ce9a
307dad0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2676,6 +2676,68 @@ 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. If the `misc_plug_loads_vehicle_present` argument is true, this argument is superseded and vehicle charging will be modeled as a plug load only.') | ||
arg.setDefaultValue(false) | ||
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 | ||
Comment on lines
+2709
to
+2713
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not currently used, but will be needed in schedule generation PR |
||
|
||
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 | ||
Comment on lines
+2715
to
+2718
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this argument belongs here. It will be used in ResStockArguments to scale the miles/year, which influences the schedule. I liked that it persists into the HPXML to give context to the miles/year, but the fraction is not used directly in OS-HPXML. |
||
|
||
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.") | ||
|
@@ -3210,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. Specifying this argument will model EV charging as a plug load and take precendence over the `ev_battery_present` argument.') | ||
arg.setDefaultValue(false) | ||
args << arg | ||
|
||
|
@@ -3941,6 +4003,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) | ||
|
@@ -6877,6 +6940,47 @@ 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.vehicle_type == HPXML::VehicleTypeBEV } | ||
hpxml_bldg.vehicles.add(id: "ElectricVehicle#{ev_ct + 1}", | ||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to calculate the effective discharge power in vehicles.rb (power = kwh/mile * annl_miles / driving hours)