Skip to content

Commit

Permalink
Stub request when generator, add notes, revert defaults changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Nov 16, 2023
1 parent 9322a7c commit feb4af6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
6 changes: 3 additions & 3 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>5a988455-10e6-4e09-a169-42f3b52c5222</version_id>
<version_modified>2023-11-15T21:19:24Z</version_modified>
<version_id>7f9d8cf2-9144-41f2-ad54-55bd9c514cd2</version_id>
<version_modified>2023-11-16T00:11:23Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -262,7 +262,7 @@
<filename>hpxml_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>51C4EFBB</checksum>
<checksum>745C9EA1</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
Expand Down
42 changes: 20 additions & 22 deletions HPXMLtoOpenStudio/resources/hpxml_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,33 +401,31 @@ def self.apply_utility_bill_scenarios(runner, hpxml_header, hpxml_bldg, has_fuel
end
end

if (hpxml_bldg.pv_systems.size > 0) || (hpxml_bldg.batteries.size > 0)
if scenario.pv_compensation_type.nil?
scenario.pv_compensation_type = HPXML::PVCompensationTypeNetMetering
scenario.pv_compensation_type_isdefaulted = true
end
next if hpxml_bldg.pv_systems.size == 0

if scenario.pv_compensation_type == HPXML::PVCompensationTypeNetMetering
if scenario.pv_net_metering_annual_excess_sellback_rate_type.nil?
scenario.pv_net_metering_annual_excess_sellback_rate_type = HPXML::PVAnnualExcessSellbackRateTypeUserSpecified
scenario.pv_net_metering_annual_excess_sellback_rate_type_isdefaulted = true
end
if scenario.pv_net_metering_annual_excess_sellback_rate_type == HPXML::PVAnnualExcessSellbackRateTypeUserSpecified
if scenario.pv_net_metering_annual_excess_sellback_rate.nil?
scenario.pv_net_metering_annual_excess_sellback_rate = 0.03
scenario.pv_net_metering_annual_excess_sellback_rate_isdefaulted = true
end
end
elsif scenario.pv_compensation_type == HPXML::PVCompensationTypeFeedInTariff
if scenario.pv_feed_in_tariff_rate.nil?
scenario.pv_feed_in_tariff_rate = 0.12
scenario.pv_feed_in_tariff_rate_isdefaulted = true
if scenario.pv_compensation_type.nil?
scenario.pv_compensation_type = HPXML::PVCompensationTypeNetMetering
scenario.pv_compensation_type_isdefaulted = true
end

if scenario.pv_compensation_type == HPXML::PVCompensationTypeNetMetering
if scenario.pv_net_metering_annual_excess_sellback_rate_type.nil?
scenario.pv_net_metering_annual_excess_sellback_rate_type = HPXML::PVAnnualExcessSellbackRateTypeUserSpecified
scenario.pv_net_metering_annual_excess_sellback_rate_type_isdefaulted = true
end
if scenario.pv_net_metering_annual_excess_sellback_rate_type == HPXML::PVAnnualExcessSellbackRateTypeUserSpecified
if scenario.pv_net_metering_annual_excess_sellback_rate.nil?
scenario.pv_net_metering_annual_excess_sellback_rate = 0.03
scenario.pv_net_metering_annual_excess_sellback_rate_isdefaulted = true
end
end
elsif scenario.pv_compensation_type == HPXML::PVCompensationTypeFeedInTariff
if scenario.pv_feed_in_tariff_rate.nil?
scenario.pv_feed_in_tariff_rate = 0.12
scenario.pv_feed_in_tariff_rate_isdefaulted = true
end
end

next if hpxml_bldg.pv_systems.size == 0

if scenario.pv_monthly_grid_connection_fee_dollars_per_kw.nil? && scenario.pv_monthly_grid_connection_fee_dollars.nil?
scenario.pv_monthly_grid_connection_fee_dollars = 0.0
scenario.pv_monthly_grid_connection_fee_dollars_isdefaulted = true
Expand Down
4 changes: 3 additions & 1 deletion ReportUtilityBills/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,13 @@ def energyPlusOutputRequests(runner, user_arguments)
# Has production
has_pv = @hpxml_buildings.select { |hpxml_bldg| !hpxml_bldg.pv_systems.empty? }.size > 0
has_battery = @model.getElectricLoadCenterStorageLiIonNMCBatterys.size > 0 # has a modeled battery
has_generator = @hpxml_buildings.select { |hpxml_bldg| !hpxml_bldg.generators.empty? }.size > 0

# Fuel outputs
fuels.each do |(fuel_type, is_production), fuel|
fuel.meters.each do |meter|
next unless has_fuel[hpxml_fuel_map[fuel_type]]
next if is_production && !has_pv && !has_battery
next if is_production && !has_pv && !has_battery && !has_generator

result << OpenStudio::IdfObject.load("Output:Meter,#{meter},monthly;").get
if fuel_type == FT::Elec && @hpxml_header.utility_bill_scenarios.has_detailed_electric_rates
Expand Down Expand Up @@ -550,6 +551,7 @@ def get_utility_rates(hpxml_path, fuels, utility_rates, bill_scenario, monthly_f
end

# Net Metering
# TODO: if battery or generator and no PV, default to HPXML::PVAnnualExcessSellbackRateTypeRetailElectricityCost?
rate.net_metering_excess_sellback_type = bill_scenario.pv_net_metering_annual_excess_sellback_rate_type if bill_scenario.pv_compensation_type == HPXML::PVCompensationTypeNetMetering
rate.net_metering_user_excess_sellback_rate = bill_scenario.pv_net_metering_annual_excess_sellback_rate if rate.net_metering_excess_sellback_type == HPXML::PVAnnualExcessSellbackRateTypeUserSpecified

Expand Down
8 changes: 4 additions & 4 deletions ReportUtilityBills/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_utility_bills</name>
<uid>ca88a425-e59a-4bc4-af51-c7e7d1e960fe</uid>
<version_id>a51e801a-a4b6-47b4-a2e6-83e4066b05b3</version_id>
<version_modified>2023-11-15T21:19:27Z</version_modified>
<version_id>1f833719-ec58-490d-b8d3-5b7dd52078bc</version_id>
<version_modified>2023-11-16T00:15:18Z</version_modified>
<xml_checksum>15BF4E57</xml_checksum>
<class_name>ReportUtilityBills</class_name>
<display_name>Utility Bills Report</display_name>
Expand Down Expand Up @@ -142,7 +142,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>B4589B2D</checksum>
<checksum>48E10965</checksum>
</file>
<file>
<filename>detailed_rates/Sample Flat Rate Min Annual Charge.json</filename>
Expand Down Expand Up @@ -280,7 +280,7 @@
<filename>util.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>87D3BB06</checksum>
<checksum>A8ACF98D</checksum>
</file>
<file>
<filename>Contains Demand Charges.json</filename>
Expand Down
1 change: 1 addition & 0 deletions ReportUtilityBills/resources/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def self.detailed_electric(header, fuels, rate, bill)
end_of_year_bill_credit, excess_sellback = apply_excess_sellback(end_of_year_bill_credit, rate.net_metering_excess_sellback_type, rate.net_metering_user_excess_sellback_rate, net_elec_month.sum(0.0))

annual_total_charge_with_pv = annual_payments + end_of_year_bill_credit - excess_sellback
# TODO: if battery or generator and no PV, put this toward annual_energy_charge instead of annual_production credit?
bill.annual_production_credit = annual_total_charge - annual_total_charge_with_pv

for m in 0..11
Expand Down

0 comments on commit feb4af6

Please sign in to comment.