This study built from Calliope 0.4.1-dev to create a piecewise model.
The easiest way to install the necessary packages is to create a conda environment: conda create -n piecewise-calliope plotly
. Activate the environment and install the necessary development branch:
pip install git+https://github.com/brynpickering/calliope.git@Piecewise_constrainedcurves
The study utilised CPLEX 12.6.2.0 for MILP solving.
Once Calliope installed, models can be run and results can be analysed as per the documentation.
Model run configurations can be found in the models
folder, where each run configuration has been named as: run_[season]_[No. of breakpoints]bp_[linearisation method].yaml
The models will save their solutions as netCDF to an Output folder. These solution files are required for ex-post analysis functions to operate correctly.
The functions get_piecewise.py
and minimize_linearisation_error.py
are used to find breakpoint positions along technology nonlinear characteristic curves. Breakpoint allocation is done equidistantly as well as optimised (to reduce error vs. the nonlinear curve). The result of get_piecewise.py
is a YAML file that is used by this modified version of Calliope to create piecewise constraints.
ex-post.py contains a function for analysis of the error incurred by linearisation of consumption curves. Each linear model run is compared to its nonlinear counterpart, by applying the relevant nonlinear consumption curves to the technology outputs obtained using the linear optimisation.
The output of this function is two xarray DataArrays, error
and error_t
. The former provides per technology & location error in consumption, heat to power ratio (for CHP) and cost. The latter additionally provides consumption and HTP error for each timestep.
If you use this model or work derived from it in an academic publication, please cite the following paper:
Pickering, B. and Choudhary, R.. "Applying Piecewise Linear Characteristic Curves in District Energy Optimisation" 30th INTERNATIONAL CONFERENCE on Efficiency, Cost, Optimisation, Simulation and Environmental Impact of Energy Systems. San Diego, USA. 2017.
Copyright (c) 2016-2017 Bryn Pickering
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.