ShellRechargeSolutionsEU / docile-charge-point

Scriptable OCPP charge point simulator and test tool
GNU General Public License v3.0
82 stars 32 forks source link

How can I add reservation and meter reading #21

Open meran opened 3 years ago

meran commented 3 years ago

Hi, I am using the example scale form the repo named continuous-remote-listening.scala

I was wondering, how I can add meter reading (estimation cost ) and printing the output ? I also found that in order to perform reservation I can use:

val resNum= expectIncoming(reserveNowReq.respondingWith(ReserveNowRes(Reservation.Accepted)))(noTimeout)
var reID= resNum.reservationId

The problem is that I want my simulator to be able to perform charging or reservation without prior preparation. How can I achieve it?

Do you have any relevant examples for that ? Thanks

reinierl commented 3 years ago

Hi Meran,

Cool that you're using this tool :).

What do you mean exactly by "without prior preparation"?

I can imagine two things:

  1. Without knowing exactly what happens before or after the reservation comes in

For this use case, a "handlingIncomingMessages" function was added in pull request #19 which hasn't been merged unfortunately. You can use the fork of this repo at https://github.com/IHomer/docile-charge-point to have it. An example of its use is included there: https://github.com/IHomer/docile-charge-point/blob/master/examples/ocpp1x/handling-incoming-messages.scala

  1. Without the Central System requesting it from the simulator

This can only apply for charging; OCPP 1.6 doesn't allow a charge point to make a reservation by itself. To start charging without the Central System requesting it, you can use startTransaction().

meran commented 3 years ago

Thanks for the reply. I will try this fork and hopefully your suggestion will help.

What about meter reading ? is it possible to add it ?

reinierl commented 3 years ago

It is possible to send meter values using docile-charge-point. meterValues() sends some default placeholder stuff and you can tweak the meters argument to send whatever meter value you want.

Now the data structure of OCPP meter values is a bit counterintuitive unfortunately so it may be complicated at first. But it can be made to work if you study the source code. Are you using the autocomplete-template-project so you have IDE support?

If you could make a nice DSL for constructing these metervalues and contribute it to the project that would be uber awesome.