Skip to content

Commit

Permalink
fix bug for vehicles in the reporting measures
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeake committed Oct 18, 2024
1 parent 32e567b commit 7c3a84a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ReportSimulationOutput/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ def get_outputs(runner, args)
# Remove EV battery discharging
@model.getElectricLoadCenterStorageLiIonNMCBatterys.each do |elcs|
next unless elcs.additionalProperties.getFeatureAsString('is_ev')

fuel.annual_output += get_report_variable_data_annual([elcs.name.to_s.upcase], ['Electric Storage Discharge Energy']) if fuel_type == FT::Elec
end

Expand All @@ -778,6 +777,13 @@ def get_outputs(runner, args)
# We add Electric Storage onto the timeseries Electricity fuel meter
elec_storage_timeseries_output = get_report_meter_data_timeseries(['ElectricStorage:ElectricityProduced'], UnitConversions.convert(1.0, 'J', fuel.timeseries_units), 0, args[:timeseries_frequency])
fuel.timeseries_output = fuel.timeseries_output.zip(elec_storage_timeseries_output).map { |x, y| x - y }

# Remove timeseries EV battery discharging
@model.getElectricLoadCenterStorageLiIonNMCBatterys.each do |elcs|
next unless elcs.additionalProperties.getFeatureAsString('is_ev')
ev_discharge_timeseries_output = get_report_variable_data_timeseries([elcs.name.to_s.upcase], ['Electric Storage Discharge Energy'], UnitConversions.convert(1.0, 'J', fuel.timeseries_units), 0, args[:timeseries_frequency])
fuel.timeseries_output = fuel.timeseries_output.zip(ev_discharge_timeseries_output).map { |x, y| x + y }
end
end

# Peak Electricity Consumption
Expand Down Expand Up @@ -1480,7 +1486,8 @@ def check_for_errors(runner, outputs)
@fuels => 'Fuel',
@emissions => 'Emissions',
@loads => 'Load',
@component_loads => 'Component Load' }.each do |outputs, output_type|
@component_loads => 'Component Load',
@vehicles => 'Vehicles' }.each do |outputs, output_type|
outputs.each do |key, obj|
next if obj.timeseries_output.empty?

Expand Down Expand Up @@ -2816,7 +2823,7 @@ def get_timeseries_units_from_fuel_type(fuel_type)
@vehicles[VT::VehicleDischarging] = Vehicles.new(variables: get_object_outputs(VT, VT::VehicleDischarging))
@vehicles.each do |vehicles_type, vehicle_data|
vehicle_data.name = "Vehicle: #{vehicles_type}"
vehicle_data.annual_units = 'Mbtu'
vehicle_data.annual_units = 'MBtu'
vehicle_data.timeseries_units = 'kWh'
end

Expand Down

0 comments on commit 7c3a84a

Please sign in to comment.