Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kflemin committed Jun 5, 2020
2 parents aa1af90 + 3233b9c commit 72243e7
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 251 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ AllCops:


inherit_from:
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# URBANopt Scenario Gem

## Version 0.3.0
Date Range: 04/01/20 - 06/04/20:

Updating to OpenStudio 3.0 and Ruby 2.5

- Fixed [#114]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/114 ), Bug fix
- Fixed [#117]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/117 ), Added utility cost outputs to reports
- Fixed [#118]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/118 ), test Jenkins using pipeline to run OpenStudio 3.0.0
- Fixed [#119]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/119 ), added timeseries outputs for heat rejection end uses
- Fixed [#120]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/120 ), Bug fix r

## Version 0.2.0


Expand Down
17 changes: 7 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ gemspec
# checkout the latest version (develop) from github.
allow_local = ENV['FAVOR_LOCAL_GEMS']

# Uncomment the extension and common measures gem if you need to test local development versions. Otherwise
# these are included in the model articulation gem.
# Uncomment the extension gem if you need to test local development versions. Otherwise
# is is included in the model articulation gem.
#
# if allow_local && File.exist?('../OpenStudio-extension-gem')
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
# end

# if allow_local && File.exist?('../openstudio-common-measures-gem')
# gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
# elsif allow_local
# gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
# end
if allow_local && File.exist?('../openstudio-common-measures-gem')
gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
elsif allow_local
gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
end

if allow_local && File.exist?('../openstudio-model-articulation-gem')
gem 'openstudio-model-articulation', path: '../openstudio-model-articulation-gem'
Expand All @@ -37,6 +37,3 @@ if allow_local && File.exist?('../urbanopt-core-gem')
elsif allow_local
gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'
end

# simplecov has an unnecessary dependency on native json gem, use fork that does not require this
gem 'simplecov', github: 'NREL/simplecov'
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RSpec::Core::RakeTask.new(:spec)
require 'openstudio/extension/rake_task'
require 'urbanopt/scenario'
rake_task = OpenStudio::Extension::RakeTask.new
rake_task.set_extension_class(URBANopt::Scenario::Extension)
rake_task.set_extension_class(URBANopt::Scenario::Extension, 'urbanopt/urbanopt-scenario-gem')

require 'rubocop/rake_task'
RuboCop::RakeTask.new
Expand Down
147 changes: 0 additions & 147 deletions lib/change_log.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/measures/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ AllCops:
Exclude:
- 'spec/test_measures/**/*'
inherit_from:
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
40 changes: 5 additions & 35 deletions lib/measures/default_feature_reports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,25 @@

###### (Automatically generated documentation)

# DefaultFeatureReports
#

## Description
Writes default_feature_reports.json and default_feature_reports.csv files used by URBANopt Scenario Default Post Processor


## Modeler Description
This measure only allows for one feature_report per simulation. If multiple features are simulated in a single simulation, a new measure must be written to disaggregate simulation results to multiple features.


## Measure Type
ReportingMeasure
ModelMeasure

## Taxonomy


## Arguments


### Feature unique identifier

**Name:** feature_id,
**Type:** String,
**Units:** ,
**Required:** false,
**Model Dependent:** false

### Feature scenario specific name

**Name:** feature_name,
**Type:** String,
**Units:** ,
**Required:** false,
**Model Dependent:** false

### URBANopt Feature Type

**Name:** feature_type,
**Type:** String,
**Units:** ,
**Required:** false,
**Model Dependent:** false

### Reporting Frequency
The frequency at which to report timeseries output data.
**Name:** reporting_frequency,
**Type:** Choice,
**Units:** ,
**Required:** true,
**Model Dependent:** false


This measure does not have any user arguments


46 changes: 40 additions & 6 deletions lib/measures/default_feature_reports/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ def energyPlusOutputRequests(runner, user_arguments)
# result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Heating:Gas,#{reporting_frequency};").get
# result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,WaterSystems:Gas,#{reporting_frequency};").get
# result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,InteriorEquipment:Gas,#{reporting_frequency};").get
result << OpenStudio::IdfObject.load('Output:Variable,*,Heating Coil Heating Rate,hourly; !- HVAC Average [W];').get

timeseries_data = ['District Cooling Chilled Water Rate', 'District Cooling Mass Flow Rate',
'District Cooling Inlet Temperature', 'District Cooling Outlet Temperature',
'District Heating Hot Water Rate', 'District Heating Mass Flow Rate',
'District Heating Inlet Temperature', 'District Heating Outlet Temperature']
'District Heating Inlet Temperature', 'District Heating Outlet Temperature', 'Cooling Coil Total Cooling Rate',
'Heating Coil Heating Rate']

timeseries_data.each do |ts|
result << OpenStudio::IdfObject.load("Output:Variable,*,#{ts},#{reporting_frequency};").get
Expand Down Expand Up @@ -583,6 +585,19 @@ def run(runner, user_arguments)
photovoltaic_power = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Photovoltaic Power' AND ColumnName='Electricity'")
feature_report.reporting_periods[0].energy_production[:electricity_produced][:photovoltaic] = convert_units(photovoltaic_power, 'GJ', 'kBtu')

## Total utility cost
total_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Total'")
feature_report.reporting_periods[0].total_utility_cost = total_utility_cost

## Utility Costs
# electricity utility cost
elec_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Electric'")
feature_report.reporting_periods[0].utility_costs[0][:fuel_type] = 'Electricity'
feature_report.reporting_periods[0].utility_costs[0][:total_cost] = elec_utility_cost
# gas utility cost
gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
feature_report.reporting_periods[0].utility_costs << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }

## comfort_result
# time_setpoint_not_met_during_occupied_cooling
time_setpoint_not_met_during_occupied_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Comfort and Setpoint Not Met Summary' AND RowName='Time Setpoint Not Met During Occupied Cooling' AND ColumnName='Facility'")
Expand Down Expand Up @@ -627,6 +642,8 @@ def run(runner, user_arguments)
'Fans:Electricity',
'Pumps:Electricity',
'WaterSystems:Electricity',
'HeatRejection:Electricity',
'HeatRejection:Gas',
'Heating:Gas',
'WaterSystems:Gas',
'InteriorEquipment:Gas',
Expand All @@ -639,7 +656,9 @@ def run(runner, user_arguments)
'District Heating Hot Water Rate',
'District Heating Mass Flow Rate',
'District Heating Inlet Temperature',
'District Heating Outlet Temperature'
'District Heating Outlet Temperature',
'Cooling Coil Total Cooling Rate',
'Heating Coil Heating Rate'
]

# add thermal comfort timeseries
Expand Down Expand Up @@ -682,9 +701,9 @@ def run(runner, user_arguments)
final_timeseries_names = []

# loop over requested timeseries
# rubocop: disable Metrics/BlockLength
requested_timeseries_names.each_index do |i|
timeseries_name = requested_timeseries_names[i]
puts " *********timeseries_name = #{timeseries_name}******************"
runner.registerInfo("TIMESERIES: #{timeseries_name}")

# get all the key values that this timeseries can be reported for (e.g. if PMV is requested for each zone)
Expand Down Expand Up @@ -760,15 +779,20 @@ def run(runner, user_arguments)
'kWh'
when 'gal'
'm3'
when 'W'
'W'
end
end

# loop through each value and apply unit conversion
os_vec = values[key_cnt]
if !timeseries_name.include? 'Zone Thermal Comfort'
for i in 0..os_vec.length - 1
unless new_unit == old_unit || !ts.is_initialized

unless new_unit == old_unit || old_unit.nil? || new_unit.nil? || !ts.is_initialized
os_vec[i] = OpenStudio.convert(os_vec[i], old_unit, new_unit).get
end

end
end

Expand Down Expand Up @@ -914,9 +938,19 @@ def run(runner, user_arguments)
datetimes = []
# check what timeseries is available
available_ts = sql_file.availableTimeSeries
puts "####### available_ts = #{available_ts}"
# get the timeseries for any of available timeseries
ts_d = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, available_ts[0], '')
timeseries_d = ts_d.get
# RK: code enhancement needed
ts_d_e = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Electricity:Facility', '')
ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Gas:Facility', '')

if ts_d_e.is_initialized
timeseries_d = ts_d_e.get
elsif ts_d_g.is_initialized
timeseries_d = ts_d_g.get
else
raise 'ELECTRICITY and GAS results are not initiaized'
end
# get formated datetimes
timeseries_d.dateTimes.each do |datetime|
datetimes << format_datetime(datetime.to_s)
Expand Down
Loading

0 comments on commit 72243e7

Please sign in to comment.