diff --git a/application_events.json b/application_events.json index fd228d3..430b1ec 100644 --- a/application_events.json +++ b/application_events.json @@ -5914,8 +5914,1160 @@ "resumed_datasets": 1, "total_attempted": 1 } + }, + { + "timestamp": "2025-08-08T15:46:11.256958", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T15:46:26.435662", + "level": "info", + "event_type": "dataset_deactivated", + "message": "Dataset deactivated: DAR", + "details": { + "dataset_id": "dar" + } + }, + { + "timestamp": "2025-08-08T15:46:26.454245", + "level": "info", + "event_type": "dataset_deleted", + "message": "Dataset deleted: DAR", + "details": { + "dataset_id": "dar", + "dataset_info": { + "name": "DAR", + "prefix": "dar", + "variables": { + "UR29_Brix_Digital": { + "area": "db", + "offset": 40, + "type": "real", + "streaming": true, + "db": 2120 + }, + "UR62_PEW": { + "area": "pew", + "offset": 300, + "type": "word", + "streaming": false + }, + "UR29_PEW": { + "area": "pew", + "offset": 304, + "type": "word", + "streaming": false + }, + "UR62_Brix": { + "area": "db", + "offset": 1296, + "type": "real", + "streaming": true, + "db": 1011 + }, + "UR29_Brix": { + "area": "db", + "offset": 1322, + "type": "real", + "streaming": true, + "db": 1011 + }, + "CTS306_PV": { + "area": "db", + "offset": 1328, + "type": "real", + "streaming": true, + "db": 1011 + } + }, + "streaming_variables": [ + "UR29_Brix_Digital", + "UR62_Brix", + "CTS306_PV", + "UR29_Brix" + ], + "sampling_interval": 0.2, + "enabled": false, + "created": "2025-07-17T16:47:56.698652" + } + } + }, + { + "timestamp": "2025-08-08T15:46:29.529192", + "level": "info", + "event_type": "dataset_deleted", + "message": "Dataset deleted: mixer", + "details": { + "dataset_id": "mixer", + "dataset_info": { + "name": "mixer", + "prefix": "mixer", + "variables": {}, + "streaming_variables": [], + "sampling_interval": 1.0, + "enabled": false, + "created": "2025-07-17T17:43:27.745292" + } + } + }, + { + "timestamp": "2025-08-08T15:46:37.258589", + "level": "info", + "event_type": "plot_session_removed", + "message": "Plot session 'Brix' removed", + "details": { + "session_id": "plot_18" + } + }, + { + "timestamp": "2025-08-08T15:47:18.567735", + "level": "info", + "event_type": "dataset_created", + "message": "Dataset created: DAR (prefix: gateway_phoenix)", + "details": { + "dataset_id": "DAR", + "name": "DAR", + "prefix": "gateway_phoenix", + "sampling_interval": 1.0 + } + }, + { + "timestamp": "2025-08-08T15:49:08.446090", + "level": "info", + "event_type": "variable_added", + "message": "Variable added to dataset 'DAR': UR29_ma -> DB2120.36 (real)", + "details": { + "dataset_id": "DAR", + "name": "UR29_ma", + "area": "db", + "db": 2120, + "offset": 36, + "bit": null, + "type": "real", + "streaming": false + } + }, + { + "timestamp": "2025-08-08T15:49:24.959749", + "level": "info", + "event_type": "variable_added", + "message": "Variable added to dataset 'DAR': UR29_Brix -> DB2120.40 (real)", + "details": { + "dataset_id": "DAR", + "name": "UR29_Brix", + "area": "db", + "db": 2120, + "offset": 40, + "bit": null, + "type": "real", + "streaming": false + } + }, + { + "timestamp": "2025-08-08T15:49:51.335129", + "level": "info", + "event_type": "variable_removed", + "message": "Variable removed from dataset 'DAR': UR29_Brix", + "details": { + "dataset_id": "DAR", + "name": "UR29_Brix", + "removed_config": { + "area": "db", + "offset": 40, + "type": "real", + "streaming": false, + "db": 2120 + } + } + }, + { + "timestamp": "2025-08-08T15:49:51.671970", + "level": "info", + "event_type": "variable_added", + "message": "Variable added to dataset 'DAR': UR29_Brix -> DB2123.40 (real)", + "details": { + "dataset_id": "DAR", + "name": "UR29_Brix", + "area": "db", + "db": 2123, + "offset": 40, + "bit": null, + "type": "real", + "streaming": false + } + }, + { + "timestamp": "2025-08-08T15:49:57.472230", + "level": "info", + "event_type": "variable_removed", + "message": "Variable removed from dataset 'DAR': UR29_ma", + "details": { + "dataset_id": "DAR", + "name": "UR29_ma", + "removed_config": { + "area": "db", + "offset": 36, + "type": "real", + "streaming": false, + "db": 2120 + } + } + }, + { + "timestamp": "2025-08-08T15:49:57.801094", + "level": "info", + "event_type": "variable_added", + "message": "Variable added to dataset 'DAR': UR29_ma -> DB2123.36 (real)", + "details": { + "dataset_id": "DAR", + "name": "UR29_ma", + "area": "db", + "db": 2123, + "offset": 36, + "bit": null, + "type": "real", + "streaming": false + } + }, + { + "timestamp": "2025-08-08T15:50:04.353876", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T15:50:27.613148", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T15:50:27.631139", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T15:50:27.648644", + "level": "info", + "event_type": "plc_connection", + "message": "Successfully connected to PLC 10.1.33.11 and auto-started CSV recording for 1 datasets", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "auto_started_recording": true, + "recording_datasets": 1, + "dataset_names": [ + "DAR" + ] + } + }, + { + "timestamp": "2025-08-08T15:51:06.327983", + "level": "info", + "event_type": "plot_session_created", + "message": "Plot session 'UR29' created and started", + "details": { + "session_id": "plot_19", + "variables": [ + "UR29_Brix", + "UR29_ma" + ], + "time_window": 20, + "trigger_variable": null, + "auto_started": true + } + }, + { + "timestamp": "2025-08-08T15:53:55.692196", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:01:44.775233", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:05:14.435549", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:06:18.582309", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:06:28.949003", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T16:06:28.965005", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T16:06:28.974386", + "level": "info", + "event_type": "plc_connection", + "message": "Successfully connected to PLC 10.1.33.11 and auto-started CSV recording for 1 datasets", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "auto_started_recording": true, + "recording_datasets": 1, + "dataset_names": [ + "DAR" + ] + } + }, + { + "timestamp": "2025-08-08T16:09:30.260543", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:11:14.846031", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:13:23.303916", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:13:28.345510", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:13:37.063364", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T16:13:37.074023", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T16:13:37.083144", + "level": "info", + "event_type": "plc_connection", + "message": "Successfully connected to PLC 10.1.33.11 and auto-started CSV recording for 1 datasets", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "auto_started_recording": true, + "recording_datasets": 1, + "dataset_names": [ + "DAR" + ] + } + }, + { + "timestamp": "2025-08-08T16:15:40.983784", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:18:46.815760", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:22:30.815606", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:22:49.523718", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T16:22:49.533431", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T16:22:49.546347", + "level": "info", + "event_type": "plc_connection", + "message": "Successfully connected to PLC 10.1.33.11 and auto-started CSV recording for 1 datasets", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "auto_started_recording": true, + "recording_datasets": 1, + "dataset_names": [ + "DAR" + ] + } + }, + { + "timestamp": "2025-08-08T16:23:18.308001", + "level": "info", + "event_type": "plot_session_removed", + "message": "Plot session 'UR29' removed", + "details": { + "session_id": "plot_19" + } + }, + { + "timestamp": "2025-08-08T16:24:02.833199", + "level": "info", + "event_type": "plot_session_created", + "message": "Plot session 'UR29' created and started", + "details": { + "session_id": "plot_20", + "variables": [ + "UR29_Brix", + "UR29_ma" + ], + "time_window": 10, + "trigger_variable": null, + "auto_started": true + } + }, + { + "timestamp": "2025-08-08T16:27:23.764600", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:32:17.659371", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:32:33.699622", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:32:42.851780", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:32:52.344999", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:32:59.845526", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:33:36.344644", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:34:33.570032", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:34:39.344956", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2 + } + }, + { + "timestamp": "2025-08-08T16:39:03.710569", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T16:39:08.957681", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T16:39:08.965050", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T16:39:08.976139", + "level": "info", + "event_type": "plc_connection", + "message": "Successfully connected to PLC 10.1.33.11 and auto-started CSV recording for 1 datasets", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "auto_started_recording": true, + "recording_datasets": 1, + "dataset_names": [ + "DAR" + ] + } + }, + { + "timestamp": "2025-08-08T16:44:56.998469", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T16:46:00.648608", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:00:10.281628", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T17:00:18.843808", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "error": "b' TCP : Unreachable peer'" + } + }, + { + "timestamp": "2025-08-08T17:00:27.345374", + "level": "error", + "event_type": "plc_connection_failed", + "message": "Failed to connect to PLC 10.1.33.11", + "details": { + "ip": "10.1.33.11", + "rack": 0, + "slot": 2, + "error": "b' TCP : Unreachable peer'" + } + }, + { + "timestamp": "2025-08-08T17:01:23.976465", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-08T17:01:24.635282", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 2, + "streaming_count": 0, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-08T17:01:24.643670", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 1 + } + }, + { + "timestamp": "2025-08-08T17:02:12.395825", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:05:19.598518", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:06:19.781670", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:09:33.736237", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:11:22.096573", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:11:37.992953", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:12:44.893285", + "level": "info", + "event_type": "udp_streaming_started", + "message": "UDP streaming to PlotJuggler started", + "details": { + "udp_host": "127.0.0.1", + "udp_port": 9870, + "datasets_available": 1 + } + }, + { + "timestamp": "2025-08-08T17:13:21.923606", + "level": "info", + "event_type": "config_change", + "message": "UDP configuration updated: 127.0.0.1:9870", + "details": { + "old_config": { + "host": "127.0.0.1", + "port": 9870 + }, + "new_config": { + "host": "127.0.0.1", + "port": 9870 + } + } + }, + { + "timestamp": "2025-08-08T17:13:24.482570", + "level": "info", + "event_type": "udp_streaming_stopped", + "message": "UDP streaming to PlotJuggler stopped (CSV recording continues)", + "details": {} + }, + { + "timestamp": "2025-08-08T17:13:44.674742", + "level": "info", + "event_type": "udp_streaming_started", + "message": "UDP streaming to PlotJuggler started", + "details": { + "udp_host": "127.0.0.1", + "udp_port": 9870, + "datasets_available": 1 + } + }, + { + "timestamp": "2025-08-08T17:18:25.505842", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:20:30.530937", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:23:30.252028", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:24:50.039424", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:25:10.527736", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:26:29.368843", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:41:12.712930", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:43:29.144341", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:50:31.972123", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:54:14.850056", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T17:55:10.108583", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:05:44.243683", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:10:28.632767", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:11:28.672278", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:13:19.402314", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:15:47.781729", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:16:19.866436", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:17:25.271707", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:20:15.297054", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:21:05.593257", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:21:40.316314", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:22:11.433288", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:24:19.821377", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:25:21.871543", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:26:28.518728", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:27:31.483866", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:27:56.948643", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:28:29.947564", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:29:06.114262", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:29:22.195572", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } + }, + { + "timestamp": "2025-08-08T18:30:01.498578", + "level": "info", + "event_type": "datasets_resumed_after_reconnection", + "message": "Automatically resumed streaming for 1 datasets after PLC reconnection", + "details": { + "resumed_datasets": 1, + "total_attempted": 1 + } } ], - "last_updated": "2025-08-04T18:25:54.868463", - "total_entries": 570 + "last_updated": "2025-08-08T18:30:01.498578", + "total_entries": 671 } \ No newline at end of file diff --git a/core/plc_client.py b/core/plc_client.py index afacd41..db7e3fd 100644 --- a/core/plc_client.py +++ b/core/plc_client.py @@ -14,6 +14,7 @@ class PLCClient: self.logger = logger self.plc = None self.connected = False + self.last_error = None # Connection configuration for reconnection self.connection_config = {"ip": None, "rack": None, "slot": None} @@ -43,6 +44,7 @@ class PLCClient: self.plc = snap7.client.Client() self.plc.connect(ip, rack, slot) self.connected = True + self.last_error = None # Store connection configuration for reconnection self.connection_config = {"ip": ip, "rack": rack, "slot": slot} @@ -58,6 +60,7 @@ class PLCClient: except Exception as e: self.connected = False + self.last_error = str(e) if self.logger: self.logger.error( f"Failed to connect to PLC {ip}:{rack}/{slot}: {str(e)}" diff --git a/core/plc_data_streamer.py b/core/plc_data_streamer.py index 3e2cd48..e7ef101 100644 --- a/core/plc_data_streamer.py +++ b/core/plc_data_streamer.py @@ -152,7 +152,10 @@ class PLCDataStreamer: "error", "plc_connection_failed", f"Failed to connect to PLC {self.config_manager.plc_config['ip']}", - self.config_manager.plc_config, + { + **self.config_manager.plc_config, + "error": getattr(self.plc_client, "last_error", None), + }, ) return success diff --git a/main.py b/main.py index bc894b2..15ae296 100644 --- a/main.py +++ b/main.py @@ -298,7 +298,23 @@ def connect_plc(): if streamer.connect_plc(): return jsonify({"success": True, "message": "Connected to PLC"}) else: - return jsonify({"success": False, "message": "Error connecting to PLC"}), 500 + # Extraer detalle de error si disponible + last_error = None + try: + last_error = streamer.plc_client.last_error + except Exception: + last_error = None + return ( + jsonify( + { + "success": False, + "message": "Error connecting to PLC", + "error": last_error, + "plc_config": streamer.config_manager.plc_config, + } + ), + 500, + ) @app.route("/api/plc/disconnect", methods=["POST"]) diff --git a/plc_config.json b/plc_config.json index 074ae31..0a5af50 100644 --- a/plc_config.json +++ b/plc_config.json @@ -16,6 +16,6 @@ "max_days": 30, "max_hours": null, "cleanup_interval_hours": 24, - "last_cleanup": "2025-08-04T15:29:50.501222" + "last_cleanup": "2025-08-08T15:50:27.922821" } } \ No newline at end of file diff --git a/plc_datasets.json b/plc_datasets.json index f30c509..5828eb1 100644 --- a/plc_datasets.json +++ b/plc_datasets.json @@ -1,74 +1,37 @@ { "datasets": { - "dar": { + "DAR": { "name": "DAR", - "prefix": "dar", + "prefix": "gateway_phoenix", "variables": { - "UR29_Brix_Digital": { + "UR29_Brix": { "area": "db", "offset": 40, "type": "real", "streaming": true, - "db": 2120 + "db": 2123 }, - "UR62_PEW": { - "area": "pew", - "offset": 300, - "type": "word", - "streaming": false - }, - "UR29_PEW": { - "area": "pew", - "offset": 304, - "type": "word", - "streaming": false - }, - "UR62_Brix": { + "UR29_ma": { "area": "db", - "offset": 1296, + "offset": 36, "type": "real", "streaming": true, - "db": 1011 - }, - "UR29_Brix": { - "area": "db", - "offset": 1322, - "type": "real", - "streaming": true, - "db": 1011 - }, - "CTS306_PV": { - "area": "db", - "offset": 1328, - "type": "real", - "streaming": true, - "db": 1011 + "db": 2123 } }, "streaming_variables": [ - "UR29_Brix_Digital", - "UR62_Brix", - "CTS306_PV", - "UR29_Brix" + "UR29_Brix", + "UR29_ma" ], - "sampling_interval": 0.2, - "enabled": true, - "created": "2025-07-17T16:47:56.698652" - }, - "mixer": { - "name": "mixer", - "prefix": "mixer", - "variables": {}, - "streaming_variables": [], "sampling_interval": 1.0, - "enabled": false, - "created": "2025-07-17T17:43:27.745292" + "enabled": true, + "created": "2025-08-08T15:47:18.566053" } }, "active_datasets": [ - "dar" + "DAR" ], - "current_dataset_id": "dar", + "current_dataset_id": "DAR", "version": "1.0", - "last_update": "2025-08-04T18:22:22.744860" + "last_update": "2025-08-08T17:13:42.321147" } \ No newline at end of file diff --git a/plot_sessions.json b/plot_sessions.json index 7addab9..8849ad1 100644 --- a/plot_sessions.json +++ b/plot_sessions.json @@ -1,21 +1,21 @@ { "plots": { - "plot_18": { - "name": "Brix", + "plot_20": { + "name": "UR29", "variables": [ "UR29_Brix", - "UR62_Brix" + "UR29_ma" ], - "time_window": 60, + "time_window": 10, "y_min": null, "y_max": null, "trigger_variable": null, "trigger_enabled": false, "trigger_on_true": true, - "session_id": "plot_18" + "session_id": "plot_20" } }, - "session_counter": 19, - "last_saved": "2025-08-04T00:49:55.221304", + "session_counter": 21, + "last_saved": "2025-08-08T16:24:02.832199", "version": "1.0" } \ No newline at end of file diff --git a/static/js/chartjs-streaming/chartjs-plugin-streaming.js b/static/js/chartjs-streaming/chartjs-plugin-streaming.js index 54669be..435ba25 100644 --- a/static/js/chartjs-streaming/chartjs-plugin-streaming.js +++ b/static/js/chartjs-streaming/chartjs-plugin-streaming.js @@ -97,18 +97,32 @@ hasOnRefresh: typeof me.realtime.onRefresh === 'function' }); - // Configurar intervalo de actualización - if (!streaming.intervalId && me.realtime.refresh > 0) { + // Configurar intervalo de obtención de datos (refresh) + if (me.realtime.refresh > 0) { + if (streaming.intervalId) { + clearInterval(streaming.intervalId); + } streaming.intervalId = setInterval(() => { if (!me.realtime.pause && typeof me.realtime.onRefresh === 'function') { me.realtime.onRefresh(chart); } + }, me.realtime.refresh); + console.log('📈 RealTimeScale data interval started:', me.realtime.refresh + 'ms'); + } + + // Configurar intervalo de render (frameRate) + const fps = Math.max(1, me.realtime.frameRate || 30); + const frameIntervalMs = Math.round(1000 / fps); + if (streaming.frameIntervalId) { + clearInterval(streaming.frameIntervalId); + } + streaming.frameIntervalId = setInterval(() => { + if (!me.realtime.pause) { me.updateRealTimeData(); chart.update('quiet'); - }, me.realtime.refresh); - - console.log('📈 RealTimeScale interval started:', me.realtime.refresh + 'ms'); - } + } + }, frameIntervalMs); + console.log('🎞️ RealTimeScale render interval started:', frameIntervalMs + 'ms (' + fps + ' fps)'); } updateRealTimeData() { @@ -151,10 +165,17 @@ const chart = me.chart; const streaming = chart.$streaming; - if (streaming && streaming.intervalId) { - clearInterval(streaming.intervalId); - delete streaming.intervalId; - console.log('📈 RealTimeScale interval cleared'); + if (streaming) { + if (streaming.intervalId) { + clearInterval(streaming.intervalId); + delete streaming.intervalId; + console.log('📈 RealTimeScale data interval cleared'); + } + if (streaming.frameIntervalId) { + clearInterval(streaming.frameIntervalId); + delete streaming.frameIntervalId; + console.log('🎞️ RealTimeScale render interval cleared'); + } } super.destroy(); diff --git a/static/js/plotting.js b/static/js/plotting.js index af304a0..7d90b86 100644 --- a/static/js/plotting.js +++ b/static/js/plotting.js @@ -194,6 +194,26 @@ class PlotManager { chartConfig = this.createFallbackChartConfig(sessionId, config); } + // Pre-poblar datasets en config antes de crear el Chart para evitar metas undefined + if (Array.isArray(config.variables) && config.variables.length > 0) { + const datasets = []; + config.variables.forEach((variable, index) => { + const color = this.getColor(variable, index); + datasets.push({ + label: variable, + data: [], + borderColor: color, + backgroundColor: color + '20', + borderWidth: 2, + fill: false, + pointRadius: 0, + pointHoverRadius: 3, + tension: 0.1 + }); + }); + chartConfig.data.datasets = datasets; + } + // Crear chart const chart = new Chart(ctx, chartConfig); @@ -203,7 +223,8 @@ class PlotManager { config: config, lastDataFetch: 0, datasetIndex: new Map(), // Mapeo de variable -> índice de dataset - isRealTimeMode: hasRealTimeScale + isRealTimeMode: hasRealTimeScale, + lastPushedXByDataset: new Map() // índice de dataset -> último timestamp x añadido }); // Inicializar refresh rate por defecto @@ -212,8 +233,12 @@ class PlotManager { console.log(`⏱️ Plot ${sessionId}: Default refresh rate set to 1000ms`); } - // Inicializar datasets para las variables - this.initializeChartDatasets(sessionId, config); + // Inicializar índice de datasets (sin mutar chart aún) + if (Array.isArray(config.variables)) { + config.variables.forEach((variable, index) => { + this.sessions.get(sessionId).datasetIndex.set(variable, index); + }); + } // Si no es modo realtime, iniciar intervalo manual if (!hasRealTimeScale) { @@ -243,7 +268,7 @@ class PlotManager { realtime: { duration: (config.time_window || 60) * 1000, refresh: this.refreshRates.get(sessionId) || 1000, // Actualizar según configuración dinámica - delay: 0, + delay: ((this.refreshRates.get(sessionId) || 1000) * 2), // Margen temporal para evitar saltos frameRate: 30, pause: !config.is_active, // Pausar si no está activo onRefresh: (chart) => { @@ -443,14 +468,10 @@ class PlotManager { const timeSinceLastUpdate = now - sessionData.lastDataFetch; sessionData.lastDataFetch = now; - console.log(`🔄 Plot ${sessionId}: Updating data (${timeSinceLastUpdate}ms since last update, threshold: ${minInterval}ms)`); // Obtener datos del backend (que usa solo cache) const response = await fetch(`/api/plots/${sessionId}/data`); - if (!response.ok) { - console.error(`📈 Plot ${sessionId}: API response not ok:`, response.status); - return; - } + if (!response.ok) return; const plotData = await response.json(); @@ -497,12 +518,12 @@ class PlotManager { } // Agregar el punto con timestamp correcto - const newPoint = { - x: latestPoint.x || timestamp, - y: latestPoint.y - }; + const lastPushedX = sessionData.lastPushedXByDataset.get(datasetIndex) || 0; + const candidateX = latestPoint.x || timestamp; + const finalX = candidateX > lastPushedX ? candidateX : lastPushedX + 1; // garantizar x strictly increasing - chart.data.datasets[datasetIndex].data.push(newPoint); + chart.data.datasets[datasetIndex].data.push({ x: finalX, y: latestPoint.y }); + sessionData.lastPushedXByDataset.set(datasetIndex, finalX); pointsAdded++; }); @@ -1539,23 +1560,30 @@ class PlotManager { // Actualizar la configuración de refresh rate chart.scales.x.realtime.refresh = finalRefreshRateMs; - // Forzar reinicio del intervalo interno del plugin + // Forzar reinicio del intervalo de obtención de datos (onRefresh) const streaming = chart.$streaming; - if (streaming && streaming.intervalId) { - clearInterval(streaming.intervalId); - - // Recrear el intervalo con el nuevo refresh rate + if (streaming) { + if (streaming.intervalId) { + clearInterval(streaming.intervalId); + } + // Recrear el intervalo SOLO para onRefresh; el render lo gestiona el plugin oficial streaming.intervalId = setInterval(() => { if (!chart.scales.x.realtime.pause && typeof chart.scales.x.realtime.onRefresh === 'function') { chart.scales.x.realtime.onRefresh(chart); } - if (chart.scales.x.updateRealTimeData) { - chart.scales.x.updateRealTimeData(); - } - chart.update('quiet'); }, finalRefreshRateMs); - console.log(`🔄 Streaming interval restarted with ${finalRefreshRateMs}ms`); + console.log(`🔄 Data refresh interval restarted with ${finalRefreshRateMs}ms`); + } + + // Ajustar dinámicamente el delay a 2x refresh para evitar saltos visuales + if (chart.scales && chart.scales.x && chart.scales.x.realtime) { + const newDelay = Math.max(finalRefreshRateMs * 2, 0); + chart.scales.x.realtime.delay = newDelay; + if (chart.options && chart.options.scales && chart.options.scales.x && chart.options.scales.x.realtime) { + chart.options.scales.x.realtime.delay = newDelay; + } + console.log(`⏳ Realtime delay adjusted to ${newDelay}ms`); } // También actualizar la configuración de opciones para futuros reinicios diff --git a/static/js/status.js b/static/js/status.js index 9d7cfac..fcb8106 100644 --- a/static/js/status.js +++ b/static/js/status.js @@ -76,8 +76,12 @@ function updateStatus() { fetch('/api/plc/connect', { method: 'POST' }) .then(response => response.json()) .then(data => { - showMessage(data.message, data.success ? 'success' : 'error'); + const msg = data.error ? `${data.message}: ${data.error}` : data.message; + showMessage(msg, data.success ? 'success' : 'error'); updateStatus(); + }) + .catch(err => { + showMessage(`Error connecting to PLC: ${err}`, 'error'); }); }); } @@ -228,8 +232,12 @@ function updateStatusFromStream(status) { fetch('/api/plc/connect', { method: 'POST' }) .then(response => response.json()) .then(data => { - showMessage(data.message, data.success ? 'success' : 'error'); + const msg = data.error ? `${data.message}: ${data.error}` : data.message; + showMessage(msg, data.success ? 'success' : 'error'); updateStatus(); + }) + .catch(err => { + showMessage(`Error connecting to PLC: ${err}`, 'error'); }); }); } diff --git a/system_state.json b/system_state.json index 66feee2..251eaf1 100644 --- a/system_state.json +++ b/system_state.json @@ -1,11 +1,11 @@ { "last_state": { "should_connect": true, - "should_stream": false, + "should_stream": true, "active_datasets": [ - "dar" + "DAR" ] }, "auto_recovery_enabled": true, - "last_update": "2025-08-04T18:22:22.763087" + "last_update": "2025-08-08T17:13:44.673911" } \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 1b4ae17..73330b4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -754,12 +754,11 @@ - - - - - - + + + + +