tandemdrive / ocpi-tariffs

OCPI tariff calculations
Apache License 2.0
38 stars 9 forks source link

Min/max power restrictions ignored #77

Open ptkio opened 1 month ago

ptkio commented 1 month ago

Hi,

I tried the online demo and noticed an issue with the min_power and max_power restrictions. When we attempt to add a restriction using min/max power, the restriction is either ignored or incorrectly validated.

Using the default example with your tools, you can test this with the pricing elements: (I’m using a large value for demonstration purposes)

"elements": [
    {
      "price_components": [
        {
          "type": "ENERGY",
          "price": 0.5,
          "vat": 10.0,
          "step_size": 1
        }
      ],
      "restrictions": {
        "min_power": 32000.00
      }
    },
    {
      "price_components": [
        {
          "type": "ENERGY",
          "price": 0.25,
          "vat": 10.0,
          "step_size": 1
        }
      ]
    }
  ],

Thanks for this nice tool! :)

remkop22 commented 1 month ago

Hi @ptkio,

Thanks for checking out the tool.

Could you show me which CDR you are using to test this?

ptkio commented 1 month ago

Yes, I’m using the default CDR :

{
  "country_code": "BE",
  "party_id": "BEC",
  "id": "12345",
  "start_date_time": "2015-06-29T21:39:09Z",
  "end_date_time": "2015-06-29T23:37:32Z",
  "cdr_token": {
    "uid": "012345678",
    "type": "RFID",
    "contract_id": "DE8ACC12E46L89"
  },
  "auth_method": "WHITELIST",
  "cdr_location": {
    "id": "LOC1",
    "name": "Gent Zuid",
    "address": "F.Rooseveltlaan 3A",
    "city": "Gent",
    "postal_code": "9000",
    "country": "BEL",
    "coordinates": {
      "latitude": "3.729944",
      "longitude": "51.047599"
    },
    "evse_uid": "3256",
    "evse_id": "BE*BEC*E041503003",
    "connector_id": "1",
    "connector_standard": "IEC_62196_T2",
    "connector_format": "SOCKET",
    "connector_power_type": "AC_1_PHASE"
  },
  "currency": "EUR",
  "tariffs": [],
  "charging_periods": [
    {
      "start_date_time": "2015-06-29T21:39:09Z",
      "dimensions": [
        {
          "type": "TIME",
          "volume": 1.973
        },
        {
          "type": "ENERGY",
          "volume": 15.342
        }
      ],
      "tariff_id": "12"
    }
  ],
  "total_cost": {
    "excl_vat": 4.00,
    "incl_vat": 4.40
  },
  "total_energy": 15.342,
  "total_time": 1.973,
  "total_time_cost": {
    "excl_vat": 4.00,
    "incl_vat": 4.40
  },
  "last_updated": "2015-06-29T22:01:13Z"
}