Commit d40398e7 authored by Sebastian Schwarz's avatar Sebastian Schwarz
Browse files

Merge branch 'development' into 'master'

Merge branch development into master (v1.0.2)

See merge request !41
parents 4f32bb3e c8c9e31f
Pipeline #498855 canceled with stages
in 18 minutes and 9 seconds
variables:
GIT_STRATEGY: fetch
DOCKER_FILE: ${CI_PROJECT_DIR}/gitlab-utils/Dockerfile
DOCKER_IMAGE_DEV: pycity_scheduling_ci
DOCKER_TAG: latest
DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}
stages:
......@@ -12,21 +13,58 @@ stages:
prepare:
variables:
GIT_SUBMODULE_STRATEGY: none
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- docker version
- echo "${CI_REGISTRY_PASSWORD}" | docker login --password-stdin --username "${CI_REGISTRY_USER}" "${CI_REGISTRY}"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${DOCKER_FILE} --target base --destination ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image --cache=true --snapshotMode=redo --use-new-run
- mkdir -p /.docker
- docker build -f ${DOCKER_FILE} -t ${DOCKER_IMAGE}:${DOCKER_TAG} /.docker
- docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
tags:
- docker
test-prerequisites:
stage: test
image: ${DOCKER_IMAGE}
script:
- python3.6 -m pytest -q /opt/richardsonpy/.
- python3.6 -m pytest -q /opt/pycity_base/.
tags:
- docker
unittest-gurobi:
stage: test
image: ${DOCKER_IMAGE}
script:
- mv $GUROBI_LIC /opt/gurobi/gurobi.lic
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- python3.6 -m unittest discover -s $CI_PROJECT_DIR/src/testing/unit_tests -v
tags:
- docker
unittest-scip:
stage: test
image: ${DOCKER_IMAGE}
script:
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- sed -i '55s/GUROBI_DIRECT_SOLVER/SCIP_SOLVER/g' $CI_PROJECT_DIR/src/pycity_scheduling/solvers.py
- sed -i '56s/GUROBI_DIRECT_SOLVER_OPTIONS/SCIP_SOLVER_OPTIONS/g' $CI_PROJECT_DIR/src/pycity_scheduling/solvers.py
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- python3.6 -m unittest discover -s $CI_PROJECT_DIR/src/testing/unit_tests -v
tags:
- docker
lint:
stage: test
image: ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image
image: ${DOCKER_IMAGE}
script:
- mkdir -p lint
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
......@@ -41,23 +79,15 @@ lint:
- lint
expire_in: 4 weeks
when: always
unittest:
stage: test
image: ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image
script:
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- python3.6 -m unittest discover -s $CI_PROJECT_DIR/src/testing/unit_tests -v
tags:
- docker
doc:
stage: deploy
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG =~ /^v/'
image: ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image
image: ${DOCKER_IMAGE}
script:
- mkdir -p doc
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
......@@ -79,13 +109,15 @@ pages:
- if: '$CI_COMMIT_TAG =~ /^v/'
when: delayed
start_in: '60 minutes'
image: ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image
image: ${DOCKER_IMAGE}
script:
- mkdir -p public
- mv $CI_PROJECT_DIR/docs/* public
artifacts:
paths:
- public
tags:
- docker
pypi-release:
......@@ -93,8 +125,8 @@ pypi-release:
rules:
- if: '$CI_COMMIT_TAG =~ /^v/'
when: delayed
start_in: '60 minutes'
image: ${CI_REGISTRY_IMAGE}:${DOCKER_IMAGE_DEV}-base-image
start_in: '120 minutes'
image: ${DOCKER_IMAGE}
script:
- mkdir -p release
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
......@@ -109,3 +141,5 @@ pypi-release:
name: "pycity_scheduling-release-$CI_COMMIT_TAG"
paths:
- release
tags:
- docker
......@@ -22,12 +22,13 @@ Its target users are researchers in the field of smart grid applications and the
## Installation
pycity_scheduling requires at least the following Python packages:
- numpy
- pandas
- matplotlib
- pyomo
- Shapely
- pycity_base
- numpy==1.19.5
- pandas==1.1.5
- matplotlib==3.3.4
- pyomo==6.0.0
- Shapely==1.7.1
- pycity_base==0.3.2
- pytest==6.2.4 (optional)
as well as the installation of at least one mathematical programming solver for convex and/or non-convex problems, which is supported by the [Pyomo](http://www.pyomo.org/) optimisation modelling library.
We recommend one of the following solvers:
......@@ -40,7 +41,7 @@ We recommend one of the following solvers:
### Installation of pycity_scheduling
The latest version of pycity_scheduling is v1.0.1.
The latest version of pycity_scheduling is v1.0.2.
If all the abovementioned dependencies are installed, you should be able to install package pycity_scheduling via [PyPI](https://pypi.org/) (using Python 3.X) as follows:
......
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: 'v1.0.1',
VERSION: 'v1.0.2',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
......
......@@ -9,7 +9,7 @@ ENTRYPOINT /bin/bash
# Install the archlinux base packages:
RUN pacman -Syu sudo git patch wget curl php doxygen make cmake clang base-devel gcc gcc-fortran unzip tar bzip2 expat gdbm libffi openssl bluez-libs mpdecimal sqlite tk bison flex pkgconf boost boost-libs zlib gmp blas gsl readline ncurses tbb cliquer ghc ghc-libs haskell-criterion coin-or-asl lapack metis --noconfirm
RUN pacman -Syu sudo git patch wget php doxygen make cmake clang base-devel gcc gcc-fortran unzip tar bzip2 expat gdbm libffi openssl bluez-libs mpdecimal sqlite tk bison flex pkgconf boost boost-libs zlib gmp blas gsl readline ncurses tbb cliquer ghc ghc-libs haskell-criterion coin-or-asl lapack metis --noconfirm
# Create a builduser (required for some archlinux operations running inside Docker):
......@@ -19,9 +19,9 @@ RUN useradd builduser -m -d /home/builduser &&\
printf 'root ALL=(ALL) ALL\n' | tee a /etc/sudoers
# Downgrade Python to the recommended version 3.6 and install some core package:
# Install Python version 3.6 together with some core package:
RUN cd / &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/python36 && cd ~/python36 && wget --quiet https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=python36 -O PKGBUILD && makepkg -s' &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/python36 && cd ~/python36 && wget --quiet "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=python36&id=a057b43d348f307a04e166cbef04deec7cf4c8c4" -O PKGBUILD && makepkg -s' &&\
cd /home/builduser/python36 &&\
pacman -U *.pkg.tar.zst --noconfirm &&\
wget --quiet https://bootstrap.pypa.io/get-pip.py &&\
......@@ -31,12 +31,12 @@ RUN cd / &&\
cd /
# Download and install the required IPOPT solver:
# Download and install the required IPOPT solver (version 3.13.2):
RUN cd / &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/coin-or-coinmumps && cd ~/coin-or-coinmumps && wget --quiet https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=coin-or-coinmumps -O PKGBUILD && makepkg -s' &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/coin-or-coinmumps && cd ~/coin-or-coinmumps && wget --quiet "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=coin-or-coinmumps&id=43e3a59117757bb582f52c041b64a741fa19324b" -O PKGBUILD && makepkg -s' &&\
cd /home/builduser/coin-or-coinmumps &&\
pacman -U *.pkg.tar.zst --noconfirm &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/coin-or-ipopt && cd ~/coin-or-ipopt && wget --quiet https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=coin-or-ipopt -O PKGBUILD && makepkg -s' &&\
sudo -u builduser /bin/bash -c 'mkdir -p ~/coin-or-ipopt && cd ~/coin-or-ipopt && wget --quiet "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=coin-or-ipopt&id=7e213d37212b3c9f2658a7608bf4c0289a8a7319" -O PKGBUILD && makepkg -s' &&\
cd /home/builduser/coin-or-ipopt &&\
pacman -U *.pkg.tar.zst --noconfirm &&\
cd /
......@@ -59,6 +59,7 @@ RUN cd $HMETIS_BASE_DIR &&\
wget --quiet http://glaros.dtc.umn.edu/gkhome/fetch/sw/hmetis/hmetis-1.5-linux.tar.gz &&\
tar xzf $HMETIS_BASE_DIR/hmetis-1.5-linux.tar.gz &&\
chmod +x $HMETIS_BASE_DIR/hmetis-1.5-linux/hmetis &&\
rm -rf $HMETIS_BASE_DIR/hmetis-1.5-linux.tar.gz &&\
cd /
ENV PATH="${PATH}:$HMETIS_BASE_DIR/hmetis-1.5-linux/"
......@@ -69,9 +70,10 @@ RUN mkdir -p /opt/bliss
ENV BLISS_BASE_DIR="/opt/bliss"
RUN cd $BLISS_BASE_DIR &&\
wget --quiet http://www.tcs.hut.fi/Software/bliss/bliss-0.73.zip &&\
wget --quiet https://www3.hhu.de/stups/buildlibs/bliss-0.73.zip &&\
unzip $BLISS_BASE_DIR/bliss-0.73.zip &&\
wget --quiet https://www.scipopt.org/download/bugfixes/scip-7.0.1/bliss-0.73.patch &&\
rm -rf $BLISS_BASE_DIR/bliss-0.73.zip &&\
wget --quiet https://www.scipopt.org/download/bugfixes/scip-7.0.0/bliss-0.73.patch &&\
patch -l -p0 < bliss-0.73.patch &&\
mv $BLISS_BASE_DIR/bliss-0.73 $BLISS_BASE_DIR/bliss-0.73p &&\
cd $BLISS_BASE_DIR/bliss-0.73p &&\
......@@ -83,59 +85,84 @@ RUN cd $BLISS_BASE_DIR &&\
ENV PATH="${PATH}:$BLISS_BASE_DIR/bliss-0.73p/"
# Download, build and install the SCIP solver (SCIPOptSuite 7.0.1).
# Important note: You are allowed to retrieve a copy of SCIP for research purposes as a member of a noncommercial and academic institution.
# In order to get a copy of SCIP, you need to certify that you are a member of a noncommercial, academic institution and accept the ZIB Academic License.
# Download, build and install the SCIP optimization solver (SCIPOptSuite 7.0.3).
# Important note: You are allowed to retrieve a copy of SCIP for research purposes as a member of a noncommercial and academic institution only.
# To get a copy of SCIP, you need to certify that you are a member of a noncommercial, academic institution and accept the ZIB Academic License.
# Commercial use requires a commercial license.
# For further information visit: https://scipopt.org/#scipoptsuite
RUN mkdir -p /opt/scip
ENV SCIPAMPL_BASE_DIR="/opt/scip"
RUN cd $SCIPAMPL_BASE_DIR &&\
wget --quiet https://www.scipopt.org/download/release/scipoptsuite-7.0.1.tgz &&\
tar xzf $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1.tgz &&\
wget --quiet https://www.scipopt.org/download/release/scipoptsuite-7.0.3.tgz &&\
tar xzf $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3.tgz &&\
rm -rf $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3.tgz &&\
cd /
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1 &&\
mkdir -p $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/build &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/build &&\
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3 &&\
mkdir -p $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/build &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/build &&\
cmake .. -DCMAKE_BUILD_TYPE=Release -DBLISS_DIR=$BLISS_BASE_DIR/bliss-0.73p -DBOOST=on -DGCG=on -DGMP=on -DGSL=on -DHIGHS=on -DHIGHS_DIR=$HiGHS_BASE_DIR/HiGHS -DHMETIS=on -DIPOPT=on -DLPS=spx -DPAPILO=on -DQUADMATH=on -DREADLINE=on -DSCIP=on -DSHARED=on -DSOPLEX=on -DSYM=bliss -DWORHP=off -DZIMPL=on -DZLIB=on &&\
make &&\
cd /
ENV SCIP_DIR=$SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/build
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl &&\
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl &&\
./get.ASL &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl/solvers &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl/solvers &&\
sh configurehere &&\
make -f makefile.u &&\
cd /
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl &&\
mkdir -p $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl/build &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl/build &&\
cmake .. -DSCIP_DIR=$SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/build &&\
RUN cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl &&\
mkdir -p $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl/build &&\
cd $SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl/build &&\
cmake .. -DSCIP_DIR=$SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/build &&\
make &&\
cd /
ENV PATH="${PATH}:$SCIPAMPL_BASE_DIR/scipoptsuite-7.0.1/scip/interfaces/ampl/build"
ENV PATH="${PATH}:$SCIPAMPL_BASE_DIR/scipoptsuite-7.0.3/scip/interfaces/ampl/build"
# Download, install and test Python package richardsonpy:
# Download, build and install the Gurobi optimization solver (Gurobi 9.1.2).
# Important note: You are allowed to retrieve a copy of Gurobi for research purposes as a member of a non-commercial and academic institution only.
# To get a copy of Gurobi, you need to request for an academic license at Gurobi Optimization, LLC.
# Commercial use requires a commercial license.
# For further information visit: https://www.gurobi.com/
RUN mkdir -p /opt/gurobi
ENV GUROBI_BASE_DIR="/opt/gurobi"
RUN cd $GUROBI_BASE_DIR &&\
wget --quiet https://packages.gurobi.com/9.1/gurobi9.1.2_linux64.tar.gz &&\
tar xfz gurobi9.1.2_linux64.tar.gz &&\
rm $GUROBI_BASE_DIR/gurobi9.1.2_linux64.tar.gz &&\
chmod -R 755 $GUROBI_BASE_DIR/gurobi912 &&\
cd $GUROBI_BASE_DIR/gurobi912/linux64 &&\
python3.6 setup.py install &&\
cd /
ENV PATH="${PATH}:$GUROBI_BASE_DIR/gurobi912/linux64/bin"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$GUROBI_BASE_DIR/gurobi912/linux64/lib"
# Download and install Python package richardsonpy:
# Unfortunately, the current PyPI version of package richardsonpy seems to be broken.
# As a workaround, richardsonpy is downloaded from github and flag -e is used for pip.
RUN git clone --depth=1 -b v0.2.1 https://github.com/RWTH-EBC/richardsonpy &&\
RUN cd /opt &&\
git clone --depth=1 -b v0.2.1 https://github.com/RWTH-EBC/richardsonpy &&\
python3.6 -m pip install --no-cache-dir -e richardsonpy/ &&\
python3.6 -m pytest -q richardsonpy/
cd /
# Download, install and test Python package pycity_base:
# Download and install Python package pycity_base:
# Always use a specific tagged pycity_base version from github.
# Thus, pycity_base is downloaded from github and flag -e is used for pip.
RUN git clone --depth=1 -b v0.3.1 https://github.com/RWTH-EBC/pyCity pycity_base &&\
RUN cd /opt &&\
git clone --depth=1 -b v0.3.2 https://github.com/RWTH-EBC/pyCity pycity_base &&\
python3.6 -m pip install --no-cache-dir -e pycity_base/ &&\
python3.6 -m pytest -q pycity_base/
cd /
# Download and install the other requirements for package pycity_scheduling:
# Moreover, install the third-party Python site-packages that are required by the used tools during the different CI stages.
RUN python3.6 -m pip install --no-cache-dir numpy pandas matplotlib pyomo Shapely pylint sphinx numpydoc
RUN python3.6 -m pip install --no-cache-dir importlib pylint sphinx numpydoc
......@@ -18,13 +18,13 @@ sys.path.insert(0, os.path.abspath('../../src'))
# -- Project information -----------------------------------------------------
project = 'pycity_scheduling'
copyright = '2020, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), ' \
copyright = '2021, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), ' \
'RWTH Aachen University'
# The short X.Y version
version = 'v1.0.1'
version = 'v1.0.2'
# The full version, including alpha/beta/rc tags
release = 'v1.0.1'
release = 'v1.0.2'
# -- General configuration ---------------------------------------------------
......
"""
The pycity_scheduling framework
Copyright (C) 2020,
Institute for Automation of Complex Power Systems (ACS),
E.ON Energy Research Center (E.ON ERC),
RWTH Aachen University
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import numpy as np
import matplotlib.pyplot as plt
from pycity_scheduling.classes import *
from pycity_scheduling.algorithms import *
# This is a very simple power scheduling example using the central optimization algorithm to demonstrate the impact
# of system level objective "self-consumption".
def main(do_plot=False):
print("\n\n------ Example 09: Objective Self-Consumption ------\n\n")
# Define timer, price, weather, and environment objects:
t = Timer(op_horizon=96, step_size=900, initial_date=(2015, 4, 1))
p = Prices(timer=t)
w = Weather(timer=t)
e = Environment(timer=t, weather=w, prices=p)
# City district with district operator objective "self-consumption":
cd = CityDistrict(environment=e, objective='self-consumption')
# Schedule some sample buildings. The buildings' objectives are defined as "none".
n = 10
for i in range(n):
bd = Building(environment=e, objective='none')
cd.addEntity(entity=bd, position=[0, i])
bes = BuildingEnergySystem(environment=e)
bd.addEntity(bes)
ths = ThermalHeatingStorage(environment=e, e_th_max=40, soc_init=0.5)
bes.addDevice(ths)
eh = ElectricalHeater(environment=e, p_th_nom=10)
bes.addDevice(eh)
ap = Apartment(environment=e)
bd.addEntity(ap)
fi = FixedLoad(e, method=1, annual_demand=3000.0, profile_type='H0')
ap.addEntity(fi)
sh = SpaceHeating(environment=e, method=1, living_area=120, specific_demand=90, profile_type='HEF')
ap.addEntity(sh)
pv = Photovoltaic(environment=e, method=1, peak_power=8.2)
bes.addDevice(pv)
bat = Battery(environment=e, e_el_max=12.0, p_el_max_charge=4.6, p_el_max_discharge=4.6)
bes.addDevice(bat)
# Perform the scheduling:
opt = CentralOptimization(city_district=cd)
results = opt.solve()
cd.copy_schedule("self-consumption")
# Print and show the city district's schedule:
print("Schedule of the city district:")
print(list(cd.p_el_schedule))
plt.plot(cd.p_el_schedule)
#plt.ylim([-2.0, 5.0])
plt.xlabel('Time in hours')
plt.ylabel('Electrical power in kW')
plt.title('City district scheduling result')
plt.grid()
if do_plot:
plt.show()
return
# Conclusions:
# Using "self-consumption" as the system level objective results in a power profile with zero net power export for the
# considered city district over time. In other words, this means that the local power generation (e.g. from the
# buildings' PV units) is fully self-consumed inside the city district. However, this may result in an increased power
# import from the distribution grid and therefore cause power peaks.
if __name__ == '__main__':
# Run example:
main(do_plot=True)
......@@ -35,7 +35,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 09: Objective Price ------\n\n")
print("\n\n------ Example 10: Objective Price ------\n\n")
# Define timer, price, weather, and environment objects:
t = Timer(op_horizon=96, step_size=900, initial_date=(2015, 4, 1))
......
......@@ -35,7 +35,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 10: Objective CO2------\n\n")
print("\n\n------ Example 11: Objective CO2------\n\n")
# Define timer, price, weather, and environment objects:
t = Timer(op_horizon=96, step_size=900, initial_date=(2015, 4, 1))
......
......@@ -35,7 +35,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 11: Objective Valley-Filling ------\n\n")
print("\n\n------ Example 12: Objective Valley-Filling ------\n\n")
# Define timer, price, weather, and environment objects:
t = Timer(op_horizon=96, step_size=900, initial_date=(2015, 4, 1))
......
......@@ -35,7 +35,7 @@ import pycity_scheduling.util.debug as debug
def main(do_plot=False):
print("\n\n------ Example 12: District Generator ------\n\n")
print("\n\n------ Example 13: District Generator ------\n\n")
# First, create an environment using the factory's "generate_standard_environment" method. The environment
# automatically encapsulates time, weather, and price data/information.
......
......@@ -33,7 +33,7 @@ from pycity_scheduling.util import calculate_flexibility_potential
def main(do_plot=False):
print("\n\n------ Example 13: District Flexibility Quantification ------\n\n")
print("\n\n------ Example 14: District Flexibility Quantification ------\n\n")
# First, create an environment using the factory's "generate_standard_environment" method. The environment
# automatically encapsulates time, weather, and price data/information.
......
......@@ -36,7 +36,7 @@ from pycity_scheduling.classes import *
# is hence considered more complex.
def main(do_plot=False):
print("\n\n------ Example 14: Scheduling Complex City District ------\n\n")
print("\n\n------ Example 15: Scheduling Complex City District ------\n\n")
# First, create an environment using the factory's "generate_standard_environment" method. The environment
# automatically encapsulates time, weather, and price data/information.
......
......@@ -36,7 +36,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 15: Scheduling Convex vs. Integer Mode ------\n\n")
print("\n\n------ Example 16: Scheduling Convex vs. Integer Mode ------\n\n")
# Scheduling will be performed for a typical winter day within the annual heating period:
env = factory.generate_standard_environment(step_size=3600, op_horizon=24, mpc_horizon=None, mpc_step_width=None,
......@@ -70,7 +70,6 @@ def main(do_plot=False):
# Plot the convex schedules:
plot_time = list(range(env.timer.timesteps_used_horizon))
figure = plt.figure(figsize=(6, 6))
gs = gridspec.GridSpec(5, 1)
ax0 = plt.subplot(gs[0])
......
......@@ -36,7 +36,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 16: Scheduling PV+Battery System ------\n\n")
print("\n\n------ Example 17: Scheduling PV+Battery System ------\n\n")
# Scheduling will be performed for one month:
env = factory.generate_standard_environment(step_size=3600, op_horizon=24*31, mpc_horizon=None,
......@@ -67,7 +67,6 @@ def main(do_plot=False):
# Plot the (thermal) schedules of interest:
plot_time = list(range(env.timer.timesteps_used_horizon))
figure = plt.figure(figsize=(6, 6))
gs = gridspec.GridSpec(5, 1)
ax0 = plt.subplot(gs[0])
......
......@@ -36,7 +36,7 @@ from pycity_scheduling.algorithms import *
def main(do_plot=False):
print("\n\n------ Example 17: Scheduling Heating and Cooling Loads ------\n\n")
print("\n\n------ Example 18: Scheduling Heating and Cooling Loads ------\n\n")
# Scheduling will be performed for a full year:
env = factory.generate_standard_environment(step_size=3600, op_horizon=24*365, mpc_horizon=None,
......@@ -53,7 +53,6 @@ def main(do_plot=False):
# Plot the thermal loads:
plot_time = list(range(env.timer.timesteps_used_horizon))
figure = plt.figure(figsize=(6, 6))
gs = gridspec.GridSpec(2, 1)
ax0 = plt.subplot(gs[0])
......@@ -116,7 +115,6 @@ def main(do_plot=False):
# Plot the (thermal) schedules of interest:
plot_time = list(range(env.timer.timesteps_used_horizon))
figure = plt.figure(figsize=(6, 6))
gs = gridspec.GridSpec(4, 1)
ax0 = plt.subplot(gs[0])
......
......@@ -34,7 +34,7 @@ from pycity_scheduling.util.metric import calculate_costs
def main(do_plot=False):
print("\n\n------ Example 18: Scheduling Robust Optimization ------\n\n")
print("\n\n------ Example 19: Scheduling Robust Optimization ------\n\n")
# Use a simple environment of 6 hours with quarter-hourly resolution (=15min=900sec):
env = factory.generate_standard_environment(step_size=900, op_horizon=6)
......
......@@ -35,7 +35,7 @@ from pycity_scheduling.util.write_schedules import schedule_to_json, schedule_to
def main(do_plot=False):
print("\n\n------ Example 19: Post-Processing Schedule Evaluation ------\n\n")
print("\n\n------ Example 20: Post-Processing Schedule Evaluation ------\n\n")
# Define timer, price, weather, and environment objects:
t = Timer()
......
......@@ -37,7 +37,7 @@ from pycity_scheduling.util.metric import calculate_costs, peak_to_average_ratio
def main(do_plot=False):
print("\n\n------ Example 20: Post-Processing Metrics Evaluation ------\n\n")
print("\n\n------ Example 21: Post-Processing Metrics Evaluation ------\n\n")
# Use a standard environment of 24 hours with hourly resolution (=60min=3600sec):