You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
UnitCommitment.jl/0.1/model/index.html

322 lines
12 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>Model - UnitCommitment.jl</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/v4-shims.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.min.css">
<link href='//rsms.me/inter/inter.css' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,600,700&subset=latin-ext,latin' rel='stylesheet' type='text/css'>
<link href="../css/bootstrap-custom.min.css" rel="stylesheet">
<link href="../css/base.min.css" rel="stylesheet">
<link href="../css/cinder.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.0/build/styles/github.min.css">
<link href="../css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Main title -->
<a class="navbar-brand" href="..">UnitCommitment.jl</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="..">Home</a>
</li>
<li >
<a href="../install/">Install</a>
</li>
<li >
<a href="../format/">Data</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fas fa-search"></i> Search
</a>
</li>
<li>
<a href="https://github.com/edit/master/src/docs/model.md"><i class="fab fa-github"></i> Edit on GitHub</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="first-level active"><a href="#benchmark-model">Benchmark Model</a></li>
<li class="second-level"><a href="#building-and-solving-the-model">Building and Solving the Model</a></li>
<li class="second-level"><a href="#decision-variables">Decision Variables</a></li>
<li class="second-level"><a href="#accessing-the-solution">Accessing the Solution</a></li>
<li class="second-level"><a href="#modifying-the-model">Modifying the Model</a></li>
<li class="second-level"><a href="#reference">Reference</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<h1 id="benchmark-model">Benchmark Model</h1>
<p>UnitCommitment.jl includes a reference Mixed-Integer Linear Programming
(MILP), built with <a href="https://github.com/JuliaOpt/JuMP.jl">JuMP</a>, which can
either be used as-is to solve instances of the problem, or be extended to
build more complex formulations.</p>
<h2 id="building-and-solving-the-model">Building and Solving the Model</h2>
<p>Given an instance and a JuMP optimizer, the function <code>build_model</code> can be used to
build the reference MILP model. For example:</p>
<pre><code class="julia">using UnitCommitment, JuMP, Cbc
instance = UnitCommitment.load(&quot;ieee_rts/case118&quot;)
model = build_model(instance, with_optimizer(Cbc.Optimizer))
</code></pre>
<p>The model enforces all unit constraints described in <a href="@ref">Unit Commitment
Instances</a>, including ramping, minimum-up and minimum-down times. Some
system-wide constraints, such as spinning reserves, are also enforced. The
model, however, does not enforce transmission or N-1 security constraints,
since these are typically generated on-the-fly.</p>
<p>A reference to the JuMP model is stored at <code>model.mip</code>. After constructed, the model can
be optimized as follows:</p>
<pre><code class="julia">optimize!(model.mip)
</code></pre>
<h2 id="decision-variables">Decision Variables</h2>
<p>References to all decision variables are stored at <code>model.vars</code>.
A complete list of available decision variables is as follows:</p>
<table>
<thead>
<tr>
<th align="left">Variable</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>model.vars.production[gi,t]</code></td>
<td align="left">Amount of power (in MW) produced by unit with index <code>gi</code> at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.reserve[gi,t]</code></td>
<td align="left">Amount of spinning reserves (in MW) provided by unit with index <code>gi</code> at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.is_on[gi,t]</code></td>
<td align="left">Binary variable indicating if unit with index <code>gi</code> is operational at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.switch_on[gi,t]</code></td>
<td align="left">Binary variable indicating if unit with index <code>gi</code> was switched on at time <code>t</code>. That is, the unit was not operational at time <code>t-1</code>, but it is operational at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.switch_off[gi,t]</code></td>
<td align="left">Binary variable indicating if unit with index <code>gi</code> was switched off at time <code>t</code>. That is, the unit was operational at time <code>t-1</code>, but it is no longer operational at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.unit_cost[gi,t]</code></td>
<td align="left">The total cost to operate unit with index <code>gi</code> at time <code>t</code>. Includes start-up costs, no-load costs and any other production costs.</td>
</tr>
<tr>
<td align="left"><code>model.vars.cost[t]</code></td>
<td align="left">Total cost at time <code>t</code>.</td>
</tr>
<tr>
<td align="left"><code>model.vars.net_injection[bi,t]</code></td>
<td align="left">Total net injection (in MW) at bus with index <code>bi</code> and time <code>t</code>. Net injection is defined as the total power being produced by units located at the bus minus the bus load.</td>
</tr>
</tbody>
</table>
<h2 id="accessing-the-solution">Accessing the Solution</h2>
<p>To access the value of a particular decision variable after the
optimization is completed, the function <code>JuMP.value(var)</code> can be used. The
following example prints the amount of power (in MW) produced by each unit at time 5:</p>
<pre><code class="julia">for g in instance.units
@show value(model.vars.production[g.index, 5])
end
</code></pre>
<h2 id="modifying-the-model">Modifying the Model</h2>
<p>Prior to being solved, the reference model can be modified by using the variable references
above and conventional JuMP macros. For example, the
following code can be used to ensure that at most 10 units are operational at time 4:</p>
<pre><code class="julia">using UnitCommitment, JuMP, Cbc
instance = UnitCommitment.load(&quot;ieee_rts/case118&quot;)
model = build_model(instance, with_optimizer(Cbc.Optimizer))
@contraint(model.mip,
sum(model.vars.is_on[g.index, 4]
for g in instance.units) &lt;= 10)
optimize!(model.mip)
</code></pre>
<p>It is not currently possible to modify the constraints included in the
reference model.</p>
<h2 id="reference">Reference</h2>
<p><code>@docs
UnitCommitment.build_model</code></p></div>
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.0/build/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>var base_url = ".."</script>
<script src="../js/base.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="../js/mathjax.js"></script>
<script src="../search/main.js"></script>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="searchModalLabel">Search</h4>
</div>
<div class="modal-body">
<p>
From here you can search these documents. Enter
your search terms below.
</p>
<form>
<div class="form-group">
<input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style="width: 20%;">Keys</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="help shortcut"><kbd>?</kbd></td>
<td>Open this help</td>
</tr>
<tr>
<td class="next shortcut"><kbd>n</kbd></td>
<td>Next page</td>
</tr>
<tr>
<td class="prev shortcut"><kbd>p</kbd></td>
<td>Previous page</td>
</tr>
<tr>
<td class="search shortcut"><kbd>s</kbd></td>
<td>Search</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>