urbanopt-scenario 0.4.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +1 -1
  3. data/CHANGELOG.md +39 -0
  4. data/Gemfile +8 -14
  5. data/LICENSE.md +29 -17
  6. data/RDOC_MAIN.md +2 -2
  7. data/README.md +1 -1
  8. data/Rakefile +16 -6
  9. data/docs/.vuepress/components/InnerJsonSchema.vue +7 -15
  10. data/docs/.vuepress/config.js +13 -9
  11. data/docs/.vuepress/highlight.js +1 -1
  12. data/docs/.vuepress/json-schema-deref-loader.js +22 -0
  13. data/docs/README.md +2 -2
  14. data/docs/package-lock.json +429 -498
  15. data/docs/package.json +7 -4
  16. data/lib/urbanopt-scenario.rb +16 -6
  17. data/lib/urbanopt/scenario.rb +16 -6
  18. data/lib/urbanopt/scenario/default_reports.rb +16 -6
  19. data/lib/urbanopt/scenario/extension.rb +21 -9
  20. data/lib/urbanopt/scenario/logger.rb +16 -6
  21. data/lib/urbanopt/scenario/scenario_base.rb +20 -10
  22. data/lib/urbanopt/scenario/scenario_csv.rb +54 -28
  23. data/lib/urbanopt/scenario/scenario_datapoint_base.rb +20 -10
  24. data/lib/urbanopt/scenario/scenario_post_processor_base.rb +18 -8
  25. data/lib/urbanopt/scenario/scenario_post_processor_default.rb +40 -25
  26. data/lib/urbanopt/scenario/scenario_post_processor_opendss.rb +25 -15
  27. data/lib/urbanopt/scenario/scenario_runner_base.rb +22 -11
  28. data/lib/urbanopt/scenario/scenario_runner_osw.rb +22 -10
  29. data/lib/urbanopt/scenario/scenario_visualization.rb +25 -15
  30. data/lib/urbanopt/scenario/simulation_dir_base.rb +19 -9
  31. data/lib/urbanopt/scenario/simulation_dir_osw.rb +20 -10
  32. data/lib/urbanopt/scenario/simulation_mapper_base.rb +19 -9
  33. data/lib/urbanopt/scenario/version.rb +17 -7
  34. data/urbanopt-scenario-gem.gemspec +13 -8
  35. metadata +8 -65
  36. data/docs/.vuepress/components/ScenarioSchema.vue +0 -12
  37. data/docs/schemas/scenario-schema.md +0 -3
data/docs/package.json CHANGED
@@ -10,21 +10,24 @@
10
10
  },
11
11
  "author": "NREL",
12
12
  "dependencies": {
13
- "highlight.js": "^10.2.0",
13
+ "highlight.js": "^10.4.1",
14
14
  "json-schema-ref-parser": "^9.0.6",
15
15
  "json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
16
- "vuepress": "^1.5.4",
17
- "webpack-dev-middleware": "^3.7.2"
16
+ "vuepress": "^1.6.0",
17
+ "webpack-dev-middleware": "^3.6.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "braces": "^3.0.2",
21
21
  "dot-prop": "^5.3.0",
22
22
  "gh-pages": "^3.1.0",
23
+ "is-svg": ">=4.3.1",
23
24
  "js-yaml": "^3.14.0",
24
25
  "minimist": ">=1.2.3",
25
26
  "node-forge": ">=0.10.0",
26
27
  "serialize-javascript": "^5.0.1",
27
28
  "set-value": "^3.0.2",
28
- "yargs-parser": ">=18.1.1"
29
+ "ssri": ">=8.0.1",
30
+ "yargs-parser": "^20.2.1",
31
+ "ini": "^2.0.0"
29
32
  }
30
33
  }
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -39,14 +49,15 @@ module URBANopt
39
49
  end
40
50
 
41
51
  ##
42
- # Returns the absolute path of the measures or nil if there is none, can be used when configuring OSWs.
52
+ # [return:] Absolute path of the measures or nil if there is none, can be used when configuring OSWs.
43
53
  def measures_dir
44
54
  return File.absolute_path(File.join(@root_dir, 'lib', 'measures'))
45
55
  end
46
56
 
47
57
  ##
48
58
  # Relevant files such as weather data, design days, etc.
49
- # Return the absolute path of the files or nil if there is none, used when configuring OSWs
59
+ ##
60
+ # [return:] Absolute path of the files or nil if there is none, used when configuring OSWs
50
61
  def files_dir
51
62
  return nil
52
63
  end
@@ -54,7 +65,8 @@ module URBANopt
54
65
  ##
55
66
  # Doc templates are common files like copyright files which are used to update measures and other code.
56
67
  # Doc templates will only be applied to measures in the current repository.
57
- # Return the absolute path of the doc templates dir or nil if there is none.
68
+ ##
69
+ # [return:] Absolute path of the doc templates dir or nil if there is none.
58
70
  def doc_templates_dir
59
71
  return File.absolute_path(File.join(@root_dir, 'doc_templates'))
60
72
  end
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -36,10 +46,10 @@ module URBANopt
36
46
  # Initialize ScenarioBase attributes: +name+ , +root directory+ , +run directory+ and +feature_file+
37
47
  ##
38
48
  # [parameters:]
39
- # +name+ - _String_ - Human readable scenario name.
40
- # +root_dir+ - _String_ - Root directory for the scenario, contains Gemfile describing dependencies.
41
- # +run_dir+ - _String_ - Directory for simulation of this scenario, deleting run directory clears the scenario.
42
- # +feature_file+ - _FeatureFile_ - An instance of +URBANopt::Core::FeatureFile+ containing features for simulation.
49
+ # * +name+ - _String_ - Human readable scenario name.
50
+ # * +root_dir+ - _String_ - Root directory for the scenario, contains Gemfile describing dependencies.
51
+ # * +run_dir+ - _String_ - Directory for simulation of this scenario, deleting run directory clears the scenario.
52
+ # * +feature_file+ - _FeatureFile_ - An instance of +URBANopt::Core::FeatureFile+ containing features for simulation.
43
53
  def initialize(name, root_dir, run_dir, feature_file)
44
54
  @name = name
45
55
  @root_dir = root_dir
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -42,16 +52,16 @@ module URBANopt
42
52
  # The CSV file has three columns 1) feature_id, 2) feature_name, and 3) mapper_class_name. There is one row for each Feature.
43
53
  ##
44
54
  # [parameters:]
45
- # +name+ - _String_ - Human readable scenario name.
46
- # +root_dir+ - _String_ - Root directory for the scenario, contains Gemfile describing dependencies.
47
- # +run_dir+ - _String_ - Directory for simulation of this scenario, deleting run directory clears the scenario.
48
- # +feature_file+ - _URBANopt::Core::FeatureFile_ - FeatureFile containing features to simulate.
49
- # +mapper_files_dir+ - _String_ - Directory containing all mapper class files containing MapperBase definitions.
50
- # +csv_file+ - _String_ - Path to CSV file assigning a MapperBase class to each feature in feature_file.
51
- # +num_header_rows+ - _Strng_ - Number of header rows to skip in CSV file.
52
-
55
+ # * +name+ - _String_ - Human readable scenario name.
56
+ # * +root_dir+ - _String_ - Root directory for the scenario, contains Gemfile describing dependencies.
57
+ # * +run_dir+ - _String_ - Directory for simulation of this scenario, deleting run directory clears the scenario.
58
+ # * +feature_file+ - _URBANopt::Core::FeatureFile_ - FeatureFile containing features to simulate.
59
+ # * +mapper_files_dir+ - _String_ - Directory containing all mapper class files containing MapperBase definitions.
60
+ # * +csv_file+ - _String_ - Path to CSV file assigning a MapperBase class to each feature in feature_file.
61
+ # * +num_header_rows+ - _String_ - Number of header rows to skip in CSV file.
53
62
  def initialize(name, root_dir, run_dir, feature_file, mapper_files_dir, csv_file, num_header_rows)
54
63
  super(name, root_dir, run_dir, feature_file)
64
+ @root_dir = root_dir
55
65
  @mapper_files_dir = mapper_files_dir
56
66
  @csv_file = csv_file
57
67
  @num_header_rows = num_header_rows
@@ -72,28 +82,44 @@ module URBANopt
72
82
 
73
83
  # Require all simulation mappers in mapper_files_dir
74
84
  def load_mapper_files
75
- dirs = Dir.glob(File.join(@mapper_files_dir, '/*.rb'))
76
- # order is not guaranteed...attempt to add Baseline first, then High Efficiency
77
- ordered_dirs = []
78
- bindex = dirs.find_index { |i| i.include? 'Baseline.rb' }
79
- if bindex
80
- ordered_dirs << dirs[bindex]
81
- dirs.delete_at(bindex)
85
+
86
+ # loads default values from extension gem
87
+ options = OpenStudio::Extension::RunnerConfig.default_config
88
+ # check if runner.conf file exists
89
+ if File.exist?(File.join(@root_dir, OpenStudio::Extension::RunnerConfig::FILENAME))
90
+ runner_config = OpenStudio::Extension::RunnerConfig.new(@root_dir)
91
+ # use the default values overriden with runner.conf values
92
+ options = options.merge(runner_config.options)
93
+ end
94
+
95
+ # bundle path is assigned from the runner.conf if it exists or is assigned in the root_dir
96
+ bundle_path = !options.key?(:bundle_install_path) || options[:bundle_install_path] === '' ? File.join(@root_dir, '.bundle/install/') : options[:bundle_install_path]
97
+
98
+ # checks if bundle path doesn't exist or is empty
99
+ if !Dir.exists?(bundle_path) or Dir.empty?(bundle_path)
100
+ # install bundle
101
+ OpenStudio::Extension::Runner.new(@root_dir)
82
102
  end
83
- hindex = dirs.find_index { |i| i.include? 'HighEfficiency.rb' }
84
- if hindex
85
- ordered_dirs << dirs[hindex] if hindex
86
- dirs.delete_at(hindex)
103
+
104
+ # find all lib dirs in the bundle path and add them to the path
105
+ lib_dirs = Dir.glob(File.join(bundle_path, '/**/lib'))
106
+ lib_dirs.each do |ld|
107
+ # for now only add openstudio and urbanopt gems to the load path
108
+ if ld.include? 'urbanopt' or ld.include? 'openstudio'
109
+ puts "adding DIR to load path: #{ld}"
110
+ $LOAD_PATH.unshift(ld)
111
+ end
87
112
  end
88
- # then the rest
89
- ordered_dirs += dirs
90
113
 
91
- ordered_dirs.each do |f|
114
+ dirs = Dir.glob(File.join(@mapper_files_dir, '/*.rb'))
115
+
116
+ dirs.each do |f|
92
117
  require(f)
93
118
  rescue LoadError => e
94
119
  @@logger.error(e.message)
95
120
  raise
96
121
  end
122
+
97
123
  end
98
124
 
99
125
  # Gets all the simulation directories
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
- #
4
+
5
5
  # Redistribution and use in source and binary forms, with or without modification,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
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
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -38,10 +48,10 @@ module URBANopt
38
48
  # A Simulation Mapper will map the
39
49
  ##
40
50
  # [parameters:]
41
- # +scenario+ - _ScenarioBase_ - Scenario containing this ScenarioDatapoint.
42
- # +feature_id+ - _String_ - Unique id of the feature for this ScenarioDatapoint.
43
- # +feature_name+ - _String_ - Human readable name of the feature for this ScenarioDatapoint.
44
- # +mapper_class+ - _String_ - Name of Ruby class used to translate feature to simulation OSW.
51
+ # * +scenario+ - _ScenarioBase_ - Scenario containing this ScenarioDatapoint.
52
+ # * +feature_id+ - _String_ - Unique id of the feature for this ScenarioDatapoint.
53
+ # * +feature_name+ - _String_ - Human readable name of the feature for this ScenarioDatapoint.
54
+ # * +mapper_class+ - _String_ - Name of Ruby class used to translate feature to simulation OSW.
45
55
  def initialize(scenario, feature_id, feature_name, mapper_class)
46
56
  @scenario = scenario
47
57
  @feature_id = feature_id