{ "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", " | rtorpa | \n", "soe_mean | \n", "
---|---|---|
0 | \n", "0.459418 | \n", "475.000000 | \n", "
1 | \n", "0.698615 | \n", "1000.000000 | \n", "
2 | \n", "0.814061 | \n", "1525.000000 | \n", "
3 | \n", "0.426796 | \n", "2000.000000 | \n", "
4 | \n", "0.660763 | \n", "1473.684211 | \n", "
5 | \n", "0.426009 | \n", "736.184211 | \n", "
6 | \n", "0.733494 | \n", "1000.000000 | \n", "
7 | \n", "0.991707 | \n", "1737.500000 | \n", "
8 | \n", "0.816683 | \n", "1576.315789 | \n", "
9 | \n", "0.040184 | \n", "626.315789 | \n", "
10 | \n", "0.862928 | \n", "575.000000 | \n", "
11 | \n", "0.967568 | \n", "1525.000000 | \n", "
12 | \n", "0.528905 | \n", "1968.534483 | \n", "
13 | \n", "0.320486 | \n", "1410.753176 | \n", "
14 | \n", "0.179744 | \n", "756.034483 | \n", "
15 | \n", "0.506928 | \n", "1102.631579 | \n", "
16 | \n", "0.184159 | \n", "1051.315789 | \n", "
17 | \n", "0.758873 | \n", "1000.000000 | \n", "
18 | \n", "0.773333 | \n", "1737.500000 | \n", "
19 | \n", "0.427789 | \n", "1473.684211 | \n", "
20 | \n", "0.568534 | \n", "473.684211 | \n", "
21 | \n", "0.038720 | \n", "50.000000 | \n", "
22 | \n", "0.406480 | \n", "575.000000 | \n", "
23 | \n", "0.467345 | \n", "1525.000000 | \n", "
24 | \n", "0.176373 | \n", "1525.000000 | \n", "
25 | \n", "0.489898 | \n", "1525.000000 | \n", "
26 | \n", "0.294734 | \n", "2000.000000 | \n", "
27 | \n", "0.096778 | \n", "1473.684211 | \n", "
28 | \n", "0.047591 | \n", "473.684211 | \n", "
29 | \n", "0.199256 | \n", "475.000000 | \n", "
30 | \n", "0.028051 | \n", "1263.815789 | \n", "
31 | \n", "0.402718 | \n", "1051.315789 | \n", "
32 | \n", "0.273838 | \n", "1000.000000 | \n", "
33 | \n", "0.517905 | \n", "1737.500000 | \n", "
34 | \n", "0.550950 | \n", "2000.000000 | \n", "
35 | \n", "0.059592 | \n", "2000.000000 | \n", "
36 | \n", "0.037408 | \n", "1473.684211 | \n", "
37 | \n", "0.083896 | \n", "1422.368421 | \n", "
38 | \n", "0.208502 | \n", "1374.977314 | \n", "
39 | \n", "0.552403 | \n", "688.793103 | \n", "
40 | \n", "0.530890 | \n", "1000.000000 | \n", "
41 | \n", "0.328186 | \n", "1051.315789 | \n", "
42 | \n", "0.720418 | \n", "1102.631579 | \n", "
43 | \n", "0.503628 | \n", "1051.315789 | \n", "
44 | \n", "0.096158 | \n", "1000.000000 | \n", "
45 | \n", "0.879919 | \n", "1737.500000 | \n", "
46 | \n", "0.244617 | \n", "1473.684211 | \n", "
47 | \n", "0.264351 | \n", "473.684211 | \n", "