-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The exporter knew too much about the specifics. This commit implements an interface to get specific sets of results, which basically is the query. What's left in the queries is alignment of results and aggregation of attributes.
- Loading branch information
Showing
17 changed files
with
771 additions
and
634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from abc import ABC, abstractmethod | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
from enum import Enum | ||
from typing import Iterable, Iterator, List, Optional, Tuple | ||
|
||
from libecalc.common.units import Unit | ||
|
||
|
||
class ExportableType(str, Enum): | ||
INSTALLATION = "INSTALLATION" | ||
|
||
|
||
class ConsumptionType(str, Enum): | ||
FUEL = "FUEL" | ||
ELECTRICITY = "ELECTRICITY" | ||
|
||
|
||
@dataclass | ||
class AttributeMeta: | ||
fuel_category: Optional[str] | ||
consumer_category: Optional[str] | ||
producer_category: Optional[str] = None | ||
emission_type: Optional[str] = None | ||
|
||
|
||
class Attribute(ABC): | ||
@abstractmethod | ||
def datapoints(self) -> Iterable[Tuple[datetime, float]]: ... | ||
|
||
@abstractmethod | ||
def get_meta(self) -> AttributeMeta: ... | ||
|
||
|
||
@dataclass | ||
class AttributeSet(ABC): | ||
attributes: List[Attribute] | ||
|
||
def __iter__(self) -> Iterator[Attribute]: | ||
return self.attributes.__iter__() | ||
|
||
|
||
class Exportable(ABC): | ||
@abstractmethod | ||
def get_name(self) -> str: ... | ||
|
||
@abstractmethod | ||
def get_category(self) -> str: ... | ||
|
||
@abstractmethod | ||
def get_timesteps(self) -> List[datetime]: ... | ||
|
||
@abstractmethod | ||
def get_fuel_consumption(self) -> AttributeSet: ... | ||
|
||
@abstractmethod | ||
def get_power_consumption(self, unit: Unit) -> AttributeSet: ... | ||
|
||
@abstractmethod | ||
def get_emissions(self, unit: Unit) -> AttributeSet: ... | ||
|
||
@abstractmethod | ||
def get_electricity_production(self, unit: Unit) -> AttributeSet: ... | ||
|
||
@abstractmethod | ||
def get_maximum_electricity_production(self, unit: Unit) -> AttributeSet: ... | ||
|
||
@abstractmethod | ||
def get_storage_volumes(self, unit: Unit) -> AttributeSet: ... | ||
|
||
|
||
class ExportableSet(ABC): | ||
@abstractmethod | ||
def get_from_type(self, exportable_type: ExportableType) -> List[Exportable]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.