Skip to content

Commit

Permalink
Merge branch 'ev_batteries' into ev_schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeee committed Oct 24, 2024
2 parents 8131ce2 + e032b3e commit 997fbee
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6944,7 +6944,7 @@ def self.set_electric_vehicle(hpxml_bldg, args)
charging_power: args[:ev_charger_power])
end

ev_ct = hpxml_bldg.vehicles.count { |vehicle| vehicle.id.include?('ElectricVehicle') }
ev_ct = hpxml_bldg.vehicles.count { |vehicle| vehicle.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle }
hpxml_bldg.vehicles.add(id: "ElectricVehicle#{ev_ct + 1}",
type: HPXML::BatteryTypeLithiumIon,
rated_power_output: args[:ev_battery_discharge_power],
Expand Down
6 changes: 3 additions & 3 deletions 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>8c76d707-3a76-4e27-a6d6-d550938a8e4a</version_id>
<version_modified>2024-10-17T23:34:54Z</version_modified>
<version_id>53f9747b-540d-420d-94ff-3769990ffe49</version_id>
<version_modified>2024-10-23T23:37:57Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -7671,7 +7671,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>120CB23B</checksum>
<checksum>36F871FD</checksum>
</file>
<file>
<filename>constants.rb</filename>
Expand Down
12 changes: 6 additions & 6 deletions 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>5f76eb19-bda7-4881-9455-1ae69e3fac7b</version_id>
<version_modified>2024-10-21T17:04:36Z</version_modified>
<version_id>4f9b5196-8d8e-4c6d-a5d7-130124191ce4</version_id>
<version_modified>2024-10-23T23:38:02Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -327,7 +327,7 @@
<filename>defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>87964053</checksum>
<checksum>F2FA03D1</checksum>
</file>
<file>
<filename>energyplus.rb</filename>
Expand Down Expand Up @@ -357,7 +357,7 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>EDFD942E</checksum>
<checksum>6EEFB907</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
Expand Down Expand Up @@ -627,7 +627,7 @@
<filename>vehicle.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>08832679</checksum>
<checksum>4F3F7F2C</checksum>
</file>
<file>
<filename>version.rb</filename>
Expand Down Expand Up @@ -765,7 +765,7 @@
<filename>test_vehicle.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>648B6BE9</checksum>
<checksum>1B995BBB</checksum>
</file>
<file>
<filename>test_water_heater.rb</filename>
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3168,7 +3168,7 @@ def self.apply_generators(hpxml_bldg)
def self.apply_vehicles(hpxml_bldg)
default_values = get_eletric_vehicle_values()
hpxml_bldg.vehicles.each do |vehicle|
next unless vehicle.id.include?('ElectricVehicle')
next unless vehicle.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle

apply_battery(vehicle, default_values)

Expand Down
4 changes: 2 additions & 2 deletions HPXMLtoOpenStudio/resources/hpxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9231,7 +9231,7 @@ class Vehicle < BaseElement
ATTRS = [:id, :type, :lifetime_model, :rated_power_output, :location,
:nominal_capacity_kwh, :nominal_capacity_ah, :nominal_voltage,
:round_trip_efficiency, :usable_capacity_kwh, :usable_capacity_ah,
:energy_efficiency, :miles_per_year, :hours_per_week,
:energy_efficiency, :vehicle_type, :miles_per_year, :hours_per_week,
:fraction_charged_home, :ev_charger_idref]
attr_accessor(*ATTRS)

Expand Down Expand Up @@ -9262,7 +9262,7 @@ def to_doc(building)
sys_id = XMLHelper.add_element(vehicle, 'SystemIdentifier')
XMLHelper.add_attribute(sys_id, 'id', @id)
ev_type = XMLHelper.add_element(vehicle, 'VehicleType')
electric_vehicle = XMLHelper.add_element(ev_type, 'BEV')
electric_vehicle = XMLHelper.add_element(ev_type, Constants::ObjectTypeBatteryElectricVehicle)
battery = XMLHelper.add_element(electric_vehicle, 'Battery')

# Battery
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Vehicle
# @return [nil]
def self.apply(runner, model, spaces, hpxml_bldg, schedules_file)
hpxml_bldg.vehicles.each do |vehicle|
next unless vehicle.id.include?('ElectricVehicle')
next unless vehicle.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle

apply_electric_vehicle(runner, model, spaces, hpxml_bldg, vehicle, schedules_file)
end
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/tests/test_vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_ev_battery_default
model, _hpxml, hpxml_bldg = _test_measure(args_hash)

hpxml_bldg.vehicles.each do |hpxml_ev|
next unless hpxml_ev.id.include? 'ElectricVehicle'
next unless hpxml_ev.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle

ev_battery = get_battery(model, hpxml_ev.id)
assert_nil(ev_battery) # no defaulted schedule means no EV is generated
Expand Down
6 changes: 2 additions & 4 deletions ReportSimulationOutput/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,6 @@ def get_outputs(runner, args)
batteries = []
@hpxml_bldgs.each do |hpxml_bldg|
hpxml_bldg.batteries.each do |battery|
next if battery.id.to_s.include? 'ElectricVehicle'

batteries << battery
end
end
Expand Down Expand Up @@ -3042,7 +3040,7 @@ def get_object_outputs_by_key(model, object, class_name)
[to_ft[fuel], EUT::Generator] => ["Generator #{fuel} HHV Basis Energy"] }

elsif object.to_ElectricLoadCenterStorageLiIonNMCBattery.is_initialized
if object.name.to_s.include? 'ElectricVehicle'
if object.additionalProperties.getFeatureAsBoolean('is_ev').get
return { [FT::Elec, EUT::Vehicle] => ['Electric Storage Production Decrement Energy'] }
else
return { [FT::Elec, EUT::Battery] => ['Electric Storage Production Decrement Energy', 'Electric Storage Discharge Energy'] }
Expand Down Expand Up @@ -3213,7 +3211,7 @@ def get_object_outputs_by_key(model, object, class_name)
# Vehicles

if object.to_ElectricLoadCenterStorageLiIonNMCBattery.is_initialized
if object.name.to_s.include? 'ElectricVehicle'
if object.additionalProperties.getFeatureAsBoolean('is_ev').get
return { VT::VehicleDischarging => ['Electric Storage Discharge Energy'] }
end
end
Expand Down
8 changes: 4 additions & 4 deletions ReportSimulationOutput/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>report_simulation_output</name>
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
<version_id>f41d6d5f-673e-4686-9270-edee5eca7903</version_id>
<version_modified>2024-10-21T17:04:38Z</version_modified>
<version_id>0c568585-4b24-41f7-816a-5644dfdb6bbf</version_id>
<version_modified>2024-10-23T23:38:06Z</version_modified>
<xml_checksum>9BF1E6AC</xml_checksum>
<class_name>ReportSimulationOutput</class_name>
<display_name>HPXML Simulation Output Report</display_name>
Expand Down Expand Up @@ -1974,13 +1974,13 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>916B5825</checksum>
<checksum>3EA81AB5</checksum>
</file>
<file>
<filename>test_report_sim_output.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>9278BCB1</checksum>
<checksum>DC3B7CFB</checksum>
</file>
</files>
</measure>
4 changes: 2 additions & 2 deletions workflow/tests/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier)
end
# Battery with no schedule
hpxml_bldg.vehicles.each do |vehicle|
next unless vehicle.id.include?('ElectricVehicle')
next unless vehicle.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle
next unless hpxml_bldg.header.schedules_filepaths.empty?
next unless not vehicle.ev_charger_idref.nil?
next if message.include? 'Electric vehicle battery specified with no charging/discharging schedule provided; battery will not be modeled.'
Expand All @@ -245,7 +245,7 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier)
end
# Battery with no charger
hpxml_bldg.vehicles.each do |vehicle|
next unless vehicle.id.include?('ElectricVehicle')
next unless vehicle.vehicle_type == Constants::ObjectTypeBatteryElectricVehicle
next unless vehicle.ev_charger_idref.nil?
next if message.include? 'Electric vehicle specified with no charger provided; battery will not be modeled.'

Expand Down

0 comments on commit 997fbee

Please sign in to comment.