flixopt 2.1.5__py3-none-any.whl → 2.1.7__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 flixopt might be problematic. Click here for more details.
- docs/examples/00-Minimal Example.md +1 -1
- docs/examples/01-Basic Example.md +1 -1
- docs/examples/02-Complex Example.md +1 -1
- docs/examples/index.md +1 -1
- docs/faq/contribute.md +26 -14
- docs/faq/index.md +1 -1
- docs/javascripts/mathjax.js +1 -1
- docs/user-guide/Mathematical Notation/Bus.md +1 -1
- docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +13 -13
- docs/user-guide/Mathematical Notation/Flow.md +1 -1
- docs/user-guide/Mathematical Notation/LinearConverter.md +2 -2
- docs/user-guide/Mathematical Notation/Piecewise.md +1 -1
- docs/user-guide/Mathematical Notation/Storage.md +1 -1
- docs/user-guide/Mathematical Notation/index.md +1 -1
- docs/user-guide/Mathematical Notation/others.md +1 -1
- docs/user-guide/index.md +2 -2
- flixopt/__init__.py +4 -0
- flixopt/aggregation.py +0 -1
- flixopt/calculation.py +3 -7
- flixopt/components.py +140 -21
- flixopt/core.py +10 -6
- flixopt/effects.py +2 -1
- flixopt/elements.py +5 -3
- flixopt/features.py +17 -13
- flixopt/flow_system.py +54 -0
- flixopt/network_app.py +755 -0
- flixopt/structure.py +1 -3
- {flixopt-2.1.5.dist-info → flixopt-2.1.7.dist-info}/METADATA +41 -20
- flixopt-2.1.7.dist-info/RECORD +54 -0
- scripts/extract_release_notes.py +5 -5
- flixopt-2.1.5.dist-info/RECORD +0 -53
- {flixopt-2.1.5.dist-info → flixopt-2.1.7.dist-info}/WHEEL +0 -0
- {flixopt-2.1.5.dist-info → flixopt-2.1.7.dist-info}/licenses/LICENSE +0 -0
- {flixopt-2.1.5.dist-info → flixopt-2.1.7.dist-info}/top_level.txt +0 -0
flixopt/flow_system.py
CHANGED
|
@@ -61,6 +61,8 @@ class FlowSystem:
|
|
|
61
61
|
|
|
62
62
|
self._connected = False
|
|
63
63
|
|
|
64
|
+
self._network_app = None
|
|
65
|
+
|
|
64
66
|
@classmethod
|
|
65
67
|
def from_dataset(cls, ds: xr.Dataset):
|
|
66
68
|
timesteps_extra = pd.DatetimeIndex(ds.attrs['timesteps_extra'], name='time')
|
|
@@ -241,6 +243,58 @@ class FlowSystem:
|
|
|
241
243
|
node_infos, edge_infos = self.network_infos()
|
|
242
244
|
return plotting.plot_network(node_infos, edge_infos, path, controls, show)
|
|
243
245
|
|
|
246
|
+
def start_network_app(self):
|
|
247
|
+
"""Visualizes the network structure of a FlowSystem using Dash, Cytoscape, and networkx.
|
|
248
|
+
Requires optional dependencies: dash, dash-cytoscape, networkx, werkzeug.
|
|
249
|
+
"""
|
|
250
|
+
from .network_app import DASH_CYTOSCAPE_AVAILABLE, VISUALIZATION_ERROR, flow_graph, shownetwork
|
|
251
|
+
|
|
252
|
+
warnings.warn(
|
|
253
|
+
'The network visualization is still experimental and might change in the future.',
|
|
254
|
+
stacklevel=2,
|
|
255
|
+
category=UserWarning,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
if not DASH_CYTOSCAPE_AVAILABLE:
|
|
259
|
+
raise ImportError(
|
|
260
|
+
f'Network visualization requires optional dependencies. '
|
|
261
|
+
f'Install with: pip install flixopt[viz], flixopt[full] or pip install dash dash_cytoscape networkx werkzeug. '
|
|
262
|
+
f'Original error: {VISUALIZATION_ERROR}'
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
if not self._connected:
|
|
266
|
+
self._connect_network()
|
|
267
|
+
|
|
268
|
+
if self._network_app is not None:
|
|
269
|
+
logger.warning('The network app is already running. Restarting it.')
|
|
270
|
+
self.stop_network_app()
|
|
271
|
+
|
|
272
|
+
self._network_app = shownetwork(flow_graph(self))
|
|
273
|
+
|
|
274
|
+
def stop_network_app(self):
|
|
275
|
+
"""Stop the network visualization server."""
|
|
276
|
+
from .network_app import DASH_CYTOSCAPE_AVAILABLE, VISUALIZATION_ERROR
|
|
277
|
+
|
|
278
|
+
if not DASH_CYTOSCAPE_AVAILABLE:
|
|
279
|
+
raise ImportError(
|
|
280
|
+
f'Network visualization requires optional dependencies. '
|
|
281
|
+
f'Install with: pip install flixopt[viz]. '
|
|
282
|
+
f'Original error: {VISUALIZATION_ERROR}'
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
if self._network_app is None:
|
|
286
|
+
logger.warning('No network app is currently running. Cant stop it')
|
|
287
|
+
return
|
|
288
|
+
|
|
289
|
+
try:
|
|
290
|
+
logger.info('Stopping network visualization server...')
|
|
291
|
+
self._network_app.server_instance.shutdown()
|
|
292
|
+
logger.info('Network visualization stopped.')
|
|
293
|
+
except Exception as e:
|
|
294
|
+
logger.error(f'Failed to stop the network visualization app: {e}')
|
|
295
|
+
finally:
|
|
296
|
+
self._network_app = None
|
|
297
|
+
|
|
244
298
|
def network_infos(self) -> Tuple[Dict[str, Dict[str, str]], Dict[str, Dict[str, str]]]:
|
|
245
299
|
if not self._connected:
|
|
246
300
|
self._connect_network()
|