{ "cells": [ { "cell_type": "code", "execution_count": 89, "id": "3cd3ada2-e064-412b-aaf3-09af3279f411", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The autoreload extension is already loaded. To reload it, use:\n", " %reload_ext autoreload\n" ] } ], "source": [ "from datetime import timedelta\n", "import json\n", "import pprint\n", "from copy import deepcopy\n", "\n", "import cufflinks\n", "cufflinks.go_offline()\n", "import numpy as np\n", "from numpy.polynomial import Polynomial\n", "import pandas as pd\n", "from tqdm.notebook import tqdm\n", "\n", "from notepad import WaterStorage, Heatpump\n", "from pyrecoy.colors import *\n", "from pyrecoy.converters import *\n", "from pyrecoy.financial import calculate_eb_ode, get_tax_tables, get_tax_rate, get_grid_tariffs_electricity\n", "from pyrecoy.framework import TimeFramework\n", "from pyrecoy.casestudy import CaseStudy\n", "from pyrecoy.plotting import ebitda_bar_chart, npv_bar_chart\n", "from pyrecoy.reports import CaseReport, ComparisonReport, BusinessCaseReport, SingleFigureComparison\n", "from pyrecoy.sensitivity import SensitivityAnalysis\n", "from pyrecoy.prices import get_tennet_data, get_afrr_capacity_fees_nl\n", "from pyrecoy.forecasts import Mipf\n", "\n", "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 90, "id": "4213d9a9-8a4e-465d-b982-540fad36dde0", "metadata": {}, "outputs": [], "source": [ "class Config():\n", " start = '2019-01-01'\n", " end = '2019-12-31'\n", " \n", " hp_vdg_e_power = 23.3 # MW before\n", " hp_ndg_e_power = 7.7 # MW after\n", " hp_min_load = 0.3\n", " hp_lifetime = 25\n", " hp_capex = 200_000 # EUR/MWth\n", " hp_opex = 0.01 # in % of CAPEX\n", " hp_devex = 0.005 # in % of CAPEX\n", " \n", " gb_power = 35 # MW\n", " gb_efficiency = 0.9\n", " \n", " tax_bracket_g = 4 \n", " tax_bracket_e = 4\n", " \n", " include_transport_costs = False\n", " grid_operator = 'Liander'\n", " connection_type = 'TS/MS'\n", " \n", " discount_rate = 0.1\n", " project_duration = 12\n", "\n", " forecast = 'ForeNeg'\n", " gas_price_multiplier = 1\n", " e_price_multiplier = 1\n", " e_price_volatility_multiplier = 1\n", " co2_price_multiplier = 1\n", " tsource_delta = 0\n", " tsink_delta = 0\n", " energy_tax_multiplier = 1\n", " \n", " # Review the SDE implementation\n", " sde_base_amount = 81\n", " longterm_gas_price = 24.00\n", " longterm_co2_price = 37.90\n", " sde_switch_price_correction = 40\n", " \n", " day_ahead_buying_perc = 0.3\n", " \n", " afrr_capacity_fee = 25_000\n", "\n", "c = Config()" ] }, { "cell_type": "code", "execution_count": 91, "id": "55d320d4-0590-4b4b-b361-9b3742134254", "metadata": {}, "outputs": [], "source": [ "class Store():\n", " pass" ] }, { "cell_type": "code", "execution_count": 104, "id": "e976f5b5-ab1c-48af-be8c-589f0d62e68b", "metadata": {}, "outputs": [], "source": [ "def load_demand_data(c, s):\n", " demand = pd.read_csv('data/smurfit_demand_preprocessed.csv', delimiter=';', decimal=',')\n", " dt_index = pd.date_range(\n", " start=s.time_fw.start,\n", " end=s.time_fw.start + timedelta(days=365), freq='1T',\n", " closed='left',\n", " tz='Europe/Amsterdam')\n", " demand.index = dt_index\n", " demand['Total demand'] = demand['MW (VDG)'] + demand['MW (NDG)']\n", " demand = demand[c.start:c.end]\n", " return demand\n" ] }, { "cell_type": "code", "execution_count": 94, "id": "98285112-9b23-4cb9-9b66-0f62e23360c4", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\users\\shahla huseynova\\python\\29 - pyrecoy modelling framework\\pyrecoy\\pyrecoy\\framework.py:35: FutureWarning:\n", "\n", "Argument `closed` is deprecated in favor of `inclusive`.\n", "\n", "c:\\users\\shahla huseynova\\python\\29 - pyrecoy modelling framework\\pyrecoy\\pyrecoy\\framework.py:35: FutureWarning:\n", "\n", "Argument `closed` is deprecated in favor of `inclusive`.\n", "\n", "C:\\Users\\SHAHLA~1\\AppData\\Local\\Temp/ipykernel_27972/4233922362.py:3: FutureWarning:\n", "\n", "Argument `closed` is deprecated in favor of `inclusive`.\n", "\n" ] }, { "data": { "text/plain": [ "[,\n", " ]" ] }, "execution_count": 94, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def setup_model(c):\n", " s = Store()\n", " \n", " s.time_fw = TimeFramework(start=c.start, end=c.end)\n", " mipf = Mipf(\n", " start=s.time_fw.start, \n", " end=s.time_fw.end, \n", " tidy=True, \n", " include_nextQ=True, \n", " folder_path=r\"C:\\Users\\Shahla Huseynova\\Recoy\\Recoy - Documents\\03 - Libraries\\12 - Data Management\\Forecast Data\"\n", " ).data\n", "\n", " s.hpcase = CaseStudy(time_fw=s.time_fw, freq='1T', name='Heatpump only', data=mipf)\n", " s.hp_storage_case = CaseStudy(time_fw=s.time_fw, freq='1T', name='Heatpump + Storage', data=mipf)\n", " \n", " s.cases = list(CaseStudy.instances.values())\n", " s.optcases = [s.hpcase, s.hp_storage_case]\n", " # s.sde_cases = [s.hpcase_sde, s.optcase1, s.afrr_case]\n", " \n", " s.demand = load_demand_data(c, s)\n", " return s\n", "\n", "s = setup_model(c)\n", "s.optcases" ] }, { "cell_type": "code", "execution_count": 95, "id": "59d72c05-698f-47d6-96e1-2dba6ebf7dfb", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\SHAHLA~1\\AppData\\Local\\Temp/ipykernel_27972/4233922362.py:3: FutureWarning:\n", "\n", "Argument `closed` is deprecated in favor of `inclusive`.\n", "\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Tsource (VDG)Tsink (VDG)MW (VDG)Tsource (NDG)Tsink (NDG)MW (NDG)Total demand
2019-01-01 00:00:00+01:0064.990143.3600.0020.510147.6200.000.00
2019-01-01 00:01:00+01:0064.985143.0890.0020.387147.6420.000.00
2019-01-01 00:02:00+01:0064.980142.8180.0020.264147.6640.000.00
2019-01-01 00:03:00+01:0064.975142.5470.0020.141147.6860.000.00
2019-01-01 00:04:00+01:0064.970142.2760.0020.018147.7080.000.00
........................
2019-12-31 23:55:00+01:0065.050129.97017.0467.070129.3505.6922.73
2019-12-31 23:56:00+01:0065.050129.97017.0467.070129.3505.6922.73
2019-12-31 23:57:00+01:0065.050129.97017.0467.070129.3505.6922.73
2019-12-31 23:58:00+01:0065.050129.97017.0467.070129.3505.6922.73
2019-12-31 23:59:00+01:0065.050129.97017.0467.070129.3505.6922.73
\n", "

525600 rows × 7 columns

\n", "
" ], "text/plain": [ " Tsource (VDG) Tsink (VDG) MW (VDG) \\\n", "2019-01-01 00:00:00+01:00 64.990 143.360 0.00 \n", "2019-01-01 00:01:00+01:00 64.985 143.089 0.00 \n", "2019-01-01 00:02:00+01:00 64.980 142.818 0.00 \n", "2019-01-01 00:03:00+01:00 64.975 142.547 0.00 \n", "2019-01-01 00:04:00+01:00 64.970 142.276 0.00 \n", "... ... ... ... \n", "2019-12-31 23:55:00+01:00 65.050 129.970 17.04 \n", "2019-12-31 23:56:00+01:00 65.050 129.970 17.04 \n", "2019-12-31 23:57:00+01:00 65.050 129.970 17.04 \n", "2019-12-31 23:58:00+01:00 65.050 129.970 17.04 \n", "2019-12-31 23:59:00+01:00 65.050 129.970 17.04 \n", "\n", " Tsource (NDG) Tsink (NDG) MW (NDG) Total demand \n", "2019-01-01 00:00:00+01:00 20.510 147.620 0.00 0.00 \n", "2019-01-01 00:01:00+01:00 20.387 147.642 0.00 0.00 \n", "2019-01-01 00:02:00+01:00 20.264 147.664 0.00 0.00 \n", "2019-01-01 00:03:00+01:00 20.141 147.686 0.00 0.00 \n", "2019-01-01 00:04:00+01:00 20.018 147.708 0.00 0.00 \n", "... ... ... ... ... \n", "2019-12-31 23:55:00+01:00 67.070 129.350 5.69 22.73 \n", "2019-12-31 23:56:00+01:00 67.070 129.350 5.69 22.73 \n", "2019-12-31 23:57:00+01:00 67.070 129.350 5.69 22.73 \n", "2019-12-31 23:58:00+01:00 67.070 129.350 5.69 22.73 \n", "2019-12-31 23:59:00+01:00 67.070 129.350 5.69 22.73 \n", "\n", "[525600 rows x 7 columns]" ] }, "execution_count": 95, "metadata": {}, "output_type": "execute_result" } ], "source": [ "demand = load_demand_data(c, s)\n", "demand\n", "# how this dataframe is created in the class??" ] }, { "cell_type": "code", "execution_count": 114, "id": "35d436bc-6846-4888-982d-1a501fc2654d", "metadata": {}, "outputs": [], "source": [ "def add_afrr_prices(c, case):\n", " try:\n", " aFRR_signal = pd.read_csv(f'data/aFRR_{c.start}.csv', delimiter=';', decimal=',', index_col='datetime')\n", " aFRR_signal.index = case.data.index\n", " except:\n", " data = get_tennet_data('balansdelta2017', pd.to_datetime(c.start), pd.to_datetime(c.end))\n", " data.index = data[[\"datum\", \"tijd\"]].apply(lambda x: \" \".join(x), axis=1)\n", " data.index = pd.to_datetime(data.index, format=\"%d-%m-%Y %H:%M\").tz_localize(\n", " \"Europe/Amsterdam\", ambiguous=True\n", " )\n", " data = data[~data.index.duplicated(keep=\"first\")]\n", " date_ix = pd.date_range(\n", " data.index[0], data.index[-1], freq=\"1T\", tz=\"Europe/Amsterdam\"\n", " )\n", " data = data.reindex(date_ix)\n", " aFRR_signal = data[['Hoogste_prijs_opregelen', 'Mid_prijs_opregelen', 'Laagste_prijs_afregelen']]\n", " aFRR_signal.to_csv(f'data/aFRR_{c.start}.csv', sep=';', decimal=',', index_label='datetime')\n", "\n", " try:\n", " aFRR_prices = pd.read_csv(f'data/aFRR_prices_{c.start}.csv', delimiter=';', decimal=',', index_col='datetime')\n", " aFRR_prices.index = case.data.index\n", " except:\n", " data = get_aFRR_prices_nl(pd.to_datetime(c.start), pd.to_datetime(c.end))\n", " data.index = pd.date_range(\n", " start=c.start,\n", " end=pd.to_datetime(c.end) + timedelta(days=1),\n", " tz='Europe/Amsterdam', \n", " freq='15T', \n", " closed='left'\n", " )\n", " aFRR_prices = data.reindex(case.data.index, method='ffill')\n", " aFRR_prices.to_csv(f'data/aFRR_prices_{c.start}.csv', sep=';', decimal=',', index_label='datetime')\n", " \n", " case.data = pd.concat([case.data, aFRR_signal, aFRR_prices], axis=1)\n", " return case" ] }, { "cell_type": "code", "execution_count": 97, "id": "066c1955-a448-443a-ac2c-6ec7930b02fb", "metadata": {}, "outputs": [], "source": [ "def increase_volatility_by_factor(col, factor):\n", " mean = col.mean()\n", " diff_to_mean = col - mean\n", " new_diff = diff_to_mean * factor\n", " return mean + new_diff\n", "\n", "def multiply_by_factor(col, factor):\n", " mean = col.mean()\n", " diff_to_mean = col - mean\n", " \n", " cond = diff_to_mean > 0\n", " diff_to_mean[cond] *= factor\n", " diff_to_mean[~cond] /= factor\n", " return mean + diff_to_mean" ] }, { "cell_type": "code", "execution_count": 98, "id": "3f2710a5-2744-4aa8-9c9d-2a5770389f52", "metadata": {}, "outputs": [], "source": [ "def load_data(c, s):\n", " # s.afrr_case = add_afrr_prices(c, s.afrr_case)\n", " \n", " for case in s.cases:\n", " case.add_gasprices()\n", " case.add_co2prices(perMWh=True)\n", " \n", " case.data['Gas prices (€/MWh)'] *= c.gas_price_multiplier\n", " case.data['CO2 prices (€/MWh)'] *= c.co2_price_multiplier\n", " case.data['CO2 prices (€/ton)'] *= c.co2_price_multiplier\n", " \n", " for case in s.optcases:\n", " case.data['NEG'] = multiply_by_factor(case.data['NEG'], c.e_price_multiplier)\n", " case.data['ForeNeg'] = multiply_by_factor(case.data['ForeNeg'], c.e_price_multiplier)\n", " case.data['DAM'] = multiply_by_factor(case.data['DAM'], c.e_price_multiplier)\n", " \n", " case.data['NEG'] = increase_volatility_by_factor(case.data['NEG'], c.e_price_volatility_multiplier)\n", " case.data['ForeNeg'] = increase_volatility_by_factor(case.data['ForeNeg'], c.e_price_volatility_multiplier)\n", " \n", " s.demand[['Tsource (VDG)', 'Tsource (NDG)']] += c.tsource_delta\n", " s.demand[['Tsink (VDG)', 'Tsink (NDG)']] += c.tsink_delta\n", " for case in s.cases:\n", " case.data = pd.concat([case.data, s.demand], axis=1) \n", "\n", " s.eb_ode_g = get_tax_rate('gas', 2020, 4)['EB+ODE'] * c.energy_tax_multiplier\n", " s.eb_ode_e = get_tax_rate('electricity', 2020, 4)['EB+ODE'] * c.energy_tax_multiplier\n", " s.grid_fees = get_grid_tariffs_electricity(c.grid_operator, 2020, c.connection_type)\n", " s.grid_fee_per_MWh = s.grid_fees['kWh tarief'] * 1000\n", " return s\n", "\n", "s = load_data(c, s)" ] }, { "cell_type": "code", "execution_count": 106, "id": "5df8557b-1d2e-4c2b-bfce-4a45c898dcc9", "metadata": {}, "outputs": [], "source": [ "def cop_value(Tsink, Tsource):\n", " Tsink += 273\n", " Tsource += 273\n", " \n", " return Tsink / (Tsink - Tsource)" ] }, { "cell_type": "code", "execution_count": 107, "id": "fd0e191c-0c3d-4c93-9be4-19a59a9e4856", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3.591304347826087" ] }, "execution_count": 107, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cop_value(140, 25)" ] }, { "cell_type": "code", "execution_count": 108, "id": "8db4c66e-4675-4277-bcd3-596b4afc9b4e", "metadata": {}, "outputs": [], "source": [ "heatpump = Heatpump(\n", " name='Heatpump',\n", " max_th_power=1,\n", " min_th_power=0,\n", " cop_curve=cop_value\n", ")" ] }, { "cell_type": "code", "execution_count": 118, "id": "f503259c-a00a-4348-bda7-3d32e76788b7", "metadata": {}, "outputs": [ { "ename": "TypeError", "evalue": "_set_cop_curve() takes 1 positional argument but 2 were given", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", "\u001b[1;32mC:\\Users\\SHAHLA~1\\AppData\\Local\\Temp/ipykernel_27972/1526814104.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 46\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0ms\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 47\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 48\u001b[1;33m \u001b[0ms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcreate_and_assign_assets\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mc\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ms\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32mC:\\Users\\SHAHLA~1\\AppData\\Local\\Temp/ipykernel_27972/1526814104.py\u001b[0m in \u001b[0;36mcreate_and_assign_assets\u001b[1;34m(c, s)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcreate_and_assign_assets\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mc\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ms\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m heatpump_vdg = Heatpump(\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'Heatpump VDG'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mmax_th_power\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhp_vdg_e_power\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mmin_th_power\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhp_vdg_e_power\u001b[0m \u001b[1;33m*\u001b[0m \u001b[0mc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhp_min_load\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\python\\Encore\\notepad.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, name, max_th_power, cop_curve, min_th_power)\u001b[0m\n\u001b[0;32m 206\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmax_th_power\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmax_th_power\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 207\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmin_th_power\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmin_th_power\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 208\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcop_curve\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_set_cop_curve\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcop_curve\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 209\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 210\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__repr__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mTypeError\u001b[0m: _set_cop_curve() takes 1 positional argument but 2 were given" ] } ], "source": [ "def create_and_assign_assets(c, s):\n", " heatpump_vdg = Heatpump(\n", " name='Heatpump VDG',\n", " max_th_power=c.hp_vdg_e_power,\n", " min_th_power=c.hp_vdg_e_power * c.hp_min_load,\n", " cop_curve=cop_value\n", " )\n", "\n", " capex_vdg = c.hp_capex*(heatpump_vdg.max_th_power) \n", " heatpump_vdg.set_financials(capex=capex_vdg, opex=c.hp_opex*capex_vdg, devex=c.hp_devex*capex_vdg, lifetime=25)\n", "\n", " vessel = WaterStorage(\n", " name='MyStorage',\n", " max_power=10,\n", " min_power=-10,\n", " roundtrip_eff=0.90,\n", " specific_heat_capacity =1.16*1e-3,\n", " volume = 1000,\n", " lifetime = 25,\n", " min_temperature = 55 + 273,\n", " max_temperature = 95 + 273\n", " )\n", " capex_per_MW = 3_000\n", " capex_per_MWh = 10_000\n", "\n", " vessel.set_financials(\n", " capex_per_MW,\n", " capex_per_MWh,\n", " 2_000,\n", " 0,\n", " lifetime=30\n", " )\n", " \n", "# s.hp_storage_case.add_asset(vessel)\n", " s.baseline.add_asset(gasboiler)\n", " s.hpcase.add_asset(heatpump_vdg)\n", " s.hpcase.add_asset(heatpump_ndg)\n", " s.hpcase_sde.add_asset(heatpump_vdg)\n", " s.hpcase_sde.add_asset(heatpump_ndg)\n", " s.optcase1.add_asset(heatpump_vdg)\n", " s.optcase1.add_asset(heatpump_ndg)\n", " s.optcase1.add_asset(gasboiler)\n", " s.afrr_case.add_asset(heatpump_vdg)\n", " s.afrr_case.add_asset(heatpump_ndg)\n", " s.afrr_case.add_asset(gasboiler)\n", " return s\n", "\n", "s = create_and_assign_assets(c, s)" ] }, { "cell_type": "code", "execution_count": null, "id": "c097f427-755e-418d-ba1d-fc0de1aa729c", "metadata": {}, "outputs": [], "source": [ "def vessel_charge(self, temperature):\n", " if case.data is NEG and load_perc =! 1\n", " return Tsink\n", " \n", " " ] }, { "cell_type": "code", "execution_count": null, "id": "cb2d60bf-eb09-400e-810a-9d78e062d3f3", "metadata": {}, "outputs": [], "source": [ "def vessel_discharge(self):\n", " if case.data is DAM and Tsource