Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Reserve service #54

Closed
afernandezcanosa opened this issue Feb 26, 2019 · 13 comments
Closed

Issues with Reserve service #54

afernandezcanosa opened this issue Feb 26, 2019 · 13 comments

Comments

@afernandezcanosa
Copy link
Collaborator

@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:

  • Running these lines:
    all_results = pd.concat([all_results, fleet_response[0]], sort=True)
    annual_signals = pd.concat([annual_signals, fleet_response[1]], sort=True)

    I got this error:
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!

@afernandezcanosa afernandezcanosa changed the title Issues with Reserve service bug: Issues with Reserve service Feb 26, 2019
@afernandezcanosa afernandezcanosa changed the title bug: Issues with Reserve service bug Issues with Reserve service Feb 26, 2019
@afernandezcanosa afernandezcanosa changed the title bug Issues with Reserve service Issues with Reserve service Feb 26, 2019
@afernandezcanosa afernandezcanosa changed the title Issues with Reserve service label:bug Issues with Reserve service Feb 26, 2019
@afernandezcanosa afernandezcanosa changed the title label:bug Issues with Reserve service Issues with Reserve service Feb 26, 2019
@jingjingliu2018
Copy link
Collaborator

jingjingliu2018 commented Feb 27, 2019 via email

@afernandezcanosa
Copy link
Collaborator Author

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

@rhosbach
Copy link
Collaborator

@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
Copy link
Collaborator Author

@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:

excel_data.columns = pd.to_datetime(excel_data.columns)

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

@emayhorn
Copy link
Contributor

@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
Copy link
Collaborator

rhosbach commented Feb 27, 2019

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
Copy link
Collaborator Author

@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
Copy link
Collaborator

@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
Copy link
Collaborator Author

@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
Copy link
Collaborator

@afernandezcanosa Perfect! Good find!

@afernandezcanosa
Copy link
Collaborator Author

@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
Copy link
Collaborator

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

@jingjingliu2018
Copy link
Collaborator

jingjingliu2018 commented Feb 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants