EVerest / everest-demo

EVerest demo: Dockerized demo with software in the loop simulation
Apache License 2.0
14 stars 15 forks source link

Patch Cleanup After CharIN Demos #61

Open louisg1337 opened 3 months ago

louisg1337 commented 3 months ago

During CharIN, multiple on the spot patches had to be made to get the demos working, found in this PR. The goal is to now slowly fix everything so that these patches are no longer needed.

Discussions started about debugging our MaEVe implementation of setChargingProfile so that it can work without a patch, found here. This thread is now the continuation of all of the above.

louisg1337 commented 3 months ago

MaEVe setChargingProfile Update

I finally managed to figure out what was wrong with my implementation of setChargingProfile in MaEVe. As I mentioned before, identifiers in structs need to be capitalized if we want the data within them to be exported, i.e. work in other packages. This caused an issue for us because libocpp wanted the lowercase versions of the EvsdeId and ChargingProfile.

I firstly spent a good amount of time trying to trace the code in libocpp and maeve-csms to try and see if I made a mistake along the way. I then tried adding in different hot fixes to convert the values in our SetChargingProfileRequestJson struct to lowercase before being sent out, but that didn't work. I then finally realized what was different between my struct and all the other ones already defined in MaEVe. The difference is that in their structs they had a tag that could allow you to specify what name you wanted the identifier to have in a json object. This meant that we could specify ChargingProfile/EvseId to show up as chargingProfile/evseId in json, all while retaining the capitalization. The final changed can be found here.

With this new change in place, I went ahead and tried to test out my new implementation with some of the patchwork taken away. As stated in this comment, I only removed the patch made to messages/SetChargingProfile.cpp, which had the formatting change. Once the docker containers were up and running I sent over the setChargingProfile API request and it worked. This is the response I received:

SetChargingProfile Response ``` 2024-06-17 15:05:48.011299 [ERRO] ocpp:OCPP201 void ocpp::v201::ChargePoint::handle_set_charging_profile_req(ocpp::Call) :: Received SetChargingProfile: { "chargingProfile": { "chargingProfileKind": "Absolute", "chargingProfilePurpose": "TxDefaultProfile", "chargingSchedule": [ { "chargingRateUnit": "A", "chargingSchedulePeriod": [ { "limit": 20.0, "numberPhases": 1, "startPeriod": 0 } ], "duration": 86400, "id": 0, "minChargingRate": 0.0, "startSchedule": "2024-06-13T00:00:00.000Z" } ], "id": 1, "recurrencyKind": "Daily", "stackLevel": 1 }, "evseId": 0 } with messageId: 2915644d-7ecb-403c-8d6d-f8ec777f12da 2024-06-17 15:05:48.039283 [WARN] ocpp:OCPP201 module::OCPP201::ready():: :: Received a new Charging Schedules from the CSMS or another actor. 2024-06-17 15:05:48.048997 [INFO] ocpp:OCPP201 :: ProfileId #1 Kind: Absolute 2024-06-17 15:05:48.055404 [INFO] ocpp:OCPP201 :: #1 find_period_at> 2024-06-13T00:00:00.000Z 2024-06-17 15:05:48.056224 [INFO] ocpp:OCPP201 :: find_period_at> start_time> 2024-06-17T15:05:48.039Z 2024-06-17 15:05:48.056508 [INFO] ocpp:OCPP201 :: find_period_at> period_start_time> 2024-06-13T00:00:00.000Z 2024-06-17 15:05:48.056984 [INFO] ocpp:OCPP201 :: find_period_at> period_end_time> 2024-06-14T00:00:00.000Z 2024-06-17 15:05:48.059371 [INFO] ocpp:OCPP201 :: PeriodDateTimePair> end_time: 2080-02-01T07:44:08.478Z 2024-06-17 15:05:48.059538 [INFO] ocpp:OCPP201 :: ProfileId #1 Kind: Absolute 2024-06-17 15:05:48.059651 [INFO] ocpp:OCPP201 :: #1 find_period_at> 2024-06-13T00:00:00.000Z 2024-06-17 15:05:48.059814 [INFO] ocpp:OCPP201 :: find_period_at> start_time> 2024-06-17T15:05:48.059Z 2024-06-17 15:05:48.059957 [INFO] ocpp:OCPP201 :: find_period_at> period_start_time> 2024-06-13T00:00:00.000Z 2024-06-17 15:05:48.060028 [INFO] ocpp:OCPP201 :: find_period_at> period_end_time> 2024-06-14T00:00:00.000Z 2024-06-17 15:05:48.062774 [INFO] ocpp:OCPP201 :: PeriodDateTimePair> end_time: 2080-02-01T07:44:08.478Z 2024-06-17 15:05:48.245824 [ERRO] ocpp:OCPP201 void ocpp::v201::ChargePoint::handle_set_charging_profile_req(ocpp::Call) :: Received profile validity: Validsetting response to { "status": "Accepted" } ```
louisg1337 commented 3 months ago

Just posted the PR to MaEVe to integrate our setChargingProfile API. I'll start looking into the rest of the MaEVe patch files and try to figure out how to put it in some type of config.

louisg1337 commented 3 months ago

For the rest of the MaEVe patch files, I just submitted another PR. I tried creating some type of config option with a script that you could run if using MaEVe with EVerest, and I left room for the community to provide their own feedback/thoughts for hopefully a better solution.

louisg1337 commented 3 months ago

Added in new PR's for EVerest patches that do not require recompiling...

louisg1337 commented 3 months ago

Added in more PRs to US-JOET for patches that do require recompiling...

shankari commented 3 months ago

Converted both to draft; please clean up before taking it off draft

louisg1337 commented 3 months ago

Thank you for the feedback @shankari, just addressed all the comments in both PRs and set them back to ready for review. Let me know what else, if anything, needs to be done to them.