GMLC-1-4-2 / battery_interface

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

Validating results EVs against Regulation service #49

Closed afernandezcanosa closed 5 years ago

afernandezcanosa commented 5 years ago

@jingjingliu2018 I am trying to produce valid results of the EV class run against the regulation service (both traditional and dynamic). I am very close to have satisfying results by using the scaling we agreed in Friday's meeting.

As you provide your signals normalized between -1 and 1, I found that the correct scaling in this line:

https://github.com/GMLC-1-4-2/battery_interface/blob/a286babbc4423f4b2a072c805b6c4a516ce11ec8/src/services/reg_service/reg_service.py#L201

would be:

reqrespitems = [self.request(x, sim_step, i * self._fleet.assigned_service_kW()) for x,i in signals.items()] 

With this scaling, the results are consistent with the size of the fleet.

jingjingliu2018 commented 5 years ago

Hi Alejandro,

My codes currently plots request and response in MW values, which is why the assigned_service_kW is divided by 1000. I'm not sure I understand how it's causing inconsistent results.

Jingjing

On Mon, Feb 25, 2019 at 10:14 AM Alejandro Fernandez Canosa < notifications@github.com> wrote:

@jingjingliu2018 https://github.com/jingjingliu2018 I am trying to produce valid results of the EV class run against the regulation service (both traditional and dynamic). I am very close to have satisfying results by using the scaling we agreed in Friday's meeting.

As you provide your signals normalized between -1 and 1, I found that the correct scaling in this line:

https://github.com/GMLC-1-4-2/battery_interface/blob/a286babbc4423f4b2a072c805b6c4a516ce11ec8/src/services/reg_service/reg_service.py#L201

would be:

reqrespitems = [self.request(x, sim_step, i * self._fleet.assigned_service_kW()) for x,i in signals.items()]

With this scaling, the results are consistent with the size of the fleet.

— 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/49, or mute the thread https://github.com/notifications/unsubscribe-auth/AlzNqRfYKwvWM09nV7KN4aGuDNlArAY8ks5vRCV9gaJpZM4bQdMr .

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

@jingjingliu2018 Ok, I understand that your service uses MW values stored in the excel files to generate the request. However, the fleets process kW requests and the assigned_service_kW is a kW magnitude. Therefore, the requests need to be in kW to be consistent with the units that are passed to the fleet.

For example, this is the last example that I have run for Traditional Regulation against the EV fleet with the scaling that I show at the beginning.

image

This results are consistent with the results that I expected for EVs if we start the request at 4 pm. Does it make sense now?

Thank you!

emayhorn commented 5 years ago

I was just about to send a message to @jingjingliu2018 about this issue I also found when testing the EV/regulation integration. Great you are also doing the testing on your end @afernandezcanosa.

@jingjingliu2018 I just want to add clarification if possible. In line 201 of reg_service.py, you have divided the kW scaling factor sent from the device fleet by 1000, which means that a MW request value is actually being sent to the fleet (in line 210) instead of kW. As a result, the scaling is off. Since you would like to report results in MW, you should divide P_request and P_response by 1000 in the part of the code where you are generating plots and not inside the request loop.

afernandezcanosa commented 5 years ago

@emayhorn Yes, that is what I meant! Actually, the scaling works well for both Traditional and Dynamic. Also, makes a lot of sense to include a weight factor to have more control over the scaling. I find the solution that we agreed very convenient for integration purposes.

Attached here you will find results for dynamic regulation.

image

I am satisfied with these results and we can see some of the limitations of this fleet. Although more testing is required, we can have something to show in tomorrow's meeting!

emayhorn commented 5 years ago

@afernandezcanosa Great! The results look really good. To get those results, did you happen to make any further changes to your code that you have not yet uploaded? I am having a hard time duplicating those results on my end.

Also can you try to run an EV integration test with the reserve service?

emayhorn commented 5 years ago

@afernandezcanosa i'm only running 1 min simulations but it is clear that we are not getting the same result. 20190225_august_2secnormsignals_traditional_electricvehiclesfleet

afernandezcanosa commented 5 years ago

@emayhorn Yes, I made the following changes. In fleet factory, I have changed this: https://github.com/GMLC-1-4-2/battery_interface/blob/a286babbc4423f4b2a072c805b6c4a516ce11ec8/src/fleet_factory.py#L27-L28

By this, to be consistent with the time step and timestamp of the request.

# Time stamp to start the simulation
dt = 2  # time step (in seconds)
ts = datetime(2017, 8, 1, 16, 00, 00, 000000)

I still need to pass this as an input of the fleet_request method, but this solution works for testing.

Also, the integration test.py file to run the test is:

if service_name == 'Regulation':
    fleet_responses = service.request_loop(service_type='Dynamic',
                                           start_time=parser.parse('2017-08-02 16:00:00'),
                                           # end_time=parser.parse('2017-08-02 15:00:00'),
                                           end_time=parser.parse('2017-08-02 17:00:00'),
                                           clearing_price_filename='historical-ancillary-service-data-2017.xls',
                                           fleet_name = 'ElectricVehicle')

I'll try to find some time this afternoon to test the Reserve service, but I found some issues last week that I wasn't able to resolve.

emayhorn commented 5 years ago

@afernandezcanosa Thanks.

I am also running to an issue with this spinning reserve integration test. Are you getting the following error?

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

afernandezcanosa commented 5 years ago

Yes, that's the error that I get.

jingjingliu2018 commented 5 years ago

Hi Alejandro,

I realized it was not the place I intended to handle the conversion so I changed it. It's in the pull request now. Please let me know if it works this time once you had the chance to test.

Thanks, Jingjing

On Mon, Feb 25, 2019 at 10:46 AM Alejandro Fernandez Canosa < notifications@github.com> wrote:

@jingjingliu2018 https://github.com/jingjingliu2018 Ok, I understand that your service uses MW values stored in the excel files to generate the request. However, the fleets process kW requests and the assigned_service_kW is a kW magnitude. Therefore, the requests need to be in kW to be consistent with the units that are passed to the fleet.

For example, this is the last example that I have run for Traditional Regulation against the EV fleet with the scaling that I show at the beginning.

[image: image] https://user-images.githubusercontent.com/40611009/53360147-6476d680-38fa-11e9-9250-29e7e8d960dd.png

This results are consistent with the results that I expected for EVs if we start the request at 4 pm. Does it make sense now?

Thank you!

— 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/49#issuecomment-467131172, or mute the thread https://github.com/notifications/unsubscribe-auth/AlzNqQzGqKUclx1qJhgQC8SSoVoixy8vks5vRC9zgaJpZM4bQdMr .

-- 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/

emayhorn commented 5 years ago

@jingjingliu2018 It looks like you only made the change in reg_service. Can you also make the appropriate changes in reserve_service?

emayhorn commented 5 years ago

Yes, that's the error that I get. @afernandezcanosa Modifying line 224 of electric_vehicles_fleet to the following resolves this error.

    FleetResponse = self.simulate(fleet_request.P_req, fleet_request.Q_req, self.SOC, self.time, fleet_request.sim_step)
jingjingliu2018 commented 5 years ago

Thanks for the catch! I just corrected it. It should be in the same pull request now.

On Mon, Feb 25, 2019 at 3:37 PM emayhorn notifications@github.com wrote:

@jingjingliu2018 https://github.com/jingjingliu2018 It looks like you only made the change in reg_service. Can you also make the appropriate changes in reserve_service?

— 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/49#issuecomment-467229030, or mute the thread https://github.com/notifications/unsubscribe-auth/AlzNqUiqYBjFQ0w5f85_IU56TNjWPQdpks5vRHObgaJpZM4bQdMr .

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

Yes, that's the error that I get. @afernandezcanosa Modifying line 224 of electric_vehicles_fleet to the following resolves this error.

    FleetResponse = self.simulate(fleet_request.P_req, fleet_request.Q_req, self.SOC, self.time, fleet_request.sim_step)

@emayhorn I have just made this change and committed it to my last PR. This will resolve the issue that we had with the time steps.

emayhorn commented 5 years ago

@afernandezcanosa did you try to run it all the way through? I got errors in other places because dt and sim_step are of different variable types. dt is an int and sim_step is a time_delta object.

afernandezcanosa commented 5 years ago

@emayhorn I have just realized that there was an error as fleet_request.sim_step was a timedelta object while dt was an integer. See my latest commit to see how I have resolved it. Thanks!

afernandezcanosa commented 5 years ago

@DavidWiniarski-pnnl These are the results that I got some time ago. Please, let me know if this improves the results that you are getting. You probably have to assign self.montecarlo_reference = True for this particular grid service. It probably makes more sense here. https://github.com/GMLC-1-4-2/battery_interface/blob/b2bef631e14fe380ef461616accc450899c69ce2/src/fleets/electric_vehicles_fleet/electric_vehicles_fleet.py#L161

Thanks!