Investment and sizing
=====================

el1xr_opt can size candidate assets alongside operation: a unit whose data carries a
positive ``FixedInvestmentCost`` becomes an investment candidate, and the model decides
its build fraction on the same discounted footing as the operating costs. The layer is
built by ``oM_Investment.create_investment`` and is a no-op for cases with no
candidates.

Candidates and the build decision
---------------------------------

A candidate electricity or hydrogen unit :math:`\genindex` gets a build-fraction
variable

.. math::
   \vgeninvest_{\genindex} \in [\underline{x}_{\genindex}, \overline{x}_{\genindex}]
   \subseteq [0, 1]

(``vEleGenInvest`` / ``vHydGenInvest``, bounded by ``InvestmentLo`` /
``InvestmentUp``). With ``BinaryInvestment`` set, the variable is binary -- build all
or nothing; left blank, the build is continuous, which keeps the problem an LP.

Capacity coupling
-----------------

The build fraction scales every nameplate rating of the candidate, so an unbuilt
candidate can do nothing and a half-built one has half of every capability
(«``eEleInvestMaxOutput``» / «``eHydInvestMaxOutput``», «``eEleInvestMaxCharge``» /
«``eHydInvestMaxCharge``», «``eEleInvestMaxInventory``» / «``eHydInvestMaxInventory``»):

.. math::
   \veletotaloutput_{\periodindex,\scenarioindex,\timeindex,\genindex} \leq
   \overline{P}_{\periodindex,\scenarioindex,\timeindex,\genindex} \, \vgeninvest_{\genindex}

.. math::
   \veletotalcharge_{\periodindex,\scenarioindex,\timeindex,\genindex} \leq
   \overline{C}_{\periodindex,\scenarioindex,\timeindex,\genindex} \, \vgeninvest_{\genindex}

.. math::
   \veleinventory_{\periodindex,\scenarioindex,\timeindex,\storageindex} \leq
   \overline{S}_{\periodindex,\scenarioindex,\timeindex,\storageindex} \, \vgeninvest_{\storageindex}

where :math:`\overline{P}`, :math:`\overline{C}` and :math:`\overline{S}` are the
``MaximumPower``, ``MaximumCharge`` and ``MaximumStorage`` ratings. The charge cap
applies both to storage charging and to an electrolyser's electricity input -- for an
electrolyser the input is the real design variable, since its hydrogen output is the
input divided by the production function.

.. note::

   The minimum-storage floor (``MinimumStorage``) and the initial inventory
   (``InitialStorage``) do **not** scale with the build fraction. A candidate store
   should therefore start empty with no inventory floor, otherwise satisfying its own
   floor forces it to be built (this is how the hydrogen sizing cases are set up; see
   ``data/sizing/README.md``).

Investment cost
---------------

Each candidate pays its annualised investment cost :math:`\pinvestmentcost_{\genindex}`
(``FixedInvestmentCost`` x ``FixedChargeRate``) weighted by its build fraction. The
total («``eTotalICost``») enters the objective next to the operating terms; see the
:doc:`objective-function` page, :eq:`eq:TotalICost`.

The sizing validation cases (``HomeBatt``, ``HoodBatt``, ``H2Tank``, ``Electrolyser``
and variants, generated by ``data/sizing/make_sizing_cases.py``) each make exactly one
asset a candidate and are regression-tested on both their cost and their build
decision.
