Commit Graph

18 Commits

Author SHA1 Message Date
Miguel 51d0f36187 Refactor TSNet Hydraulic Simulation Integration
- Implemented node name sanitization in TSNetINPGenerator to ensure compatibility with EPANET INP format.
- Enhanced TSNetSimulationManager to manage hydraulic components and elements more robustly, including improved error handling and logging.
- Replaced HydraulicSimulationManager with TSNetSimulationManager in MainViewModel, updating all relevant references and methods.
- Improved handling of IOException tracking in MainViewModel for better debugging and stability during simulation runs.
- Updated osHydPipe, osHydPump, and osHydTank classes to utilize sanitized node names for hydraulic nodes.
- Added new methods for resetting and clearing hydraulic objects in TSNetSimulationManager.
- Enhanced UserControlFactory to support the new TSNetSimulationManager without assigning the old hydraulic simulation manager.
2025-09-11 22:30:37 +02:00
Miguel 1b21f86886 Refactor hydraulic components: Enhance UI elements and add flow indicators
- Updated ucHydPipe.xaml to improve visual representation with drop shadows and flow indicators.
- Modified ucHydPump.xaml to include a background ellipse and improved status indicators.
- Simplified ucHydTank.xaml by removing unnecessary sections and enhancing the fluid level display.
- Added a new method CopyFrom in osBase.cs to facilitate property copying between objects.
2025-09-11 14:52:45 +02:00
Miguel 1df7a24140 Implement threading optimizations and error handling improvements in MCP server and hydraulic components
- Replaced blocking Dispatcher.Invoke() calls with non-blocking Dispatcher.BeginInvoke() in MainViewModel, osBase, and ObjectManipulationManager to enhance responsiveness during simulations.
- Added checks for Dispatcher availability to prevent crashes during application shutdown.
- Implemented comprehensive error handling with try-catch blocks and logging for better debugging.
- Corrected hydraulic connection logic to use component names instead of IDs for better accuracy in osHydPump.
- Introduced methods for safe Dispatcher invocation with timeout handling in MCPServer.
- Enhanced debug logging for better traceability of errors and server status.
- Documented threading improvements and their impact on MCP stability in new markdown files.
2025-09-11 10:28:26 +02:00
Miguel 5727c1b376 Refactor TSNet test suites and migrate CtrEditor MCP to CPython
- Updated `tsnet_direct_tests.py` to improve code formatting and consistency.
- Enhanced `tsnet_edge_test_suite.py` with better error handling and logging.
- Refactored `tsnet_mcp_test_suite.py` for improved structure and clarity.
- Revised `tsnet_simple_verification.py` for better readability and error checking.
- Added comprehensive migration summary for CtrEditor from IronPython to CPython.
- Introduced new test scripts (`test_debug.py`, `test_mcp.py`, `test_python.py`) for validating CPython integration.
- Ensured all tests are compatible with the new CPython environment and improved performance metrics.
2025-09-11 07:54:52 +02:00
Miguel 55b0767685 Add comprehensive test suites for TSNet Phase 2 functionality
- Implemented `tsnet_direct_tests.py` for direct testing of TSNet core functionalities without MCP.
- Created `tsnet_edge_test_suite.py` to handle edge cases and error management in TSNet.
- Developed `tsnet_mcp_test_suite.py` to test TSNet using MCP CtrEditor APIs, ensuring no freezing occurs.
- Introduced `tsnet_simple_verification.py` for a basic connectivity and functionality check of TSNet.
2025-09-10 22:47:07 +02:00
Miguel 181a3db41c Implement Python execution support and enhance hydraulic component management
- Added Python execution capabilities via MCPServer, allowing scripts to interact with CtrEditor objects.
- Introduced methods for executing Python code and retrieving help on available objects.
- Updated osHydPump and osHydTank classes to remove direct hydraulic object management, leveraging the new unified hydraulic simulation system.
- Created documentation for Python integration and usage examples.
- Developed a script for analyzing screenshots to detect circular objects and assess their centering.
- Implemented tests for Python execution functionality to ensure proper integration and response handling.
- Addressed potential freeze issues in MCPServer and StateManager by improving async handling and cancellation support.
2025-09-08 11:52:06 +02:00
Miguel 3c9c0e2479 Refactor hydraulic components: Simplify pump and tank logic, remove unused properties, and enhance flow calculations
- Updated osHydPump.cs to replace NPSH and cavitation calculations with a simpler flow check.
- Modified pump status display to indicate whether the pump is pumping or not.
- Streamlined fluid updates in osHydPump.cs to only occur when there is flow.
- Refactored osHydTank.cs to consolidate flow handling and remove unnecessary three-section logic.
- Adjusted UI elements in ucHydTank.xaml to reflect changes in flow representation and removed deprecated visual indicators.
- Enhanced DebugConsoleServer.cs to improve client connection handling with timeout and error management.
2025-09-07 17:06:15 +02:00
Miguel 322d335edd feat: Add detailed status properties and margin converter for tank sections in hydraulic components 2025-09-06 23:09:55 +02:00
Miguel 5c03e19207 Implementación del sistema de pruebas hidráulicas con timing preciso y generación de resultados en formato JSON. Se agregaron clases para tanques, bombas y tuberías, junto con métodos para gestionar la simulación y realizar pruebas de equilibrio de flujo. Se documentaron resultados de pruebas y se identificaron mejoras necesarias en la visualización de datos. Se creó un resumen completo de las pruebas realizadas y se actualizaron las recomendaciones para futuras mejoras del sistema. 2025-09-06 22:18:26 +02:00
Miguel 04565d21d0 Implement NPSH verification system in hydraulic simulation
- Added NPSH verification logic to PumpHQ and osHydPump classes.
- Introduced properties for NPSH available, cavitation factor, and operational status.
- Implemented NPSH testing on application startup in MainWindow.xaml.cs.
- Created a console application (NPSHTestConsole) for testing NPSH functionalities.
- Developed NPSHTestExample class to demonstrate original user problem and solutions.
- Enhanced osHydTank and osHydPump classes to support NPSH calculations and conditions.
- Added comprehensive logging for debugging and verification purposes.
2025-09-06 10:32:42 +02:00
Miguel e06efacaaf refactor: Update hydraulic components to implement IHydraulicComponent interface 2025-09-06 03:09:09 +02:00
Miguel e6a8bb8cbe feat: Enhance hydraulic simulation components and integrate new object management
- Updated UserControlFactory to support hydraulic simulation manager in AssignDatos method.
- Introduced new classes for hydraulic simulation objects: simHydraulicBase, simHydraulicPump, simHydraulicTank, and simHydraulicPipe.
- Implemented methods for updating properties and applying simulation results in hydraulic components.
- Enhanced osHydPipe, osHydPump, and osHydTank classes to manage hydraulic simulation objects and their properties.
- Added methods for creating, removing, and clearing hydraulic simulation objects in HydraulicSimulationManager.
- Improved error handling and logging in various components to facilitate debugging.
- Refactored XAML and code-behind files to align with new namespace structure for hydraulic components.
2025-09-06 02:58:18 +02:00
Miguel 8e6d457047 Refactor hydraulic components: Updated osHydPipe and osHydPump to improve code clarity by changing region comments to regular comments. Enhanced osHydTank with a new OnMove method and improved initialization in ucHydTank.xaml. Updated StateSerializer to include default values during serialization. 2025-09-06 01:47:57 +02:00
Miguel 0147e010d3 Refactor hydraulic components: Updated osHydPump and added osHydTank class with dynamic level and pressure management. Enhanced XAML for tank visualization and implemented converters for UI binding. Improved error handling in converters and added tests for hydraulic component detection. 2025-09-05 15:41:17 +02:00
Miguel 70bc74fa7d Fix hydraulic simulation issues: prevent double registration of objects, correct MaxFlow unit conversion, enable verbose output for debugging, and ensure proper convergence of the hydraulic solver. 2025-09-04 18:52:46 +02:00
Miguel de4193dee3 Add unit test for hydraulic component type assignability
- Created a new test class TestItemsSource in test_osBaseItemsSource.cs.
- Implemented TestTypeAssignability method to verify that osHydPipe, osHydDischargeTank, and osHydPump correctly implement the IHydraulicComponent interface.
- Added console output to display results of type checks and comparisons.
2025-09-04 18:25:31 +02:00
Miguel 42c9ab9449 Refactor hydraulic components: removed ucPumpExample, added ucHydDischargeTank and ucHydPipe with corresponding logic and XAML. Introduced new converters for UI bindings and created a simple hydraulic system example with testing capabilities. 2025-09-04 17:29:20 +02:00
Miguel d968aa9a2f Mejorado de HydPump 2025-09-04 15:54:14 +02:00