Skip to content

Commit

Permalink
build based on 4d35a79
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Oct 29, 2024
1 parent d48a420 commit 3d9893a
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-29T06:56:50","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-29T08:09:46","documenter_version":"1.7.0"}}
2 changes: 1 addition & 1 deletion dev/10-how-to-use/index.html

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions dev/20-tutorials/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
connection = DBInterface.connect(DuckDB.DB)
read_csv_folder(connection, input_dir; schemas = TulipaEnergyModel.schema_per_table_name)
energy_problem = run_scenario(connection)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">EnergyProblem:
- Time creating internal structures (in seconds): 8.477514402
- Time computing constraints partitions (in seconds): 4.29620603
- Time creating dataframes (in seconds): 1.516605841
- Time creating variables indices (in seconds): 1.653e-6
- Time creating internal structures (in seconds): 8.928622023
- Time computing constraints partitions (in seconds): 4.490356425
- Time creating dataframes (in seconds): 1.455075528
- Time creating variables indices (in seconds): 1.983e-6
- Model created!
- Time for creating the model (in seconds): 15.651206269
- Time for creating the model (in seconds): 16.137012815
- Number of variables: 368
- Number of constraints for variable bounds: 368
- Number of structural constraints: 432
- Model solved!
- Time for solving the model (in seconds): 2.497279289
- Time for solving the model (in seconds): 2.60770982
- Termination status: OPTIMAL
- Objective value: 269238.4382375954
</code></pre><p>The <code>energy_problem</code> variable is of type <code>EnergyProblem</code>. For more details, see the <a href="../95-reference/#TulipaEnergyModel.EnergyProblem">documentation for that type</a> or the section <a href="../10-how-to-use/#structures">Structures</a>.</p><p>That&#39;s all it takes to run a scenario! To learn about the data required to run your own scenario, see the <a href="../10-how-to-use/#input">Input section</a> of <a href="../10-how-to-use/#how-to-use">How to Use</a>.</p><h3 id="Manually-running-each-step"><a class="docs-heading-anchor" href="#Manually-running-each-step">Manually running each step</a><a id="Manually-running-each-step-1"></a><a class="docs-heading-anchor-permalink" href="#Manually-running-each-step" title="Permalink"></a></h3><p>If we need more control, we can create the energy problem first, then the optimization model inside it, and finally ask for it to be solved.</p><pre><code class="language-julia hljs">using DuckDB, TulipaIO, TulipaEnergyModel
Expand All @@ -25,10 +25,10 @@
connection = DBInterface.connect(DuckDB.DB)
read_csv_folder(connection, input_dir; schemas = TulipaEnergyModel.schema_per_table_name)
energy_problem = EnergyProblem(connection)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">EnergyProblem:
- Time creating internal structures (in seconds): 0.13342404
- Time computing constraints partitions (in seconds): 0.00018746
- Time creating dataframes (in seconds): 0.005203897
- Time creating variables indices (in seconds): 1.683e-6
- Time creating internal structures (in seconds): 0.136561249
- Time computing constraints partitions (in seconds): 0.000190425
- Time creating dataframes (in seconds): 0.00638123
- Time creating variables indices (in seconds): 1.794e-6
- Model not created!
- Model not solved!
</code></pre><p>The energy problem does not have a model yet:</p><pre><code class="language-julia hljs">energy_problem.model === nothing</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">true</code></pre><p>To create the internal model, we call the function <a href="../95-reference/#TulipaEnergyModel.create_model!-Tuple{Any}"><code>create_model!</code></a>.</p><pre><code class="language-julia hljs">create_model!(energy_problem)
Expand Down Expand Up @@ -82,7 +82,7 @@
:max_energy_inter_rp =&gt; <span class="sgr1">0×4 DataFrame</span>
:storage_level_intra_rp =&gt; <span class="sgr1">0×5 DataFrame</span>
:highest_in =&gt; <span class="sgr1">0×5 DataFrame</span>
:units_on =&gt; <span class="sgr1">1 DataFrame</span>
:units_on =&gt; <span class="sgr1">7 DataFrame</span>
:highest_in_out =&gt; <span class="sgr1">72×7 DataFrame</span>
:flows =&gt; <span class="sgr1">360×9 DataFrame</span>
:lowest =&gt; <span class="sgr1">360×5 DataFrame</span>
Expand All @@ -93,7 +93,7 @@
variables = compute_variables_indices(dataframes)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{Symbol, TulipaVariable} with 5 entries:
:is_charging =&gt; TulipaVariable(<span class="sgr1">0×5 DataFrame</span>
:flow =&gt; TulipaVariable(<span class="sgr1">360×9 DataFrame</span>
:units_on =&gt; TulipaVariable(<span class="sgr1">1 DataFrame</span>
:units_on =&gt; TulipaVariable(<span class="sgr1">7 DataFrame</span>
:storage_level_inter_rp =&gt; TulipaVariable(<span class="sgr1">0×4 DataFrame</span>
:storage_level_intra_rp =&gt; TulipaVariable(<span class="sgr1">0×5 DataFrame</span></code></pre><p>Now we can compute the model.</p><pre><code class="language-julia hljs">model = create_model(graph, sets, variables, representative_periods, dataframes, years, timeframe, groups, model_parameters)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">A JuMP Model
├ solver: none
Expand All @@ -112,17 +112,17 @@
connection = DBInterface.connect(DuckDB.DB)
read_csv_folder(connection, input_dir; schemas = TulipaEnergyModel.schema_per_table_name)
energy_problem = run_scenario(connection, optimizer = GLPK.Optimizer)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">EnergyProblem:
- Time creating internal structures (in seconds): 0.136411911
- Time computing constraints partitions (in seconds): 0.000185927
- Time creating dataframes (in seconds): 0.00583825
- Time creating variables indices (in seconds): 1.623e-6
- Time creating internal structures (in seconds): 0.137979912
- Time computing constraints partitions (in seconds): 0.000174967
- Time creating dataframes (in seconds): 0.006570406
- Time creating variables indices (in seconds): 1.904e-6
- Model created!
- Time for creating the model (in seconds): 0.006936498
- Time for creating the model (in seconds): 0.006729089
- Number of variables: 368
- Number of constraints for variable bounds: 368
- Number of structural constraints: 432
- Model solved!
- Time for solving the model (in seconds): 2.046274089
- Time for solving the model (in seconds): 2.122235957
- Termination status: OPTIMAL
- Objective value: 269238.4382417078
</code></pre><p>or</p><pre><code class="language-julia hljs">using GLPK
Expand Down Expand Up @@ -492,4 +492,4 @@
54777.52475361511
52128.801264625705
46907.046645223265</code></pre><p>Here <code>value.</code> (i.e., broadcasting) was used instead of the vector comprehension from previous examples just to show that it also works.</p><p>The value of the constraint is obtained by looking only at the part with variables. So a constraint like <code>2x + 3y - 1 &lt;= 4</code> would return the value of <code>2x + 3y</code>.</p><h3 id="Writing-the-output-to-CSV"><a class="docs-heading-anchor" href="#Writing-the-output-to-CSV">Writing the output to CSV</a><a id="Writing-the-output-to-CSV-1"></a><a class="docs-heading-anchor-permalink" href="#Writing-the-output-to-CSV" title="Permalink"></a></h3><p>To save the solution to CSV files, you can use <a href="../95-reference/#TulipaEnergyModel.save_solution_to_file-NTuple{4, Any}"><code>save_solution_to_file</code></a>:</p><pre><code class="language-julia hljs">mkdir(&quot;outputs&quot;)
save_solution_to_file(&quot;outputs&quot;, energy_problem)</code></pre><h3 id="Plotting"><a class="docs-heading-anchor" href="#Plotting">Plotting</a><a id="Plotting-1"></a><a class="docs-heading-anchor-permalink" href="#Plotting" title="Permalink"></a></h3><p>In the previous sections, we have shown how to create vectors such as the one for flows. If you want simple plots, you can plot the vectors directly using any package you like.</p><p>If you would like more custom plots, check out <a href="https://github.com/TulipaEnergy/TulipaPlots.jl">TulipaPlots.jl</a>, under development, which provides tailor-made plots for <em>TulipaEnergyModel.jl</em>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../10-how-to-use/">« How to Use</a><a class="docs-footer-nextpage" href="../30-concepts/">Concepts »</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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 29 October 2024 06:56">Tuesday 29 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
save_solution_to_file(&quot;outputs&quot;, energy_problem)</code></pre><h3 id="Plotting"><a class="docs-heading-anchor" href="#Plotting">Plotting</a><a id="Plotting-1"></a><a class="docs-heading-anchor-permalink" href="#Plotting" title="Permalink"></a></h3><p>In the previous sections, we have shown how to create vectors such as the one for flows. If you want simple plots, you can plot the vectors directly using any package you like.</p><p>If you would like more custom plots, check out <a href="https://github.com/TulipaEnergy/TulipaPlots.jl">TulipaPlots.jl</a>, under development, which provides tailor-made plots for <em>TulipaEnergyModel.jl</em>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../10-how-to-use/">« How to Use</a><a class="docs-footer-nextpage" href="../30-concepts/">Concepts »</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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 29 October 2024 08:09">Tuesday 29 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
14 changes: 7 additions & 7 deletions dev/30-concepts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@
connection = DBInterface.connect(DuckDB.DB)
read_csv_folder(connection, input_dir; schemas = TulipaEnergyModel.schema_per_table_name)
energy_problem = run_scenario(connection)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">EnergyProblem:
- Time creating internal structures (in seconds): 0.16852234
- Time computing constraints partitions (in seconds): 0.000248794
- Time creating dataframes (in seconds): 0.005003489
- Time creating variables indices (in seconds): 2.014e-6
- Time creating internal structures (in seconds): 0.178616774
- Time computing constraints partitions (in seconds): 0.00025679
- Time creating dataframes (in seconds): 0.006399288
- Time creating variables indices (in seconds): 1.683e-6
- Model created!
- Time for creating the model (in seconds): 3.399579548
- Time for creating the model (in seconds): 3.543088927
- Number of variables: 727
- Number of constraints for variable bounds: 727
- Number of structural constraints: 957
- Model solved!
- Time for solving the model (in seconds): 0.029106612
- Time for solving the model (in seconds): 0.029591687
- Termination status: OPTIMAL
- Objective value: 2409.3840293440285
</code></pre><p>Since the <code>battery</code> is not seasonal, it only has results for the intra-storage level of each representative period, as shown in the following figure:</p><p><img src="../figs/intra-storage-level.png" alt="Battery-intra-storage-level"/></p><p>Since the <code>phs</code> is defined as seasonal, it has results for only the inter-storage level. Since we defined the period partition as 1, we get results for each period (i.e., day). We can see that the inter-temporal constraints in the model keep track of the storage level through the whole timeframe definition (i.e., week).</p><p><img src="../figs/inter-storage-level.png" alt="PHS-inter-storage-level"/></p><p>In this example, we have demonstrated how to partially recover the chronological information of a storage asset with a longer discharge duration (such as 48 hours) than the representative period length (24 hours). This feature enables us to model both short- and long-term storage in <em>TulipaEnergyModel.jl</em>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../20-tutorials/">« Tutorials</a><a class="docs-footer-nextpage" href="../40-formulation/">Mathematical Formulation »</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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 29 October 2024 06:56">Tuesday 29 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
</code></pre><p>Since the <code>battery</code> is not seasonal, it only has results for the intra-storage level of each representative period, as shown in the following figure:</p><p><img src="../figs/intra-storage-level.png" alt="Battery-intra-storage-level"/></p><p>Since the <code>phs</code> is defined as seasonal, it has results for only the inter-storage level. Since we defined the period partition as 1, we get results for each period (i.e., day). We can see that the inter-temporal constraints in the model keep track of the storage level through the whole timeframe definition (i.e., week).</p><p><img src="../figs/inter-storage-level.png" alt="PHS-inter-storage-level"/></p><p>In this example, we have demonstrated how to partially recover the chronological information of a storage asset with a longer discharge duration (such as 48 hours) than the representative period length (24 hours). This feature enables us to model both short- and long-term storage in <em>TulipaEnergyModel.jl</em>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../20-tutorials/">« Tutorials</a><a class="docs-footer-nextpage" href="../40-formulation/">Mathematical Formulation »</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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 29 October 2024 08:09">Tuesday 29 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 3d9893a

Please sign in to comment.