Skip to content

Commit

Permalink
v0.10.0 (#152)
Browse files Browse the repository at this point in the history
* Additional reporting tests (#147)

* wip: tests for distributed generation reports

* details so 2 more tests pass

* continuing to clean up merging dgen test

* fix how I instantiate the dgen class

* yet moar tests!

* remove testing print statements

* update formatting and version in export_modelica_loads (#149)

Co-authored-by: Nathan Moore <[email protected]>

* Update feature reports for Reopt v3 (#148)

* start of mods for v3

* update to remove `us_dollars` from reopt outputs

* change `_pct` to `_fraction`

* fix copy paste typo

---------

Co-authored-by: kflemin <[email protected]>

* Prep 0.10.0 (#150)

* bump to version 0.10.0

* update changelog from github automated output

* rubocop

* fix test after earlier refactor

* enable manually running CI on demand (once merged to develop)

---------

Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: kflemin <[email protected]>
  • Loading branch information
3 people authored May 6, 2024
1 parent dc31cea commit 2320bdf
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 277 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nightly_ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Reporting-gem CI

on:
# push:
workflow_dispatch:
schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# 5 am UTC (11pm MDT the day before) every weekday night in MDT
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# URBANopt Reporting Gem

## Version 0.10.0
## What's Changed
* Additional reporting tests by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/147
* Update formatting and version in export_modelica_loads by @nllong in https://github.com/urbanopt/urbanopt-reporting-gem/pull/149
* Update feature reports for Reopt v3 by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/148


**Full Changelog**: https://github.com/urbanopt/urbanopt-reporting-gem/compare/v0.9.1...0.10.0

## Version 0.9.1
* downgrade json-schema to 2.7 by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/145

Expand Down
2 changes: 1 addition & 1 deletion lib/measures/export_modelica_loads/measure.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<measure>
<schema_version>3.1</schema_version>
<schema_version>3.0</schema_version>
<name>export_modelica_loads</name>
<uid>7051db01-2e55-4223-b5b5-fee615b68dd0</uid>
<version_id>e682f518-4785-4917-802e-600023816cc3</version_id>
Expand Down
130 changes: 65 additions & 65 deletions lib/urbanopt/reporting/default_reports/distributed_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,67 +20,67 @@ class DistributedGeneration
##
# _Float_ - Lifecycle costs for the complete distributed generation system in US Dollars
#
attr_accessor :lcc_us_dollars
attr_accessor :lcc

##
# _Float_ - Lifecycle costs for the complete distributed generation system in US Dollars
#
attr_accessor :lcc_bau_us_dollars
attr_accessor :lcc_bau

##
# _Float_ - Net present value of the complete distributed generation system in US Dollars
#
attr_accessor :npv_us_dollars
attr_accessor :npv

##
# _Float_ - Total amount paid for utility energy in US Dollars in the first year of operation
#
attr_accessor :year_one_energy_cost_us_dollars
attr_accessor :year_one_energy_cost_before_tax

##
# _Float_ - Total amount paid in utility demand charges in US Dollars in the first year of operation
#
attr_accessor :year_one_demand_cost_us_dollars
attr_accessor :year_one_demand_cost_before_tax

##
# _Float_ - Total amount paid to the utility in US Dollars in the first year of operation
#
attr_accessor :year_one_bill_us_dollars
attr_accessor :year_one_bill_before_tax

##
# _Float_ - Total energy costs in US Dollars over the life of the system after tax
#
attr_accessor :total_energy_cost_us_dollars
attr_accessor :lifecycle_energy_cost_after_tax

##
# _Float_ - Total demand costs in US Dollars over the life of the system after tax
#
attr_accessor :total_demand_cost_us_dollars
attr_accessor :lifecycle_demand_cost_after_tax

##
# _Float_ - Year one energy cost in the business as usual scenario (i.e no new system) after tax, us dollars
# _Float_ - Year one energy cost in the business as usual scenario (i.e no new system) before tax, us dollars
#
attr_accessor :year_one_energy_cost_bau_us_dollars
attr_accessor :year_one_energy_cost_before_tax_bau

##
# _Float_ - Year one demand cost in the business as usual scenario (i.e no new system), us dollars
#
attr_accessor :year_one_demand_cost_bau_us_dollars
attr_accessor :year_one_demand_cost_before_tax_bau

##
# _Float_ - Year one demand energy bill in the business as usual scenario (i.e no new system), us dollars
#
attr_accessor :year_one_bill_bau_us_dollars
attr_accessor :year_one_bill_before_tax_bau

##
# _Float_ - Total lifetime demand costs in the business as usual scenario (i.e no new system) after tax, us dollars
#
attr_accessor :total_demand_cost_bau_us_dollars
attr_accessor :lifecycle_demand_cost_after_tax_bau

##
# _Float_ - Total lifetime energy costs in the business as usual scenario (i.e no new system) after tax, us dollars
#
attr_accessor :total_energy_cost_bau_us_dollars
attr_accessor :lifecycle_energy_cost_after_tax_bau

##
# _Array_ - List of _SolarPV_ systems
Expand Down Expand Up @@ -162,16 +162,16 @@ class DistributedGeneration
attr_accessor :reopt_assumptions_file_path

##
# _Float_ - Annual percentage of electricity supplied by renewable sources
# _Float_ - Annual fraction of electricity supplied by renewable sources
#
attr_accessor :annual_renewable_electricity_pct
attr_accessor :renewable_electricity_fraction

##
# Initialize distributed generation system design and financial metrics.
#
# * Technologies include +:solar_pv+, +:wind+, +:generator+, and +:storage+.
# * Financial metrics include +:lcc_us_dollars+, +:npv_us_dollars+, +:year_one_energy_cost_us_dollars+, +:year_one_demand_cost_us_dollars+,
# +:year_one_bill_us_dollars+, and +:total_energy_cost_us_dollars+
# * Financial metrics include +:lcc+, +:npv+, +:year_one_energy_cost_before_tax+, +:year_one_demand_cost_before_tax+,
# +:year_one_bill_before_tax+, and +:lifecycle_energy_cost_after_tax+
##
# [parameters:]
#
Expand All @@ -180,20 +180,20 @@ class DistributedGeneration
def initialize(hash = {})
hash.delete_if { |k, v| v.nil? }

@annual_renewable_electricity_pct = hash[:annual_renewable_electricity_pct]
@lcc_us_dollars = hash[:lcc_us_dollars]
@lcc_bau_us_dollars = hash[:lcc_bau_us_dollars]
@npv_us_dollars = hash[:npv_us_dollars]
@year_one_energy_cost_us_dollars = hash[:year_one_energy_cost_us_dollars]
@year_one_energy_cost_bau_us_dollars = hash[:year_one_energy_cost_bau_us_dollars]
@year_one_demand_cost_us_dollars = hash[:year_one_demand_cost_us_dollars]
@year_one_demand_cost_bau_us_dollars = hash[:year_one_demand_cost_bau_us_dollars]
@year_one_bill_us_dollars = hash[:year_one_bill_us_dollars]
@year_one_bill_bau_us_dollars = hash[:year_one_bill_bau_us_dollars]
@total_energy_cost_us_dollars = hash[:total_energy_cost_us_dollars]
@total_energy_cost_bau_us_dollars = hash[:total_energy_cost_bau_us_dollars]
@total_demand_cost_us_dollars = hash[:total_demand_cost_us_dollars]
@total_demand_cost_bau_us_dollars = hash[:total_demand_cost_bau_us_dollars]
@renewable_electricity_fraction = hash[:renewable_electricity_fraction]
@lcc = hash[:lcc]
@lcc_bau = hash[:lcc_bau]
@npv = hash[:npv]
@year_one_energy_cost_before_tax = hash[:year_one_energy_cost_before_tax]
@year_one_energy_cost_before_tax_bau = hash[:year_one_energy_cost_before_tax_bau]
@year_one_demand_cost_before_tax = hash[:year_one_demand_cost_before_tax]
@year_one_demand_cost_before_tax_bau = hash[:year_one_demand_cost_before_tax_bau]
@year_one_bill_before_tax = hash[:year_one_bill_before_tax]
@year_one_bill_before_tax_bau = hash[:year_one_bill_before_tax_bau]
@lifecycle_energy_cost_after_tax = hash[:lifecycle_energy_cost_after_tax]
@lifecycle_energy_cost_after_tax_bau = hash[:lifecycle_energy_cost_after_tax_bau]
@lifecycle_demand_cost_after_tax = hash[:lifecycle_demand_cost_after_tax]
@lifecycle_demand_cost_after_tax_bau = hash[:lifecycle_demand_cost_after_tax_bau]

@resilience_hours_min = hash[:resilience_hours_min]
@resilience_hours_max = hash[:resilience_hours_max]
Expand Down Expand Up @@ -345,22 +345,22 @@ def add_tech(name, tech)
def to_hash
result = {}
result[:reopt_assumptions_file_path] = @reopt_assumptions_file_path if @reopt_assumptions_file_path
result[:annual_renewable_electricity_pct] = @annual_renewable_electricity_pct if @annual_renewable_electricity_pct
result[:lcc_us_dollars] = @lcc_us_dollars if @lcc_us_dollars
result[:lcc_bau_us_dollars] = @lcc_bau_us_dollars if @lcc_bau_us_dollars
result[:npv_us_dollars] = @npv_us_dollars if @npv_us_dollars

result[:year_one_energy_cost_us_dollars] = @year_one_energy_cost_us_dollars if @year_one_energy_cost_us_dollars
result[:year_one_demand_cost_us_dollars] = @year_one_demand_cost_us_dollars if @year_one_demand_cost_us_dollars
result[:year_one_bill_us_dollars] = @year_one_bill_us_dollars if @year_one_bill_us_dollars
result[:total_demand_cost_us_dollars] = @total_demand_cost_us_dollars if @total_demand_cost_us_dollars
result[:total_energy_cost_us_dollars] = @total_energy_cost_us_dollars if @total_energy_cost_us_dollars

result[:year_one_energy_cost_bau_us_dollars] = @year_one_energy_cost_bau_us_dollars if @year_one_energy_cost_bau_us_dollars
result[:year_one_demand_cost_bau_us_dollars] = @year_one_demand_cost_bau_us_dollars if @year_one_demand_cost_bau_us_dollars
result[:year_one_bill_bau_us_dollars] = @year_one_bill_bau_us_dollars if @year_one_bill_bau_us_dollars
result[:total_energy_cost_bau_us_dollars] = @total_energy_cost_bau_us_dollars if @total_energy_cost_bau_us_dollars
result[:total_demand_cost_bau_us_dollars] = @total_demand_cost_bau_us_dollars if @total_demand_cost_bau_us_dollars
result[:renewable_electricity_fraction] = @renewable_electricity_fraction if @renewable_electricity_fraction
result[:lcc] = @lcc if @lcc
result[:lcc_bau] = @lcc_bau if @lcc_bau
result[:npv] = @npv if @npv

result[:year_one_energy_cost_before_tax] = @year_one_energy_cost_before_tax if @year_one_energy_cost_before_tax
result[:year_one_demand_cost_before_tax] = @year_one_demand_cost_before_tax if @year_one_demand_cost_before_tax
result[:year_one_bill_before_tax] = @year_one_bill_before_tax if @year_one_bill_before_tax
result[:lifecycle_demand_cost_after_tax] = @lifecycle_demand_cost_after_tax if @lifecycle_demand_cost_after_tax
result[:lifecycle_energy_cost_after_tax] = @lifecycle_energy_cost_after_tax if @lifecycle_energy_cost_after_tax

result[:year_one_energy_cost_before_tax_bau] = @year_one_energy_cost_before_tax_bau if @year_one_energy_cost_before_tax_bau
result[:year_one_demand_cost_before_tax_bau] = @year_one_demand_cost_before_tax_bau if @year_one_demand_cost_before_tax_bau
result[:year_one_bill_before_tax_bau] = @year_one_bill_before_tax_bau if @year_one_bill_before_tax_bau
result[:lifecycle_energy_cost_after_tax_bau] = @lifecycle_energy_cost_after_tax_bau if @lifecycle_energy_cost_after_tax_bau
result[:lifecycle_demand_cost_after_tax_bau] = @lifecycle_demand_cost_after_tax_bau if @lifecycle_demand_cost_after_tax_bau

result[:total_solar_pv_kw] = @total_solar_pv_kw if @total_solar_pv_kw
result[:total_wind_kw] = @total_wind_kw if @total_wind_kw
Expand Down Expand Up @@ -415,22 +415,22 @@ def self.add_values(existing_value, new_value) #:nodoc:
# Merge a distributed generation system with a new system
##
def self.merge_distributed_generation(existing_dgen, new_dgen)
existing_dgen.annual_renewable_electricity_pct = add_values(existing_dgen.annual_renewable_electricity_pct, new_dgen.annual_renewable_electricity_pct)
existing_dgen.lcc_us_dollars = add_values(existing_dgen.lcc_us_dollars, new_dgen.lcc_us_dollars)
existing_dgen.lcc_bau_us_dollars = add_values(existing_dgen.lcc_bau_us_dollars, new_dgen.lcc_bau_us_dollars)
existing_dgen.npv_us_dollars = add_values(existing_dgen.npv_us_dollars, new_dgen.npv_us_dollars)

existing_dgen.year_one_energy_cost_us_dollars = add_values(existing_dgen.year_one_energy_cost_us_dollars, new_dgen.year_one_energy_cost_us_dollars)
existing_dgen.year_one_demand_cost_us_dollars = add_values(existing_dgen.year_one_demand_cost_us_dollars, new_dgen.year_one_demand_cost_us_dollars)
existing_dgen.year_one_bill_us_dollars = add_values(existing_dgen.year_one_bill_us_dollars, new_dgen.year_one_bill_us_dollars)
existing_dgen.total_energy_cost_us_dollars = add_values(existing_dgen.total_energy_cost_us_dollars, new_dgen.total_energy_cost_us_dollars)
existing_dgen.total_demand_cost_us_dollars = add_values(existing_dgen.total_demand_cost_us_dollars, new_dgen.total_demand_cost_us_dollars)

existing_dgen.year_one_energy_cost_bau_us_dollars = add_values(existing_dgen.year_one_energy_cost_bau_us_dollars, new_dgen.year_one_energy_cost_bau_us_dollars)
existing_dgen.year_one_demand_cost_bau_us_dollars = add_values(existing_dgen.year_one_demand_cost_bau_us_dollars, new_dgen.year_one_demand_cost_bau_us_dollars)
existing_dgen.year_one_bill_bau_us_dollars = add_values(existing_dgen.year_one_bill_bau_us_dollars, new_dgen.year_one_bill_bau_us_dollars)
existing_dgen.total_energy_cost_bau_us_dollars = add_values(existing_dgen.total_energy_cost_bau_us_dollars, new_dgen.total_energy_cost_bau_us_dollars)
existing_dgen.total_demand_cost_bau_us_dollars = add_values(existing_dgen.total_demand_cost_bau_us_dollars, new_dgen.total_demand_cost_bau_us_dollars)
existing_dgen.renewable_electricity_fraction = add_values(existing_dgen.renewable_electricity_fraction, new_dgen.renewable_electricity_fraction)
existing_dgen.lcc = add_values(existing_dgen.lcc, new_dgen.lcc)
existing_dgen.lcc_bau = add_values(existing_dgen.lcc_bau, new_dgen.lcc_bau)
existing_dgen.npv = add_values(existing_dgen.npv, new_dgen.npv)

existing_dgen.year_one_energy_cost_before_tax = add_values(existing_dgen.year_one_energy_cost_before_tax, new_dgen.year_one_energy_cost_before_tax)
existing_dgen.year_one_demand_cost_before_tax = add_values(existing_dgen.year_one_demand_cost_before_tax, new_dgen.year_one_demand_cost_before_tax)
existing_dgen.year_one_bill_before_tax = add_values(existing_dgen.year_one_bill_before_tax, new_dgen.year_one_bill_before_tax)
existing_dgen.lifecycle_energy_cost_after_tax = add_values(existing_dgen.lifecycle_energy_cost_after_tax, new_dgen.lifecycle_energy_cost_after_tax)
existing_dgen.lifecycle_demand_cost_after_tax = add_values(existing_dgen.lifecycle_demand_cost_after_tax, new_dgen.lifecycle_demand_cost_after_tax)

existing_dgen.year_one_energy_cost_before_tax_bau = add_values(existing_dgen.year_one_energy_cost_before_tax_bau, new_dgen.year_one_energy_cost_before_tax_bau)
existing_dgen.year_one_demand_cost_before_tax_bau = add_values(existing_dgen.year_one_demand_cost_before_tax_bau, new_dgen.year_one_demand_cost_before_tax_bau)
existing_dgen.year_one_bill_before_tax_bau = add_values(existing_dgen.year_one_bill_before_tax_bau, new_dgen.year_one_bill_before_tax_bau)
existing_dgen.lifecycle_energy_cost_after_tax_bau = add_values(existing_dgen.lifecycle_energy_cost_after_tax_bau, new_dgen.lifecycle_energy_cost_after_tax_bau)
existing_dgen.lifecycle_demand_cost_after_tax_bau = add_values(existing_dgen.lifecycle_demand_cost_after_tax_bau, new_dgen.lifecycle_demand_cost_after_tax_bau)

existing_dgen.resilience_hours_min = add_values(existing_dgen.resilience_hours_min, new_dgen.resilience_hours_min)
existing_dgen.resilience_hours_max = add_values(existing_dgen.resilience_hours_max, new_dgen.resilience_hours_max)
Expand Down Expand Up @@ -470,7 +470,7 @@ def self.merge_distributed_generation(existing_dgen, new_dgen)

new_dgen.generator.each do |generator|
existing_dgen.generator.push generator
if existing_dgen.total_wind_kw.nil?
if existing_dgen.total_generator_kw.nil?
existing_dgen.total_generator_kw = generator.size_kw
else
existing_dgen.total_generator_kw += generator.size_kw
Expand Down
3 changes: 1 addition & 2 deletions lib/urbanopt/reporting/default_reports/feature_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def initialize(hash = {})
# design_parameters to add later
@construction_costs = []
hash[:construction_costs].each do |cc|
@constructiion_costs << ConstructionCost.new(cc)
@construction_costs << ConstructionCost.new(cc)
end

@reporting_periods = []
Expand Down Expand Up @@ -212,7 +212,6 @@ def to_hash
def save(file_name = 'default_feature_report')
# reassign the initialize local variable @file_name to the file name input.
@file_name = file_name

# save the feature reports csv and json data
old_timeseries_path = nil
if !@timeseries_csv.path.nil?
Expand Down
15 changes: 4 additions & 11 deletions lib/urbanopt/reporting/default_reports/qaqc_flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class QAQC
##
# _Hash_ - Hash of flags raised by QAQC measure for this feature during this reporting period
#
attr_accessor :eui_reasonableness,:end_use_by_category,:mechanical_system_part_load_efficiency,
:simultaneous_heating_and_cooling , :internal_loads , :schedules, :envelope_r_value,
:domestic_hot_water , :mechanical_system_efficiency , :supply_and_zone_air_temperature,
attr_accessor :eui_reasonableness, :end_use_by_category, :mechanical_system_part_load_efficiency,
:simultaneous_heating_and_cooling, :internal_loads, :schedules, :envelope_r_value,
:domestic_hot_water, :mechanical_system_efficiency, :supply_and_zone_air_temperature,
:total_qaqc_flags

##
Expand Down Expand Up @@ -46,14 +46,11 @@ def initialize(hash = {})
@mechanical_system_efficiency = hash[:mechanical_system_efficiency]
@total_qaqc_flags = hash[:total_qaqc_flags]


# initialize class variables @@validator and @@schema
@@validator ||= Validator.new
@@schema ||= @@validator.schema

end


##
# Assigns default values if values do not exist.
##
Expand All @@ -72,9 +69,9 @@ def defaults
hash[:mechanical_system_efficiency] = nil
hash[:total_qaqc_flags] = nil


return hash
end

##
# Convert to a Hash equivalent for JSON serialization
##
Expand All @@ -99,7 +96,6 @@ def to_hash
end

return result

end

##
Expand All @@ -126,7 +122,6 @@ def add_values(existing_value, new_value) #:nodoc:
# +other+ - _QAQC_ - An object of Program class.
##
def add_qaqc_flags(other)

@eui_reasonableness = add_values(@eui_reasonableness, other.eui_reasonableness)
@end_use_by_category = add_values(@end_use_by_category, other.end_use_by_category)
@mechanical_system_part_load_efficiency = add_values(@mechanical_system_part_load_efficiency, other.mechanical_system_part_load_efficiency)
Expand All @@ -138,9 +133,7 @@ def add_qaqc_flags(other)
@domestic_hot_water = add_values(@domestic_hot_water, other.domestic_hot_water)
@mechanical_system_efficiency = add_values(@mechanical_system_efficiency, other.mechanical_system_efficiency)
@total_qaqc_flags = add_values(@total_qaqc_flags, other.total_qaqc_flags)

end

end
end
end
Expand Down
Loading

0 comments on commit 2320bdf

Please sign in to comment.