diff --git a/BuildResidentialHPXML/measure.rb b/BuildResidentialHPXML/measure.rb index 761759bedc..e056f117a5 100644 --- a/BuildResidentialHPXML/measure.rb +++ b/BuildResidentialHPXML/measure.rb @@ -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], diff --git a/BuildResidentialHPXML/measure.xml b/BuildResidentialHPXML/measure.xml index 458ce9eef5..59ddd79d15 100644 --- a/BuildResidentialHPXML/measure.xml +++ b/BuildResidentialHPXML/measure.xml @@ -3,8 +3,8 @@ 3.1 build_residential_hpxml a13a8983-2b01-4930-8af2-42030b6e4233 - 8c76d707-3a76-4e27-a6d6-d550938a8e4a - 2024-10-17T23:34:54Z + 53f9747b-540d-420d-94ff-3769990ffe49 + 2024-10-23T23:37:57Z 2C38F48B BuildResidentialHPXML HPXML Builder @@ -7671,7 +7671,7 @@ measure.rb rb script - 120CB23B + 36F871FD constants.rb diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 839d0c5ac9..f3406f3360 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 5f76eb19-bda7-4881-9455-1ae69e3fac7b - 2024-10-21T17:04:36Z + 4f9b5196-8d8e-4c6d-a5d7-130124191ce4 + 2024-10-23T23:38:02Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -327,7 +327,7 @@ defaults.rb rb resource - 87964053 + F2FA03D1 energyplus.rb @@ -357,7 +357,7 @@ hpxml.rb rb resource - EDFD942E + 6EEFB907 hpxml_schema/HPXML.xsd @@ -627,7 +627,7 @@ vehicle.rb rb resource - 08832679 + 4F3F7F2C version.rb @@ -765,7 +765,7 @@ test_vehicle.rb rb test - 648B6BE9 + 1B995BBB test_water_heater.rb diff --git a/HPXMLtoOpenStudio/resources/defaults.rb b/HPXMLtoOpenStudio/resources/defaults.rb index d93de53414..692faf254c 100644 --- a/HPXMLtoOpenStudio/resources/defaults.rb +++ b/HPXMLtoOpenStudio/resources/defaults.rb @@ -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) diff --git a/HPXMLtoOpenStudio/resources/hpxml.rb b/HPXMLtoOpenStudio/resources/hpxml.rb index 32f6146ce7..352c6f1109 100644 --- a/HPXMLtoOpenStudio/resources/hpxml.rb +++ b/HPXMLtoOpenStudio/resources/hpxml.rb @@ -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) @@ -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 diff --git a/HPXMLtoOpenStudio/resources/vehicle.rb b/HPXMLtoOpenStudio/resources/vehicle.rb index 567f33507e..e056a63557 100644 --- a/HPXMLtoOpenStudio/resources/vehicle.rb +++ b/HPXMLtoOpenStudio/resources/vehicle.rb @@ -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 diff --git a/HPXMLtoOpenStudio/tests/test_vehicle.rb b/HPXMLtoOpenStudio/tests/test_vehicle.rb index 642081af88..a06f49501c 100644 --- a/HPXMLtoOpenStudio/tests/test_vehicle.rb +++ b/HPXMLtoOpenStudio/tests/test_vehicle.rb @@ -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 diff --git a/ReportSimulationOutput/measure.rb b/ReportSimulationOutput/measure.rb index e5ccb7d83f..4f52ef5eb3 100644 --- a/ReportSimulationOutput/measure.rb +++ b/ReportSimulationOutput/measure.rb @@ -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 @@ -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'] } @@ -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 diff --git a/ReportSimulationOutput/measure.xml b/ReportSimulationOutput/measure.xml index 34fd8d2ef8..d0934950aa 100644 --- a/ReportSimulationOutput/measure.xml +++ b/ReportSimulationOutput/measure.xml @@ -3,8 +3,8 @@ 3.1 report_simulation_output df9d170c-c21a-4130-866d-0d46b06073fd - f41d6d5f-673e-4686-9270-edee5eca7903 - 2024-10-21T17:04:38Z + 0c568585-4b24-41f7-816a-5644dfdb6bbf + 2024-10-23T23:38:06Z 9BF1E6AC ReportSimulationOutput HPXML Simulation Output Report @@ -1974,13 +1974,13 @@ measure.rb rb script - 916B5825 + 3EA81AB5 test_report_sim_output.rb rb test - 9278BCB1 + DC3B7CFB diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb index 4101f2f0d9..9c4243cf6b 100644 --- a/workflow/tests/util.rb +++ b/workflow/tests/util.rb @@ -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.' @@ -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.'