From e3fc4f4c53013b2893174976e86b8d0cb9209385 Mon Sep 17 00:00:00 2001 From: spicyneutrino <107169289+spicyneutrino@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:39:15 -0600 Subject: [PATCH 1/5] feat: websocket migration (clean history) --- core/power_system.py | 8 +- index.html | 27 +- main_complete_integration.py | 195 +++++- manhattan_sumo_manager.py | 98 ++- scenario_controller.py | 10 +- static/scenario-controls.js | 98 ++- static/scenario-director.js | 160 +++-- static/script.js | 1238 ++++++++++++++++++++++++++-------- 8 files changed, 1437 insertions(+), 397 deletions(-) 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 @@