Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp
### 📝 Docs

### 👷 Development
- Added type hints for submodel in all Interface classes

### 🚧 Known Issues

Expand Down
4 changes: 3 additions & 1 deletion flixopt/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class for defined way of solving a flow_system optimization
active_timesteps: Deprecated. Use FlowSystem.sel(time=...) or FlowSystem.isel(time=...) instead.
"""

model: FlowSystemModel | None

def __init__(
self,
name: str,
Expand Down Expand Up @@ -88,7 +90,7 @@ def __init__(
flow_system._used_in_calculation = True

self.flow_system = flow_system
self.model: FlowSystemModel | None = None
self.model = None

self.durations = {'modeling': 0.0, 'solving': 0.0, 'saving': 0.0}
self.folder = pathlib.Path.cwd() / 'results' if folder is None else pathlib.Path(folder)
Expand Down
6 changes: 6 additions & 0 deletions flixopt/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ class LinearConverter(Component):

"""

submodel: LinearConverterModel | None

def __init__(
self,
label: str,
Expand Down Expand Up @@ -376,6 +378,8 @@ class Storage(Component):
With flow rates in m3/h, the charge state is therefore in m3.
"""

submodel: StorageModel | None

def __init__(
self,
label: str,
Expand Down Expand Up @@ -640,6 +644,8 @@ class Transmission(Component):

"""

submodel: TransmissionModel | None

def __init__(
self,
label: str,
Expand Down
6 changes: 5 additions & 1 deletion flixopt/effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class Effect(Element):

"""

submodel: EffectModel | None

def __init__(
self,
label: str,
Expand Down Expand Up @@ -453,12 +455,14 @@ class EffectCollection:
Handling all Effects
"""

submodel: EffectCollectionModel | None

def __init__(self, *effects: Effect):
self._effects = {}
self._standard_effect: Effect | None = None
self._objective_effect: Effect | None = None

self.submodel: EffectCollectionModel | None = None
self.submodel = None
self.add_effects(*effects)

def create_model(self, model: FlowSystemModel) -> EffectCollectionModel:
Expand Down
4 changes: 4 additions & 0 deletions flixopt/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class Bus(Element):
by the FlowSystem during system setup.
"""

submodel: BusModel | None

def __init__(
self,
label: str,
Expand Down Expand Up @@ -362,6 +364,8 @@ class Flow(Element):

"""

submodel: FlowModel | None

def __init__(
self,
label: str,
Expand Down
2 changes: 2 additions & 0 deletions flixopt/flow_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class FlowSystem(Interface):
connected_and_transformed automatically when trying to solve a calculation.
"""

model: FlowSystemModel | None

def __init__(
self,
timesteps: pd.DatetimeIndex,
Expand Down
2 changes: 2 additions & 0 deletions flixopt/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class CalculationResults:

"""

model: linopy.Model | None

@classmethod
def from_file(cls, folder: str | pathlib.Path, name: str) -> CalculationResults:
"""Load CalculationResults from saved files.
Expand Down
4 changes: 3 additions & 1 deletion flixopt/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,8 @@ def __deepcopy__(self, memo):
class Element(Interface):
"""This class is the basic Element of flixopt. Every Element has a label"""

submodel: ElementModel | None

def __init__(self, label: str, meta_data: dict | None = None):
"""
Args:
Expand All @@ -864,7 +866,7 @@ def __init__(self, label: str, meta_data: dict | None = None):
"""
self.label = Element._valid_label(label)
self.meta_data = meta_data if meta_data is not None else {}
self.submodel: ElementModel | None = None
self.submodel = None

def _plausibility_checks(self) -> None:
"""This function is used to do some basic plausibility checks for each Element during initialization.
Expand Down