{ "cells": [ { "cell_type": "markdown", "id": "2e6e02af-f001-4280-b12d-4fe5b43fd5d5", "metadata": {}, "source": [ "## Example: LCOE and TEA Metrics\n", "This example shows how to use the TEA module" ] }, { "cell_type": "code", "execution_count": 1, "id": "c290d9d7-e627-42a7-8fb9-5b4b43bda49b", "metadata": {}, "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'TEA'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mTEA\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mnp\u001b[39;00m\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'TEA'" ] } ], "source": [ "from TEA import *\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "id": "48e47eac-d13c-42d0-aa73-f23f093a6086", "metadata": {}, "outputs": [], "source": [ "# Random system augmentation values\n", "aug = [0.0, 0.0,177697.15370019045,123415.5182529735,125167.53750872007,127459.48015140122,129797.99522506997,132179.45632859864,\n", " 134604.61151508446,137074.2621040492,139589.22446923406,25270485.436780076,144758.42520256026,153745.5370943209,2395386.602393612,\n", " 95601.68890339525,76487.6653485089,77705.21401286017,79129.25172473586,80581.05651950833,82059.51282053148,25211900.201960098,\n", " 85098.30106005147,86659.63738404102,193247.85620667101,162422.98262435052,163888.04287525837, 165959.6936979254, 168060.3576125073, \n", " 170182.3355685308, 172325.6064117179]" ] }, { "cell_type": "markdown", "id": "e14da104-76ef-493b-84ee-84b79823dc86", "metadata": {}, "source": [ "### Initialize class" ] }, { "cell_type": "code", "execution_count": 3, "id": "340924a2-b7cd-4d03-8bc7-9da29090ae3f", "metadata": {}, "outputs": [], "source": [ "LCOECalculator = LCOECalculator(system_capex_USD = 346560945.0499253,\n", " system_annual_OM_USD = 7373570,\n", " system_annual_VOM_USD = 1097289,\n", " system_to_load_annual_MWh_e = 365763,\n", " system_augment = aug)" ] }, { "cell_type": "markdown", "id": "01e8e4c0-1fe1-47a3-98ae-f9579775fc98", "metadata": {}, "source": [ "### Run using set and default values, or use your own inputs" ] }, { "cell_type": "code", "execution_count": 4, "id": "2e2ab972-d499-4aa3-9c65-36ae2390d3d1", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "([0,\n", " 101057171.57655823,\n", " 58936542.463448755,\n", " 34371791.56468331,\n", " 20045628.84052331,\n", " 11690610.739793193,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0],\n", " [0,\n", " 0.38880000000000003,\n", " 0.22674816,\n", " 0.13223952691199997,\n", " 0.0771220920950784,\n", " 0.04497760410984972,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0,\n", " 0])" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LCOECalculator.calculate_depreciation()" ] }, { "cell_type": "code", "execution_count": 5, "id": "ecb7be73-95af-4949-aa76-4be49ec84a6d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'annual_electricity_purchases_USD': 0,\n", " 'annual_electricity_sales_USD': 25603410.000000004,\n", " 'PVD': 0.767373270359498,\n", " 'FCR_AT': 0.036148074230068654,\n", " 'FCR_BT': 0.05294061134598742,\n", " 'CRF': 0.07650022967642069,\n", " 'NPV_cash_flow': -75538974.3174016,\n", " 'IRR': -0.008560633038295795,\n", " 'payback_period': None,\n", " 'LCOE_real_USD_kWh_BT': 0.0884607380006672,\n", " 'LCOE_real_USD_kWh_AT': 0.06270683095590603}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LCOECalculator.calculate_lcoe_metrics()" ] }, { "cell_type": "code", "execution_count": 6, "id": "61e45238-4652-42b9-9f39-2de12c301f76", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "([0, 873000000.0, 508086000.0, 295706052.0, 172100922.264, 100162736.75764799],\n", " [0, 0.388, 0.225816, 0.131424912, 0.076489298784, 0.044516771892288])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LCOECalculator.calculate_depreciation(analysis_period = 5, system_capex_USD = 3000000000, inflation = 0.03)" ] }, { "cell_type": "code", "execution_count": 7, "id": "1f628dd5-657f-4c28-89be-7b8e4ee73853", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'annual_electricity_purchases_USD': 0,\n", " 'annual_electricity_sales_USD': 25603410.000000004,\n", " 'PVD': 0.6474760495464913,\n", " 'FCR_AT': 0.03791600902027981,\n", " 'FCR_BT': 0.05532006597615048,\n", " 'CRF': 0.07650022967642069,\n", " 'NPV_cash_flow': -1827446916.07056,\n", " 'IRR': nan,\n", " 'payback_period': None,\n", " 'LCOE_real_USD_kWh_BT': 0.4920364130385064,\n", " 'LCOE_real_USD_kWh_AT': 0.33944481783246816}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LCOECalculator.calculate_lcoe_metrics(system_capex_USD = 3000000000, system_annual_OM_USD = 7373570, depreciation_period = 10)" ] }, { "cell_type": "code", "execution_count": 26, "id": "23820b6b-464e-47d5-9170-c70c8cf4c1cc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0 1 2 3 0 1 2 3 0 1 2 3]\n" ] } ], "source": [ "arr = [1,2,3]\n", "L = 12\n", "\n", "arr_with_zero = np.insert(arr, 0, 0) # Insert a zero at the beginning of the array\n", "l_val = arr_with_zero.size\n", "if L > l_val:\n", " shortfall = L - l_val\n", " repeat_times = (shortfall + l_val - 1) // l_val\n", " repeated_section = np.tile(arr_with_zero, (repeat_times,))[-shortfall:]\n", " augmented_array = np.concatenate((arr_with_zero, repeated_section))\n", " print(augmented_array)\n", "else:\n", " print(arr_with_zero[:L])" ] }, { "cell_type": "code", "execution_count": null, "id": "b4ec6cec-c34f-4b1a-91f2-72c77d39f693", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "“ASGARD-env”", "language": "python", "name": "asgard-env" }, "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.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }