GMLC-1-4-2 / battery_interface

Implemenation of Device Models and their Battery Equivalent Interface
MIT License
5 stars 0 forks source link

Issues with the forecast method #82

Closed afernandezcanosa closed 5 years ago

afernandezcanosa commented 5 years ago

@emayhorn @Hayden-Reeve I am opening this thread to resolve the issues with the forecast method that the devices need to have implemented for certain grid services.

@raselmahmud02 I found a minor issue in your forecast method when I was trying to run it against the energy market service (I am helping @TomEdmunds and @can7huang with the API version of their service and we need the forecast method):

https://github.com/GMLC-1-4-2/battery_interface/blob/d4fc77448f0b3ee2c62b7f999e0a281548fb4bd5/src/fleets/PV/PV_Inverter_Fleet.py#L194-L197

The bug is that you are getting the variables: ts_req, sim_step, P_req from a list of objects instead of the object itself. This code snippet should solve the issue:

https://github.com/GMLC-1-4-2/battery_interface/blob/d4fc77448f0b3ee2c62b7f999e0a281548fb4bd5/src/fleets/electric_vehicles_fleet/electric_vehicles_fleet.py#L614-L621

At this time, I didn't find any other bug with the forecast for other devices. I will post them here if I found more. Some of the devices have the method included in their latest PR.

Thanks!

Hayden-Reeve commented 5 years ago

Thanks @afernandezcanosa

The test_unit.py has a basic forecast test that is consistent with this (see below). EV and Electrolyzer pass this. If we need to check for other features or make changes let me know.

https://github.com/GMLC-1-4-2/battery_interface/blob/8d38f8b53e3fb2a10be5e4316e3becf501058027/src/test_unit.py#L283-L313

afernandezcanosa commented 5 years ago

Thanks @Hayden-Reeve

In this unit test, are you only checking if the forecast method exists? In the case of PVs, it exists, but it breaks when you try to run it.

Apart from the EVs and Electrolyzers, I think that the rest of the fleets have the forecast method in their PRs. So, should be in the master branch soon.

Hayden-Reeve commented 5 years ago

@afernandezcanosa ,

It is specifically checking that the fleet returns a P_service value in the responses list that is not None for the first request and the last request. We could check other variables and indices in the request and response but I figured this is sufficient for now. It will fail for PV as it will crash when struggling to find ts and other parameters where it expects them in the structure. (PV is crashing for other reasons now that I need to investigate). I hope this helps.

raselmahmud02 commented 5 years ago

@afernandezcanosa ; @Hayden-Reeve forecast method updated