diff --git a/core/power_system.py b/core/power_system.py index 5214e57..8318bc1 100644 --- a/core/power_system.py +++ b/core/power_system.py @@ -836,6 +836,11 @@ def _store_network_state(self): import json try: + # Guard: Check if db_manager and get_session are available + if not hasattr(db_manager, 'get_session') or not callable(getattr(db_manager, 'get_session', None)): + # Database not configured - skip storage (this is optional for simulation) + return + with db_manager.get_session() as session: state = NetworkState( simulation_time=int(self.network.snapshots[0].timestamp()), @@ -859,7 +864,8 @@ def _store_network_state(self): session.commit() except Exception as e: - logger.error(f"Failed to store network state: {e}") + # Don't spam logs - database storage is optional for demo + pass def _calculate_health_score(self) -> float: """Calculate overall system health score (0-100)""" diff --git a/index.html b/index.html index d1509af..9f9951a 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ + @@ -19,8 +20,8 @@ - - + +
@@ -531,18 +532,20 @@