urbanopt-scenario 0.8.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/nightly_ci_build.yml +34 -0
  3. data/CHANGELOG.md +18 -3
  4. data/Gemfile +1 -1
  5. data/LICENSE.md +16 -11
  6. data/README.md +6 -3
  7. data/doc_templates/LICENSE.md +16 -11
  8. data/doc_templates/copyright_erb.txt +45 -39
  9. data/doc_templates/copyright_js.txt +2 -2
  10. data/doc_templates/copyright_ruby.txt +2 -37
  11. data/docs/package-lock.json +29 -47
  12. data/lib/urbanopt/scenario/default_reports.rb +2 -37
  13. data/lib/urbanopt/scenario/extension.rb +2 -37
  14. data/lib/urbanopt/scenario/logger.rb +2 -37
  15. data/lib/urbanopt/scenario/scenario_base.rb +2 -37
  16. data/lib/urbanopt/scenario/scenario_csv.rb +2 -37
  17. data/lib/urbanopt/scenario/scenario_datapoint_base.rb +2 -37
  18. data/lib/urbanopt/scenario/scenario_post_processor_base.rb +2 -37
  19. data/lib/urbanopt/scenario/scenario_post_processor_default.rb +2 -37
  20. data/lib/urbanopt/scenario/scenario_post_processor_disco.rb +124 -0
  21. data/lib/urbanopt/scenario/scenario_post_processor_opendss.rb +6 -40
  22. data/lib/urbanopt/scenario/scenario_runner_base.rb +2 -37
  23. data/lib/urbanopt/scenario/scenario_runner_osw.rb +2 -37
  24. data/lib/urbanopt/scenario/scenario_visualization.rb +25 -43
  25. data/lib/urbanopt/scenario/simulation_dir_base.rb +2 -37
  26. data/lib/urbanopt/scenario/simulation_dir_osw.rb +2 -37
  27. data/lib/urbanopt/scenario/simulation_mapper_base.rb +2 -37
  28. data/lib/urbanopt/scenario/version.rb +3 -38
  29. data/lib/urbanopt/scenario.rb +3 -37
  30. data/lib/urbanopt-scenario.rb +2 -37
  31. data/urbanopt-scenario-gem.gemspec +5 -16
  32. metadata +20 -18
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  module URBANopt
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  require 'urbanopt/scenario/scenario_base'
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  module URBANopt
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  module URBANopt
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  require 'urbanopt/scenario/scenario_post_processor_base'
@@ -0,0 +1,124 @@
1
+ # *********************************************************************************
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
4
+ # *********************************************************************************
5
+
6
+ require 'urbanopt/reporting/default_reports'
7
+
8
+ require 'csv'
9
+ require 'json'
10
+ require 'fileutils'
11
+
12
+ module URBANopt
13
+ module Scenario
14
+ class DISCOPostProcessor
15
+ ##
16
+ # DISCOPostProcessor post-processes DISCO results to selected DISCO results and
17
+ # integrate them in scenario and feature reports.
18
+ ##
19
+ # [parameters:]
20
+ # * +scenaro_report+ - _ScenarioBase_ - An object of Scenario_report class.
21
+ # * +disco_results_dir_name+ - _directory name of disco results
22
+ def initialize(scenario_report, disco_results_dir_name = 'disco')
23
+ if !scenario_report.nil?
24
+ @scenario_report = scenario_report
25
+ @disco_results_dir = File.join(@scenario_report.directory_name, disco_results_dir_name)
26
+ else
27
+ raise 'scenario_report is not valid'
28
+ end
29
+
30
+ # initialize disco data
31
+ @disco_data = {}
32
+
33
+ # initialize disco json results
34
+ @disco_json_results = {}
35
+
36
+ # initialize logger
37
+ @@logger ||= URBANopt::Reporting::DefaultReports.logger
38
+ end
39
+
40
+ # load disco data (if exists)
41
+ def load_disco_data
42
+
43
+ # load disco upgrade summary
44
+ disco_json_filename = File.join(@disco_results_dir, 'upgrade_summary.json')
45
+ if File.exist?(disco_json_filename)
46
+ @disco_json_results = JSON.parse(File.read(disco_json_filename))
47
+ end
48
+
49
+ end
50
+
51
+ # load disco data
52
+ def load_data
53
+ # load selected disco data
54
+ load_disco_data
55
+ end
56
+
57
+
58
+ ##
59
+ # save disco scenario fields
60
+ ##
61
+ def save_disco_scenario
62
+ @scenario_report.scenario_power_distribution_cost = URBANopt::Reporting::DefaultReports::ScenarioPowerDistributionCost.new
63
+
64
+ # RESULTS
65
+
66
+ res = []
67
+ # read result from JSON report
68
+ res = @disco_json_results['results']
69
+ @scenario_report.scenario_power_distribution_cost.results = res
70
+
71
+
72
+
73
+ # OUTPUTS
74
+
75
+ out = {}
76
+ # read result from JSON report
77
+ out[:log_file] = @disco_json_results['outputs']['log_file']
78
+ out[:jobs] = []
79
+ @disco_json_results['outputs']['jobs'].each do |job|
80
+ out[:jobs] << job
81
+ end
82
+ @scenario_report.scenario_power_distribution_cost.outputs = out
83
+
84
+ # VIOLATION SUMMARY
85
+
86
+ vio = []
87
+ # read result from JSON report
88
+ vio = @disco_json_results['violation_summary']
89
+ @scenario_report.scenario_power_distribution_cost.violation_summary = vio
90
+
91
+ # COSTS PER EQUIPMENT
92
+ cos = []
93
+ # read result from JSON report
94
+ cos = @disco_json_results['costs_per_equipment']
95
+ @scenario_report.scenario_power_distribution_cost.costs_per_equipment = cos
96
+
97
+ # EQUIPMENT
98
+ equ = []
99
+ # read result from JSON report
100
+ equ = @disco_json_results['equipment']
101
+ @scenario_report.scenario_power_distribution_cost.equipment = equ
102
+
103
+ end
104
+
105
+ ##
106
+ # run disco post_processor
107
+ ##
108
+ def run
109
+
110
+ # load data
111
+ load_data
112
+
113
+ # save additional global disco fields
114
+ save_disco_scenario
115
+
116
+ # save the updated scenario reports
117
+ # set save_feature_reports to false since only the scenario reports should be saved
118
+ # now, set save csv reports to false
119
+ @scenario_report.save(file_name = 'scenario_report_disco', save_feature_reports = false, save_csv_reports = false)
120
+ end
121
+
122
+ end
123
+ end
124
+ end
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  # require 'urbanopt/scenario/scenario_post_processor_base'
@@ -301,8 +266,10 @@ module URBANopt
301
266
  # also add additional keys for OpenDSS Loads
302
267
  loads = @opendss_json_results['model'].select { |d| d['class'] == 'Load' }
303
268
  if loads
304
- bld_load = loads.select { |d| d['name']['value'] == id }
305
- if bld_load
269
+ # RNM includes other strings around the Load ID, like: load_1_27, where the id is the 1 in the middle.
270
+ # Use the ID part of the string as the key.
271
+ bld_load = loads.select { |d| d['name']['value'] == id || d['name']['value'].split('_')[1] == id }
272
+ if !bld_load.empty?
306
273
  if bld_load.is_a?(Array)
307
274
  bld_load = bld_load[0]
308
275
  end
@@ -313,7 +280,6 @@ module URBANopt
313
280
  if nominal_voltage < 300
314
281
  nominal_voltage *= Math.sqrt(3)
315
282
  end
316
- nominal_voltage = nominal_voltage
317
283
 
318
284
  # max_power_kw
319
285
  # max_reactive_power_kvar
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  module URBANopt
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  require 'urbanopt/scenario/scenario_runner_base'
@@ -1,41 +1,6 @@
1
1
  # *********************************************************************************
2
- # URBANopt™, Copyright (c) 2019-2022, 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
- # Redistribution of this software, without modification, must refer to the software
20
- # by the same designation. Redistribution of a modified version of this software
21
- # (i) may not refer to the modified version by the same designation, or by any
22
- # confusingly similar designation, and (ii) must refer to the underlying software
23
- # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
- # the term “URBANopt”, or any confusingly similar designation may not be used to
25
- # refer to any modified version of this software or any modified version of the
26
- # underlying software originally provided by Alliance without the prior written
27
- # consent of Alliance.
28
-
29
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
- # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
- # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
- # OF THE POSSIBILITY OF SUCH DAMAGE.
2
+ # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
3
+ # See also https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md
39
4
  # *********************************************************************************
40
5
 
41
6
  require 'csv'
@@ -45,10 +10,11 @@ require 'json'
45
10
  module URBANopt
46
11
  module Scenario
47
12
  class ResultVisualization
48
- def self.create_visualization(run_dir, feature = true, feature_names = false)
13
+ def self.create_visualization(default_report_list, feature = true, feature_names = false)
49
14
  @all_results = []
50
15
  name = nil
51
- run_dir.each do |folder|
16
+
17
+ default_report_list.each do |folder|
52
18
  # create visualization for scenarios
53
19
  case feature
54
20
  when false
@@ -57,11 +23,14 @@ module URBANopt
57
23
 
58
24
  # create visualization for features
59
25
  when true
60
- index = run_dir.index(folder)
26
+ index = default_report_list.index(folder)
61
27
  name = "#{folder.split('/')[-3]}-#{feature_names[index]}"
62
28
  csv_dir = folder
63
29
  end
64
30
 
31
+ # get JSON report
32
+ json_report = folder.gsub('.csv', '.json')
33
+
65
34
  if File.exist?(csv_dir)
66
35
  size = CSV.open(csv_dir).readlines.size
67
36
 
@@ -210,6 +179,7 @@ module URBANopt
210
179
  results['name'] = name
211
180
  results['monthly_values'] = {}
212
181
  results['annual_values'] = {}
182
+ results['qaqc_flags'] = {}
213
183
 
214
184
  if @jan_next_year_index.nil? || @feb_index.nil? || @mar_index.nil? || @apr_index.nil? || @may_index.nil? || @jun_index.nil? || @jul_index.nil? || @aug_index.nil? || @sep_index.nil? || @oct_index.nil? || @nov_index.nil? || @dec_index.nil?
215
185
  results['complete_simulation'] = false
@@ -230,6 +200,18 @@ module URBANopt
230
200
  end
231
201
  end
232
202
 
203
+ # QAQC flags by category (if present)
204
+ if File.exist?(json_report)
205
+ report_data = JSON.parse(File.read(json_report))
206
+ if feature == false
207
+ # adjust nesting for scenario report
208
+ report_data = report_data['scenario_report']
209
+ end
210
+
211
+ if report_data.key?('qaqc_flags')
212
+ results['qaqc_flags'] = report_data['qaqc_flags']
213
+ end
214
+ end
233
215
  end
234
216
 
235
217
  unless results.nil?
@@ -237,13 +219,13 @@ module URBANopt
237
219
  end
238
220
  end
239
221
 
240
- # create json with required data stored in a variable
222
+ # create js file with required data stored in a variable
241
223
  if feature == false
242
224
  # In case of scenario visualization store result at top of the run folder
243
- results_path = File.expand_path('../../scenarioData.js', run_dir[0])
225
+ results_path = File.expand_path('../../scenarioData.js', default_report_list[0])
244
226
  else
245
227
  # In case of feature visualization store result at top of scenario folder folder
246
- results_path = File.expand_path('../../../scenarioData.js', run_dir[0])
228
+ results_path = File.expand_path('../../../scenarioData.js', default_report_list[0])
247
229
  end
248
230
  File.open(results_path, 'w') do |file|
249
231
  file << "var scenarioData = #{JSON.pretty_generate(@all_results)};"