{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import Image\n",
    "Image(\"images\\strukturExample.png\");"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Workflow for the EnergyLand energy system\n",
    "\n",
    "In this application of the FINE framework, a 1-node energy system is modeled and optimized.\n",
    "\n",
    "The workflow is structures as follows:\n",
    "1. Required packages are imported and the input data path is set\n",
    "2. An energy system model instance is created\n",
    "3. Commodity sources are added to the energy system model\n",
    "4. Commodity conversion components are added to the energy system model\n",
    "5. Commodity storages are added to the energy system model\n",
    "6. Commodity sinks are added to the energy system model\n",
    "7. The energy system model is optimized\n",
    "8. Selected optimization results are presented"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![Structure of EnergyLand](images\\strukturExample.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. Import packages\n",
    "\n",
    "The FINE framework is imported which provides the required classes and functions for modeling the energy system.\n",
    "The working directory and the underlying excelfile which provides some of the input data is imported."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import FINE as fn\n",
    "from getData import getData\n",
    "import pandas as pd\n",
    "import os\n",
    "cwd = os.getcwd()\n",
    "data = getData()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. Set up energy system model instance\n",
    "\n",
    "The structure of the energy system model is given by the considered locations, in this case we consider only one location (EnergyLand), commodities, the number of time steps as well as the hours per time step.\n",
    "\n",
    "The commodities are specified by a unit, which can be given as an energy or mass unit per hour."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "locations = {'EnergyLand'}\n",
    "commodityUnitDict = {'electricity': r'GW$_{el}$', 'hydrogen': r'GW$_{H_{2},LHV}$', \n",
    "                     'nGas':r'GW$_{CH4}$', 'coal':r'GW$_{coal}$', 'PHeat': r'GW$_{Pheat}$',\n",
    "                     'LTHeat':r'GW$_{LTHeat}$', 'CO2':r'kt$_{CO_{2}}$/h', 'pTransport': 'Mio pkm/h',\n",
    "                     'fTransport': 'Mio tkm/h', 'crudeOil': r'GW$_{Oil}$', 'wood': r'GW$_{wood}$', \n",
    "                     'biowaste': r'GW$_{biowaste}$', 'bioslurry': r'GW$_{bioslurry}$',\n",
    "                     'diesel': r'GW$_{diesel}$', 'biogas': r'GW$_{CH4}$', 'nGasImp': r'GW$_{CH4}$'}\n",
    "commodities = {'electricity', 'hydrogen', 'nGas', 'coal', 'PHeat', 'LTHeat', 'CO2', 'pTransport', \n",
    "               'fTransport', 'crudeOil', 'wood', 'biowaste', 'bioslurry', 'diesel', 'nGasImp', 'biogas'}\n",
    "numberOfTimeSteps=8760\n",
    "hoursPerTimeStep=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM = fn.EnergySystemModel(locations=locations, commodities=commodities, numberOfTimeSteps=8760,\n",
    "                           commodityUnitsDict=commodityUnitDict,\n",
    "                           hoursPerTimeStep=1, costUnit='1e6 Euro', lengthUnit='km', verboseLogLevel=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. Sources\n",
    "\n",
    "Source components transfer a commodity from outside the system boundary of EnergyLand into the system."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.1 Electricity sources"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Wind turbines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Onshore Wind Turbines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='Wind_Onshore', commodity='electricity', hasCapacityVariable=True,\n",
    "                  operationRateMax=data['Wind_onshore, operationRateMax'],\n",
    "                  capacityMax=data['Wind_onshore, capacityMax'],\n",
    "                  investPerCapacity=1250, opexPerCapacity=1250*0.02, interestRate=0.08,\n",
    "                  economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Offshore Wind Turbines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='Wind_Offshore', commodity='electricity', hasCapacityVariable=True,\n",
    "                  operationRateMax=data['Wind_offshore, operationRateMax'],\n",
    "                  capacityMax=data['Wind_offshore, capacityMax'],\n",
    "                  investPerCapacity=2530, opexPerCapacity=2530*0.045, interestRate=0.08,\n",
    "                  economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Photovoltaic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='PV', commodity='electricity', hasCapacityVariable=True,\n",
    "                  operationRateMax=data['PV, operationRateMax'],\n",
    "                  capacityMax=data['PV, capacityMax'],\n",
    "                  investPerCapacity=800, opexPerCapacity=800*0.019, interestRate=0.08,\n",
    "                  economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Electricity import"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='el_Import', commodity='electricity', hasCapacityVariable=False,\n",
    "                  operationRateMax=data['el_Import, operationRateMax']))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.2 Hydrogen source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='H2_Import', commodity='hydrogen', hasCapacityVariable=False,\n",
    "                  operationRateMax=data['H2_Import, operationRateMax'],\n",
    "                  commodityCost=0.132))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.3 Coal source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='CoalSource', commodity='coal', hasCapacityVariable=False,\n",
    "                  commodityCost=0.021))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.4 Crude Oil source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='CrudeOilSource', commodity='crudeOil', hasCapacityVariable=False,\n",
    "                  commodityCost=0.036))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.5 Natural gas source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='nGasSource', commodity='nGasImp', hasCapacityVariable=False,\n",
    "                  commodityCost=0.0256))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.6 Biomass sources"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Wood Source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='WoodSource', commodity='wood', hasCapacityVariable=True,\n",
    "                  capacityMax=data['wood_source, capacityMax'],\n",
    "                  commodityCost=0.028))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Biowaste Source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='BiowasteSource', commodity='biowaste', hasCapacityVariable=True,\n",
    "                  capacityMax=data['biowaste_source, capacityMax'],\n",
    "                  commodityCost=0.07))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Bioslurry Source"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Source(esM=esM, name='BioslurrySource', commodity='bioslurry', hasCapacityVariable=True,\n",
    "                  capacityMax=data['bioslurry_source, capacityMax'],\n",
    "                  commodityCost=0.07))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4. Conversion components\n",
    "\n",
    "These are the components which can transfer one commodity into another one."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.1 Biomas to biogas"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Bioslurry to Biogas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='bioslurry-biogas', physicalUnit= r'GW$_{CH4}$',\n",
    "                      commodityConversionFactors={'bioslurry':-1, 'biogas':1},\n",
    "                      hasCapacityVariable=False))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Biowaste to Biogas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='biowaste-biogas', physicalUnit= r'GW$_{CH4}$',\n",
    "                      commodityConversionFactors={'biowaste':-1, 'biogas':1},\n",
    "                      hasCapacityVariable=False))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.2 Methane Slip (Virtual conversion)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "methaneSlip=0.1\n",
    "esM.add(fn.Conversion(esM=esM, name='CH4Slip', physicalUnit= r'GW$_{CH4}$',\n",
    "                      commodityConversionFactors={'nGasImp':-1, 'nGas':1, 'CO2':methaneSlip*2.014},\n",
    "                      hasCapacityVariable=False))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.3 Biogas to Methane (Virtual conversion)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='biogas-nGas', physicalUnit= r'GW$_{CH4}$',\n",
    "                      commodityConversionFactors={'biogas':-1, 'nGas':1, 'CO2':-0.2014},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0003,\n",
    "                      investPerCapacity=343, opexPerCapacity=343*0.025, interestRate=0.08,\n",
    "                      economicLifetime=15))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.4 Transport"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Batterie Electric Vehicle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### BEV Car"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='BEV_PCar', physicalUnit= r'Mio pkm/h',\n",
    "                      commodityConversionFactors={'electricity':-1/7.676226, 'pTransport':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=15694, opexPerCapacity=15694*0.009, interestRate=0.08,\n",
    "                      economicLifetime=12))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### BEV Truck"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='BEV_Truck', physicalUnit= r'Mio tkm/h',\n",
    "                      commodityConversionFactors={'electricity':-1/11.401, 'fTransport':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=4304, opexPerCapacity=4304*0.009, interestRate=0.08,\n",
    "                      economicLifetime=15))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fuel Cell Electric Vehicle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### FCEV Car"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='FCEV_PCar', physicalUnit= r'Mio pkm/h',\n",
    "                      commodityConversionFactors={'hydrogen':-1/4.7472, 'pTransport':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=15694, opexPerCapacity=15694*0.009, interestRate=0.08,\n",
    "                      economicLifetime=12))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### FCEV Truck"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='FCEV_Truck', physicalUnit= r'Mio tkm/h',\n",
    "                      commodityConversionFactors={'hydrogen':-1/8.251, 'fTransport':1},\n",
    "                      hasCapacityVariable=True,\n",
    "                      investPerCapacity=4283, opexPerCapacity=4283*0.009, interestRate=0.08,\n",
    "                      economicLifetime=15))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fossil Vehicles"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Fossil Car"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='FossilCar', physicalUnit= r'Mio pkm/h',\n",
    "                      commodityConversionFactors={'diesel':-1/3.1308, 'pTransport':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=15694, opexPerCapacity=15694*0.016, interestRate=0.08,\n",
    "                      economicLifetime=12))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Fossil Truck"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='FossilTruck', physicalUnit= r'Mio tkm/h',\n",
    "                      commodityConversionFactors={'diesel':-1/7.938, 'fTransport':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=3342, opexPerCapacity=3342*0.016, interestRate=0.08,\n",
    "                      economicLifetime=15))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.5 Diesel Refinery"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='DieselRef', physicalUnit= r'GW$_{diesel}$',\n",
    "                      commodityConversionFactors={'crudeOil':-1/0.364, 'diesel':1, 'CO2':0.725},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=1/0.364, opexPerCapacity=(1/0.364)*0.001, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.6 Power Plants"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Combined Cycle Gas Turbine"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Natural Gas CCGT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='CCGT plants (NGas)', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'nGas':-1/0.65, 'CO2':0.31},\n",
    "                      hasCapacityVariable=True,investPerCapacity=850, \n",
    "                      opexPerCapacity=850*0.03, opexPerOperation=0.002, interestRate=0.08,\n",
    "                      economicLifetime=30))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### H2 CCGT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='CCGT plants (hydrogen)', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'hydrogen':-1/0.6},\n",
    "                      hasCapacityVariable=True, investPerCapacity=760, \n",
    "                      opexPerCapacity=760*0.014, opexPerOperation=0.002, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fuel cell"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='LS-SOFC', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'hydrogen':-1/0.7, 'LTHeat':0.25/0.7},\n",
    "                      hasCapacityVariable=True, investPerCapacity=1210, \n",
    "                      opexPerCapacity=1210*0.008, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Coal power plant"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='CoalPP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'coal':-1/0.5, 'CO2':0.674},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0015,\n",
    "                      investPerCapacity=1450, opexPerCapacity=1450*0.026, interestRate=0.08,\n",
    "                      economicLifetime=40))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Combined Heat and Power Plants"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Coal CHP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='CoalCHP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'LTHeat':0.51/0.38, 'coal':-1/0.38, 'CO2':0.886},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0051,\n",
    "                      investPerCapacity=1847, opexPerCapacity=1847*0.027, interestRate=0.08,\n",
    "                      economicLifetime=35))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Wood CHP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='WoodCHP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'LTHeat':0.826/0.291, 'wood':-1/0.291},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0038,\n",
    "                      investPerCapacity=3000, opexPerCapacity=3000*0.029, interestRate=0.08,\n",
    "                      economicLifetime=25))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Natural Gas CHP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='nGasCHP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'LTHeat':0.5/0.35, 'nGas':-1/0.35, 'CO2':0.575},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0015,\n",
    "                      investPerCapacity=666, opexPerCapacity=666*0.041, interestRate=0.08,\n",
    "                      economicLifetime=30))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Biogas CHP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='BioGasCHP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'LTHeat':1, 'biogas':-1/0.47},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.008,\n",
    "                      investPerCapacity=850, opexPerCapacity=850*0.01, interestRate=0.08,\n",
    "                      economicLifetime=25))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### H2 CHP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='H2CHP', physicalUnit=r'GW$_{el}$',\n",
    "                      commodityConversionFactors={'electricity':1, 'LTHeat':0.41/0.49, 'hydrogen':-1/0.49},\n",
    "                      hasCapacityVariable=True, opexPerOperation=0.0006,\n",
    "                      investPerCapacity=715, opexPerCapacity=715*0.001, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.7 Thermal power plants"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Oil Boiler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='oilBoiler', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'crudeOil':-1/0.96, 'LTHeat':1, 'CO2':0.275},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=330, opexPerCapacity=330*0.041, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Gas Boiler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='gasBoiler', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'nGas':-1/0.96, 'LTHeat':1, 'CO2':0.21},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=330, opexPerCapacity=330*0.012, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### H2 Boiler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='H2Boiler', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'hydrogen':-1/0.98, 'LTHeat':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=655, opexPerCapacity=655*0.01, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Heat pump"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='Heatpump', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'electricity':-1/0.45, 'LTHeat':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=725, opexPerCapacity=725*0.02, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Heating rod"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='Heating rod', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'electricity':-1/0.99, 'LTHeat':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=800, opexPerCapacity=800*0.0125, interestRate=0.08,\n",
    "                      economicLifetime=30))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Electrode boiler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='electrode boiler', physicalUnit=r'GW$_{Pheat}$',\n",
    "                      commodityConversionFactors={'electricity':-1/0.99, 'PHeat':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=140, opexPerCapacity=140*0.02, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stove"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='woood Stove', physicalUnit=r'GW$_{LTHeat}$',\n",
    "                      commodityConversionFactors={'wood':-1/0.75, 'LTHeat':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=775, opexPerCapacity=775*0.06, interestRate=0.08,\n",
    "                      economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.8 Electrolyzer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Conversion(esM=esM, name='electroylzer', physicalUnit=r'GW$_{H_{2},LHV}$',\n",
    "                      commodityConversionFactors={'electricity':-1/0.7, 'hydrogen':1},\n",
    "                      hasCapacityVariable=True, \n",
    "                      investPerCapacity=500, opexPerCapacity=500*0.03, interestRate=0.08,\n",
    "                      economicLifetime=10))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 5. Storages\n",
    "\n",
    "The storages which can be used by the EnergyLand model are constructed."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Lithium ion batteries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Storage(esM=esM, name='Li-ion batteries', commodity='electricity',\n",
    "                   hasCapacityVariable=True, chargeEfficiency=0.99,\n",
    "                   dischargeEfficiency=0.99, selfDischarge=0.004,\n",
    "                   doPreciseTsaModeling=False,investPerCapacity=120, \n",
    "                   opexPerCapacity=120*0.014, opexPerChargeOperation=0.0001, \n",
    "                   interestRate=0.08, economicLifetime=10))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hydrogen filled salt caverns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Storage(esM=esM, name='H2Storage', commodity='hydrogen',\n",
    "                   hasCapacityVariable=True, chargeEfficiency=0.98,\n",
    "                   dischargeEfficiency=0.998, doPreciseTsaModeling=False,\n",
    "                   investPerCapacity=362, opexPerCapacity=362*0.02, opexPerChargeOperation=0.0001, \n",
    "                   interestRate=0.08, economicLifetime=40))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Heat storage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "esM.add(fn.Storage(esM=esM, name='LTHeatstorage', commodity='LTHeat',\n",
    "                   hasCapacityVariable=True, chargeEfficiency=0.95,\n",
    "                   dischargeEfficiency=0.95, selfDischarge=0.0003,\n",
    "                   chargeRate=1, dischargeRate=1, doPreciseTsaModeling=False,\n",
    "                   investPerCapacity=147, opexPerCapacity=147*0.01, opexPerChargeOperation=0.0001,\n",
    "                   interestRate=0.08, economicLifetime=20))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 6. Sinks\n",
    "\n",
    "Electricity, heat and transport demand are set in the following components."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Electricity demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "eDemand=516\n",
    "esM.add(fn.Sink(esM=esM, name='Electricity demand', commodity='electricity',\n",
    "                hasCapacityVariable=False, operationRateFix=data['Electricity demand, operationRateFix']*eDemand))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Passenger Transportation demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "pTdemand=867\n",
    "esM.add(fn.Sink(esM=esM, name='pT_demand', commodity='pTransport',\n",
    "                hasCapacityVariable=False, operationRateFix=data['T_demand, operationRateFix']*pTdemand))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Freight Transportation demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "fTdemand=945.5\n",
    "esM.add(fn.Sink(esM=esM, name='fT_demand', commodity='fTransport',\n",
    "                hasCapacityVariable=False, operationRateFix=data['T_demand, operationRateFix']*fTdemand))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Heat demand"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Process heat demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "pHeatDemand=423.75\n",
    "esM.add(fn.Sink(esM=esM, name='PHeat_demand', commodity='PHeat',\n",
    "                hasCapacityVariable=False, operationRateFix=data['pHeat_demand, operationRateFix']*pHeatDemand))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Low temperature residential heat demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "LTHeatDemand=560.8\n",
    "esM.add(fn.Sink(esM=esM, name='LTHeat_demand', commodity='LTHeat',\n",
    "                hasCapacityVariable=False, operationRateFix=data['LtHeat_demand, operationRateFix']*LTHeatDemand))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Environment\n",
    "\n",
    "The CO2 limit is set in this component."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "CO2limit=210000\n",
    "esM.add(fn.Sink(esM=esM, name='environment', commodity='CO2', commodityLimitID='CO2_cap',\n",
    "                hasCapacityVariable=False, yearlyLimit=CO2limit))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 7. Optimization of EnergyLand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Clustering time series data with 48 typical periods and 24 time steps per period...\n",
      "\t\t(0.9526 sec)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "esM.cluster(numberOfTypicalPeriods=48)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time series aggregation specifications:\n",
      "Number of typical periods:48, number of time steps per periods:24\n",
      "\n",
      "Declaring sets, variables and constraints for SourceSinkModel\n",
      "\tdeclaring sets... \n",
      "\tdeclaring variables... \n",
      "\tdeclaring constraints... \n",
      "\t\t(1.2495 sec)\n",
      "\n",
      "Declaring sets, variables and constraints for ConversionModel\n",
      "\tdeclaring sets... \n",
      "\tdeclaring variables... \n",
      "\tdeclaring constraints... \n",
      "\t\t(0.5935 sec)\n",
      "\n",
      "Declaring sets, variables and constraints for StorageModel\n",
      "\tdeclaring sets... \n",
      "\tdeclaring variables... \n",
      "\tdeclaring constraints... \n",
      "\t\t(0.5778 sec)\n",
      "\n",
      "Declaring shared potential constraint...\n",
      "\t\t(0.0000 sec)\n",
      "\n",
      "Declaring commodity balances...\n",
      "\t\t(0.9527 sec)\n",
      "\n",
      "Declaring objective function...\n",
      "\t\t(0.3748 sec)\n",
      "\n",
      "Using license file C:\\Users\\t.gross\\gurobi.lic\n",
      "Academic license - for non-commercial use only\n",
      "Read LP format model from file C:\\Users\\T58C8~1.GRO\\AppData\\Local\\Temp\\tmp1nrd042w.pyomo.lp\n",
      "Reading time = 0.33 seconds\n",
      "x63807: 82956 rows, 63807 columns, 238879 nonzeros\n",
      "Changed value of parameter QCPDual to 1\n",
      "   Prev: 0  Min: 0  Max: 1  Default: 0\n",
      "Changed value of parameter Threads to 3\n",
      "   Prev: 0  Min: 0  Max: 1024  Default: 0\n",
      "Parameter logfile unchanged\n",
      "   Value:   Default: \n",
      "Gurobi Optimizer version 9.0.0 build v9.0.0rc2 (win64)\n",
      "Optimize a model with 82956 rows, 63807 columns and 238879 nonzeros\n",
      "Model fingerprint: 0xd85fd6ee\n",
      "Coefficient statistics:\n",
      "  Matrix range     [4e-06, 2e+01]\n",
      "  Objective range  [2e-04, 2e+03]\n",
      "  Bounds range     [7e-01, 6e+02]\n",
      "  RHS range        [5e-02, 2e+05]\n",
      "\n",
      "Concurrent LP optimizer: dual simplex and barrier\n",
      "Showing barrier log only...\n",
      "\n",
      "Presolve removed 25384 rows and 19340 columns\n",
      "Presolve time: 0.14s\n",
      "Presolved: 57572 rows, 44467 columns, 210024 nonzeros\n",
      "\n",
      "Ordering time: 0.02s\n",
      "\n",
      "Barrier statistics:\n",
      " Dense cols : 30\n",
      " Free vars  : 720\n",
      " AA' NZ     : 4.569e+05\n",
      " Factor NZ  : 2.403e+06 (roughly 60 MBytes of memory)\n",
      " Factor Ops : 3.859e+08 (less than 1 second per iteration)\n",
      " Threads    : 2\n",
      "\n",
      "                  Objective                Residual\n",
      "Iter       Primal          Dual         Primal    Dual     Compl     Time\n",
      "   0   2.13996556e+07 -4.61094986e+05  4.70e+05 1.01e+00  1.20e+05     0s\n",
      "   1   1.92872650e+07 -3.52067963e+07  3.25e+05 3.22e+01  5.01e+04     0s\n",
      "   2   1.51673159e+07 -4.82238267e+07  1.99e+05 8.70e+00  2.58e+04     0s\n",
      "   3   1.05704919e+07 -4.66690530e+07  6.23e+04 4.22e+00  9.42e+03     1s\n",
      "   4   8.09130670e+06 -3.71357602e+07  2.24e+04 1.15e+00  3.27e+03     1s\n",
      "   5   5.10022759e+06 -2.24517290e+07  6.57e+03 3.44e-01  1.04e+03     1s\n",
      "   6   4.18737468e+06 -1.44446060e+07  4.29e+03 1.51e-01  6.09e+02     1s\n",
      "   7   3.25609378e+06 -1.00364386e+07  2.58e+03 8.87e-02  3.61e+02     1s\n",
      "   8   2.34024961e+06 -6.64238358e+06  1.34e+03 4.16e-02  1.94e+02     1s\n",
      "   9   1.54027297e+06 -3.88355984e+06  5.07e+02 2.00e-02  8.94e+01     1s\n",
      "  10   9.44696897e+05 -7.49802920e+05  1.40e+02 2.10e-03  2.21e+01     1s\n",
      "  11   6.95513344e+05 -1.84110006e+05  5.28e+01 6.01e-04  1.04e+01     1s\n",
      "  12   6.30178227e+05  5.76834917e+04  3.58e+01 5.46e-04  6.57e+00     1s\n",
      "  13   5.70943854e+05  2.14580804e+05  2.18e+01 4.46e-04  3.99e+00     1s\n",
      "  14   5.24059926e+05  3.11490041e+05  1.30e+01 3.81e-04  2.34e+00     1s\n",
      "  15   4.94767876e+05  3.58088048e+05  8.98e+00 3.00e-04  1.49e+00     1s\n",
      "  16   4.64289191e+05  3.75517594e+05  4.93e+00 2.63e-04  9.57e-01     1s\n",
      "  17   4.56359222e+05  3.82052296e+05  3.99e+00 2.39e-04  7.99e-01     1s\n",
      "  18   4.44734038e+05  3.91668756e+05  2.67e+00 1.99e-04  5.69e-01     2s\n",
      "  19   4.35830696e+05  4.00184000e+05  1.74e+00 1.53e-04  3.81e-01     2s\n",
      "  20   4.31811842e+05  4.05616343e+05  1.33e+00 1.18e-04  2.79e-01     2s\n",
      "  21   4.26403242e+05  4.08923722e+05  8.22e-01 9.92e-05  1.86e-01     2s\n",
      "  22   4.25742956e+05  4.10312183e+05  7.66e-01 8.48e-05  1.64e-01     2s\n",
      "  23   4.23157185e+05  4.11389385e+05  5.32e-01 7.62e-05  1.25e-01     2s\n",
      "  24   4.21225950e+05  4.12694071e+05  3.69e-01 6.78e-05  9.07e-02     2s\n",
      "  25   4.19965331e+05  4.13953436e+05  2.58e-01 5.25e-05  6.39e-02     2s\n",
      "  26   4.19142820e+05  4.14578101e+05  1.87e-01 4.58e-05  4.85e-02     2s\n",
      "  27   4.18537849e+05  4.15376749e+05  1.38e-01 3.74e-05  3.35e-02     2s\n",
      "  28   4.18037595e+05  4.15891663e+05  9.71e-02 2.83e-05  2.28e-02     2s\n",
      "  29   4.17652183e+05  4.16164930e+05  6.67e-02 2.78e-05  1.58e-02     2s\n",
      "  30   4.17403574e+05  4.16358484e+05  4.74e-02 2.60e-05  1.11e-02     2s\n",
      "  31   4.17251075e+05  4.16447897e+05  3.52e-02 2.55e-05  8.51e-03     2s\n",
      "  32   4.17041145e+05  4.16565268e+05  1.89e-02 2.06e-05  5.04e-03     3s\n",
      "  33   4.16915663e+05  4.16663412e+05  9.86e-03 1.51e-05  2.67e-03     3s\n",
      "  34   4.16841747e+05  4.16699776e+05  4.89e-03 1.85e-05  1.50e-03     3s\n",
      "  35   4.16823269e+05  4.16724086e+05  3.65e-03 2.14e-05  1.05e-03     3s\n",
      "  36   4.16795639e+05  4.16744473e+05  1.89e-03 1.94e-05  5.42e-04     3s\n",
      "  37   4.16779038e+05  4.16754235e+05  7.89e-04 1.28e-05  2.63e-04     3s\n",
      "  38   4.16773749e+05  4.16759999e+05  4.70e-04 7.03e-06  1.46e-04     3s\n",
      "  39   4.16771948e+05  4.16762843e+05  3.69e-04 3.83e-06  9.64e-05     3s\n",
      "  40   4.16767139e+05  4.16764035e+05  9.93e-05 3.98e-06  3.28e-05     3s\n",
      "  41   4.16765977e+05  4.16764708e+05  3.26e-05 2.15e-06  1.34e-05     3s\n",
      "  42   4.16765612e+05  4.16764977e+05  1.29e-05 1.22e-06  6.72e-06     3s\n",
      "  43   4.16765518e+05  4.16765216e+05  8.23e-06 3.82e-07  3.19e-06     3s\n",
      "  44   4.16765378e+05  4.16765293e+05  1.89e-06 1.06e-07  9.05e-07     3s\n",
      "  45   4.16765358e+05  4.16765300e+05  1.84e-06 8.19e-08  6.09e-07     3s\n",
      "  46   4.16765353e+05  4.16765308e+05  1.57e-06 5.67e-08  4.77e-07     3s\n",
      "  47   4.16765353e+05  4.16765308e+05  4.34e-06 5.67e-08  4.77e-07     4s\n",
      "  48   4.16765353e+05  4.16765308e+05  4.34e-06 5.67e-08  4.77e-07     4s\n",
      "  49   4.16765353e+05  4.16765308e+05  4.34e-06 5.67e-08  4.77e-07     4s\n",
      "  50   4.16765353e+05  4.16765308e+05  4.34e-06 5.67e-08  4.77e-07     4s\n",
      "  51   4.16765353e+05  4.16765308e+05  4.34e-06 5.67e-08  4.77e-07     4s\n",
      "  52   4.16765350e+05  4.16765309e+05  8.31e-06 5.55e-08  4.44e-07     4s\n",
      "  53   4.16765350e+05  4.16765309e+05  8.31e-06 5.55e-08  4.44e-07     4s\n",
      "  54   4.16765350e+05  4.16765309e+05  8.31e-06 5.55e-08  4.44e-07     4s\n",
      "  55   4.16765350e+05  4.16765309e+05  8.31e-06 5.55e-08  4.43e-07     4s\n",
      "  56   4.16765350e+05  4.16765309e+05  8.31e-06 5.55e-08  4.43e-07     4s\n",
      "  57   4.16765350e+05  4.16765309e+05  8.28e-06 5.54e-08  4.42e-07     5s\n",
      "\n",
      "Barrier performed 57 iterations in 4.59 seconds\n",
      "Sub-optimal termination - objective 4.16765350e+05\n",
      "\n",
      "Crossover log...\n",
      "\n",
      "   11275 DPushes remaining with DInf 0.0000000e+00                 6s\n",
      "       0 DPushes remaining with DInf 1.0516137e-11                 8s\n",
      "\n",
      "   16837 PPushes remaining with PInf 1.0170541e-02                 8s\n",
      "   11329 PPushes remaining with PInf 4.0276948e-02                10s\n",
      "       0 PPushes remaining with PInf 6.8493449e-02                14s\n",
      "\n",
      "  Push phase complete: Pinf 6.8493449e-02, Dinf 1.6440764e+03     14s\n",
      "\n",
      "Iteration    Objective       Primal Inf.    Dual Inf.      Time\n",
      "   31941    4.1676549e+05   0.000000e+00   1.644076e+03     14s\n",
      "   32543    4.1676533e+05   0.000000e+00   0.000000e+00     15s\n",
      "\n",
      "Solved with barrier\n",
      "Solved in 32543 iterations and 14.88 seconds\n",
      "Optimal objective  4.167653255e+05\n",
      "\n",
      "Status: ok\n",
      "Return code: 0\n",
      "Message: Model was solved to optimality (subject to tolerances), and an optimal solution is available.\n",
      "Termination condition: optimal\n",
      "Termination message: Model was solved to optimality (subject to tolerances), and an optimal solution is available.\n",
      "Wall time: 14.884099960327148\n",
      "Error rc: 0\n",
      "Time: 15.899292945861816\n",
      "\n",
      "\n",
      "Name: x63807_copy\n",
      "Lower bound: 416765.32545957615\n",
      "Upper bound: 416765.32545957615\n",
      "Number of objectives: 1\n",
      "Number of constraints: 82956\n",
      "Number of variables: 63807\n",
      "Number of binary variables: 0\n",
      "Number of integer variables: 0\n",
      "Number of continuous variables: 63807\n",
      "Number of nonzeros: 238879\n",
      "Sense: minimize\n",
      "\n",
      "Solve time: 19.491485357284546 sec.\n",
      "\n",
      "Processing optimization output...\n",
      "for SourceSinkModel ...(1.3900sec)\n",
      "for ConversionModel ...(2.3271sec)\n",
      "for StorageModel ...  (2.2490sec)\n",
      "\t\t(5.9661 sec)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "esM.optimize(timeSeriesAggregation=True, solver='gurobi')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 8. Results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>EnergyLand</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Component</th>\n",
       "      <th>Property</th>\n",
       "      <th>Unit</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">BioslurrySource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>1402.72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{bioslurry}$]</th>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>1402.72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{bioslurry}$*h/a]</th>\n",
       "      <td>20038.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">BiowasteSource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>338.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{biowaste}$]</th>\n",
       "      <td>0.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>338.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{biowaste}$*h/a]</th>\n",
       "      <td>4840.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">CoalSource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>7224.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>7224.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{coal}$*h/a]</th>\n",
       "      <td>344037</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">CrudeOilSource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>2448.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>2448.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{Oil}$*h/a]</th>\n",
       "      <td>68021.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Electricity demand</th>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>516000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">H2_Import</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>205.179</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>205.179</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{H_{2},LHV}$*h/a]</th>\n",
       "      <td>1554.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LTHeat_demand</th>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{LTHeat}$*h/a]</th>\n",
       "      <td>560800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PHeat_demand</th>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{Pheat}$*h/a]</th>\n",
       "      <td>423750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">PV</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>23590.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{el}$]</th>\n",
       "      <td>244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>19881.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>195200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>292176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>3708.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">Wind_Offshore</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>18744.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{el}$]</th>\n",
       "      <td>50.4506</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>13000.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>127640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>163336</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>5743.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">Wind_Onshore</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>43894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{el}$]</th>\n",
       "      <td>288.179</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>36689.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>360223</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>508034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>7204.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">WoodSource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>3695.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{wood}$]</th>\n",
       "      <td>16.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>3695.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{wood}$*h/a]</th>\n",
       "      <td>131980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>el_Import</th>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>83312.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>environment</th>\n",
       "      <th>operation</th>\n",
       "      <th>[kt$_{CO_{2}}$/h*h/a]</th>\n",
       "      <td>210000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>fT_demand</th>\n",
       "      <th>operation</th>\n",
       "      <th>[Mio tkm/h*h/a]</th>\n",
       "      <td>945500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">nGasSource</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>4842.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>commodCosts</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>4842.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{CH4}$*h/a]</th>\n",
       "      <td>189172</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pT_demand</th>\n",
       "      <th>operation</th>\n",
       "      <th>[Mio pkm/h*h/a]</th>\n",
       "      <td>867000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                      EnergyLand\n",
       "Component          Property    Unit                             \n",
       "BioslurrySource    TAC         [1e6 Euro/a]              1402.72\n",
       "                   capacity    [GW$_{bioslurry}$]            2.9\n",
       "                   commodCosts [1e6 Euro/a]              1402.72\n",
       "                   operation   [GW$_{bioslurry}$*h/a]    20038.8\n",
       "BiowasteSource     TAC         [1e6 Euro/a]              338.802\n",
       "                   capacity    [GW$_{biowaste}$]             0.7\n",
       "                   commodCosts [1e6 Euro/a]              338.802\n",
       "                   operation   [GW$_{biowaste}$*h/a]     4840.03\n",
       "CoalSource         TAC         [1e6 Euro/a]              7224.77\n",
       "                   commodCosts [1e6 Euro/a]              7224.77\n",
       "                   operation   [GW$_{coal}$*h/a]          344037\n",
       "CrudeOilSource     TAC         [1e6 Euro/a]              2448.78\n",
       "                   commodCosts [1e6 Euro/a]              2448.78\n",
       "                   operation   [GW$_{Oil}$*h/a]          68021.6\n",
       "Electricity demand operation   [GW$_{el}$*h/a]            516000\n",
       "H2_Import          TAC         [1e6 Euro/a]              205.179\n",
       "                   commodCosts [1e6 Euro/a]              205.179\n",
       "                   operation   [GW$_{H_{2},LHV}$*h/a]    1554.39\n",
       "LTHeat_demand      operation   [GW$_{LTHeat}$*h/a]        560800\n",
       "PHeat_demand       operation   [GW$_{Pheat}$*h/a]         423750\n",
       "PV                 TAC         [1e6 Euro/a]              23590.4\n",
       "                   capacity    [GW$_{el}$]                   244\n",
       "                   capexCap    [1e6 Euro/a]              19881.6\n",
       "                   invest      [1e6 Euro]                 195200\n",
       "                   operation   [GW$_{el}$*h/a]            292176\n",
       "                   opexCap     [1e6 Euro/a]               3708.8\n",
       "Wind_Offshore      TAC         [1e6 Euro/a]              18744.2\n",
       "                   capacity    [GW$_{el}$]               50.4506\n",
       "                   capexCap    [1e6 Euro/a]              13000.4\n",
       "                   invest      [1e6 Euro]                 127640\n",
       "                   operation   [GW$_{el}$*h/a]            163336\n",
       "                   opexCap     [1e6 Euro/a]               5743.8\n",
       "Wind_Onshore       TAC         [1e6 Euro/a]                43894\n",
       "                   capacity    [GW$_{el}$]               288.179\n",
       "                   capexCap    [1e6 Euro/a]              36689.5\n",
       "                   invest      [1e6 Euro]                 360223\n",
       "                   operation   [GW$_{el}$*h/a]            508034\n",
       "                   opexCap     [1e6 Euro/a]              7204.46\n",
       "WoodSource         TAC         [1e6 Euro/a]              3695.44\n",
       "                   capacity    [GW$_{wood}$]                16.2\n",
       "                   commodCosts [1e6 Euro/a]              3695.44\n",
       "                   operation   [GW$_{wood}$*h/a]          131980\n",
       "el_Import          operation   [GW$_{el}$*h/a]           83312.2\n",
       "environment        operation   [kt$_{CO_{2}}$/h*h/a]      210000\n",
       "fT_demand          operation   [Mio tkm/h*h/a]            945500\n",
       "nGasSource         TAC         [1e6 Euro/a]              4842.79\n",
       "                   commodCosts [1e6 Euro/a]              4842.79\n",
       "                   operation   [GW$_{CH4}$*h/a]           189172\n",
       "pT_demand          operation   [Mio pkm/h*h/a]            867000"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "esM.getOptimizationSummary(\"SourceSinkModel\", outputLevel=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>EnergyLand</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Component</th>\n",
       "      <th>Property</th>\n",
       "      <th>Unit</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">BEV_PCar</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>220091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[Mio pkm/h]</th>\n",
       "      <td>98.9726</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>206112</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>1.55328e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[Mio pkm/h*h/a]</th>\n",
       "      <td>867000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">oilBoiler</th>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{LTHeat}$]</th>\n",
       "      <td>20.7962</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>698.986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>6862.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operation</th>\n",
       "      <th>[GW$_{LTHeat}$*h/a]</th>\n",
       "      <td>65300.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>281.372</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>74 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          EnergyLand\n",
       "Component Property  Unit                            \n",
       "BEV_PCar  TAC       [1e6 Euro/a]              220091\n",
       "          capacity  [Mio pkm/h]              98.9726\n",
       "          capexCap  [1e6 Euro/a]              206112\n",
       "          invest    [1e6 Euro]           1.55328e+06\n",
       "          operation [Mio pkm/h*h/a]           867000\n",
       "...                                              ...\n",
       "oilBoiler capacity  [GW$_{LTHeat}$]          20.7962\n",
       "          capexCap  [1e6 Euro/a]             698.986\n",
       "          invest    [1e6 Euro]               6862.74\n",
       "          operation [GW$_{LTHeat}$*h/a]      65300.7\n",
       "          opexCap   [1e6 Euro/a]             281.372\n",
       "\n",
       "[74 rows x 1 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "esM.getOptimizationSummary(\"ConversionModel\", outputLevel=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>EnergyLand</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Component</th>\n",
       "      <th>Property</th>\n",
       "      <th>Unit</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"8\" valign=\"top\">LTHeatstorage</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>4575.69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{LTHeat}$*h]</th>\n",
       "      <td>277.568</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>4155.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>40802.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operationCharge</th>\n",
       "      <th>[GW$_{LTHeat}$*h/a]</th>\n",
       "      <td>118340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operationDischarge</th>\n",
       "      <th>[GW$_{LTHeat}$*h/a]</th>\n",
       "      <td>106483</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>408.025</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCharge</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>11.834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"8\" valign=\"top\">Li-ion batteries</th>\n",
       "      <th>TAC</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>3168.85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capacity</th>\n",
       "      <th>[GW$_{el}$*h]</th>\n",
       "      <td>161.737</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>2892.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>invest</th>\n",
       "      <th>[1e6 Euro]</th>\n",
       "      <td>19408.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operationCharge</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>46985.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operationDischarge</th>\n",
       "      <th>[GW$_{el}$*h/a]</th>\n",
       "      <td>43805.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCap</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>271.718</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>opexCharge</th>\n",
       "      <th>[1e6 Euro/a]</th>\n",
       "      <td>4.69859</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                        EnergyLand\n",
       "Component        Property           Unit                          \n",
       "LTHeatstorage    TAC                [1e6 Euro/a]           4575.69\n",
       "                 capacity           [GW$_{LTHeat}$*h]      277.568\n",
       "                 capexCap           [1e6 Euro/a]           4155.83\n",
       "                 invest             [1e6 Euro]             40802.5\n",
       "                 operationCharge    [GW$_{LTHeat}$*h/a]     118340\n",
       "                 operationDischarge [GW$_{LTHeat}$*h/a]     106483\n",
       "                 opexCap            [1e6 Euro/a]           408.025\n",
       "                 opexCharge         [1e6 Euro/a]            11.834\n",
       "Li-ion batteries TAC                [1e6 Euro/a]           3168.85\n",
       "                 capacity           [GW$_{el}$*h]          161.737\n",
       "                 capexCap           [1e6 Euro/a]           2892.43\n",
       "                 invest             [1e6 Euro]             19408.5\n",
       "                 operationCharge    [GW$_{el}$*h/a]        46985.9\n",
       "                 operationDischarge [GW$_{el}$*h/a]        43805.4\n",
       "                 opexCap            [1e6 Euro/a]           271.718\n",
       "                 opexCharge         [1e6 Euro/a]           4.69859"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "esM.getOptimizationSummary(\"StorageModel\", outputLevel=2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
