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 Reserve service #54

Closed afernandezcanosa closed 5 years ago

afernandezcanosa commented 5 years ago

@jingjingliu2018 @emayhorn Yesterday and today, I have been testing the reserve service against the EV fleet and I found some issues that I'd like to talk with you:

If I assign Response_MeetReqOrMax_Index_number = 0, the service is successfully integrated with the fleet, but the results that are produced only include information of the request, but not the response.

I have just run one event that I found in March in the historical-spin-events.xls file by using the following code at the beginning of the test.py for integration:

        monthtimes = dict({
#            'January': ["2017-01-01 06:30:00", "2017-01-23 07:15:00"],
#            'February': ["2017-02-01 00:00:00", "2017-02-28 23:59:59"],
            'March': ["2017-03-23 06:45:00", "2017-03-23 07:15:00"],
            # 'April': ["2017-04-01 00:00:00", "2017-04-30 23:59:59"],
            # 'May': ["2017-05-01 00:00:00", "2017-05-31 23:59:59"],
            # 'June': ["2017-06-01 00:00:00", "2017-06-30 23:59:59"],
            # 'July': ["2017-07-01 00:00:00", "2017-07-31 23:59:59"],
            # 'August': ["2017-08-01 00:00:00", "2017-08-31 23:59:59"],
            # 'September': ["2017-09-01 00:00:00", "2017-09-30 23:59:59"],
            # 'October': ["2017-10-01 00:00:00", "2017-10-31 23:59:59"],
            # 'November': ["2017-11-01 00:00:00", "2017-11-30 23:59:59"],
            # 'December': ["2017-12-01 00:00:00", "2017-12-31 23:59:00"]
        }) 

According to the historical-spin-events.xls file, I think that the event that I am running is this one:

3/23/2017 6:48 3/23/2017 7:12 0:24:00 RTO

Am I missing something? Maybe I have to run the service for the whole year, but this will take around 87 hours of computing in the case of the EV fleet.

Thanks!

jingjingliu2018 commented 5 years ago

Hi Alejandro,

I'd like to introduce my colleague Robert (cc'd) to work with you on these issues. Robert is a major contributor to our codes, please expect him to contact you to solve these issues.

Thanks, Jingjing

On Tue, Feb 26, 2019 at 1:07 PM Alejandro Fernandez Canosa < notifications@github.com> wrote:

@jingjingliu2018 https://github.com/jingjingliu2018 @emayhorn https://github.com/emayhorn Yesterday and today, I have been testing the reserve service against the EV fleet and I found some issues that I'd like to talk with you:

TypeError: concat() got an unexpected keyword argument 'sort'

If I delete the sort argument, it runs without error, but I got a different error instead. Is it necessary to use this argument?

IndexError: index 0 is out of bounds for axis 0 with size 0

If I assign Response_MeetReqOrMax_Index_number = 0, the service is successfully integrated with the fleet, but the results that are produced only include information of the request, but not the response.

I have just run one event that I found in March in the historical-spin-events.xls file by using the following code at the beginning of the test.py for integration:

    monthtimes = dict({#            'January': ["2017-01-01 06:30:00", "2017-01-23 07:15:00"],#            'February': ["2017-02-01 00:00:00", "2017-02-28 23:59:59"],
        'March': ["2017-03-23 06:45:00", "2017-03-23 07:15:00"],
        # 'April': ["2017-04-01 00:00:00", "2017-04-30 23:59:59"],
        # 'May': ["2017-05-01 00:00:00", "2017-05-31 23:59:59"],
        # 'June': ["2017-06-01 00:00:00", "2017-06-30 23:59:59"],
        # 'July': ["2017-07-01 00:00:00", "2017-07-31 23:59:59"],
        # 'August': ["2017-08-01 00:00:00", "2017-08-31 23:59:59"],
        # 'September': ["2017-09-01 00:00:00", "2017-09-30 23:59:59"],
        # 'October': ["2017-10-01 00:00:00", "2017-10-31 23:59:59"],
        # 'November': ["2017-11-01 00:00:00", "2017-11-30 23:59:59"],
        # 'December': ["2017-12-01 00:00:00", "2017-12-31 23:59:00"]
    })

According to the historical-spin-events.xls file, I think that the event that I am running is this one: 3/23/2017 6:48 3/23/2017 7:12 0:24:00 RTO

Am I missing something? Maybe I have to run the service for the whole year, but this will take around 87 hours of computing in the case of the EV fleet.

Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMLC-1-4-2/battery_interface/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/AlzNqQYTSwfWp7cpFyZPj6zanRI1iScMks5vRaH7gaJpZM4bTHz- .

-- Jingjing Liu, P.E., CDCP, BEAP, CP EnMS – Industrial, SEP Performance Verifier – Industrial

Program Manager Building & Industrial Applications, Energy Technologies Area Lawrence Berkeley National Laboratory Phone: (510) 486-5410 Email: JingjingLiu@lbl.gov psheaffer@lbl.gov Web: https://industrialapplications.lbl.gov/

afernandezcanosa commented 5 years ago

Thanks for the introduction, @jingjingliu2018 @rhosbach Let me know if you know how can we solve those errors.

rhosbach commented 5 years ago

@afernandezcanosa:

The two issues you brought up I think can be easily explained: 1) The latest version of Pandas (0.24.1) allows for a "sort" keyword on pd.concat. Earlier versions (e.g., 0.22.0) do not. Please check what version of Pandas you're using. 2) I've looked into the index out-of-bounds issue and it would appear that it's an issue with the fleet. Essentially, the "event" dataframe has NaN values populating the Response column (this occurs for other events as well, if running the ElectricVehicle fleet). I tried to dig into the issue and it could be that the ElectricVehicle fleet does not have a self._fleet.assigned_service_kW() value assigned (please confirm if this is true). I think if that value is assigned, hopefully the data frame Response column will populate properly.

I'm happy to have a call with you today if you'd like. Just let me know. Robert

afernandezcanosa commented 5 years ago

@rhosbach Great! Thanks for your response.

  1. I have updated pandas to 0.24.1. Although some warnings appear now in the EV fleet, those are not critical and the Regulation service still works fine, but the Reserve service still doesn't work.
  2. The ElectricVehicle fleet has the fleet.assigned_service_kW() method in the latest PR, which is the one that I am testing for both Regulation and Reserve.

After upgrading pandas, a new error is raised by the read_and_store_historical_signals function of the historical_signal_helper.py file:

ValueError: Unknown string format in line 26: https://github.com/GMLC-1-4-2/battery_interface/blob/a286babbc4423f4b2a072c805b6c4a516ce11ec8/src/services/reserve_service/helpers/historical_signal_helper.py#L26

I'm confused because that error wasn't raised before upgrading pandas. What are your thoughts? Thanks!

emayhorn commented 5 years ago

@afernandezcanosa I also ran into this issue yesterday when I ran an EV / reserve test. However, I did not get this error when running the reserve service with the battery inverter. This leads me to believe that the sim_step variable type issue with the EV model has no been completely resolved.

rhosbach commented 5 years ago

Oh yes. I ran into that error as well. The fix is easy: Make the keyword "index_col" rather than "index" in the line (line 17): excel_data = pd.read_excel(input_data_file_path, ...)

This was one of the updates they made to read_excel method of Pandas. And that same fix will need to be made to the regulation service historical_signal_helper.py file as well.

afernandezcanosa commented 5 years ago

@rhosbach That solution works! But I am getting the same error in this line of the reserve_service.py:

Response_MeetReqOrMax_Index_number = event.loc[event.Response == Response_Max_MW, :].index[0]
IndexError: index 0 is out of bounds for axis 0 with size 0

It seems that the service is not computing the response properly for this fleet. It runs fine for the battery inverter fleet, but not for the EV fleet.

I'm wondering if there is any problem with the sim_step as pointed out by @emayhorn. I will check the differences with the battery_inverter_fleet to see if there is anything different in our class or something in the fleet_response.py class.

rhosbach commented 5 years ago

@afernandezcanosa That's correct, the index out of bounds error will still persist. As I mentioned in a previous comment, I can get the BatteryInverter and PV fleets to run through without bugs, but not the ElectricVehicle fleet. I'll point out again that when I tried to debug this, the fleet had no self._fleet.assigned_service_kW() value, which may be causing the bug.

afernandezcanosa commented 5 years ago

@rhosbach I have self._fleet.assigned_service_kW() in my last PR. Please, use that if you want to do integration tests. I am using that PR right now.

I think that the problem is that I need to include response.ts to be equal to fleet_request.ts_req inside my class. I tried with that and works fine. I just need to syncronize everything.

Thanks!

rhosbach commented 5 years ago

@afernandezcanosa Perfect! Good find!

afernandezcanosa commented 5 years ago

@emayhorn @rhosbach I have just run the EV fleet against the spinning reserve for three days in January with the bugs resolved and the results look fine.

For example, this event starts at 7:24 PM and the request is tracked well. image

However, if the event starts at 3:28 AM, when most of the EVs that can be controlled are fully charged, the event is just ignored, which makes sense. The EV fleet is highly constrained by the user's demands. image

The issue was the syncronization between the timestamps in the request/response instances. I will commit the changes in the code that I made later this afternoon.

rhosbach commented 5 years ago

Great job @afernandezcanosa! Thanks for sharing those results. I'm glad we (thanks to you) got those bugs sorted out!

jingjingliu2018 commented 5 years ago

Great! Thanks for sharing results.

On Wed, Feb 27, 2019, 2:12 PM Alejandro Fernandez Canosa < notifications@github.com> wrote:

@emayhorn https://github.com/emayhorn @rhosbach https://github.com/rhosbach I have just run the EV fleet against the spinning reserve for three days in January with the bugs resolved and the results look fine.

For example, this event starts at 7:24 PM and the request is tracked well. [image: image] https://user-images.githubusercontent.com/40611009/53526492-f83ad500-3aa9-11e9-87c4-b3fcebfe54c5.png

However, if the event starts at 3:28 AM, when most of the EVs that can be controlled are fully charged, the event is just ignored, which makes sense. The EV fleet is highly constrained by the user's demands. [image: image] https://user-images.githubusercontent.com/40611009/53526565-320bdb80-3aaa-11e9-90e1-b152c875df06.png

The issue was the syncronization between the timestamps in the request/response instances. I will commit the changes in the code that I made later this afternoon.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMLC-1-4-2/battery_interface/issues/54#issuecomment-468051749, or mute the thread https://github.com/notifications/unsubscribe-auth/AlzNqVoCp93HVP8cxrka_KFNbYy9bKMjks5vRwLQgaJpZM4bTHz- .