Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/K08 Get Composite Schedule (#745)
* * Added OCPP 2.0.1 Calculate Composite Schedule functionality and tests * Added Generic optional type equality function for testing option types * Create v201/profile.hpp to match file structure used in 1.6 CompositeSchedule work * Added to_string functions to v201/utils to facilitate easier testing, logging and debugging * Added OCPP 1.6 test_composite_schedule.cpp suite. * Added ability to use serialized JSON Profiles scenarios for testing in v1.6 and 2.0.1. * Added JSON Profiles based on specific testing scenarios for v1.6 and 2.0.1. * Enabled now working 1.6 Composit Schedule tests * Added v201/test_profile.cpp suite mirroring but refactoring tests done for v1.6 version * Removed excessive logging Signed-off-by: Christoph <[email protected]> * Added sorting of vectors in SmartChargingTestUtils::get_charging_profiles_from_directory() to fix order issue in tests on CI Signed-off-by: Christoph <[email protected]> * Updated READMEs to fix linting issues Signed-off-by: Christoph <[email protected]> * Updated READMEs to fix more linting issues Signed-off-by: Christoph <[email protected]> * Removed unused LimitStackLevelPair struct caught by linter Signed-off-by: Christoph <[email protected]> * Added const to functions as per linter Signed-off-by: Christoph <[email protected]> * Added pass by const reference to functions as per linter Signed-off-by: Christoph <[email protected]> * Updated status doc Signed-off-by: Christoph <[email protected]> * Add get_valid_profiles() to Smart Charging Handler. When retrieving the valid profiles for calculating composite schedules, this function returns all of the profiles for a given EVSE ID, as well as the station-wide profiles. It also ensures that the profiles are valid. The calculations for composite schedule handle the start and end time, so this function does not account for it at this stage. Signed-off-by: Christopher Davis <[email protected]> Signed-off-by: Gianfranco Berardi <[email protected]> * added calculation for charging station external constraints. added tests to cover external constraints. refactored calculation for both max and external to a method. Signed-off-by: Coury Richards <[email protected]> * smart_charging: Make more functions mockable Make `calculate_composite_schedule()` and `get_valid_profiles()` part of the `SmartChargingHandlerInterface` so they may be overriden for mocking. Signed-off-by: Christopher Davis <[email protected]> * smart_charging: Take chargingRateUnit as optional in `calculate_composite_schedule()` The internal functions (and the v1.6 impl) take this as optional, but we were requiring a value. Signed-off-by: Christopher Davis <[email protected]> * charge_point: Handle GetCompositeScheduleRequest Adds a message handler for GetCompositeScheduleRequest and associated tests within `test_charge_point.cpp`. Due to the core functionality being tested within `test_composite_schedule.cpp`, we primarily test that `get_valid_profiles()` and `calculate_composite_schedule()` are being called within the right contexts: * We calculate a composite schedule from a list of valid profiles * We do not calculate a composite schedule when the EVSE ID is unknown * We do not calculate a composite schedule when the `chargingRateUnit` sent in the request is not configured. Signed-off-by: Christopher Davis <[email protected]> * doc: Update OCPP v2.0.1 status doc We now cover: - K08.FR.03 - K08.FR.04 - K08.FR.05 - K08.FR.07 Signed-off-by: Christopher Davis <[email protected]> * Resolving PR comments from @Pietfried Signed-off-by: Christoph <[email protected]> * Moving location of json profiles as per PR comment Signed-off-by: Christoph <[email protected]> * Moving static functions only used in file into anonymous namespace as per PR comments Signed-off-by: Christoph <[email protected]> * Moving static functions only used in file into anonymous namespace as per PR comments Signed-off-by: Christoph <[email protected]> * Added documentation to test utility function as per PR review Signed-off-by: Christoph <[email protected]> * Moving equality operators to smart_charging_test_utils as per PR review Signed-off-by: Christoph <[email protected]> * Corrected mistake in Status doc as per PR review Signed-off-by: Christoph <[email protected]> * Updated constants as per PR review Signed-off-by: Christoph <[email protected]> * Updated profile comments as per PR review Signed-off-by: Christoph <[email protected]> * Moved functions only used in tests to tests as per PR review Signed-off-by: Christoph <[email protected]> * Added link to issue resolved in Case One composite schedule scenario test as per PR review Signed-off-by: Christoph <[email protected]> * Removed unused struct as per PR review Signed-off-by: Christoph <[email protected]> * Moved functions only used in tests to tests as per PR review Signed-off-by: Christoph <[email protected]> * Rolled back accidental changes to 1.6 code Signed-off-by: Christoph <[email protected]> * Remove profile scenario not used in PR Signed-off-by: Christoph <[email protected]> * Added more detailed Grid foundation test as per PR review. Signed-off-by: Christoph <[email protected]> * Fixed CalculateProfileEntryType_Param_Test as per PR review. Signed-off-by: Christoph <[email protected]> * Updated CalculateChargingSchedule_Overlap test names as per PR review. Signed-off-by: Christoph <[email protected]> * Updated CalculateChargingScheduleCombined_CombinedOverlapT names as per PR review. Signed-off-by: Christoph <[email protected]> * Moved functions only used in tests to tests as per PR review Signed-off-by: Christoph <[email protected]> * Added in grabbing transaction session start for relative profiles as per PR review Signed-off-by: Christoph <[email protected]> * Added check for evse_id == 0 as per PR review Signed-off-by: Christoph <[email protected]> * Touch to rerun GitHub Actions Signed-off-by: Christoph <[email protected]> * Touch to rerun GitHub Actions Signed-off-by: Christoph <[email protected]> * Touch to rerun GitHub Actions Signed-off-by: Christoph <[email protected]> --------- Signed-off-by: Christoph <[email protected]> Signed-off-by: Christopher Davis <[email protected]> Signed-off-by: Gianfranco Berardi <[email protected]> Signed-off-by: Coury Richards <[email protected]> Co-authored-by: Gianfranco Berardi <[email protected]> Co-authored-by: Coury Richards <[email protected]> Co-authored-by: Christopher Davis <[email protected]>
- Loading branch information