{ "cells": [ { "cell_type": "markdown", "id": "db1306ac-3150-42d6-8886-3cd173537a72", "metadata": {}, "source": [ "# RTORPA Example" ] }, { "cell_type": "code", "execution_count": 1, "id": "b99f0be0-a188-4cfc-a146-d2b3715aaca8", "metadata": { "tags": [] }, "outputs": [], "source": [ "import generation_models as gt\n", "from tyba_client.client import Client\n", "import numpy as np\n", "import pandas as pd\n", "import os" ] }, { "cell_type": "code", "execution_count": 2, "id": "745e67eb-8fef-4163-801a-18eee0769f2e", "metadata": { "tags": [] }, "outputs": [], "source": [ "client = Client(personal_access_token=os.environ[\"TYBA_PAT\"])" ] }, { "cell_type": "code", "execution_count": 3, "id": "5b749321-3e19-4948-8233-1d1e0163e3b9", "metadata": { "tags": [] }, "outputs": [], "source": [ "model = gt.StandaloneStorageModel(\n", " energy_prices=gt.DARTPrices(\n", " dam=np.random.random(48).tolist(),\n", " rtm=np.random.random(48).tolist(),\n", " rtorpa=np.random.random(48).tolist(),\n", " ),\n", " project_term=48,\n", " project_term_units=\"hours\",\n", " storage_inputs=gt.MultiStorageInputs(\n", " batteries=[\n", " gt.BatteryParams(\n", " power_capacity=1000.0,\n", " energy_capacity=1000.0 * 2,\n", " charge_efficiency=0.95,\n", " discharge_efficiency=0.95,\n", " degradation_rate=0.0,\n", " )\n", " ],\n", " ),\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "41f33aac-b0e2-4127-9e81-ad9d93461e20", "metadata": { "tags": [] }, "outputs": [], "source": [ "resp = client.schedule(model)\n", "resp.raise_for_status()\n", "res = client.wait_on_result(resp.json()[\"id\"])\n", "df = pd.DataFrame(res)" ] }, { "cell_type": "code", "execution_count": 5, "id": "99585aba-e42d-4b3d-bc03-8ecef19244cf", "metadata": { "tags": [] }, "outputs": [ { "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", " \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", "
rtorpasoe_mean
00.459418475.000000
10.6986151000.000000
20.8140611525.000000
30.4267962000.000000
40.6607631473.684211
50.426009736.184211
60.7334941000.000000
70.9917071737.500000
80.8166831576.315789
90.040184626.315789
100.862928575.000000
110.9675681525.000000
120.5289051968.534483
130.3204861410.753176
140.179744756.034483
150.5069281102.631579
160.1841591051.315789
170.7588731000.000000
180.7733331737.500000
190.4277891473.684211
200.568534473.684211
210.03872050.000000
220.406480575.000000
230.4673451525.000000
240.1763731525.000000
250.4898981525.000000
260.2947342000.000000
270.0967781473.684211
280.047591473.684211
290.199256475.000000
300.0280511263.815789
310.4027181051.315789
320.2738381000.000000
330.5179051737.500000
340.5509502000.000000
350.0595922000.000000
360.0374081473.684211
370.0838961422.368421
380.2085021374.977314
390.552403688.793103
400.5308901000.000000
410.3281861051.315789
420.7204181102.631579
430.5036281051.315789
440.0961581000.000000
450.8799191737.500000
460.2446171473.684211
470.264351473.684211
\n", "
" ], "text/plain": [ " rtorpa soe_mean\n", "0 0.459418 475.000000\n", "1 0.698615 1000.000000\n", "2 0.814061 1525.000000\n", "3 0.426796 2000.000000\n", "4 0.660763 1473.684211\n", "5 0.426009 736.184211\n", "6 0.733494 1000.000000\n", "7 0.991707 1737.500000\n", "8 0.816683 1576.315789\n", "9 0.040184 626.315789\n", "10 0.862928 575.000000\n", "11 0.967568 1525.000000\n", "12 0.528905 1968.534483\n", "13 0.320486 1410.753176\n", "14 0.179744 756.034483\n", "15 0.506928 1102.631579\n", "16 0.184159 1051.315789\n", "17 0.758873 1000.000000\n", "18 0.773333 1737.500000\n", "19 0.427789 1473.684211\n", "20 0.568534 473.684211\n", "21 0.038720 50.000000\n", "22 0.406480 575.000000\n", "23 0.467345 1525.000000\n", "24 0.176373 1525.000000\n", "25 0.489898 1525.000000\n", "26 0.294734 2000.000000\n", "27 0.096778 1473.684211\n", "28 0.047591 473.684211\n", "29 0.199256 475.000000\n", "30 0.028051 1263.815789\n", "31 0.402718 1051.315789\n", "32 0.273838 1000.000000\n", "33 0.517905 1737.500000\n", "34 0.550950 2000.000000\n", "35 0.059592 2000.000000\n", "36 0.037408 1473.684211\n", "37 0.083896 1422.368421\n", "38 0.208502 1374.977314\n", "39 0.552403 688.793103\n", "40 0.530890 1000.000000\n", "41 0.328186 1051.315789\n", "42 0.720418 1102.631579\n", "43 0.503628 1051.315789\n", "44 0.096158 1000.000000\n", "45 0.879919 1737.500000\n", "46 0.244617 1473.684211\n", "47 0.264351 473.684211" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# two new columns\n", "df[[\"rtorpa\", \"soe_mean\"]]" ] }, { "cell_type": "code", "execution_count": null, "id": "8bf1561f-fa22-46fe-9b13-9a2103c47c75", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }