Refactored OCPP1.6 Composite Schedule calculation #1062
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.
Describe your changes
Refactor of OCPP1.6 Composite Schedule calculation using the same approach that was introduced for OCPP2.x by this PR: #943
The reason for the refactoring is to change the composite schedule calculation for connectorId 0.
Summary of the changes:
1. Note on changed test cases
The new approach does not add
numberPhases
to the composite period in case the original profiles did not have anumberPhases
property either. This is different to the approach that was present before and had to be changed throughout the test cases. In addition, thestackLevel
calculation changed in a way that also thestackLevel
of profiles with purposeChargePointMaxProfile
are considered if those provide the lowest limit while merging the periods.2. Note on
stackLevel
andperiodTransformed
support:I tried to keep these properties part of the
EnhancedChargingSchedulePeriod
although the new approach leads to some ambigouity in certain cases.With the new approach, a composite schedule period for connectorId 0 can be composed by the sum of periods from multiple profiles (e.g. multiple different
TxDefaultProfile
s). These profiles may have differentstackLevel
values, which makes it impossible to define a explicitstackLevel
for the composite period.For the same reason,
periodTransformed
can also not be clearly defined for connectorId 0, since the composite period may be composed by periods with differentchargingRateUnit
s.3. Note on code duplication
Quite some code and tests have been copied from the v2 implementation. I see quite some potential for a subsequent refactor, but the PR is already quite large. Also, the special handling of the
EnhancedChargingProfile
as well as mostly no common type definitions for v16 and v2 make it more difficult.Issue ticket number and link
Adjustment of everest-core test cases (see 1. Note): EVerest/everest-core#1177
Checklist before requesting a review