Skip to content

Commit

Permalink
Merge branch 'main' into update-top-level-config-params
Browse files Browse the repository at this point in the history
  • Loading branch information
brynpickering committed Oct 24, 2023
2 parents 34dacd0 + a01d4bb commit 5fcabf0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 51 deletions.
43 changes: 1 addition & 42 deletions doc/user/advanced_constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,47 +274,6 @@ Export is an extension of this, allowing a carrier to be removed from the system

.. note:: Negative costs can be applied to capacity costs, but the user must an ensure a capacity limit has been set. Otherwise, optimisation will be unbounded.

.. _group_share:

-------------------------------------------
The ``group_share`` constraint (deprecated)
-------------------------------------------

.. Warning:: ``group_share`` is deprecated as of v0.6.4 and will be removed in v0.7.0.

The ``group_share`` constraint can be used to force groups of technologies to fulfill certain shares of supply or capacity.

For example, assuming a model containing a ``csp`` and a ``cold_fusion`` power generation technology, we could force at least 85% of power generation in the model to come from these two technologies with the following constraint definition in the ``model`` settings:

.. code-block:: yaml
model:
group_share:
csp,cold_fusion:
carrier_prod_min:
power: 0.85
Possible ``group_share`` constraints with carrier-specific settings are:

* ``carrier_prod_min``
* ``carrier_prod_max``
* ``carrier_prod_equals``

Possible ``group_share`` constraints with carrier-independent settings are:

* ``flow_cap_min``
* ``flow_cap_max``
* ``flow_cap_equals``

These can be implemented as, for example, to force at most 20% of ``flow_cap`` to come from the two listed technologies:

.. code-block:: yaml
model:
group_share:
csp,cold_fusion:
flow_cap_max: 0.20
------------------------------------
Binary and mixed-integer constraints
------------------------------------
Expand All @@ -323,7 +282,7 @@ Calliope models are purely linear by default. However, several constraints can t

By applying a ``purchase`` cost to a technology, that technology will have a binary variable associated with it, describing whether or not it has been "purchased".

By applying ``units.max``, ``units.min``, or ``units.equals`` to a technology, that technology will have a integer variable associated with it, describing how many of that technology have been "purchased". If a ``purchase`` cost has been applied to this same technology, the purchasing cost will be applied per unit.
By applying ``units_max`` or ``units_min`` to a technology, that technology will have a integer variable associated with it, describing how many of that technology have been "purchased". If a ``purchase`` cost has been applied to this same technology, the purchasing cost will be applied per unit.

.. Warning::

Expand Down
6 changes: 0 additions & 6 deletions src/calliope/config/math_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ properties:
max:
type: [string, number]
description: Decision variable upper bound, either as a reference to an input parameter or as a number.
equals:
type: [string, number]
description: Decision variable equality bound, either as a reference to an input parameter or as a number, which simultanously forces the lower and uppere bound to the same value.
scale:
type: [string, number]
description: Scaling factor, either as a reference to an input parameter or as a number, which will be applied to all bounds.

objectives:
type: object
Expand Down
4 changes: 2 additions & 2 deletions src/calliope/preprocess/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def _check_tech_final(
):
errors.append(
f"`{tech_id}` at `{loc_id}` fails to define flow_cap_per_unit when "
"specifying technology in units_max/min/equals"
"specifying technology in units_max/min"
)

# If a technology is defined by units & is a storage tech, it must define storage_cap_per_unit
Expand All @@ -382,7 +382,7 @@ def _check_tech_final(
):
errors.append(
f"`{tech_id}` at `{loc_id}` fails to define storage_cap_per_unit when "
"specifying technology in units_max/min/equals"
"specifying technology in units_max/min"
)

# Gather remaining unallowed constraints
Expand Down
3 changes: 2 additions & 1 deletion tests/test_backend_pyomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from copy import deepcopy
from itertools import product

import calliope.exceptions as exceptions
import numpy as np
import pandas as pd
import pyomo.kernel as pmo
import pytest # noqa: F401
import xarray as xr

import calliope.exceptions as exceptions
from calliope.backend.pyomo_backend_model import PyomoBackendModel
from calliope.core.attrdict import AttrDict

Expand Down

0 comments on commit 5fcabf0

Please sign in to comment.