Skip to content

Commit

Permalink
offtake and injection separately + summary function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Pecinovsky committed Oct 18, 2024
1 parent a19a22c commit 5b15b37
Show file tree
Hide file tree
Showing 8 changed files with 10,741 additions and 10,586 deletions.
20,919 changes: 10,460 additions & 10,459 deletions data/dyntar/sample_output.json

Large diffs are not rendered by default.

92 changes: 60 additions & 32 deletions demo_dyntar_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
" DynamicTariffAnalysisInput,\n",
" DynamicTariffAnalysisOutput,\n",
" calculate_dyntar_columns,\n",
" summarize_result,\n",
")\n",
"\n",
"import seaborn as sns\n",
Expand Down Expand Up @@ -318,8 +319,8 @@
" <th>electricity_delivered_smr2</th>\n",
" <th>electricity_exported_smr2</th>\n",
" <th>cost_electricity_delivered_smr2</th>\n",
" <th>cost_electricity_exported_smr2</th>\n",
" <th>cost_electricity_delivered_smr3</th>\n",
" <th>cost_electricity_exported_smr2</th>\n",
" <th>cost_electricity_exported_smr3</th>\n",
" <th>rlp_weighted_price_delivered</th>\n",
" <th>spp_weighted_price_exported</th>\n",
Expand All @@ -343,8 +344,8 @@
" <td>0.025193</td>\n",
" <td>NaN</td>\n",
" <td>0.000103</td>\n",
" <td>NaN</td>\n",
" <td>0.000094</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" <td>0.004102</td>\n",
" <td>NaN</td>\n",
Expand All @@ -366,8 +367,8 @@
" <td>0.024818</td>\n",
" <td>NaN</td>\n",
" <td>0.000102</td>\n",
" <td>NaN</td>\n",
" <td>0.000107</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" <td>0.004102</td>\n",
" <td>NaN</td>\n",
Expand All @@ -389,8 +390,8 @@
" <td>0.024259</td>\n",
" <td>NaN</td>\n",
" <td>0.000100</td>\n",
" <td>NaN</td>\n",
" <td>0.000082</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" <td>0.004102</td>\n",
" <td>NaN</td>\n",
Expand All @@ -412,8 +413,8 @@
" <td>0.023730</td>\n",
" <td>NaN</td>\n",
" <td>0.000097</td>\n",
" <td>NaN</td>\n",
" <td>0.000119</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" <td>0.004102</td>\n",
" <td>NaN</td>\n",
Expand All @@ -435,9 +436,9 @@
" <td>0.133335</td>\n",
" <td>0.0</td>\n",
" <td>0.000535</td>\n",
" <td>0.0</td>\n",
" <td>0.000080</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.086561</td>\n",
" <td>0.062453</td>\n",
" <td>-0.810623</td>\n",
Expand Down Expand Up @@ -481,9 +482,9 @@
" <td>0.039762</td>\n",
" <td>0.0</td>\n",
" <td>0.003802</td>\n",
" <td>-0.0</td>\n",
" <td>0.010997</td>\n",
" <td>-0.0</td>\n",
" <td>-0.0</td>\n",
" <td>0.046355</td>\n",
" <td>0.019040</td>\n",
" <td>-2.011276</td>\n",
Expand All @@ -504,9 +505,9 @@
" <td>0.040024</td>\n",
" <td>0.0</td>\n",
" <td>0.003827</td>\n",
" <td>-0.0</td>\n",
" <td>0.013388</td>\n",
" <td>-0.0</td>\n",
" <td>-0.0</td>\n",
" <td>0.046355</td>\n",
" <td>0.019040</td>\n",
" <td>-2.655088</td>\n",
Expand All @@ -527,9 +528,9 @@
" <td>0.039903</td>\n",
" <td>0.0</td>\n",
" <td>0.003816</td>\n",
" <td>-0.0</td>\n",
" <td>0.011093</td>\n",
" <td>-0.0</td>\n",
" <td>-0.0</td>\n",
" <td>0.046355</td>\n",
" <td>0.019040</td>\n",
" <td>-2.027059</td>\n",
Expand All @@ -550,9 +551,9 @@
" <td>0.038904</td>\n",
" <td>0.0</td>\n",
" <td>0.003720</td>\n",
" <td>-0.0</td>\n",
" <td>0.012527</td>\n",
" <td>-0.0</td>\n",
" <td>-0.0</td>\n",
" <td>0.046355</td>\n",
" <td>0.019040</td>\n",
" <td>-2.516225</td>\n",
Expand All @@ -573,9 +574,9 @@
" <td>0.038487</td>\n",
" <td>0.0</td>\n",
" <td>0.003227</td>\n",
" <td>-0.0</td>\n",
" <td>0.010985</td>\n",
" <td>-0.0</td>\n",
" <td>-0.0</td>\n",
" <td>0.046355</td>\n",
" <td>0.019040</td>\n",
" <td>-1.944626</td>\n",
Expand Down Expand Up @@ -682,19 +683,6 @@
"2024-04-18 20:45:00+00:00 0.003720 \n",
"2024-04-18 21:00:00+00:00 0.003227 \n",
"\n",
" cost_electricity_exported_smr2 \\\n",
"2023-12-31 23:00:00+00:00 NaN \n",
"2023-12-31 23:15:00+00:00 NaN \n",
"2023-12-31 23:30:00+00:00 NaN \n",
"2023-12-31 23:45:00+00:00 NaN \n",
"2024-01-01 00:00:00+00:00 0.0 \n",
"... ... \n",
"2024-04-18 20:00:00+00:00 -0.0 \n",
"2024-04-18 20:15:00+00:00 -0.0 \n",
"2024-04-18 20:30:00+00:00 -0.0 \n",
"2024-04-18 20:45:00+00:00 -0.0 \n",
"2024-04-18 21:00:00+00:00 -0.0 \n",
"\n",
" cost_electricity_delivered_smr3 \\\n",
"2023-12-31 23:00:00+00:00 0.000094 \n",
"2023-12-31 23:15:00+00:00 0.000107 \n",
Expand All @@ -708,6 +696,19 @@
"2024-04-18 20:45:00+00:00 0.012527 \n",
"2024-04-18 21:00:00+00:00 0.010985 \n",
"\n",
" cost_electricity_exported_smr2 \\\n",
"2023-12-31 23:00:00+00:00 NaN \n",
"2023-12-31 23:15:00+00:00 NaN \n",
"2023-12-31 23:30:00+00:00 NaN \n",
"2023-12-31 23:45:00+00:00 NaN \n",
"2024-01-01 00:00:00+00:00 0.0 \n",
"... ... \n",
"2024-04-18 20:00:00+00:00 -0.0 \n",
"2024-04-18 20:15:00+00:00 -0.0 \n",
"2024-04-18 20:30:00+00:00 -0.0 \n",
"2024-04-18 20:45:00+00:00 -0.0 \n",
"2024-04-18 21:00:00+00:00 -0.0 \n",
"\n",
" cost_electricity_exported_smr3 \\\n",
"2023-12-31 23:00:00+00:00 0.0 \n",
"2023-12-31 23:15:00+00:00 0.0 \n",
Expand Down Expand Up @@ -815,6 +816,33 @@
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"cost_electricity_delivered_smr2 75.351600\n",
"cost_electricity_delivered_smr3 83.939318\n",
"cost_electricity_exported_smr2 -9.485280\n",
"cost_electricity_exported_smr3 -8.439498\n",
"cost_electricity_total_smr2 65.866320\n",
"cost_electricity_total_smr3 75.499819\n",
"ratio 0.113553\n",
"dtype: float64"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summarize_result(df)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"output_model = DynamicTariffAnalysisOutput.from_pandas(df)\n",
Expand All @@ -831,7 +859,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -861,7 +889,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -873,7 +901,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -913,7 +941,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -952,7 +980,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1021,7 +1049,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1078,7 +1106,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1135,7 +1163,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down
2 changes: 1 addition & 1 deletion openenergyid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Open Energy ID Python SDK."""

__version__ = "0.1.19"
__version__ = "0.1.20"

from .enums import Granularity
from .models import TimeDataFrame, TimeSeries
Expand Down
5 changes: 4 additions & 1 deletion openenergyid/dyntar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Dynamic Tariff Analysis module."""

from .main import calculate_dyntar_columns
from .main import calculate_dyntar_columns, summarize_result
from .models import (
DynamicTariffAnalysisInput,
DynamicTariffAnalysisOutput,
DynamicTariffAnalysisOutputSummary,
OutputColumns,
RequiredColumns,
)
Expand All @@ -12,6 +13,8 @@
"calculate_dyntar_columns",
"DynamicTariffAnalysisInput",
"DynamicTariffAnalysisOutput",
"DynamicTariffAnalysisOutputSummary",
"OutputColumns",
"RequiredColumns",
"summarize_result",
]
9 changes: 9 additions & 0 deletions openenergyid/dyntar/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Constants for the dyntar analysis."""

from enum import Enum

ELECTRICITY_DELIVERED_SMR3 = "electricity_delivered_smr3"
ELECTRICITY_EXPORTED_SMR3 = "electricity_exported_smr3"
ELECTRICITY_DELIVERED_SMR2 = "electricity_delivered_smr2"
Expand All @@ -20,3 +22,10 @@
HEATMAP_DELIVERED_DESCRIPTION = "heatmap_delivered_description"
HEATMAP_EXPORTED_DESCRIPTION = "heatmap_exported_description"
HEATMAP_TOTAL_DESCRIPTION = "heatmap_total_description"


class Register(Enum):
"""Register for dynamic tariff analysis."""

DELIVERY = "delivery"
EXPORT = "export"
Loading

0 comments on commit 5b15b37

Please sign in to comment.