urbanopt-scenario 0.2.0.pre1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/pull_request_template.md +2 -2
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +77 -1
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +28 -18
- data/Jenkinsfile +1 -1
- data/LICENSE.md +1 -1
- data/RDOC_MAIN.md +1 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/docs/README.md +1 -1
- data/docs/package-lock.json +2499 -2322
- data/docs/package.json +13 -9
- data/lib/urbanopt-scenario.rb +1 -1
- data/lib/urbanopt/scenario.rb +3 -1
- data/lib/urbanopt/scenario/default_reports.rb +3 -8
- data/lib/urbanopt/scenario/extension.rb +1 -1
- data/lib/urbanopt/scenario/logger.rb +1 -1
- data/lib/urbanopt/scenario/scenario_base.rb +1 -1
- data/lib/urbanopt/scenario/scenario_csv.rb +22 -9
- data/lib/urbanopt/scenario/scenario_datapoint_base.rb +8 -1
- data/lib/urbanopt/scenario/scenario_post_processor_base.rb +1 -1
- data/lib/urbanopt/scenario/scenario_post_processor_default.rb +81 -8
- data/lib/urbanopt/scenario/scenario_post_processor_opendss.rb +275 -0
- data/lib/urbanopt/scenario/scenario_runner_base.rb +2 -2
- data/lib/urbanopt/scenario/scenario_runner_osw.rb +23 -9
- data/lib/urbanopt/scenario/scenario_visualization.rb +236 -0
- data/lib/urbanopt/scenario/simulation_dir_base.rb +1 -1
- data/lib/urbanopt/scenario/simulation_dir_osw.rb +2 -9
- data/lib/urbanopt/scenario/simulation_mapper_base.rb +1 -1
- data/lib/urbanopt/scenario/version.rb +2 -2
- data/package-lock.json +3 -0
- data/urbanopt-scenario-gem.gemspec +15 -15
- metadata +78 -82
- data/doc_templates/LICENSE.md +0 -27
- data/doc_templates/README.md.erb +0 -42
- data/doc_templates/copyright_erb.txt +0 -31
- data/doc_templates/copyright_js.txt +0 -4
- data/doc_templates/copyright_ruby.txt +0 -29
- data/lib/change_log.rb +0 -147
- data/lib/measures/.rubocop.yml +0 -5
- data/lib/measures/default_feature_reports/LICENSE.md +0 -27
- data/lib/measures/default_feature_reports/README.md +0 -56
- data/lib/measures/default_feature_reports/README.md.erb +0 -42
- data/lib/measures/default_feature_reports/measure.rb +0 -957
- data/lib/measures/default_feature_reports/measure.xml +0 -143
- data/lib/measures/default_feature_reports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
- data/lib/measures/default_feature_reports/tests/default_feature_reports_test.rb +0 -238
- data/lib/measures/default_feature_reports/tests/example_model.osm +0 -4378
- data/lib/urbanopt/scenario/default_reports/construction_cost.rb +0 -169
- data/lib/urbanopt/scenario/default_reports/date.rb +0 -97
- data/lib/urbanopt/scenario/default_reports/distributed_generation.rb +0 -374
- data/lib/urbanopt/scenario/default_reports/end_use.rb +0 -159
- data/lib/urbanopt/scenario/default_reports/end_uses.rb +0 -140
- data/lib/urbanopt/scenario/default_reports/feature_report.rb +0 -260
- data/lib/urbanopt/scenario/default_reports/generator.rb +0 -92
- data/lib/urbanopt/scenario/default_reports/location.rb +0 -99
- data/lib/urbanopt/scenario/default_reports/logger.rb +0 -44
- data/lib/urbanopt/scenario/default_reports/program.rb +0 -266
- data/lib/urbanopt/scenario/default_reports/reporting_period.rb +0 -301
- data/lib/urbanopt/scenario/default_reports/scenario_report.rb +0 -311
- data/lib/urbanopt/scenario/default_reports/schema/README.md +0 -33
- data/lib/urbanopt/scenario/default_reports/schema/scenario_csv_columns.txt +0 -21
- data/lib/urbanopt/scenario/default_reports/schema/scenario_schema.json +0 -839
- data/lib/urbanopt/scenario/default_reports/solar_pv.rb +0 -93
- data/lib/urbanopt/scenario/default_reports/storage.rb +0 -105
- data/lib/urbanopt/scenario/default_reports/timeseries_csv.rb +0 -284
- data/lib/urbanopt/scenario/default_reports/validator.rb +0 -97
- data/lib/urbanopt/scenario/default_reports/wind.rb +0 -92
@@ -1,97 +0,0 @@
|
|
1
|
-
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
-
# contributors. All rights reserved.
|
4
|
-
#
|
5
|
-
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
-
# are permitted provided that the following conditions are met:
|
7
|
-
#
|
8
|
-
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
-
# of conditions and the following disclaimer.
|
10
|
-
#
|
11
|
-
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
-
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
-
# materials provided with the distribution.
|
14
|
-
#
|
15
|
-
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
-
# used to endorse or promote products derived from this software without specific
|
17
|
-
# prior written permission.
|
18
|
-
#
|
19
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
-
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
-
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
-
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
-
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
-
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
# *********************************************************************************
|
30
|
-
|
31
|
-
require 'json'
|
32
|
-
|
33
|
-
module URBANopt
|
34
|
-
module Scenario
|
35
|
-
module DefaultReports
|
36
|
-
class Validator
|
37
|
-
@@schema = nil
|
38
|
-
|
39
|
-
# Initialize the root directory
|
40
|
-
def initialize
|
41
|
-
super
|
42
|
-
|
43
|
-
@root_dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..'))
|
44
|
-
|
45
|
-
@instance_lock = Mutex.new
|
46
|
-
@@schema ||= schema
|
47
|
-
end
|
48
|
-
|
49
|
-
# Return the absolute path of the default reports files
|
50
|
-
def files_dir
|
51
|
-
File.absolute_path(File.join(@root_dir, 'lib/urbanopt/scenario/default_reports/'))
|
52
|
-
end
|
53
|
-
|
54
|
-
# return path to schema file
|
55
|
-
def schema_file
|
56
|
-
File.join(files_dir, 'schema/scenario_schema.json')
|
57
|
-
end
|
58
|
-
|
59
|
-
# return schema
|
60
|
-
def schema
|
61
|
-
@instance_lock.synchronize do
|
62
|
-
if @@schema.nil?
|
63
|
-
File.open(schema_file, 'r') do |f|
|
64
|
-
@@schema = JSON.parse(f.read, symbolize_names: true)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
@@schema
|
70
|
-
end
|
71
|
-
|
72
|
-
##
|
73
|
-
# validate data against schema
|
74
|
-
##
|
75
|
-
# [parameters:]
|
76
|
-
# +schema+ - _Hash_ - A hash of the JSON scenario_schema.
|
77
|
-
# +data+ - _Hash_ - A hash of the data to be validated against scenario_schema.
|
78
|
-
##
|
79
|
-
def validate(schema, data)
|
80
|
-
JSON::Validator.fully_validate(schema, data)
|
81
|
-
end
|
82
|
-
|
83
|
-
# check if the schema is valid
|
84
|
-
def schema_valid?
|
85
|
-
metaschema = JSON::Validator.validator_for_name('draft6').metaschema
|
86
|
-
JSON::Validator.validate(metaschema, @@schema)
|
87
|
-
end
|
88
|
-
|
89
|
-
# return detailed schema validation errors
|
90
|
-
def schema_validation_errors
|
91
|
-
metaschema = JSON::Validator.validator_for_name('draft6').metaschema
|
92
|
-
JSON::Validator.fully_validate(metaschema, @@schema)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
-
# contributors. All rights reserved.
|
4
|
-
#
|
5
|
-
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
-
# are permitted provided that the following conditions are met:
|
7
|
-
#
|
8
|
-
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
-
# of conditions and the following disclaimer.
|
10
|
-
#
|
11
|
-
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
-
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
-
# materials provided with the distribution.
|
14
|
-
#
|
15
|
-
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
-
# used to endorse or promote products derived from this software without specific
|
17
|
-
# prior written permission.
|
18
|
-
#
|
19
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
-
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
-
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
-
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
-
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
-
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
# *********************************************************************************
|
30
|
-
|
31
|
-
require 'json'
|
32
|
-
require 'json-schema'
|
33
|
-
|
34
|
-
module URBANopt
|
35
|
-
module Scenario
|
36
|
-
module DefaultReports
|
37
|
-
##
|
38
|
-
# Onsite wind system attributes
|
39
|
-
##
|
40
|
-
class Wind
|
41
|
-
##
|
42
|
-
# _Float_ - power capacity in kilowatts
|
43
|
-
#
|
44
|
-
attr_accessor :size_kw
|
45
|
-
|
46
|
-
##
|
47
|
-
# Initialize Wind attributes from a hash. Wind attributes currently are limited to power capacity.
|
48
|
-
##
|
49
|
-
# [parameters:]
|
50
|
-
#
|
51
|
-
# * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
|
52
|
-
#
|
53
|
-
def initialize(hash = {})
|
54
|
-
hash.delete_if { |k, v| v.nil? }
|
55
|
-
|
56
|
-
@size_kw = hash[:size_kw]
|
57
|
-
|
58
|
-
# initialize class variables @@validator and @@schema
|
59
|
-
@@validator ||= Validator.new
|
60
|
-
@@schema ||= @@validator.schema
|
61
|
-
|
62
|
-
# initialize @@logger
|
63
|
-
@@logger ||= URBANopt::Scenario::DefaultReports.logger
|
64
|
-
end
|
65
|
-
|
66
|
-
##
|
67
|
-
# Convert to a Hash equivalent for JSON serialization
|
68
|
-
##
|
69
|
-
def to_hash
|
70
|
-
result = {}
|
71
|
-
|
72
|
-
result[:size_kw] = @size_kw if @size_kw
|
73
|
-
|
74
|
-
return result
|
75
|
-
end
|
76
|
-
|
77
|
-
##
|
78
|
-
# Merge Wind systems
|
79
|
-
##
|
80
|
-
def self.add_wind(existing_wind, new_wind)
|
81
|
-
if existing_wind.size_kw.nil? && new_wind.size_kw.nil?
|
82
|
-
existing_wind.size_kw = nil
|
83
|
-
else
|
84
|
-
existing_wind.size_kw = (existing_wind.size_kw || 0) + (new_wind.size_kw || 0)
|
85
|
-
end
|
86
|
-
|
87
|
-
return existing_wind
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|