Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folkengine/k08 octt test failure #803

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/lib/ocpp/v201/json/OCCT_TC_K_41_CS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OCCT K08 Test Case #TC_K_41_CS

Check notice on line 1 in tests/lib/ocpp/v201/json/OCCT_TC_K_41_CS/README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/lib/ocpp/v201/json/OCCT_TC_K_41_CS/README.md#L1

Expected: [None]; Actual: # OCCT K08 Test Case #TC_K_41_CS

This Composite Schedule test scenario is based on the OCTT integration test
suite TC_K_41_CS test. It is compromised of three Profiles:

- Absolute ChargingStationMaxProfile with a duration of 86404 and one
chargingSchedulePeriod.
- Absolute TxDefaultProfile with a duration of 304 and 5 periods.
- Absolute TxProfile with a duration of 264 and 5 periods.

All have a stackLevel of 0.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": 1,
"chargingProfileKind": "Absolute",
"chargingProfilePurpose": "ChargingStationMaxProfile",
"chargingSchedule": [
{
"chargingRateUnit": "A",
"chargingSchedulePeriod": [
{
"limit": 10.000000,
"numberPhases": 3,
"startPeriod": 0
}
],
"duration": 86404,
"id": 1,
"startSchedule": "2024-08-21T12:24:36Z"
}
],
"stackLevel": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"id": 2,
"chargingProfileKind": "Absolute",
"chargingProfilePurpose": "TxDefaultProfile",
"chargingSchedule": [
{
"chargingRateUnit": "A",
"chargingSchedulePeriod": [
{
"limit": 6.000000,
"numberPhases": 3,
"startPeriod": 0
},
{
"limit": 10.000000,
"numberPhases": 3,
"startPeriod": 60
},
{
"limit": 8.000000,
"numberPhases": 3,
"startPeriod": 120
},
{
"limit": 15.000000,
"numberPhases": 3,
"startPeriod": 180
},
{
"limit": 8.000000,
"numberPhases": 3,
"startPeriod": 260
}
],
"duration": 304,
"id": 1,
"startSchedule": "2024-08-21T12:24:36Z"
}
],
"stackLevel": 0,
"validFrom": "2024-08-21T12:24:36Z",
"validTo": "2024-08-21T12:31:25Z"
}
42 changes: 42 additions & 0 deletions tests/lib/ocpp/v201/json/OCCT_TC_K_41_CS/id2-TxProfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"chargingProfileKind": "Absolute",
"chargingProfilePurpose": "TxProfile",
"chargingSchedule": [
{
"chargingRateUnit": "A",
"chargingSchedulePeriod": [
{
"limit": 8.000000,
"numberPhases": 3,
"startPeriod": 0
},
{
"limit": 11.000000,
"numberPhases": 3,
"startPeriod": 50
},
{
"limit": 16.000000,
"numberPhases": 3,
"startPeriod": 140
},
{
"limit": 6.000000,
"numberPhases": 3,
"startPeriod": 200
},
{
"limit": 12.000000,
"numberPhases": 3,
"startPeriod": 240
}
],
"duration": 264,
"id": 1,
"startSchedule": "2024-08-21T12:24:36Z"
}
],
"id": 2,
"stackLevel": 0,
"transactionId": "e23889e3-0fc7-424a-b2e9-dce774521b83"
}
30 changes: 30 additions & 0 deletions tests/lib/ocpp/v201/test_composite_schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,34 @@ TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_External
ASSERT_EQ(actual, expected);
}

TEST_F(CompositeScheduleTestFixtureV201, OCTT_TC_K_41_CS) {
std::vector<ChargingProfile> profiles =
SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/OCCT_TC_K_41_CS/");

const DateTime start_time = ocpp::DateTime("2024-08-21T12:24:40");
const DateTime end_time = ocpp::DateTime("2024-08-21T12:31:20");

CompositeSchedule expected = {
.chargingSchedulePeriod = {{
.startPeriod = 0,
.limit = 8.0,
.numberPhases = 3,
},
{.startPeriod = 46, .limit = 10.0, .numberPhases = 3},
{.startPeriod = 196, .limit = 6.0, .numberPhases = 3},
{.startPeriod = 236, .limit = 10.0, .numberPhases = 3},
{.startPeriod = 260, .limit = 8.0, .numberPhases = 3},
{.startPeriod = 300, .limit = 10.0, .numberPhases = 3}},
.evseId = DEFAULT_EVSE_ID,
.duration = 400,
.scheduleStart = start_time,
.chargingRateUnit = ChargingRateUnitEnum::A,
};

CompositeSchedule actual =
handler.calculate_composite_schedule(profiles, start_time, end_time, DEFAULT_EVSE_ID, ChargingRateUnitEnum::A);

ASSERT_EQ(actual, expected);
}

} // namespace ocpp::v201
Loading