Commit Graph

39 Commits

Author SHA1 Message Date
Miguel aa75a46d84 Enhance disk usage retrieval with multiple fallbacks for Windows compatibility
- Implemented a new method `_get_disk_usage_safe` in `PLCDataStreamer` to safely retrieve disk usage information using `psutil` and `shutil` with fallbacks for different scenarios.
- Updated the disk usage calculation logic to handle potential errors and log warnings when disk usage retrieval fails.
- Modified the `system_state.json` to reorder active datasets and add a new `plotjuggler_path` entry.
- Added a comprehensive test script `test_disk_space.py` to validate the disk space calculation functionality via the API.
2025-08-22 16:04:39 +02:00
Miguel 6302acfc0f Update backend manager and instance management logic
- Modified backend_manager.status to reflect updated timestamps and status.
- Refactored backmanager.py for improved readability and consistency in logging.
- Enhanced instance_manager.py to ensure robust backend instance checks and process management.
- Updated main.py to streamline backend instance verification and improve error handling.
- Adjusted main.spec to consolidate analysis for the main application and backend manager.
- Added a new spec file for comprehensive build configuration.
- Updated system_state.json with new timestamps and dataset order.
- Improved rotating_logger.py to enhance log file cleanup messages.
2025-08-22 15:29:28 +02:00
Miguel 082f8b1790 feat: Implement Backend Manager for PLC S7-315 Streamer Watchdog Service
- Added backmanager.py to monitor backend health and restart if necessary.
- Introduced backend_manager.status to track the state of the backend.
- Updated system_state.json to reflect changes in active datasets.
- Modified rotating_logger.py for improved log messages.
- Enhanced main.spec to support separate executables for main application and backend manager.
- Created backmanager.spec and backmanager_config.json for backend manager configuration.
- Added build_all.bat for streamlined build process.
2025-08-22 14:55:10 +02:00
Miguel 192c83ebce feat: Refactor state file path handling and update application events in JSON 2025-08-22 12:07:14 +02:00
Miguel b7e491289b Add comprehensive tests for snap7 v2 functionality
- Implemented `test_simple_read_multi_vars.py` to validate read_multi_vars functionality with detailed logging and error handling.
- Created `test_snap7v2_comprehensive.py` for extensive testing of snap7 v2, covering various PLC variable types, performance comparisons, data consistency checks, and stress testing.
- Integrated existing backend components and optimized reading methods, with comprehensive reporting and logging features.
2025-08-21 20:30:41 +02:00
Miguel 12106a9fe9 feat: Implement dataset-specific optimization configuration
- Added `use_optimized_reading` parameter to dataset definitions for per-dataset control over reading methods.
- Updated JSON schema and UI schema to include the new parameter with appropriate descriptions and defaults.
- Modified `ConfigManager`, `PLCClient`, and `PLCDataStreamer` to handle the new optimization setting.
- Enhanced batch reading logic to prioritize dataset-specific settings over global configurations.
- Improved logging to indicate which reading method is being used for each dataset.
- Created comprehensive tests to validate the new functionality and ensure backward compatibility.
- Added documentation detailing the new feature, its benefits, and usage examples.
2025-08-20 00:28:07 +02:00
Miguel a9e4e0d3ae Add comprehensive tests for PE/PA fixed implementation and optimized batch reading
- Introduced `test_optimized_reader.py` to validate the functionality and configuration of `OptimizedBatchReader`.
- Created `test_pe_pa_fixed.py` to test the corrected PE/PA reading functionality using appropriate Snap7 area codes.
- Developed `test_real_plc.py` to assess the performance of optimized batch reading against legacy methods with actual PLC configurations.
- Implemented `test_simple_validation.py` for a final validation of core functionalities, ensuring correct implementation of PE/PA area codes and batch reading.
2025-08-20 00:09:42 +02:00
Miguel 4a064937d3 Implement OptimizedBatchReader for efficient PLC variable reading
- Added OptimizedBatchReader class to handle batch reading of PLC variables using snap7's read_multi_vars function.
- Introduced automatic chunking to respect S7 PDU limits, allowing for efficient handling of large variable lists.
- Replaced the existing read_variables_batch method in PLCClient with the new optimized implementation.
- Updated system_state.json to reflect the latest last_update timestamp.
- Removed commented-out code related to the previous batch reading method.
2025-08-19 10:41:09 +02:00
Miguel a1c004f11b Update configuration and directory handling
- Increased time_window in plot_definitions.json from 10 to 60.
- Added external_path function in config_manager.py to handle paths for records and logs, ensuring compatibility with both development and PyInstaller executable environments.
- Updated PLCDataStreamer to use the new get_csv_directory_path method for retrieving the records directory.
- Refactored main.py to include get_records_directory function for consistent records directory path retrieval.
- Modified system_state.json to set should_connect to false and updated last_update timestamp.
2025-08-18 18:51:18 +02:00
Miguel 00c021f496 feat: Enhance DataStreamer with critical validation and performance monitoring improvements
- Refactored performance monitoring initialization for better readability.
- Added critical validation to ensure buffered data matches current dataset variables, preventing CSV corruption.
- Implemented logging for data inconsistencies and buffer clearing during variable modifications.
- Improved error handling and logging during CSV flushing and dataset reading.
- Enhanced UDP streaming error handling and logging.
- Updated threading management for CSV flushing and dataset streaming.
- Added comprehensive performance metrics recording for dataset reads and writes.

feat: Localize historical plot management components

- Integrated i18n support in PlotHistoricalManager, PlotHistoricalSession, and TimePointSelector components.
- Translated various UI strings related to historical plots, time selection, and console logs into English, Spanish, and Italian.
- Improved user experience by providing localized messages for actions and statuses.

fix: Update system state configuration

- Changed `should_connect` to true and added active datasets to the system state.
- Updated the last update timestamp and specified the path for PlotJuggler.
2025-08-17 13:01:36 +02:00
Miguel ac87ce2568 feat: Update dataset configurations and improve PLC communication
- Changed sampling interval for "Fast" dataset from 0.1 to 0.5 seconds.
- Updated variable definitions for "Fast" dataset, including renaming and modifying properties for AUX Blink and M50 variables.
- Adjusted plot definitions to reduce time window from 36 to 10 seconds.
- Enhanced plot variables to ensure correct labeling and enablement of variables.
- Increased inter-read delay in PLCClient for improved stability and added batch reading functionality to optimize variable reads.
- Implemented asynchronous CSV writing system in DataStreamer to reduce I/O operations and improve performance.
- Updated ChartjsPlot component to modify refresh rates for real-time data handling.
- Adjusted system state to disable automatic connection and clear active datasets.
2025-08-17 11:41:31 +02:00
Miguel be2df781cf Implementación del sistema de monitoreo de rendimiento y gestión de prioridades para el recording de PLC
- Se creó el archivo PERFORMANCE_MONITORING.md que detalla el sistema de monitoreo de rendimiento en tiempo real, incluyendo métricas, logs y APIs de monitoreo.
- Se desarrolló el archivo PRIORITY_SYSTEM.md que describe la arquitectura de prioridades para asegurar que el recording de CSV tenga máxima prioridad.
- Se implementó el PerformanceMonitor en core/performance_monitor.py para registrar métricas de rendimiento, incluyendo tiempos de lectura, uso de CPU y errores.
- Se creó el PriorityThreadManager en core/priority_manager.py para gestionar la prioridad de los hilos y asegurar que las operaciones de recording no sean interrumpidas.
- Se implementó un sistema de logging rotativo en core/rotating_logger.py que permite la rotación automática de archivos de log y limpieza de archivos antiguos.
2025-08-16 18:34:31 +02:00
Miguel ae1fc0508d feat: Implement historical data caching mechanism with buffer zones for improved performance and efficiency in data retrieval 2025-08-16 10:06:43 +02:00
Miguel e7cee49b1e feat: Enhance PlotJuggler integration by launching with multiple files in a single instance, improve logging for application events, and update system state for active datasets 2025-08-15 20:38:05 +02:00
Miguel 696b79ba0d feat: Implement coordinated connection and polling for real-time data updates across tabs
- Introduced `useCoordinatedConnection` and `useCoordinatedPolling` hooks to manage data fetching and state synchronization between tabs.
- Refactored `DatasetCompleteManager`, `PlotRealtimeViewer`, and `VariableSelectorWidget` components to utilize SSE and polling for live data updates.
- Added `TabCoordinationDemo` component to visualize tab coordination status and leadership.
- Updated `Dashboard` to leverage coordinated polling for status updates, improving performance and reducing redundant connections.
- Enhanced `TabCoordinator` utility to manage leadership and data broadcasting between tabs effectively.
2025-08-15 18:55:58 +02:00
Miguel e97cd5260b feat: Implement multi-browser support for plot sessions
- Enhanced session ID generation to include browser tab identifiers, allowing multiple instances of the same plot in different tabs.
- Updated PlotManager to manage sessions more effectively, including cleanup of inactive sessions.
- Modified frontend components to handle dynamic session IDs and ensure independent operation across tabs.
- Added new API endpoints for retrieving sessions by plot ID and manual cleanup of inactive sessions.
- Improved error handling and logging for better debugging and user experience.
2025-08-15 16:56:02 +02:00
Miguel ea2006666f feat: Enhance application event logging, add CSV header validation, and implement fullscreen mode for charts 2025-08-14 22:57:42 +02:00
Miguel 032959f491 feat: Implement CSV header validation and automatic renaming for dataset files 2025-08-14 22:33:39 +02:00
Miguel d99d439455 feat: Enhance application event logging and add max_hours configuration option 2025-08-14 18:32:49 +02:00
Miguel fd8efecae4 Enhance dataset variable handling and expand symbolic variables
- Updated dataset_variables.json to include new variables and adjust configurations.
- Modified plot_variables.json to add visualization settings for new variables.
- Enhanced ConfigManager to support expansion of symbolic variables, improving variable management.
- Updated PLCClient to handle additional memory types for variable reading.
- Refactored VariableSelectorWidget to utilize expanded dataset variables for better selection.
- Added new API endpoint to retrieve expanded dataset variables.
- Adjusted system_state.json to reflect changes in active datasets and last update timestamp.
2025-08-14 18:28:37 +02:00
Miguel 09263d39f8 Update application event logging, refine plot session management, and enhance configuration handling. Removed obsolete session_id fields, added new application start events, and improved session creation logic for better user experience. 2025-08-14 11:36:22 +02:00
Miguel 2845d71efe Refactor dataset and plot management to support new array format
- Updated dataset definitions to use a sampling interval of 0.5 seconds.
- Changed plot definitions to reduce the time window to 25 seconds and added a new plot for "Brix".
- Removed deprecated variable configurations from plot variables.
- Refactored ConfigManager to load datasets and variables from new array format, eliminating legacy save methods.
- Updated PLCDataStreamer and PlotManager to reflect changes in dataset and plot management, removing automatic save calls.
- Enhanced ChartjsPlot component to handle variable configurations and session management more efficiently.
- Improved PlotRealtimeSession to ensure backend commands are verified before applying local state changes.
- Adjusted system state to reflect active datasets and connection status.
2025-08-14 11:16:52 +02:00
Miguel 276efb117d Refactor configuration schemas and UI schemas for datasets and plots
- Changed dataset_variables schema from object to array format, adding dataset_id property.
- Updated plc schema by removing cleanup_interval_hours and max_hours properties, and added sampling_interval to udp_config.
- Modified plot_variables schema from object to array format, adding plot_id property.
- Enhanced UI schemas for dataset definitions and variables, improving layout and descriptions.
- Updated PLC configuration UI schema to reflect changes in the underlying schema.
- Improved error handling and logging in the ConfigManager for better diagnostics.
- Added helper methods in PLCClient for reconnection status and connection info.
- Unified API endpoints for configuration management, allowing direct file access and validation against schemas.
- Introduced a validation script for schema compliance checks.
2025-08-13 22:12:11 +02:00
Miguel d31f0819e2 Actualización de la gestión de datasets y variables, eliminando campos estáticos innecesarios y optimizando la estructura de datos. Se implementó un nuevo formato para las variables de plot, permitiendo la configuración de colores y estado de habilitación. Además, se mejoró la interfaz de usuario con componentes RJSF y se ajustaron los esquemas de configuración para reflejar estos cambios. Se realizaron mejoras en la lógica de carga y guardado en los gestores de configuración y plots, asegurando una experiencia más fluida y consistente. 2025-08-12 23:41:16 +02:00
Miguel 4d4df0830b Refactorización completa de la gestión de datasets y plots, separando las definiciones y variables en archivos distintos. Se eliminaron archivos obsoletos como plc_datasets.json y plot_sessions.json. Se implementó una migración automática desde los archivos legacy a los nuevos formatos, mejorando la organización y flexibilidad del sistema. Se actualizaron los esquemas de configuración y se ajustaron las funciones de carga y guardado en ConfigManager y PlotManager para trabajar con los nuevos archivos separados. Además, se realizaron mejoras en la interfaz de usuario para reflejar estos cambios y se optimizó el manejo de errores en la carga de datos. 2025-08-12 18:34:12 +02:00
Miguel 0c11ee3ae2 Actualización de application_events.json para incluir nuevos eventos de inicio de aplicación y ajustes en las fechas de última actualización. Se eliminaron archivos obsoletos relacionados con la integración de Chart.js y se reorganizaron las rutas de configuración en el código. Se implementaron mejoras en la gestión de esquemas y se optimizó la carga de recursos estáticos, incluyendo la favicon y logos en la interfaz. Además, se realizaron ajustes en el manejo de errores y se mejoró la estructura de directorios para una mejor organización del proyecto. 2025-08-11 16:26:20 +02:00
Miguel 10df4e94bd Base de el configurador json basado en schemas 2025-08-10 01:17:14 +02:00
Miguel 5e2149b9d4 Actualización de application_events.json con nuevos eventos para la creación y activación de datasets, así como la gestión de sesiones de plot. Se ajustaron las fechas de última actualización en varios archivos de configuración, incluyendo plc_config.json, plc_datasets.json y system_state.json. Se implementaron mejoras en la interfaz de usuario para la visualización de datos en tiempo real y se optimizó el código en plotting.js para una mejor gestión de gráficos. 2025-08-10 00:38:08 +02:00
Miguel cf5a169cce Actualización de application_events.json con nuevos eventos para la gestión de datasets y sesiones de plot. Se mejoró el manejo de errores en la conexión al PLC en main.py, proporcionando detalles adicionales en caso de fallo. Se ajustaron las fechas de última actualización en varios archivos de configuración, incluyendo plc_config.json y plc_datasets.json. Se realizaron mejoras en la interfaz de usuario para reflejar el estado de conexión y se optimizó el código en plotting.js para una mejor gestión de datos en tiempo real. 2025-08-08 18:30:27 +02:00
Miguel df07451079 Implementación de un sistema de reconexión automática para el PLC con backoff exponencial, permitiendo la reanudación de streaming y grabación de datasets tras desconexiones. Se añadieron nuevos endpoints API para gestionar el estado de reconexión y habilitar/deshabilitar esta funcionalidad. Se actualizaron los archivos de configuración y estado del sistema, así como la interfaz de usuario para reflejar el estado de reconexión y mejorar la experiencia del usuario. 2025-08-04 18:26:22 +02:00
Miguel 8195b5d430 Actualización de archivos de configuración y estado del sistema, incluyendo la adición de nuevos eventos en application_events.json para la gestión de sesiones de plot. Se modificó el comportamiento por defecto de las sesiones en PlotManager para que se inicien automáticamente, mejorando la experiencia del usuario. Se implementaron funciones de depuración en plotting.js y se ajustaron las fechas de última actualización en varios archivos. Además, se eliminó el formulario de creación de plots en index.html para simplificar la interfaz. 2025-07-21 15:12:37 +02:00
Miguel 45686b0663 Actualización de los archivos de configuración y estado del sistema para reflejar los cambios recientes en las sesiones de plot. Se añadieron nuevos eventos en application_events.json para la creación y eliminación de sesiones de plot, así como mejoras en el auto-scaling de los gráficos. Se implementaron nuevas funcionalidades en PlotManager para la gestión de estado de las sesiones y se mejoró la inicialización del sistema en main.js. Además, se ajustaron las fechas de última actualización en los archivos correspondientes. 2025-07-21 14:37:02 +02:00
Miguel 5e575fd112 Actualización del sistema de plotting en tiempo real con nuevas funcionalidades, incluyendo la creación y edición de sesiones de plot a través de un formulario colapsable. Se implementaron nuevos endpoints API para obtener y actualizar la configuración de las sesiones de plot. Además, se mejoró la interfaz de usuario con sub-tabs dinámicos para gestionar múltiples sesiones de plot y se realizaron ajustes en los estilos CSS para una mejor experiencia visual. Se actualizaron los archivos de configuración y estado del sistema para reflejar estos cambios. 2025-07-21 12:30:26 +02:00
Miguel a13baed5c6 Implementación de un sistema de plotting en tiempo real con soporte para múltiples sesiones y un sistema de triggers basado en variables booleanas. Se añadieron nuevos endpoints API para gestionar sesiones de plotting, así como mejoras en la interfaz de usuario para facilitar la creación y control de plots. Se actualizaron los estilos CSS y se integraron nuevas funcionalidades en el frontend para una experiencia de usuario más intuitiva. Además, se realizaron ajustes en los archivos de configuración y estado del sistema para reflejar estos cambios. 2025-07-21 09:26:41 +02:00
Miguel 5138a2e7cd Implementación de un sistema de control de streaming UDP independiente, separando la grabación automática de CSV y la transmisión manual a PlotJuggler. Se añadieron nuevos endpoints API para iniciar y detener el streaming UDP, y se mejoró la gestión de eventos y el registro de estado. Además, se actualizaron los archivos de configuración y estado del sistema para reflejar estos cambios, y se realizaron mejoras en la interfaz de usuario para clarificar la distinción entre las operaciones de grabación y streaming. 2025-07-20 23:30:12 +02:00
Miguel a37cb8be3b Refactorizado de index.html 2025-07-20 23:05:14 +02:00
Miguel e939078799 Implementación de un sistema de gestión de configuración CSV, que incluye la obtención y actualización de la configuración de grabación CSV a través de la API. Se añadió la funcionalidad para limpiar archivos CSV antiguos según la configuración establecida, mejorando la gestión del espacio en disco. Además, se actualizaron los archivos de configuración y estado del sistema para reflejar los cambios recientes, y se mejoró la interfaz de usuario para mostrar información sobre el directorio de archivos CSV y su estado. 2025-07-19 23:46:46 +02:00
Miguel f276eb96c5 Version base con Pico.css 2025-07-19 12:17:44 +02:00
Miguel 81ade6f8f0 Antes de refactorizar a varias clases 2025-07-19 10:00:52 +02:00