Skip to content

Commit

Permalink
build based on c8db8a5
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed May 7, 2024
1 parent 06e8728 commit cd5bfc8
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 50 deletions.
8 changes: 6 additions & 2 deletions dev/developer/adding_tech/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
steam_turbine::Vector{String}
can_supply_steam_turbine::Vector{String}
electric_heater::Vector{String}
end</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/1199d1c007461c93b64887e2ef7634086f8dd9f3/src/core/types.jl#L17-L47">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="REopt.Techs-Tuple{Scenario}" href="#REopt.Techs-Tuple{Scenario}"><code>REopt.Techs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">Techs(s::Scenario)</code></pre><p>Create a <code>Techs</code> struct for the REoptInputs.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/1199d1c007461c93b64887e2ef7634086f8dd9f3/src/core/techs.jl#L76-L80">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="REopt.Techs-Tuple{REoptInputs, BAUScenario}" href="#REopt.Techs-Tuple{REoptInputs, BAUScenario}"><code>REopt.Techs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">Techs(p::REoptInputs, s::BAUScenario)</code></pre><p>Create a <code>Techs</code> struct for the BAUInputs</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/1199d1c007461c93b64887e2ef7634086f8dd9f3/src/core/techs.jl#L2-L6">source</a></section></article><p>From the <a href="#Techs">Techs</a> definition we can see that there are already a lot of different energy generation technology categories in REopt. Adding a new technology to the model could be as simple as adding the appropriate inputs to <code>REoptInputs</code> (described in the next section) and using the <code>Techs</code> structure to define which variables and constraints apply to the new technology.</p><p>The <code>PV</code> technology is also part of a unique set of <code>Techs</code>, namely the <code>techs.pv</code> (there can be multiple <code>PV</code> technologies in a single model as we will see soon). An example of a constraint applied over <code>techs.pv</code> is:</p><pre><code class="language-julia">@constraint(m, [loc in p.pvlocations],
can_serve_dhw::Vector{String}
can_serve_space_heating::Vector{String}
can_serve_process_heat::Vector{String}
ghp_techs::Vector{String}
end</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/c8db8a5bdee589112378a5c5a6ac79b1bcfadab5/src/core/types.jl#L17-L51">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="REopt.Techs-Tuple{Scenario}" href="#REopt.Techs-Tuple{Scenario}"><code>REopt.Techs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">Techs(s::Scenario)</code></pre><p>Create a <code>Techs</code> struct for the REoptInputs.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/c8db8a5bdee589112378a5c5a6ac79b1bcfadab5/src/core/techs.jl#L93-L97">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="REopt.Techs-Tuple{REoptInputs, BAUScenario}" href="#REopt.Techs-Tuple{REoptInputs, BAUScenario}"><code>REopt.Techs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">Techs(p::REoptInputs, s::BAUScenario)</code></pre><p>Create a <code>Techs</code> struct for the BAUInputs</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/NREL/REopt.jl/blob/c8db8a5bdee589112378a5c5a6ac79b1bcfadab5/src/core/techs.jl#L2-L6">source</a></section></article><p>From the <a href="#Techs">Techs</a> definition we can see that there are already a lot of different energy generation technology categories in REopt. Adding a new technology to the model could be as simple as adding the appropriate inputs to <code>REoptInputs</code> (described in the next section) and using the <code>Techs</code> structure to define which variables and constraints apply to the new technology.</p><p>The <code>PV</code> technology is also part of a unique set of <code>Techs</code>, namely the <code>techs.pv</code> (there can be multiple <code>PV</code> technologies in a single model as we will see soon). An example of a constraint applied over <code>techs.pv</code> is:</p><pre><code class="language-julia">@constraint(m, [loc in p.pvlocations],
sum(m[Symbol(&quot;dvSize&quot;*_n)][t] * p.pv_to_location[t][loc] for t in p.techs.pv) &lt;= p.maxsize_pv_locations[loc]
)</code></pre><p>Here we can see that the <code>dvSize</code> for each <code>techs.pv</code> is constrained based on the location of each <code>PV</code> technology. This constraint allows us to uniquely limit the <code>PV</code> capacity for roof mounted systems vs. ground mounted systems based on the available space at a site. We also see some additional inputs for the <code>PV</code> technology, such as the <code>pvlocations</code> and <code>maxsize_pv_locations</code>. Creating these input values is described in the next two sections.</p><h2 id=".-User-Inputs"><a class="docs-heading-anchor" href="#.-User-Inputs">2. User Inputs</a><a id=".-User-Inputs-1"></a><a class="docs-heading-anchor-permalink" href="#.-User-Inputs" title="Permalink"></a></h2><p>Any new technology should have a <code>technologyname.jl</code> file in the <code>src/core</code> directory. For example, in the <code>src/core/pv.jl</code> file we have a data structure and constructor for defining default values and creating the <code>PV</code> structure that is attached to the <a href="../../reopt/inputs/#Scenario">Scenario</a>. Once the new technology&#39;s data structure is defined it must be added to the <code>Scenario</code> structure (see <code>src/core/scenario.jl</code>). </p><p>When adding a new technology to REopt one must decide on how a user of the REopt will define the technology. Continuing with the <code>PV</code> example we saw that we need to define the <code>production_factor</code> for the <code>PV</code> technology in every time step. The <code>production_factor</code> varies from zero to one and defines the availability of the technology. For <code>PV</code> we have a default method for creating the <code>production_factor</code> as well as allow the user to provide their own <code>production_factor</code>.</p><p>We let the user define the <code>production_factor</code> by providing the <code>PV</code>s <code>production_factor_series</code> input in their JSON file or dictionary when creating their <a href="../../reopt/inputs/#Scenario">Scenario</a>. If the user does not provide a value for <code>production_factor_series</code> then we use the PVWatts API to get a <code>production_factor</code> based on the <code>Site.latitude</code> and <code>Site.longitude</code>. The <a href="../../reopt/inputs/#PV">PV</a> inputs structure also allows the user to change the arguments that are passed to PVWatts.</p><h2 id=".-REopt-Inputs"><a class="docs-heading-anchor" href="#.-REopt-Inputs">3. REopt Inputs</a><a id=".-REopt-Inputs-1"></a><a class="docs-heading-anchor-permalink" href="#.-REopt-Inputs" title="Permalink"></a></h2><p>The <a href="../inputs/#REoptInputs">REoptInputs</a> constructor is the work-horse for defining all the mathematical model parameters. It converts the user&#39;s <a href="../../reopt/inputs/#Scenario">Scenario</a> into a format that is necessary for adding the model decision variables and constraints.</p><p>A major part of the <a href="../inputs/#REoptInputs">REoptInputs</a> constructor is creating arrays that are indexed on sets of strings (defined in <a href="#Techs">Techs</a>) that allow us to define constraints all applicable technologies. Continuing with the <code>PV</code> example, the electrical load balance constraint includes:</p><pre><code class="language-julia">sum(p.production_factor[t, ts] * p.levelization_factor[t] * m[Symbol(&quot;dvRatedProduction&quot;*_n)][t,ts] for t in p.techs.elec) </code></pre><p>which implies that we need to define a <code>production_factor</code> for all <code>techs.elec</code> in every time step <code>ts</code>. To create the <code>production_factor</code> array the <a href="../inputs/#REoptInputs">REoptInputs</a> constructor first creates an empty array like so:</p><pre><code class="language-julia">production_factor = DenseAxisArray{Float64}(undef, techs.all, 1:length(s.electric_load.loads_kw))</code></pre><p>and then passes that array to technology specific functions that add their production factors to the <code>production_factor</code> array. For example, for <code>PV</code> within the <code>setup_pv_inputs</code> method we have:</p><pre><code class="language-julia">for pv in s.pvs
production_factor[pv.name, :] = get_production_factor(pv, s.site.latitude, s.site.longitude)
Expand All @@ -49,4 +53,4 @@
m = Model(Cbc.Optimizer)
results = run_reopt(m, &quot;path/to/mynewtech.json&quot;)
@test results[&quot;mynewtech&quot;][&quot;some_result&quot;] ≈ 78.9 atol=0.1
end</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../inputs/">« The REoptInputs structure</a><a class="docs-footer-nextpage" href="../documentation/">Documenting the Code »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 23 April 2024 00:19">Tuesday 23 April 2024</span>. Using Julia version 1.8.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
end</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../inputs/">« The REoptInputs structure</a><a class="docs-footer-nextpage" href="../documentation/">Documenting the Code »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 7 May 2024 22:58">Tuesday 7 May 2024</span>. Using Julia version 1.8.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit cd5bfc8

Please sign in to comment.