Breakthrough-Energy / PreREISE

Generate input data for scenario framework
https://breakthrough-energy.github.io/docs/
MIT License
20 stars 28 forks source link

feat: generate charging profiles for immediate charging HDV #302

Closed isond closed 1 year ago

isond commented 1 year ago

Pull Request doc

Purpose

What is the larger goal of this change? To add the Python translation of the immediate charging HDV code

What the code is doing

How is the purpose executed? Similar to the immediate charging code for LDVs and LDTs, it iterates through the HDV vehicle data and adjusts the charging profiles by applying weight factors. However, this code applies those factors after each vehicle rather than applying it at the end to the final charging profiles.

Testing

How did you test this change (unit/functional testing, manual testing, etc.)? Output from this code was compared against the MATLAB output.

Where to look

Usage Example/Visuals

How the code can be used and/or images of any graphs, tables or other visuals (not always applicable).

Time estimate

How long will it take for reviewers and observers to understand this code change? It can take a few days for the reviewers to go over the code change.

isond commented 1 year ago

I just want to point out that calculate_charging was refactored because there was an issue with grouping and indexing. Currently, it groups by Vehicle Number instead of trip number. In the current data, some vehicles have single trips that occur multiple times, but with the previous version of the function, it would group them all together and renumber them as if they were all consecutive trips.

Also, in the previous version, I think previous_group["sample vehicle number"].isin(relevant_vehicles) gets the unique values and so not all of the entries for the vehicles would get considered to update their start SOC. This would affect the indexing to put the new values back into the DataFrame.

I feel like there's a better way to go about the current function, but let me know what you think or if you need more clarification!