Enhancements & Fixes: Simulator, Network, and Train Improvements#29
Merged
AhmedAredah merged 13 commits intoVTTI-CSM:serverfrom Mar 9, 2025
AhmedAredah:server
Merged
Enhancements & Fixes: Simulator, Network, and Train Improvements#29AhmedAredah merged 13 commits intoVTTI-CSM:serverfrom AhmedAredah:server
AhmedAredah merged 13 commits intoVTTI-CSM:serverfrom
AhmedAredah:server
Conversation
Consolidates platform-specific container library paths into a single variable. Removes redundant platform-specific bin directory settings and replaces them with a generic check for library directory existence. Addresses potential configuration inconsistencies across different platforms.
Replaces the use of raw boolean with atomic boolean for pauseFlag to ensure thread safety. Modifies pause logic to avoid blocking the event loop by processing events during pause. Removes unnecessary move operation for networkTrains initialization. Improves overall thread safety and responsiveness of the simulator.
… and add debug checks - Change `createNewSimulationEnvironment` parameters from `QString` to `QJsonObject` for nodes and links file content. - Add `CHECK_TRUE` macro for enhanced debug assertion. - Improve error handling and resource cleanup on setup failure. - Register `Train*` and `APIData*` meta types. - Ensure simulator setup success tracking and conditional subsequent actions. - Use `CHECK_TRUE` for robust QObject connections.
Adds Q_DECLARE_METATYPE for std::shared_ptr<Network> to enable use of shared pointers with QVariant in the Qt framework.
Implements functionality to read nodes and links from JSON files. Adds validation and error handling for JSON structure and content. Enhances flexibility by supporting both file and JSON object inputs.
Ensures containers are assigned a location when added to a train. Updates container location setting in both addContainer and addContainers methods. Includes necessary header file adjustment and type declarations.
…nters Adds Q_DECLARE_METATYPE declarations for pointers and std::shared_ptr for TrainNetworkDefinition and TrainsResults classes to support QVariant usage with these types.
Ensures that train path IDs in JSON can be parsed from both string and number formats. Adds validation and logging for invalid string formats to prevent potential errors during parsing.
Adds a new slot `onContainersUnloaded` to handle container unloading events. Integrates the new slot with the `SimulatorAPI`. Improves message consumption logic to avoid busy-loops and CPU hogging. Enhances error handling in the `processCommand` function. Introduces retry logic for publishing RabbitMQ messages.
Refines train state storage by replacing QJsonArray with QJsonObject. Adds null check for train existence before adding containers. Ensures method exits early if containers are unloaded successfully. Fixes potential crash due to null pointer reference.
Removes the unused 'this' parameter from the `loadContainersFromJson` call. Adds the container count to the JSON output when the server build is enabled.
Improves clarity of log messages by fixing typos and formatting. Corrects the message when unloading containers and when adding containers to a train.
Includes trip time information in the JSON representation of the train's current state for better tracking of trip duration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request consolidates a range of improvements and bug fixes aimed at enhancing the simulator environment, network JSON support, and train handling functionalities. The main changes include:
CMake & Environment:
Simulator Enhancements:
Network Upgrades:
Train & Simulation Fixes:
Metatype Enhancements: