urbanopt-rnm-us 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +32 -0
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +58 -0
- data/Gemfile +10 -0
- data/LICENSE.md +38 -0
- data/README.md +49 -0
- data/Rakefile +166 -0
- data/catalogs/average_peak_per_building_type.json +94 -0
- data/catalogs/extended_catalog.json +15109 -0
- data/lib/urbanopt-rnm.rb +41 -0
- data/lib/urbanopt/rnm.rb +59 -0
- data/lib/urbanopt/rnm/api_client.rb +296 -0
- data/lib/urbanopt/rnm/capacitor_opendss.rb +57 -0
- data/lib/urbanopt/rnm/carson_eq.rb +389 -0
- data/lib/urbanopt/rnm/consumers.rb +255 -0
- data/lib/urbanopt/rnm/conversion_to_opendss.rb +152 -0
- data/lib/urbanopt/rnm/geojson_input.rb +261 -0
- data/lib/urbanopt/rnm/input_files.rb +335 -0
- data/lib/urbanopt/rnm/logger.rb +52 -0
- data/lib/urbanopt/rnm/oh_ug_rate.rb +129 -0
- data/lib/urbanopt/rnm/post_processor.rb +220 -0
- data/lib/urbanopt/rnm/processor_opendss_catalog.rb +73 -0
- data/lib/urbanopt/rnm/prosumers.rb +372 -0
- data/lib/urbanopt/rnm/rnm_us_catalog_conversion.rb +140 -0
- data/lib/urbanopt/rnm/runner.rb +177 -0
- data/lib/urbanopt/rnm/scenario_report.rb +145 -0
- data/lib/urbanopt/rnm/substation_location.rb +63 -0
- data/lib/urbanopt/rnm/transformer_opendss.rb +67 -0
- data/lib/urbanopt/rnm/version.rb +45 -0
- data/lib/urbanopt/rnm/wires_class.rb +70 -0
- data/lib/urbanopt/rnm/wires_opendss.rb +93 -0
- data/urbanopt-rnm-us-gem.gemspec +37 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bfd1fdcbaf0908d6ec884147fd9a26c78429181063cadb15fd5210e89bacd83e
|
4
|
+
data.tar.gz: d8ca20d16669801961c405b8609f6a8adf21bfc2c5862e604e74f90732cece6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9364a3a2cd150e57ee2dff2e1f070065fdc83b35dc519361e9c076393e7f3ee9b290899fef8952b26eae42abc8872989fe5ad8a7ef00b7a1a35397273578a3c7
|
7
|
+
data.tar.gz: 0fcaf071315fac36a51abace8a64f3278d80c854fd6d85bbb7a63affa774cd0a09e7c4196e2aa0e71ee446d7e8f9cd8349e3c068b67d4ae7c235b82f03433a79
|
data/.gitignore
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
.bundle/
|
2
|
+
.DS_Store
|
3
|
+
/.yardoc
|
4
|
+
/.ruby-version
|
5
|
+
Gemfile.lock
|
6
|
+
/gems
|
7
|
+
/_yardoc/
|
8
|
+
/coverage/
|
9
|
+
/doc/
|
10
|
+
/pkg/
|
11
|
+
/spec/reports/
|
12
|
+
/spec/test/
|
13
|
+
/spec/test_reopt/
|
14
|
+
/tmp/
|
15
|
+
/test/
|
16
|
+
/lib/measures/test_results
|
17
|
+
/lib/measures/*/tests/output
|
18
|
+
*.gem
|
19
|
+
|
20
|
+
.rubocop*s3*
|
21
|
+
|
22
|
+
# rspec failure tracking
|
23
|
+
.rspec_status
|
24
|
+
|
25
|
+
# Ignore IDE files
|
26
|
+
/.idea
|
27
|
+
runner.conf
|
28
|
+
|
29
|
+
# ignore template files for now
|
30
|
+
/template_inputs/*
|
31
|
+
test_opendss_catalog.json
|
32
|
+
*.sql
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# URBANopt Contribution Policy
|
2
|
+
|
3
|
+
## Version 1.0
|
4
|
+
|
5
|
+
The URBANopt team welcomes your contribution to the project. You can contribute to the URBANopt project in several ways: by using the software, reporting issues, contributing documentation, or contributing code back to the project. The GitHub [Contributing to Open Source](https://opensource.guide/how-to-contribute/) guide provides a good overview. If you contribute code, you agree that your contribution may be incorporated into the URBANopt Software Development Kit (SDK) and made available under the URBANopt SDK license.
|
6
|
+
|
7
|
+
The contribution process for URBANopt is composed of three steps:
|
8
|
+
|
9
|
+
## 1. Send consent email
|
10
|
+
|
11
|
+
In order for us to distribute your code as part of URBANopt under the URBANopt SDK [license](https://github.com/urbanopt/urbanopt-scenario-gem/blob/develop/LICENSE.md), we’ll need your consent. An email acknowledging your understanding of these terms and agreeing to them is all that will be asked of any contributor. Send an email to the URBANopt project manager ([see below](#documentation) for the address) including the following text and a list of co-contributors (if any):
|
12
|
+
|
13
|
+
*I agree to contribute to the URBANopt SDK. I agree to the following terms and conditions for my contributions: First, I agree that I am licensing the copyright to my contributions under the terms of the current URBANopt SDK license. Second, I hereby grant to Alliance for Sustainable Energy, LLC, to any successor manager and distributor of URBANopt SDK appointed by the U.S. Department of Energy, and to all recipients of a version of URBANopt SDK that includes my contributions, a non-exclusive, worldwide, royalty-free, irrevocable patent license under any patent claims owned by me, or owned by my employer and known to me, that are or will be,necessarily infringed upon by my contributions alone, or by combination of my contributions with the version of URBANopt SDK to which they are contributed, to make, have made, use, offer to sell, sell, import, and otherwise transfer any version of URBANopt SDK that includes my contributions, in source code and object code form. Third, I represent and warrant that I am authorized to make the contributions and grant the foregoing license(s). Additionally, if, to my knowledge, my employer has rights to intellectual property that covers my contributions, I represent and warrant that I have received permission to make these contributions and grant the foregoing license(s) on behalf of my employer.*
|
14
|
+
|
15
|
+
Once we have your consent on file, you’ll only need to redo it if conditions change (e.g. a change of employer).
|
16
|
+
|
17
|
+
## 2. Scope agreement and timeline commitment
|
18
|
+
|
19
|
+
If your contribution is small (e.g. a bug fix), simply submit your contribution via GitHub. If you find a bug, first make sure it is not an already known issue, then report it in the GitHub [issue tracker](https://github.com/urbanopt/urbanopt-scenario-gem/issues) for this repository. If your contribution is larger (e.g. a new feature or new functionality/capability), we’ll need to evaluate your proposed contribution first. We may ask you to revise your materials and make changes to it, which we will then re-review.
|
20
|
+
|
21
|
+
## 3. Technical contribution process
|
22
|
+
|
23
|
+
We want URBANopt to adhere to our established quality standards. Smaller, non-code contributions may not require as much review as code contributions, but all contributions will be reviewed. Code contributions will initially be in a source control branch, and then will be merged into the official URBANopt repository after review and approval. Any bugs, either discovered by you, us, or any users will be tracked in our issue tracker. We request that you take full responsibility for correcting bugs. Be aware that, unless notified otherwise, the correction of bugs takes precedence over the submission or creation of new code.
|
24
|
+
|
25
|
+
### Release Schedule
|
26
|
+
|
27
|
+
Contributions should be aligned with the URBANopt release schedule. The URBANopt SDK is currently released publicly two times each year (approximately on the last workday of March and October). There are cutoff dates for when new contributions are allowed for the upcoming release (approximately two weeks before release date). If your contribution is incomplete or comes in past the cutoff date for a release, we reserve the right to hold your code for a later release.
|
28
|
+
|
29
|
+
### Coding Standards
|
30
|
+
|
31
|
+
Make sure you read and follow the coding standards when writing URBANopt SDK code. Although these standards are not complete or very detailed, they should give you an idea of the style that we would like you to adopt. New additions to the URBANopt SDK must be written using object-oriented programming techniques and practices. Please also look at the URBANopt SDK code itself as an example of the preferred coding style.
|
32
|
+
|
33
|
+
### Code Reviews
|
34
|
+
|
35
|
+
You will be working and testing your code in a source control branch. When a piece of functionality is complete, tested and working, let us know and we will review your code. If the functionality that you contributed is complex, we may ask you for a written design document as well. We want your code to follow coding standards, be clear, readable, and maintainable, and of course it should do what it is supposed to do. We will look for errors, style issues, comments (or lack thereof), and any other issues in your code. We will inform you of our comments and we expect you to make the recommended changes. New re-reviews may be expected until the code complies with our required processes.
|
36
|
+
|
37
|
+
### Unit Tests
|
38
|
+
|
39
|
+
We ask that you supply unit tests along with the code that you have written. A unit test is a program that exercises your code in isolation to verify that it does what it is supposed to do. Your unit tests are very important to us. First, they give an indication that your code works according to its intended functionality. Second, we execute your unit tests automatically along with our unit tests to verify that the overall URBANopt SDK code continues to work.
|
40
|
+
|
41
|
+
### Code Coverage
|
42
|
+
|
43
|
+
We require that your unit tests provide an adequate coverage of the source code you are submitting. You will need to design your unit tests in such a way that all critical parts of the code (at least) are tested and verified.
|
44
|
+
|
45
|
+
### Documentation
|
46
|
+
|
47
|
+
Proper documentation is crucial for our users, without it users will not know how to use your contribution. We require that you create user documentation so that end users know how to use your new functionality.
|
48
|
+
|
49
|
+
For further questions or information:
|
50
|
+
|
51
|
+
- Ben Polly\
|
52
|
+
URBANopt Project Management\
|
53
|
+
ben.polly@nrel.gov\
|
54
|
+
(303) 384-7429
|
55
|
+
|
56
|
+
URBANopt is funded by the U.S. Department of Energy (DOE) and managed by the National Renewable Energy Laboratory (NREL).
|
57
|
+
|
58
|
+
URBANopt is developed in collaboration with NREL, LBNL, and private firms.
|
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in urbanopt-scenario-gem.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# if you want to use local gems during development, use this environment variable to enable them
|
7
|
+
allow_local = ENV['FAVOR_LOCAL_GEMS']
|
8
|
+
|
9
|
+
# Below is an example of how to configure the gemfile for developing with local gems
|
10
|
+
# modify as appropriate
|
data/LICENSE.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
contributors. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
Redistributions of source code must retain the above copyright notice, this list
|
8
|
+
of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
Redistributions in binary form must reproduce the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer in the documentation and/or other
|
12
|
+
materials provided with the distribution.
|
13
|
+
|
14
|
+
Neither the name of the copyright holder nor the names of its contributors may be
|
15
|
+
used to endorse or promote products derived from this software without specific
|
16
|
+
prior written permission.
|
17
|
+
|
18
|
+
Redistribution of this software, without modification, must refer to the software
|
19
|
+
by the same designation. Redistribution of a modified version of this software
|
20
|
+
(i) may not refer to the modified version by the same designation, or by any
|
21
|
+
confusingly similar designation, and (ii) must refer to the underlying software
|
22
|
+
originally provided by Alliance as "URBANopt". Except to comply with the foregoing,
|
23
|
+
the term "URBANopt", or any confusingly similar designation may not be used to
|
24
|
+
refer to any modified version of this software or any modified version of the
|
25
|
+
underlying software originally provided by Alliance without the prior written
|
26
|
+
consent of Alliance.
|
27
|
+
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
29
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
30
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
31
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
32
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
33
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
34
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
35
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
36
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
37
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
*********************************************************************************
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# URBANopt RNM-US Gem
|
2
|
+
|
3
|
+
The URBANopt<sup>™</sup> RNM-US Gem includes functionalities to interface the URBANopt SDK to the RNM-US Gem for the development of a synthetic optimum distribution network in the considered district, given data related to the buildings energy consumption/DER energy generation and location, modeled by the other URBANopt modules.
|
4
|
+
The RNM-US Gem is used to collect required data for the execution of RNM-US, which has been modeled in the other URBANopt modules, translating information provided
|
5
|
+
in .json and .csv format into .txt files
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
The URBANopt RNM-US Gem extracts output values from the other URBANopt Gems, to create required input files for the execution of the RNM-US software for the development of a synthetic distribution grid.
|
10
|
+
|
11
|
+
RNM-US provides output results in GIS, JSON and OpenDSS format. The results in GIS format outline the graphical representation of the synthetic distribution network modeled, including a visual outline of the street map of the considered district, the location of the consumers, transformers and substations, including the power lines layout.
|
12
|
+
The JSON format output provides a set of results regarding size, costs and measures of the synthetic network modelled.
|
13
|
+
The OpenDSS format presents results for power system analysis and simulations.
|
14
|
+
|
15
|
+
The current functionalities of the RNM-US Gem include the creation of a streetmap text file, the substation txt file and multiple txt files related to the consumers peak loads and profiles and DERs peak generation and profiles.
|
16
|
+
The streetmap text file is developed from coordinates information provided by geoJSON feature file input. The customers and generators text files, which define all the network consumers and DG included in the project, are created from their peak electricity demand/generation, and building location, provided by csv and json feature_report files modeled by the URBANopt Scenario Gem.
|
17
|
+
The profiles txt files are divided among the consumers hourly profiles of active and reactive power and the DG hourly profiles of active and reactive power for the 2 most "extreme" days of maximum net demand and maximum net generation for the district .
|
18
|
+
Finally, the extended profiles txt files provide the active and reactive profiles for each consumer/DG for the whole year.
|
19
|
+
|
20
|
+
|
21
|
+
## Generate input files
|
22
|
+
|
23
|
+
The `create_inputs` rake command can be used to generate the RNM-US inputs for an arbitrary command. You will need to specify the path to the scenario results directory and the path to the GeoJSON feature file:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
bundle exec rake create_inputs[/path/to/example_project/run/scenario_name,/path/to/feature_file.json]
|
27
|
+
```
|
28
|
+
|
29
|
+
### Options
|
30
|
+
|
31
|
+
Several options can be set when creating the input files and running the RNM-US process.
|
32
|
+
|
33
|
+
1. REopt: Set the `reopt` argument to `true` when initializing the runner to use REopt results in the RNM-US inputs.
|
34
|
+
1. Underground cables ratio: Set the `underground_cables_ratio` field at the project level in the JSON Feature File to specify the ratio of underground cables to overhead cables. If this field is not set, the default value of 0.9 will be used.
|
35
|
+
1. Low-Voltage Only: Set the boolean `only_lv_consumers` field at the project level in the JSON Feature File. If set to `true`, only low voltage consumers will be considered in the RNM analysis. If this field is not set, the default value of `true` will be used.
|
36
|
+
|
37
|
+
## Generating OpenDSS catalog
|
38
|
+
|
39
|
+
An OpenDSS-formatted catalog can be generated from the extended catalog with the following command:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
bundle exec rake create_opendss_catalog[/desired/path/to/opendss_catalog.json]
|
43
|
+
```
|
44
|
+
|
45
|
+
## Testing
|
46
|
+
|
47
|
+
```bash
|
48
|
+
bundle exec rspec
|
49
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2021, 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.
|
39
|
+
# *********************************************************************************
|
40
|
+
|
41
|
+
require 'bundler/gem_tasks'
|
42
|
+
require 'rspec/core/rake_task'
|
43
|
+
|
44
|
+
RSpec::Core::RakeTask.new(:spec)
|
45
|
+
|
46
|
+
# Load in the rake tasks from the base extension gem
|
47
|
+
require 'urbanopt/rnm'
|
48
|
+
|
49
|
+
require 'rubocop/rake_task'
|
50
|
+
RuboCop::RakeTask.new
|
51
|
+
|
52
|
+
task default: :spec
|
53
|
+
|
54
|
+
# example rake task
|
55
|
+
desc 'Return gem version number'
|
56
|
+
task :version_number do
|
57
|
+
puts "Version is: #{URBANopt::RNM::VERSION}"
|
58
|
+
end
|
59
|
+
|
60
|
+
# create input files for a project
|
61
|
+
# pass in the path to the scenario csv, the path to the json feature file, and whether this a reopt analysis (true/false)
|
62
|
+
desc 'Create input files'
|
63
|
+
task :create_inputs, [:scenario_csv_path, :feature_file_path, :reopt, :opendss_catalog] do |t, args|
|
64
|
+
puts 'Creating input files'
|
65
|
+
# if no path passed in, use default:
|
66
|
+
scenario_csv_path = args[:scenario_csv_path] || 'spec/test/example_project/baseline_scenario.csv'
|
67
|
+
root_dir, scenario_file_name = File.split(File.expand_path(scenario_csv_path))
|
68
|
+
scenario_name = File.basename(scenario_file_name, File.extname(scenario_file_name))
|
69
|
+
run_dir = File.join(root_dir, 'run', scenario_name.downcase)
|
70
|
+
puts "SCENARIO NAME: #{scenario_name}"
|
71
|
+
|
72
|
+
# set up variables
|
73
|
+
feature_file_path = args[:feature_file_path] || File.join(root_dir, 'example_project_with_network_and_streets.json')
|
74
|
+
reopt = args[:reopt] || false
|
75
|
+
reopt = reopt == 'true'
|
76
|
+
opendss_catalog = args[:opendss_catalog] || false
|
77
|
+
opendss_catalog = opendss_catalog == 'true'
|
78
|
+
|
79
|
+
extended_catalog_path = File.join(File.dirname(__FILE__), 'catalogs', 'extended_catalog.json')
|
80
|
+
average_peak_catalog_path = File.join(File.dirname(__FILE__), 'catalogs', 'average_peak_per_building_type.json')
|
81
|
+
|
82
|
+
if !File.exist?(File.join(File.dirname(__FILE__), '..', 'test'))
|
83
|
+
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', 'test'))
|
84
|
+
end
|
85
|
+
|
86
|
+
# generate inputs
|
87
|
+
runner = URBANopt::RNM::Runner.new(scenario_name, run_dir, scenario_csv_path, feature_file_path, extended_catalog_path: extended_catalog_path, average_peak_catalog_path: average_peak_catalog_path, reopt: reopt, opendss_catalog: opendss_catalog)
|
88
|
+
runner.create_simulation_files
|
89
|
+
puts '....done!'
|
90
|
+
end
|
91
|
+
|
92
|
+
# create input files for a project using defaults
|
93
|
+
# pass in the path to the scenario csv, the path to the json feature file, and whether this a reopt analysis (true/false)
|
94
|
+
desc 'Create input files with defaults'
|
95
|
+
task :create_inputs_default, [:scenario_csv_path, :feature_file_path] do |t, args|
|
96
|
+
puts 'Creating input files with defaulted settings'
|
97
|
+
# if no path passed in, use default:
|
98
|
+
scenario_csv_path = args[:scenario_csv_path] || 'spec/test/example_project/baseline_scenario.csv'
|
99
|
+
root_dir, scenario_file_name = File.split(File.expand_path(scenario_csv_path))
|
100
|
+
scenario_name = File.basename(scenario_file_name, File.extname(scenario_file_name))
|
101
|
+
run_dir = File.join(root_dir, 'run', scenario_name.downcase)
|
102
|
+
puts "SCENARIO NAME: #{scenario_name}"
|
103
|
+
|
104
|
+
# set up variables
|
105
|
+
feature_file_path = args[:feature_file_path] || File.join(root_dir, 'example_project_with_network_and_streets.json')
|
106
|
+
|
107
|
+
if !File.exist?(File.join(File.dirname(__FILE__), '..', 'test'))
|
108
|
+
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', 'test'))
|
109
|
+
end
|
110
|
+
|
111
|
+
# generate inputs
|
112
|
+
runner = URBANopt::RNM::Runner.new(scenario_name, run_dir, scenario_csv_path, feature_file_path)
|
113
|
+
runner.create_simulation_files
|
114
|
+
puts '....done!'
|
115
|
+
end
|
116
|
+
|
117
|
+
# run simulation and retrieve results
|
118
|
+
# pass in the path to the scenario csv, whether this is a reopt analysis (true/false), and whether to use localhost RNM API (true/false)
|
119
|
+
desc 'Run Simulation'
|
120
|
+
task :run_simulation, [:scenario_csv_path, :reopt, :use_localhost] do |t, args|
|
121
|
+
puts 'Running simulation'
|
122
|
+
# if no path passed in, use default:
|
123
|
+
scenario_csv = args[:scenario_csv_path] || 'spec/test/example_project/run/baseline_scenario'
|
124
|
+
root_dir, scenario_file_name = File.split(File.expand_path(scenario_csv))
|
125
|
+
scenario_name = File.basename(scenario_file_name, File.extname(scenario_file_name))
|
126
|
+
run_dir = File.join(root_dir, 'run', scenario_name.downcase)
|
127
|
+
|
128
|
+
rnm_dir = File.join(run_dir, 'rnm-us')
|
129
|
+
reopt = args[:reopt] || false
|
130
|
+
reopt = reopt == 'true'
|
131
|
+
|
132
|
+
use_localhost = args[:use_localhost] || false
|
133
|
+
use_localhost = use_localhost == 'true'
|
134
|
+
|
135
|
+
if !File.exist?(rnm_dir)
|
136
|
+
raise 'No rnm-us directory found for this scenario...run the create_inputs rake task first.'
|
137
|
+
end
|
138
|
+
|
139
|
+
puts "scenario dir path: #{run_dir}"
|
140
|
+
puts "reopt: #{reopt}"
|
141
|
+
puts "use_localhost: #{use_localhost}"
|
142
|
+
api_client = URBANopt::RNM::ApiClient.new(scenario_name, rnm_dir, use_localhost = use_localhost, reopt = reopt)
|
143
|
+
# zip inputs
|
144
|
+
api_client.zip_input_files
|
145
|
+
api_client.submit_simulation
|
146
|
+
api_client.get_results
|
147
|
+
|
148
|
+
puts '...done!'
|
149
|
+
end
|
150
|
+
|
151
|
+
# Create opendss catalog from extended catalog
|
152
|
+
# pass in the path and filename where the OpenDSS catalog should be saved
|
153
|
+
desc 'Create OpenDSS catalog'
|
154
|
+
task :create_opendss_catalog, [:save_path] do |t, args|
|
155
|
+
puts 'Creating OpenDSS catalog'
|
156
|
+
# if no path passed in, use default (current dir):
|
157
|
+
save_path = args[:save_path] || './opendss_catalog.json'
|
158
|
+
|
159
|
+
extended_catalog_path = File.join(File.dirname(__FILE__), 'catalogs', 'extended_catalog.json')
|
160
|
+
opendss_catalog = URBANopt::RNM::ConversionToOpendssCatalog.new(extended_catalog_path)
|
161
|
+
# create catalog and save to specified path
|
162
|
+
opendss_catalog.create_catalog(save_path)
|
163
|
+
|
164
|
+
puts "Catalog saved to #{save_path}"
|
165
|
+
puts '....done!'
|
166
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"building type": "Office",
|
4
|
+
"sub-type": "SmallOffice",
|
5
|
+
"average peak demand (kW/ft2)": 0.0032,
|
6
|
+
"floor_area (ft2)": 5500
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"building type": "Office",
|
10
|
+
"sub-type": "MediumOffice",
|
11
|
+
"average peak demand (kW/ft2)": 0.0058,
|
12
|
+
"floor_area (ft2)": 53628
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"building type": "Office",
|
16
|
+
"sub-type": "LargeOffice",
|
17
|
+
"average peak demand (kW/ft2)": 0.0033,
|
18
|
+
"floor_area (ft2)": 498588
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"building type": "School",
|
22
|
+
"sub-type": "PrimarySchool",
|
23
|
+
"average peak demand (kW/ft2)": 0.0043,
|
24
|
+
"floor_area (ft2)": 73960
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"building type": "School",
|
28
|
+
"sub-type": "SecondarySchool",
|
29
|
+
"average peak demand (kW/ft2)": 0.0056,
|
30
|
+
"floor_area (ft2)": 210887
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"building type": "Retail",
|
34
|
+
"sub-type": "Stand-aloneRetail",
|
35
|
+
"average peak demand (kW/ft2)": 0.0037,
|
36
|
+
"floor_area (ft2)": 24962
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"building type": "Mall",
|
40
|
+
"sub-type": "StripMall",
|
41
|
+
"average peak demand (kW/ft2)": 0.0037,
|
42
|
+
"floor_area (ft2)": 22500
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"building type": "SuperMarket",
|
46
|
+
"average peak demand (kW/ft2)": 0.0077,
|
47
|
+
"floor_area (ft2)": 45000
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"building type": "Restaurant",
|
51
|
+
"sub-type": "QuickServiceRestaurant",
|
52
|
+
"average peak demand (kW/ft2)": 0.0144,
|
53
|
+
"floor_area (ft2)": 2500
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"building type": "Restaurant",
|
57
|
+
"sub-type": "FullServiceRestaurant",
|
58
|
+
"average peak demand (kW/ft2)": 0.0115,
|
59
|
+
"floor_area (ft2)": 5500
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"building type": "Hotel",
|
63
|
+
"sub-type": "SmallHotel",
|
64
|
+
"average peak demand (kW/ft2)": 0.0029,
|
65
|
+
"floor_area (ft2)": 43200
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"building type": "Hotel",
|
69
|
+
"sub-type": "LargeHotel",
|
70
|
+
"average peak demand (kW/ft2)": 0.0038,
|
71
|
+
"floor_area (ft2)": 122120
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"building type": "Hospital",
|
75
|
+
"average peak demand (kW/ft2)": 0.0064,
|
76
|
+
"floor_area (ft2)": 241351
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"building type": "Outpatient",
|
80
|
+
"average peak demand (kW/ft2)": 0.0071,
|
81
|
+
"floor_area (ft2)": 40946
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"building type": "Warehouse",
|
85
|
+
"average peak demand (kW/ft2)": 0.0017,
|
86
|
+
"floor_area (ft2)": 52045
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"building type": "Apartment",
|
90
|
+
"sub-type": "MidriseApartment",
|
91
|
+
"average peak demand (kW/ft2)": 0.0017,
|
92
|
+
"floor_area (ft2)": 33740
|
93
|
+
}
|
94
|
+
]
|