urbanopt-reopt 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 +27 -0
- data/.rakeTasks +7 -0
- data/.rdoc_options +37 -0
- data/.rspec +3 -0
- data/.rubocop.yml +9 -0
- data/.travis.yml +22 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +67 -0
- data/Jenkinsfile +10 -0
- data/LICENSE.md +27 -0
- data/RDOC_MAIN.md +176 -0
- data/README.md +177 -0
- data/Rakefile +30 -0
- data/deploy_docs.sh +5 -0
- data/developer_nrel_key.rb +31 -0
- data/doc_templates/LICENSE.md +27 -0
- data/doc_templates/README.md.erb +42 -0
- data/doc_templates/copyright_erb.txt +31 -0
- data/doc_templates/copyright_js.txt +4 -0
- data/doc_templates/copyright_ruby.txt +29 -0
- data/docs/.gitignore +3 -0
- data/docs/.vuepress/components/InnerJsonSchema.vue +78 -0
- data/docs/.vuepress/components/JsonSchema.vue +12 -0
- data/docs/.vuepress/components/ReoptInputSchema.vue +12 -0
- data/docs/.vuepress/components/ReoptOutputSchema.vue +12 -0
- data/docs/.vuepress/components/StaticLink.vue +8 -0
- data/docs/.vuepress/config.js +16 -0
- data/docs/.vuepress/highlight.js +8 -0
- data/docs/.vuepress/public/custom_rdoc_styles.css +58 -0
- data/docs/.vuepress/utils.js +17 -0
- data/docs/README.md +196 -0
- data/docs/package-lock.json +254 -0
- data/docs/package.json +22 -0
- data/docs/schemas/reopt-input-schema.md +57 -0
- data/docs/schemas/reopt-output-schema.md +66 -0
- data/index.html +1 -0
- data/index.md +176 -0
- data/lib/files/.gitkeep +0 -0
- data/lib/urbanopt/reopt/extension.rb +44 -0
- data/lib/urbanopt/reopt/feature_report_adapter.rb +364 -0
- data/lib/urbanopt/reopt/reopt_lite_api.rb +230 -0
- data/lib/urbanopt/reopt/reopt_logger.rb +42 -0
- data/lib/urbanopt/reopt/reopt_post_processor.rb +245 -0
- data/lib/urbanopt/reopt/reopt_schema/reopt_input_schema.json +1111 -0
- data/lib/urbanopt/reopt/reopt_schema/reopt_output_schema.json +538 -0
- data/lib/urbanopt/reopt/scenario/reopt_scenario_csv.rb +115 -0
- data/lib/urbanopt/reopt/scenario_report_adapter.rb +404 -0
- data/lib/urbanopt/reopt/version.rb +35 -0
- data/lib/urbanopt/reopt.rb +36 -0
- data/lib/urbanopt/reopt_scenario.rb +31 -0
- data/lib/urbanopt-reopt.rb +31 -0
- data/urbanopt-reopt.gemspec +33 -0
- metadata +194 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
URBANopt, Copyright (c) 2019-2020, 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
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
21
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
22
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
23
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
25
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
26
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
27
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%#= README.md.erb is used to auto-generate README.md. %>
|
2
|
+
<%#= To manually maintain README.md throw away README.md.erb and manually edit README.md %>
|
3
|
+
###### (Automatically generated documentation)
|
4
|
+
|
5
|
+
# <%= name %>
|
6
|
+
|
7
|
+
## Description
|
8
|
+
<%= description %>
|
9
|
+
|
10
|
+
## Modeler Description
|
11
|
+
<%= modelerDescription %>
|
12
|
+
|
13
|
+
## Measure Type
|
14
|
+
<%= measureType %>
|
15
|
+
|
16
|
+
## Taxonomy
|
17
|
+
<%= taxonomy %>
|
18
|
+
|
19
|
+
## Arguments
|
20
|
+
|
21
|
+
<% arguments.each do |argument| %>
|
22
|
+
### <%= argument[:display_name] %>
|
23
|
+
<%= argument[:description] %>
|
24
|
+
**Name:** <%= argument[:name] %>,
|
25
|
+
**Type:** <%= argument[:type] %>,
|
26
|
+
**Units:** <%= argument[:units] %>,
|
27
|
+
**Required:** <%= argument[:required] %>,
|
28
|
+
**Model Dependent:** <%= argument[:model_dependent] %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if arguments.size == 0 %>
|
32
|
+
<%= "This measure does not have any user arguments" %>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<% if outputs.size > 0 %>
|
36
|
+
## Outputs
|
37
|
+
<% output_names = [] %>
|
38
|
+
<% outputs.each do |output| %>
|
39
|
+
<% output_names << output[:display_name] %>
|
40
|
+
<% end %>
|
41
|
+
<%= output_names.join(", ") %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%
|
2
|
+
# *********************************************************************************
|
3
|
+
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
4
|
+
# contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
7
|
+
# are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice, this list
|
10
|
+
# of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright notice, this
|
13
|
+
# list of conditions and the following disclaimer in the documentation and/or other
|
14
|
+
# materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of the copyright holder nor the names of its contributors may be
|
17
|
+
# used to endorse or promote products derived from this software without specific
|
18
|
+
# prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
23
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
24
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
25
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
27
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
28
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
29
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
# *********************************************************************************
|
31
|
+
%>
|
@@ -0,0 +1,29 @@
|
|
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
|
+
# *********************************************************************************
|
data/docs/.gitignore
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<a v-if="rawMode" @click="rawMode = false">view pretty</a>
|
4
|
+
<a v-if="!rawMode" @click="rawMode = true">view raw</a>
|
5
|
+
<div v-show="!rawMode" ref="schemaTarget" class="schema-pretty"/>
|
6
|
+
<pre v-show="rawMode"><code v-html="schemaFormatted" class="json"/></pre>
|
7
|
+
</div>
|
8
|
+
</template>
|
9
|
+
<script>
|
10
|
+
import "json-schema-view-js/dist/style.css";
|
11
|
+
import "highlight.js/styles/railscasts.css";
|
12
|
+
import highlightJson from "../highlight";
|
13
|
+
import { emptyPromise } from '../utils';
|
14
|
+
const JSONSchemaViewP = emptyPromise();
|
15
|
+
const $RefParserP = emptyPromise();
|
16
|
+
export default {
|
17
|
+
name: "InnerJsonSchema",
|
18
|
+
props: ["schema"],
|
19
|
+
data() {
|
20
|
+
return {
|
21
|
+
rawMode: false,
|
22
|
+
};
|
23
|
+
},
|
24
|
+
created() {
|
25
|
+
import("json-schema-view-js").then(JSONSchemaViewP.resolve);
|
26
|
+
import("json-schema-ref-parser/dist/ref-parser.js").then($RefParserP.resolve);
|
27
|
+
},
|
28
|
+
computed: {
|
29
|
+
view() {
|
30
|
+
return Promise.all([$RefParserP, JSONSchemaViewP])
|
31
|
+
.then(([$RefParser]) => $RefParser.default.dereference(this.schema))
|
32
|
+
.then(
|
33
|
+
s =>
|
34
|
+
new window.JSONSchemaView(s, 2, {
|
35
|
+
theme: "dark"
|
36
|
+
})
|
37
|
+
);
|
38
|
+
},
|
39
|
+
schemaFormatted() {
|
40
|
+
return highlightJson(JSON.stringify(this.schema, null, 2));
|
41
|
+
}
|
42
|
+
},
|
43
|
+
methods: {
|
44
|
+
async replaceRenderedSchema() {
|
45
|
+
const v = await this.view;
|
46
|
+
this.$refs.schemaTarget.innerHtml = "";
|
47
|
+
this.$refs.schemaTarget.appendChild(v.render());
|
48
|
+
}
|
49
|
+
},
|
50
|
+
watch: {
|
51
|
+
schema: {
|
52
|
+
handler: "replaceRenderedSchema",
|
53
|
+
immediate: true
|
54
|
+
}
|
55
|
+
}
|
56
|
+
};
|
57
|
+
</script>
|
58
|
+
<style>
|
59
|
+
.schema-pretty {
|
60
|
+
margin-top: 0.85rem;
|
61
|
+
background-color: #282c34;
|
62
|
+
padding: 1rem 1rem;
|
63
|
+
border-radius: 3px;
|
64
|
+
}
|
65
|
+
.json-formatter-row a {
|
66
|
+
color: white;
|
67
|
+
}
|
68
|
+
.json-formatter-row .json-formatter-bracket,
|
69
|
+
.json-formatter-row .json-formatter-number {
|
70
|
+
color: #9090fb;
|
71
|
+
}
|
72
|
+
.json-formatter-row .json-formatter-key {
|
73
|
+
color: #8665d0;
|
74
|
+
}
|
75
|
+
.json-schema-view .object .inner.oneOf b {
|
76
|
+
color: aqua;
|
77
|
+
}
|
78
|
+
</style>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<template>
|
2
|
+
<JsonSchema :schema="schema"/>
|
3
|
+
</template>
|
4
|
+
<script>
|
5
|
+
import { default as schema } from "../../../lib/urbanopt/reopt/reopt_schema/reopt_input_schema.json";
|
6
|
+
export default {
|
7
|
+
name: "ReoptSchema",
|
8
|
+
data() {
|
9
|
+
return { schema };
|
10
|
+
}
|
11
|
+
};
|
12
|
+
</script>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<template>
|
2
|
+
<JsonSchema :schema="schema"/>
|
3
|
+
</template>
|
4
|
+
<script>
|
5
|
+
import { default as schema } from "../../../lib/urbanopt/reopt/reopt_schema/reopt_output_schema.json";
|
6
|
+
export default {
|
7
|
+
name: "ReoptOutputSchema",
|
8
|
+
data() {
|
9
|
+
return { schema };
|
10
|
+
}
|
11
|
+
};
|
12
|
+
</script>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
:link, :visited {
|
2
|
+
color: #3eaf7c;
|
3
|
+
}
|
4
|
+
:link:hover {
|
5
|
+
border-bottom: 1px solid #3eaf7c;
|
6
|
+
}
|
7
|
+
body {
|
8
|
+
background-color: #fff;
|
9
|
+
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif !important;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
main h1, main h2, main h3, main h4, main h5, main h6 {
|
16
|
+
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
|
17
|
+
}
|
18
|
+
h1, h2, h3, h4, h5, h6 {
|
19
|
+
font-weight: 600;
|
20
|
+
line-height: 1.25;
|
21
|
+
}
|
22
|
+
main h1 {
|
23
|
+
margin-top: 1.5rem !important;
|
24
|
+
margin-bottom: 1rem;
|
25
|
+
font-size: 2.2rem;
|
26
|
+
}
|
27
|
+
|
28
|
+
#home-section, #search-section, #fileindex-section {
|
29
|
+
display: none !important;
|
30
|
+
}
|
31
|
+
.nav-section h3 {
|
32
|
+
color: #999;
|
33
|
+
font-size: 1.1em;
|
34
|
+
font-weight: 700;
|
35
|
+
background-color: #fff;
|
36
|
+
text-align: left;
|
37
|
+
}
|
38
|
+
nav .nav-section {
|
39
|
+
border-top: none;
|
40
|
+
font-size: unset;
|
41
|
+
}
|
42
|
+
|
43
|
+
.link-list a {
|
44
|
+
display: inline-block;
|
45
|
+
padding: .35rem 1rem .35rem 2rem;
|
46
|
+
font-weight: 400;
|
47
|
+
color: #2c3e50;
|
48
|
+
border-left: .25rem solid transparent;
|
49
|
+
padding: .35rem 1rem .35rem 1.25rem;
|
50
|
+
line-height: 1.4;
|
51
|
+
width: 100%;
|
52
|
+
box-sizing: border-box;
|
53
|
+
}
|
54
|
+
.link-list a:hover, .link-list :link:hover {
|
55
|
+
color: #3eaf7c;
|
56
|
+
border-bottom: none;
|
57
|
+
}
|
58
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export function emptyPromise() {
|
2
|
+
let res;
|
3
|
+
let rej;
|
4
|
+
const p = new Promise((resolve, reject) => {
|
5
|
+
res = resolve;
|
6
|
+
rej = reject;
|
7
|
+
});
|
8
|
+
p.pending = true;
|
9
|
+
p.resolved = p.rejected = null;
|
10
|
+
p.resolve = (...args) => {
|
11
|
+
res(...args); p.resolved = true; p.rejected = false; p.pending = false;
|
12
|
+
};
|
13
|
+
p.reject = (...args) => {
|
14
|
+
rej(...args); p.rejected = true; p.resolved = false; p.pending = false;
|
15
|
+
};
|
16
|
+
return p;
|
17
|
+
}
|
data/docs/README.md
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
# URBANopt REopt Gem
|
2
|
+
|
3
|
+
### <StaticLink target="\_blank" href="rdoc/">Rdocs</StaticLink>
|
4
|
+
|
5
|
+
The **URBANopt REopt Gem** extends a **URBANopt::Scenario::DefaultReports::ScenarioReport** and **URBANopt::Scenario::DefaultReports::FeatureReport** with the ability to derive cost-optimal distributed energy resource (DER) technology sizes and annual dispatch strageties via the <StaticLink target="\_blank" href="https://reopt.nrel.gov/tool">REopt Lite</StaticLink> decision support platform.
|
6
|
+
REopt Lite is a technoeconomic model which leverages mixed integer linear programming to identify the cost-optimal sizing of solar PV, Wind, Storage and/or diesel generation given an electric load profile, a utility rate tariff and other technoeconomic parameters. See <StaticLink target="\_blank" href="https://developer.nrel.gov/docs/energy-optimization/reopt-v1/">https://developer.nrel.gov/docs/energy-optimization/reopt-v1/</StaticLink> for more detailed information on input parameters and default assumptions.
|
7
|
+
|
8
|
+
The REopt Gem accomplishes three basic functions (described more below in the _Functionality_ section):
|
9
|
+
|
10
|
+
1. Accepts a json (or hash) of **assumptions** (i.e. utility rate, installation costs, escalation rates) to use in running REopt for a Scenario or Feature Report
|
11
|
+
2. Updates the **distributed_generation** attributes of a Feature Report or Scenario Report based on a cost-optimal DER system
|
12
|
+
3. Updates the **timeseries_CSV** attributes of a Feature Report or Scenario Report based on the dispatch of a cost-optimal DER system
|
13
|
+
|
14
|
+
Moreover, the REopt Gem can be run in several modes, either on:
|
15
|
+
|
16
|
+
* A Feature Report,
|
17
|
+
* A collection of Feature Reports
|
18
|
+
* All the features in a Scenario Report before aggregating results at the scenario level
|
19
|
+
* The collection of features in aggregate as summarized in a Scenario Report
|
20
|
+
|
21
|
+
See the <StaticLink target="\_blank" href="https://github.com/urbanopt/urbanopt-example-reopt-project.git">example project</StaticLink> for more infomation about usage of this gem.
|
22
|
+
|
23
|
+
<b>Note:</b> This module requires an API Key from the <StaticLink target='blank' href="https://developer.nrel.gov/">NREL Developer Network</StaticLink>.
|
24
|
+
|
25
|
+
<StaticLink target="\_blank" href="https://urbanopt.github.io/urbanopt-reopt-gem/">RDoc Documentation</StaticLink>
|
26
|
+
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
See [https://docs.urbanopt.net/installation/installation.html](https://docs.urbanopt.net/installation/installation.html) for instructions on prerequiste software, including:
|
31
|
+
- Ruby 2.2.6
|
32
|
+
- Bundler 1.17.0
|
33
|
+
- OpenStudio 2.8.1
|
34
|
+
|
35
|
+
Add this line to your application's Gemfile:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'urbanopt-reopt'
|
39
|
+
```
|
40
|
+
|
41
|
+
And then execute:
|
42
|
+
|
43
|
+
$ bundle install
|
44
|
+
$ bundle update
|
45
|
+
|
46
|
+
Or install it yourself as:
|
47
|
+
|
48
|
+
$ gem install 'urbanopt-reopt'
|
49
|
+
|
50
|
+
## Functionality
|
51
|
+
|
52
|
+
This gem is used to call the REopt Lite API on a Scenario Report or Feature Report to update the object's Distributed Generation attributes (including system financial and sizing metrics) as shown in an example below:
|
53
|
+
```
|
54
|
+
"distributed_generation": {
|
55
|
+
"lcc_us_dollars": 100000000.0,
|
56
|
+
"npv_us_dollars": 10000000.0,
|
57
|
+
"year_one_energy_cost_us_dollars": 7000000.0,
|
58
|
+
"year_one_demand_cost_us_dollars": 3000000.0,
|
59
|
+
"year_one_bill_us_dollars": 10000000.0,
|
60
|
+
"total_energy_cost_us_dollars": 70000000.0,
|
61
|
+
"solar_pv": {
|
62
|
+
"size_kw": 30000.0
|
63
|
+
},
|
64
|
+
"wind": {
|
65
|
+
"size_kw": 0.0
|
66
|
+
},
|
67
|
+
"generator": {
|
68
|
+
"size_kw": 0.0
|
69
|
+
},
|
70
|
+
"storage": {
|
71
|
+
"size_kw": 2000.0,
|
72
|
+
"size_kwh": 5000.0
|
73
|
+
}
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
77
|
+
Moreover, the following optimal dispatch fields are added to its timeseries CSV. Where no system component is recommended the dispatch will be all zero (i.e. if no solar PV is recommended ElectricityProduced:PV:Total will be always be zero)
|
78
|
+
|
79
|
+
| output | unit |
|
80
|
+
| -----------------------------------------| ------- |
|
81
|
+
| ElectricityProduced:Total | kWh |
|
82
|
+
| Electricity:Load:Total | kWh |
|
83
|
+
| Electricity:Grid:ToLoad | kWh |
|
84
|
+
| Electricity:Grid:ToBattery | kWh |
|
85
|
+
| Electricity:Storage:ToLoad | kWh |
|
86
|
+
| Electricity:Storage:ToGrid | kWh |
|
87
|
+
| Electricity:Storage:StateOfCharge | kWh |
|
88
|
+
| ElectricityProduced:Generator:Total | kWh |
|
89
|
+
| ElectricityProduced:Generator:ToBattery | kWh |
|
90
|
+
| ElectricityProduced:Generator:ToLoad | kWh |
|
91
|
+
| ElectricityProduced:Generator:ToGrid | kWh |
|
92
|
+
| ElectricityProduced:PV:Total | kWh |
|
93
|
+
| ElectricityProduced:PV:ToBattery | kWh |
|
94
|
+
| ElectricityProduced:PV:ToLoad | kWh |
|
95
|
+
| ElectricityProduced:PV:ToGrid | kWh |
|
96
|
+
| ElectricityProduced:Wind:Total | kWh |
|
97
|
+
| ElectricityProduced:Wind:ToBattery | kWh |
|
98
|
+
| ElectricityProduced:Wind:ToLoad | kWh |
|
99
|
+
| ElectricityProduced:Wind:ToGrid | kWh |
|
100
|
+
|
101
|
+
|
102
|
+
The REopt Lite has default values for all non-required input parameters that are used unless the user specifies custom assumptions. See <StaticLink target="\_blank" href="https://developer.nrel.gov/docs/energy-optimization/reopt-v1/">https://developer.nrel.gov/docs/energy-optimization/reopt-v1/</StaticLink> for more detailed information on input parameters and default assumptions.
|
103
|
+
|
104
|
+
<b>Note:</b> Required attributes for a REopt run include latitude and longitude, parsed from the Feature or Scenario Report attributes. If no utility rate is specified in your assumptions, then a constant rate of $0.13 is assumed without demand charges. Also, by default, only solar PV and storage are considered in the analysis (i.e. Wind and Generators are excluded from consideration).
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
## Getting Started
|
109
|
+
|
110
|
+
The code below shows how to run the REopt API on a single Feature Report hash using this gem:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
require 'urbanopt/reopt'
|
114
|
+
|
115
|
+
DEVELOPER_NREL_KEY = "" # <insert a valid API key from https://developer.nrel.gov/signup >
|
116
|
+
|
117
|
+
#Load a Feature Report Hash
|
118
|
+
feature_reports_hash = {} # <insert a valid Feature Report hash here with latitude and longitude filled in>
|
119
|
+
|
120
|
+
#Create a Feature Report
|
121
|
+
feature_report = URBANopt::Scenario::DefaultReports::FeatureReport.new(feature_reports_hash)
|
122
|
+
|
123
|
+
#Specify a file name where REopt Lite results will be written in JSON format
|
124
|
+
reopt_output_file = File.join(feature_report.directory_name, 'feature_report_reopt_run.json')
|
125
|
+
|
126
|
+
#Specify a file name where the new timeseries CSV will be written after REopt Lite has determined cost optimal dispatch
|
127
|
+
timeseries_output_file = File.join(feature_report.directory_name, 'feature_report_timeseries.csv')
|
128
|
+
|
129
|
+
#Specify non-default REopt Lite assumptions, saved in JSON format, to be used in calling the API
|
130
|
+
reopt_assumptions_file = File.join(File.dirname(__FILE__), '../files/reopt_assumptions_basic.json')
|
131
|
+
|
132
|
+
#Create a REopt Lite Post Processor to call the API, note you will need a Developer.nrel.gov API key in this step
|
133
|
+
reopt_post_processor = URBANopt::REopt::REoptPostProcessor.new(nil, nil, nil, DEVELOPER_NREL_KEY)
|
134
|
+
|
135
|
+
#Call REopt Lite with the post processor to update the feature's distributed generation attributes and timeseries CSV.
|
136
|
+
updated_feature_report = reopt_post_processor.run_feature_report(feature_report,reopt_assumptions_file,reopt_output_file,timeseries_output_file)
|
137
|
+
|
138
|
+
```
|
139
|
+
|
140
|
+
More commonly, this gem can be used to run REopt a collection of features stored in a Scenario Report as show here:
|
141
|
+
```ruby
|
142
|
+
require 'urbanopt/reopt'
|
143
|
+
DEVELOPER_NREL_KEY = "" # <insert a valid API key from https://developer.nrel.gov/signup >
|
144
|
+
|
145
|
+
#Create a Scenario Report
|
146
|
+
scenario_report = URBANopt::Scenario::DefaultReports::ScenarioReport.new({:directory_name => File.join(File.dirname(__FILE__), 'run/example_scenario'), :timeseries_csv => {:path => File.join(File.dirname(__FILE__), 'run/example_scenario/timeseries.csv') }})
|
147
|
+
|
148
|
+
#Load Feature Reports into the Scenario Report
|
149
|
+
(1..2).each do |i|
|
150
|
+
feature_reports_path = File.join(File.dirname(__FILE__), "run/example_scenario/#{i}/010_default_feature_reports/default_feature_reports.json")
|
151
|
+
|
152
|
+
feature_reports_hash = nil
|
153
|
+
File.open(feature_reports_path, 'r') do |file|
|
154
|
+
feature_reports_hash = JSON.parse(file.read, symbolize_names: true)
|
155
|
+
end
|
156
|
+
|
157
|
+
feature_report = URBANopt::Scenario::DefaultReports::FeatureReport.new(feature_reports_hash)
|
158
|
+
|
159
|
+
feature_report_dir = File.join(File.dirname(__FILE__), "run/example_scenario/#{i}")
|
160
|
+
feature_report.directory_name = feature_report_dir
|
161
|
+
|
162
|
+
scenario_report.add_feature_report(feature_report)
|
163
|
+
end
|
164
|
+
|
165
|
+
#Specify non-default REopt Lite assumptions, saved in JSON format, to be used in calling the API
|
166
|
+
reopt_assumptions_file = File.join(File.dirname(__FILE__), 'files/reopt_assumptions_basic.json')
|
167
|
+
|
168
|
+
#Create a REopt Lite Post Processor to call the API, note you will need a Developer.nrel.gov API key in this step
|
169
|
+
reopt_post_processor = URBANopt::REopt::REoptPostProcessor.new(scenario_report, reopt_assumptions_file, nil, DEVELOPER_NREL_KEY)
|
170
|
+
|
171
|
+
#Call REopt Lite with the post processor once on the sceanrio's aggregated load to update the scenario's distributed generation attributes and timeseries CSV.
|
172
|
+
updated_scenario_report = reopt_post_processor.run_scenario_report(scenario_report)
|
173
|
+
|
174
|
+
```
|
175
|
+
|
176
|
+
## Testing
|
177
|
+
|
178
|
+
First, check out the repository (i.e. git clone this repo).
|
179
|
+
|
180
|
+
Next, obtain a developer.nrel.gov API key from the [NREL Developer Network](https://developer.nrel.gov/]). Copy and paste your key in to the _developer_nrel_key_._rb_ file then save the file:
|
181
|
+
|
182
|
+
DEVELOPER_NREL_KEY = '<insert your key here>'
|
183
|
+
|
184
|
+
Finally, execute:
|
185
|
+
|
186
|
+
$ bundle install
|
187
|
+
$ bundle update
|
188
|
+
$ bundle exec rake
|
189
|
+
|
190
|
+
|
191
|
+
## Releasing
|
192
|
+
|
193
|
+
* Update change log
|
194
|
+
* Update version in `/lib/urbanopt/reopt/version.rb`
|
195
|
+
* Merge down to master
|
196
|
+
* run `rake release` from master
|