Commit Graph

215 Commits

Author SHA1 Message Date
Miguel c5b980b134 Refactor hydraulic tank implementation and remove unnecessary UI message boxes
- Updated osHydTank class to simplify properties and remove legacy fields.
- Changed properties to focus on essential attributes for hydraulic simulation.
- Adjusted CurrentLevel property to ensure it remains within valid bounds.
- Removed MessageBox calls in MainViewModel during TSNet integration tests, replacing them with debug logging.
- Cleaned up MCPServer by removing screenshot functionality and related methods.
- Added direct execution method for TSNet simulation without Python dependency.
2025-09-12 04:14:20 +02:00
Miguel baed392d90 Enhance TSNet simulation: optimize tank configurations, improve time settings, and extract dynamic tank levels. Update INP generator to utilize real tank data and add methods for tank adapter retrieval. 2025-09-12 02:58:39 +02:00
Miguel 88c8eea35e Implement comprehensive tests and solutions for TSNet division by zero issues, including extraction of results, configuration validation, and timestep stability demonstrations. Added multiple test scripts to ensure robustness and correctness of the simulation, along with detailed documentation of identified problems and their resolutions. 2025-09-12 02:16:27 +02:00
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 d8c03fdc39 Refactor project structure and remove unused files
- Updated CtrEditor.code-workspace to correct folder paths.
- Removed detailed analysis of critical issues from MemoriadeEvolucion.md.
- Deleted README_Canvas_Reference.md as it was no longer needed.
- Refactored ScreenshotManager.cs to improve bounding box calculations and remove auto-zoom functionality.
- Deleted analyze_canvas_screenshot.py and generate_canvas_reference.py scripts as they are no longer in use.
- Removed requirements.txt since associated scripts were deleted.
2025-09-10 11:10:55 +02:00
Miguel fa637eb323 fix: Mejorar la lógica de captura en ScreenshotManager para manejar posiciones relativas y errores de VisualBrush 2025-09-08 22:52:57 +02:00
Miguel 369bcce3d7 feat: Implement circular debug log system with pattern matching and statistics retrieval 2025-09-08 22:49:24 +02:00
Miguel 59c1c0cd3e Refactor code structure for improved readability and maintainability 2025-09-08 22:10:19 +02:00
Miguel 4ef265705c feat: Enhance base64 generation logic in ScreenshotManager with conditions and skip reasons 2025-09-08 21:43:03 +02:00
Miguel 3153f38068 Implement ScreenshotManager for enhanced screenshot functionality
- Added ScreenshotManager class to centralize screenshot capturing logic.
- Implemented methods to capture specific objects, areas, and full canvas.
- Updated MCPServer to utilize ScreenshotManager for taking screenshots.
- Introduced new API method to take screenshots of specific objects by their IDs.
- Enhanced error handling and result reporting for screenshot operations.
- Refactored TakeScreenshot and added TakeObjectScreenshot methods in MCPServer.
- Updated analyze_screenshots.py to use a relative path for screenshots directory.
- Removed outdated test script for Python execution.
2025-09-08 21:32:04 +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 b39c58e6d6 feat: Add three-section tank properties and converters for enhanced fluid management 2025-09-07 09:19:02 +02:00
Miguel 3635169f86 feat: Update simulation speed display in UI for improved user feedback 2025-09-06 23:21:52 +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 380fb5ba50 refactor: Enhance ucHydTank layout and improve information panel with detailed flow metrics 2025-09-06 22:33:08 +02:00
Miguel c76e4c1749 Remove outdated hydraulic system test scripts and results
- Deleted HydraulicSystemTests_TimingV2.py as it is no longer needed.
- Removed previous test results file HydraulicTestResults_20250106.json.
- Deleted timing test results file HydraulicTestResults_TimingV2_20250906_203611.json.
- Removed summary markdown file ResumenPruebasHidraulicas.md as it is obsolete.
- Deleted batch script start_mcp_proxy.bat for starting the MCP proxy.
- Removed Python script start_mcp_proxy.py which initiated the MCP proxy.
- Deleted PowerShell script update_single_file.ps1 used for updating methods in files.
2025-09-06 22:29:28 +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 10a1617833 feat: Implement Debug Console Server for enhanced logging and remote monitoring 2025-09-06 19:49:03 +02:00
Miguel 749f0f7eff Add comprehensive documentation and technical specifications for Hydraulic Simulator and Fluid Management System
- Introduced detailed documentation for the Hydraulic Simulator, covering architecture, components, usage examples, and integration with graphical objects.
- Added technical specifications for the Fluid Management System, including calculation algorithms, performance specifications, implementation details, and testing strategies.
- Implemented FluidProperties class to encapsulate fluid characteristics and behaviors, including density, viscosity, and mixing capabilities.
- Established enums for FluidType and MixingState to enhance code clarity and maintainability.
2025-09-06 19:10:20 +02:00
Miguel 642f4e71ff refactor: Optimize LLM usage guide for token efficiency and command clarity 2025-09-06 18:51:05 +02:00
Miguel fd57091d73 refactor: Remove connection indicators from hydraulic pipe UI 2025-09-06 17:46:44 +02:00
Miguel f07e7895f6 Add MCP Server and Proxy for CtrEditor with LLM Integration
- Implemented MCPServer class for TCP communication, allowing remote control of CtrEditor simulations.
- Added JSON-RPC methods for object management, simulation control, and screenshot functionality.
- Created a comprehensive LLM usage guide in MCP_LLM_Guide.md for interacting with the MCP server.
- Developed start_mcp_proxy.bat and start_mcp_proxy.py scripts to facilitate connection between GitHub Copilot and the MCP server.
- Enhanced error handling and logging throughout the MCP server and proxy scripts.
2025-09-06 17:05:59 +02:00
Miguel af839f4201 Antes de MCP Server 2025-09-06 13:24:28 +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
Miguel 3f21061524 Agregada base Hidraulica 2025-09-04 15:14:47 +02:00
Miguel 1e6ad6377e Implementar temporizadores más precisos utilizando System.Timers en MainViewModel y optimizar la lógica de simulación en BEPU para evitar cálculos innecesarios cuando no hay objetos simulables. 2025-09-04 14:31:57 +02:00
Miguel 091170b70d Agregado de NombreCategoria a los osSimulables 2025-09-04 12:26:24 +02:00
Miguel 6e48539d2e Agregar modo de lectura a ucAnalogTag, permitiendo la lectura condicional del valor. Se implementa la propiedad Read_Mode y se ajusta la lógica de actualización para utilizarla. 2025-09-04 11:59:32 +02:00
Miguel 3fe5b5497f Base antes de agregar logica de HydraulicSimulator 2025-09-04 11:41:26 +02:00
Miguel 4f2a109332 Implementar sistema de persistencia de configuración del entorno de trabajo, incluyendo captura y restauración de estado para el GridSplitter, canvas y actualizaciones 3D. Se añade la clase WorkspaceConfiguration y se actualizan varios archivos para integrar esta funcionalidad. 2025-09-03 20:51:51 +02:00
Miguel cad650b3d0 Mejorar la gestión del foco en la interfaz, evitando interferencias con el PLCControl. Se implementaron verificaciones para forzar actualizaciones de bindings sin robar el foco y se añadió un método para buscar controles padres en el árbol visual. 2025-09-02 18:55:48 +02:00
Miguel 3b953b7998 Ajustar parámetros de fricción estática y dinámica en la simulación de botellas, mejorando el comportamiento en situaciones de contacto. Implementar límites de velocidad en el plano XY y corregir la lógica de actualización de posición para evitar elevaciones excesivas. 2025-09-02 12:30:30 +02:00
Miguel 18017db56a Se eliminó el sistema de limitación de fuerzas para contactos múltiples, reemplazándolo por un enfoque de intervención post-solver que mejora el control de velocidades Z y simplifica la lógica de simulación. Se ajustaron los parámetros de fricción y recuperación, optimizando el comportamiento de las botellas en situaciones de contacto. Además, se eliminaron funciones relacionadas con el seguimiento de densidad de contactos, simplificando el código y mejorando la eficiencia del sistema. 2025-07-09 12:05:49 +02:00
Miguel b44bdc5ece Se implementó un nuevo sistema de limitación de fuerzas para contactos múltiples simultáneos en la simulación de botellas, mejorando la estabilidad y realismo al evitar fuerzas armónicas irreales. Se introdujo un enfoque post-solver para controlar velocidades Z excesivas y se simplificó la lógica de integración de velocidad. Además, se ajustaron los parámetros de fricción y recuperación para optimizar el comportamiento en situaciones de contacto. Se añadieron nuevas funciones para el seguimiento de densidad de contactos y la calibración visual del deslizamiento. 2025-07-09 09:47:39 +02:00
Miguel 6887ede5e0 Se realizaron ajustes significativos en la configuración de fricción y recuperación en la simulación de botellas, mejorando la estabilidad y el comportamiento en contactos. Se implementaron nuevas funciones para limitar fuerzas Z y calcular la profundidad de penetración, optimizando la respuesta de las botellas en situaciones de contacto. Además, se ajustaron los parámetros de amortiguamiento y velocidad de separación para lograr un comportamiento más realista en la simulación. 2025-07-08 17:10:44 +02:00
Miguel 62b45ebf1c Se implementaron mejoras en la gestión de imágenes de fondo en el viewport 3D, permitiendo agregar, remover y sincronizar imágenes de fondo con la visualización 3D. Se corrigieron las convenciones de posicionamiento y escalado para asegurar coherencia visual entre el canvas 2D y la representación 3D. Además, se ajustaron los coeficientes de fricción en la simulación de botellas, optimizando el comportamiento en contactos y curvas. 2025-07-06 21:29:53 +02:00
Miguel f7f49d5df0 Se implementó un sistema de fricción dinámica que simula el comportamiento de fricción estática y dinámica en contactos botella-transporte y botella-curva, mejorando el flujo de materiales y reduciendo atascos. Se reemplazó el sistema de presión por un nuevo sistema de calibración visual que permite ajustar las fricciones de cada componente, mostrando el nivel de deslizamiento en las botellas. Además, se realizaron ajustes en la lógica de colisiones y se optimizó la gestión de fricción en la simulación. 2025-07-06 21:07:11 +02:00