SAP / emobility-smart-charging

Smart charging algorithms with REST API for electric vehicle fleets
Apache License 2.0
51 stars 61 forks source link

Departure time seems not to work #59

Closed LucasBrazi06 closed 1 month ago

LucasBrazi06 commented 1 year ago

When same root fuse + car is sent with different departure times (timestampDeparture), the result is always the same!

I would have expected that the longer the departure time, the lower the amps delivered every 15 mins.

For instance changing the departure time value below (500, 5000, 50000) always results in the same response:

{
    "event": {
        "eventType": "Reoptimize"
    },
    "state": {
        "fuseTree": {
            "rootFuse": {
                "@type": "Fuse",
                "id": 0,
                "fusePhase1": 96,
                "fusePhase2": 96,
                "fusePhase3": 96,
                "phase1Connected": true,
                "phase2Connected": true,
                "phase3Connected": true,
                "children": [
                    {
                        "@type": "Fuse",
                        "id": 1,
                        "fusePhase1": 32,
                        "fusePhase2": 32,
                        "fusePhase3": 32,
                        "phase1Connected": true,
                        "phase2Connected": true,
                        "phase3Connected": true,
                        "children": [
                            {
                                "@type": "ChargingStation",
                                "id": 2,
                                "fusePhase1": 32,
                                "fusePhase2": 32,
                                "fusePhase3": 32,
                                "phase1Connected": true,
                                "phase2Connected": true,
                                "phase3Connected": true
                            }
                        ]
                    }
                ]
            }
        },
        "cars": [
            {
                "canLoadPhase1": 1,
                "canLoadPhase2": 1,
                "canLoadPhase3": 1,
                "id": 1,
                "carType": "BEV",
                "maxCapacity": 300,
                "minLoadingState": 250,
                "startCapacity": 30,
                "minCurrent": 18,
                "minCurrentPerPhase": 6,
                "maxCurrent": 96,
                "maxCurrentPerPhase": 32,
                "suspendable": true,
                "immediateStart": false,
                "canUseVariablePower": true,
                "chargingStarted": true,
                "name": "####",
                "timestampArrival": 0,
                "timestampDeparture": 50000
            }
        ],
        "carAssignments": [
            {
                "carID": 1,
                "chargingStationID": 2
            }
        ],
        "currentTimeSeconds": 1
    }
}
{
    "cars": [
        {
            "id": 1,
            "name": "####",
            "modelName": null,
            "carType": "BEV",
            "startCapacity": 30.0,
            "timestampArrival": 0,
            "timestampDeparture": 5000,
            "maxCapacity": 300.0,
            "minCurrent": 18.0,
            "minCurrentPerPhase": 6.0,
            "maxCurrent": 96.0,
            "maxCurrentPerPhase": 32.0,
            "suspendable": true,
            "canUseVariablePower": true,
            "immediateStart": false,
            "minLoadingState": 250.0,
            "canLoadPhase1": 1.0,
            "canLoadPhase2": 1.0,
            "canLoadPhase3": 1.0,
            "currentPlan": [
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                7.564967320261477,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
                ...
            ],
            "chargingStarted": true,
            "chargedCapacity": 0.0
        }
    ]
}

Could you advice?

Thanks in advance!

ofrendo commented 1 year ago

This behaviour is expected if we are looking at a single EV. Spreading out the load of a single EV throughout the day is not implemented.

However, for use cases with more than a single EV: The default "highest objective" is fair share. Fair share tries to schedule all EVs ASAP. Data structures for REST requests: https://github.com/SAP/emobility-smart-charging/blob/master/src/main/java/com/sap/charging/server/api/v1/OptimizeChargingProfilesRequest.java#L33 https://github.com/SAP/emobility-smart-charging/blob/master/src/main/java/com/sap/charging/server/api/v1/store/OptimizerSettings.java#L39

However, we can also change the objective to "peak shaving". Importantly, please note:

Having said that, the following is an example of "peak shaving" (spread the load) over the day. Note that the two EVs are not scheduled at the same time even though the fuse would support it.

{
    "event": {
        "eventType": "Reoptimize"
    },
    "state": {
        "fuseTree": {
            "rootFuse": {
                "@type": "Fuse",
                "id": 0,
                "fusePhase1": 96,
                "fusePhase2": 96,
                "fusePhase3": 96,
                "phase1Connected": true,
                "phase2Connected": true,
                "phase3Connected": true,
                "children": [
                    {
                        "@type": "ChargingStation",
                        "id": 1,
                        "fusePhase1": 32,
                        "fusePhase2": 32,
                        "fusePhase3": 32,
                        "phase1Connected": true,
                        "phase2Connected": true,
                        "phase3Connected": true
                    }, {
                        "@type": "ChargingStation",
                        "id": 2,
                        "fusePhase1": 32,
                        "fusePhase2": 32,
                        "fusePhase3": 32,
                        "phase1Connected": true,
                        "phase2Connected": true,
                        "phase3Connected": true
                    }
                ]
            }
        },
        "cars": [
            {
                "canLoadPhase1": 1,
                "canLoadPhase2": 1,
                "canLoadPhase3": 1,
                "id": 1,
                "carType": "BEV",
                "maxCapacity": 300,
                "minLoadingState": 0,
                "startCapacity": 30,
                "minCurrent": 18,
                "minCurrentPerPhase": 6,
                "maxCurrent": 96,
                "maxCurrentPerPhase": 32,
                "suspendable": true,
                "immediateStart": false,
                "canUseVariablePower": true,
                "chargingStarted": true,
                "name": "####",
                "timestampArrival": 0,
                "timestampDeparture": 50000
            },             {
                "canLoadPhase1": 1,
                "canLoadPhase2": 1,
                "canLoadPhase3": 1,
                "id": 2,
                "carType": "BEV",
                "maxCapacity": 300,
                "minLoadingState": 0,
                "startCapacity": 30,
                "minCurrent": 18,
                "minCurrentPerPhase": 6,
                "maxCurrent": 96,
                "maxCurrentPerPhase": 32,
                "suspendable": true,
                "immediateStart": false,
                "canUseVariablePower": true,
                "chargingStarted": true,
                "name": "####",
                "timestampArrival": 0,
                "timestampDeparture": 50000
            }
        ],
        "carAssignments": [
            {
                "carID": 1,
                "chargingStationID": 1
            },             {
                "carID": 2,
                "chargingStationID": 2
            }
        ],
        "currentTimeSeconds": 1
    },
    "optimizerSettings": {
        "weightObjectiveFairShare": 0,
        "weightObjectivePeakShaving": 1,
        "weightObjectiveEnergyCosts": 0,
        "weightObjectiveLoadImbalance": 0
    }
}

Response:

{
    "cars": [
        {
            "id": 1,
            "name": "####",
            "modelName": null,
            "carType": "BEV",
            "startCapacity": 30.0,
            "timestampArrival": 0,
            "timestampDeparture": 50000,
            "maxCapacity": 300.0,
            "minCurrent": 18.0,
            "minCurrentPerPhase": 6.0,
            "maxCurrent": 96.0,
            "maxCurrentPerPhase": 32.0,
            "suspendable": true,
            "canUseVariablePower": true,
            "immediateStart": false,
            "minLoadingState": 0.0,
            "canLoadPhase1": 1.0,
            "canLoadPhase2": 1.0,
            "canLoadPhase3": 1.0,
            "currentPlan": [
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                7.564967320261477,
                0.0,
                0.0,
                ....
            ],
            "chargingStarted": true,
            "chargedCapacity": 0.0
        },
        {
            "id": 2,
            "name": "####",
            "modelName": null,
            "carType": "BEV",
            "startCapacity": 30.0,
            "timestampArrival": 0,
            "timestampDeparture": 50000,
            "maxCapacity": 300.0,
            "minCurrent": 18.0,
            "minCurrentPerPhase": 6.0,
            "maxCurrent": 96.0,
            "maxCurrentPerPhase": 32.0,
            "suspendable": true,
            "canUseVariablePower": true,
            "immediateStart": false,
            "minLoadingState": 0.0,
            "canLoadPhase1": 1.0,
            "canLoadPhase2": 1.0,
            "canLoadPhase3": 1.0,
            "currentPlan": [
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                32.0,
                7.529411764705833,
                0.0,
                0.0,
                0.0,
                0.0,
                ...
            ],
            "chargingStarted": true,
            "chargedCapacity": 0.0
        }
    ]
}
LucasBrazi06 commented 1 year ago

@ofrendo Thanks a million for your comment and your example, very helpful!!! I will play with Peak Shaving then when Departure Time is active.

I though also about a workaround to stay in the Fair Share which is well tested:

LucasBrazi06 commented 1 year ago

It seems working :)

First response:

{
 "cars": [
  {
   "id": 1,
   "name": "CS-ABB-00001~1",
   "modelName": null,
   "carType": "BEV",
   "startCapacity": 543.4782608695652,
   "timestampArrival": 0,
   "timestampDeparture": 57746,
   "maxCapacity": 2173.913043478261,
   "minCurrent": 18,
   "minCurrentPerPhase": 6,
   "maxCurrent": 227.36700000000002,
   "maxCurrentPerPhase": 75.789,
   "suspendable": true,
   "canUseVariablePower": true,
   "immediateStart": false,
   "minLoadingState": 1847.8260869565217,
   "canLoadPhase1": 1,
   "canLoadPhase2": 1,
   "canLoadPhase3": 1,
   "currentPlan": [
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    75.789,
    71.4971370332476,
    0,
    0,
    0,
    ...
   ],
   "chargingStarted": false,
   "chargedCapacity": 0
  }
 ]
}

After lowering the Car's maxCurrent/maxCurrentPerPhase according its Departure Time and calling the Optimizer again, the peak is shaved:

'{
 "cars": [
  {
   "id": 1,
   "name": "CS-ABB-00001~1",
   "modelName": null,
   "carType": "BEV",
   "startCapacity": 543.4782608695652,
   "timestampArrival": 0,
   "timestampDeparture": 57746,
   "maxCapacity": 2173.913043478261,
   "minCurrent": 18,
   "minCurrentPerPhase": 6,
   "maxCurrent": 120,
   "maxCurrentPerPhase": 40,
   "suspendable": true,
   "canUseVariablePower": true,
   "immediateStart": false,
   "minLoadingState": 1847.8260869565217,
   "canLoadPhase1": 1,
   "canLoadPhase2": 1,
   "canLoadPhase3": 1,
   "currentPlan": [
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    40,
    6,
    0,
    0,
    0,
    ...
   ],
   "chargingStarted": false,
   "chargedCapacity": 0
  }
 ]
}
LucasBrazi06 commented 1 year ago

Let me know if it sounds good to you. In the meantime, I'll test it in production :-).

LucasBrazi06 commented 1 year ago

It worked in prod! We'll check now in a real customer's tenant with many DC chargers and vehicles. I'll also code the change of the algo per site area so we can test both strategies: fair share and peak shaving.

LucasBrazi06 commented 1 year ago

@ofrendo I want to give you feedbacks from the field, as you kindly answered me, that may help other users to deal with the same scenario.

Calling the Optimizer twice in Fair Share strategy by lowering the car's constraints in e-Mobility to do Peak Shaving worked:

Site Area settings: image

Settings above can be overridden by users or plannings on our side.

Without e-Mobility optimization (only Departure Time + Fair Share): The charging session took all the power at the beginning and ended charging before departure time: image

With e-Mobility optimization: The charging session took only the needed power up to the Departure Time: image

So it has the advantages of Fair Share + Peak Shaving and worked with multiple cars connected to the charger! There is still few adjustments to do like cutting the peak at the end of the session.

Thanks again for your support!!!

ofrendo commented 1 year ago

Looks good! Thank you for providing the examples, excellent to see 👍

gasparuff commented 2 months ago

Hello! Not sure if this is the right place to ask, but I see in @LucasBrazi06 screenshot all the possible settings for the smart charging. Unfortunately, in my installation it looks like this:

image

I only have the checkmark to enable the smart charging, which I enabled, but I dont get to see all the values like opimization strategy etc... what am I doing wrong?

Thanks for your help!

LucasBrazi06 commented 2 months ago

Hello! Not sure if this is the right place to ask, but I see in @LucasBrazi06 screenshot all the possible settings for the smart charging. Unfortunately, in my installation it looks like this:

image

I only have the checkmark to enable the smart charging, which I enabled, but I dont get to see all the values like opimization strategy etc... what am I doing wrong?

Thanks for your help!

You can get touch with me by email. Thanks.

gasparuff commented 2 months ago

I have sent you an email, thanks!

On Thu 15. Aug 2024 at 21:48, Serge FABIANO @.***> wrote:

Hello! Not sure if this is the right place to ask, but I see in @LucasBrazi06 https://github.com/LucasBrazi06 screenshot all the possible settings for the smart charging. Unfortunately, in my installation it looks like this:

[image: image] https://private-user-images.githubusercontent.com/5037298/358256159-ef4dec99-4ada-482f-9df6-1108b78b8bd2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3NTE1MzIsIm5iZiI6MTcyMzc1MTIzMiwicGF0aCI6Ii81MDM3Mjk4LzM1ODI1NjE1OS1lZjRkZWM5OS00YWRhLTQ4MmYtOWRmNi0xMTA4Yjc4YjhiZDIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTVUMTk0NzEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTEwNGI2MDZjZDY3ZDA5ZmQ2MDdjNjZjZTkwYzI5MDM0Y2VhYTIxOGM4ZmE5NjUxY2FiOTI5MGJhMmUyZTFlZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.BPV6skvxaqYEw-nvt1I-GBlFfS4YLzlvqK_TKBuBY6U

I only have the checkmark to enable the smart charging, which I enabled, but I dont get to see all the values like opimization strategy etc... what am I doing wrong?

Thanks for your help!

You can get touch with me by email. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/SAP/emobility-smart-charging/issues/59#issuecomment-2292074036, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGNZ4VJGPDQGS7B6XXN4PTZRUAY3AVCNFSM6AAAAABMSJ4JEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJSGA3TIMBTGY . You are receiving this because you commented.Message ID: @.***>