openenergyid 0.1.12__py2.py3-none-any.whl → 0.1.13__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openenergyid might be problematic. Click here for more details.
- openenergyid/__init__.py +1 -1
- openenergyid/energysharing/__init__.py +8 -2
- openenergyid/energysharing/data_formatting.py +0 -3
- openenergyid/energysharing/models.py +32 -8
- {openenergyid-0.1.12.dist-info → openenergyid-0.1.13.dist-info}/METADATA +1 -1
- {openenergyid-0.1.12.dist-info → openenergyid-0.1.13.dist-info}/RECORD +8 -8
- {openenergyid-0.1.12.dist-info → openenergyid-0.1.13.dist-info}/WHEEL +0 -0
- {openenergyid-0.1.12.dist-info → openenergyid-0.1.13.dist-info}/licenses/LICENSE +0 -0
openenergyid/__init__.py
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"""Energy Sharing package."""
|
|
2
2
|
|
|
3
3
|
from .main import calculate
|
|
4
|
-
from .models import CalculationMethod, EnergySharingInput, EnergySharingOutput
|
|
4
|
+
from .models import CalculationMethod, EnergySharingInput, EnergySharingOutput, KeyInput
|
|
5
5
|
|
|
6
|
-
__all__ = [
|
|
6
|
+
__all__ = [
|
|
7
|
+
"calculate",
|
|
8
|
+
"CalculationMethod",
|
|
9
|
+
"EnergySharingInput",
|
|
10
|
+
"EnergySharingOutput",
|
|
11
|
+
"KeyInput",
|
|
12
|
+
]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Data models for energy sharing."""
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Annotated
|
|
4
|
+
from typing import Annotated, Any
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
6
|
+
from pydantic import BaseModel, Field, confloat
|
|
7
7
|
import pandas as pd
|
|
8
8
|
|
|
9
9
|
from openenergyid import TimeDataFrame
|
|
@@ -19,22 +19,46 @@ class CalculationMethod(Enum):
|
|
|
19
19
|
OPTIMAL = "Optimal"
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
class KeyInput(TimeDataFrame):
|
|
23
|
+
"""Energy Sharing Keys."""
|
|
24
|
+
|
|
25
|
+
data: Annotated[
|
|
26
|
+
list[list[confloat(ge=0.0, le=1.0)]], # type: ignore
|
|
27
|
+
Field(
|
|
28
|
+
description="Key data, column per participant. "
|
|
29
|
+
"Must be between 0 and 1. "
|
|
30
|
+
"Each row must sum to 1."
|
|
31
|
+
),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
def model_post_init(self, __context: Any) -> None:
|
|
35
|
+
"""Post-initialization validation."""
|
|
36
|
+
for row in self.data:
|
|
37
|
+
if round(sum(row), 6) != 1:
|
|
38
|
+
raise ValueError("Each row must sum to 1.")
|
|
39
|
+
return super().model_post_init(__context)
|
|
40
|
+
|
|
41
|
+
|
|
22
42
|
class EnergySharingInput(BaseModel):
|
|
23
43
|
"""Input data for energy sharing."""
|
|
24
44
|
|
|
25
|
-
gross_injection: Annotated[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
gross_injection: Annotated[
|
|
46
|
+
TimeDataFrame,
|
|
47
|
+
Field(alias="grossInjection", description="Gross injection data, column per participant"),
|
|
48
|
+
]
|
|
49
|
+
gross_offtake: Annotated[
|
|
50
|
+
TimeDataFrame,
|
|
51
|
+
Field(alias="grossOfftake", description="Gross offtake data, column per participant"),
|
|
52
|
+
]
|
|
53
|
+
key: KeyInput
|
|
29
54
|
|
|
30
|
-
def
|
|
55
|
+
def to_pandas(self) -> pd.DataFrame:
|
|
31
56
|
"""Return the data as a combined DataFrame"""
|
|
32
57
|
df = create_multi_index_input_frame(
|
|
33
58
|
gross_injection=self.gross_injection.to_pandas(),
|
|
34
59
|
gross_offtake=self.gross_offtake.to_pandas(),
|
|
35
60
|
key=self.key.to_pandas(),
|
|
36
61
|
)
|
|
37
|
-
df = df.tz_convert(self.timezone)
|
|
38
62
|
return df
|
|
39
63
|
|
|
40
64
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
openenergyid/__init__.py,sha256=
|
|
1
|
+
openenergyid/__init__.py,sha256=rv5QjTRqWXVl6rEiphVaBPrzKnc-Hu1vlVS17R-v0GU,193
|
|
2
2
|
openenergyid/const.py,sha256=D-xUnUyVuLmphClkePgxpFP6z0RDhw_6m7rX0BHBgrw,823
|
|
3
3
|
openenergyid/enums.py,sha256=jdw4CB1gkisx0re_SesrTEyh_T-UxYp6uieE7iYlHdA,357
|
|
4
4
|
openenergyid/models.py,sha256=ANdbdtr6JccSz6zEZj0TQOXISGPdtJPQy4t17uub97E,3975
|
|
@@ -6,17 +6,17 @@ openenergyid/dyntar/__init__.py,sha256=iQXQXrEQOiVNeeF6LRmUf3oOhKlGjMNF7o4T04IWT
|
|
|
6
6
|
openenergyid/dyntar/const.py,sha256=K7X6nHIl9DNyC6hU8jLtvOy3-IBGuYC449evOpImuJE,773
|
|
7
7
|
openenergyid/dyntar/main.py,sha256=sn2zN5ep8XBgSGR_UDBU6mdp1WKNLzxROwp8HWCDgCM,5316
|
|
8
8
|
openenergyid/dyntar/models.py,sha256=BbGdHj7eUOMepblWJNsNd21xULluv6m7TtdhSggvVbY,1873
|
|
9
|
-
openenergyid/energysharing/__init__.py,sha256=
|
|
9
|
+
openenergyid/energysharing/__init__.py,sha256=A4JfrUYf-hBCzhUm0qL1GGlNMvpO8OwXJo80dJxFIvw,274
|
|
10
10
|
openenergyid/energysharing/const.py,sha256=X2zEPtTlsmZ66w6RmLS_h8NmdzObAEi5N6-0yrLN5V4,219
|
|
11
|
-
openenergyid/energysharing/data_formatting.py,sha256=
|
|
11
|
+
openenergyid/energysharing/data_formatting.py,sha256=RjP6NOyCXS9gI3x2NfQwHTJh9IbZJEExhXMZ4Zc0ImI,2604
|
|
12
12
|
openenergyid/energysharing/main.py,sha256=2AWaTysNVLZEFVs8yRmFWx1_qG-NPeAazWXlFLHfLRM,4409
|
|
13
|
-
openenergyid/energysharing/models.py,sha256=
|
|
13
|
+
openenergyid/energysharing/models.py,sha256=GQs7dsKxiShVKKIjNjvSgn6bafwFNuGZ8q6QnmslCjM,2524
|
|
14
14
|
openenergyid/mvlr/__init__.py,sha256=Glrc218oqa8tq_Y2G9LXaSoN4Yba-vsjXUi9r9iPzaY,471
|
|
15
15
|
openenergyid/mvlr/helpers.py,sha256=Uzbfrj3IpH26wA206KOl0hNucKE-n9guJNC_EROBVKA,983
|
|
16
16
|
openenergyid/mvlr/main.py,sha256=cn7jZ98cHn2eh-0zG9q8Pad0Ft_FuI-u3a-eeHeF8jA,1304
|
|
17
17
|
openenergyid/mvlr/models.py,sha256=qi5NWeQC1KeWEAO8KglgVM1xbHM5QoeK25ugn0W_X6c,8628
|
|
18
18
|
openenergyid/mvlr/mvlr.py,sha256=F7WvWnZQtqUmK1vsguemsn9n8pDDk3tQ1weOlv-bo0c,18626
|
|
19
|
-
openenergyid-0.1.
|
|
20
|
-
openenergyid-0.1.
|
|
21
|
-
openenergyid-0.1.
|
|
22
|
-
openenergyid-0.1.
|
|
19
|
+
openenergyid-0.1.13.dist-info/METADATA,sha256=9r6beVSt2i5VHjwsyEUnnHMR-lopo-S6-29yIq1s05E,2432
|
|
20
|
+
openenergyid-0.1.13.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
|
|
21
|
+
openenergyid-0.1.13.dist-info/licenses/LICENSE,sha256=NgRdcNHwyXVCXZ8sJwoTp0DCowThJ9LWWl4xhbV1IUY,1074
|
|
22
|
+
openenergyid-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|