Closed danielolsen closed 3 years ago
I moved the calculation of average fuel cost by bus into its own separate function, since it will be required for https://github.com/Breakthrough-Energy/SwitchWrapper/issues/1. Manual testing on the mvp_empty_dataframe
branch confirms that everything still works as expected:
>>> from switchwrapper.grid_to_switch import grid_to_switch
>>> from powersimdata import Grid
>>> grid = Grid("Western")
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
>>> grid_to_switch(grid, "output3")
Please enter base study year (normally PowerSimData scenario year): 2030
Please enter the number of investment stages: 1
Single stage expansion identified.
Please enter investment period year, separate by space: 2030
Please enter start year for each period, separate by space: 2030
Please enter end year for each period, separate by space: 2030
>>>
@YifanLi86 there is one thing that makes the code in the current state of the PR not robust to non-Western grids: we don't have a translation from our dfo
and other
types to Switch fuels. I think we can still merge this in and get started on testing for Western grids, but we will need to come up with mappings before we can successfully run on Eastern grids.
Purpose
Create data frame to populate the gen_build_costs.csv file. Closes #6.
What is the code doing
get_base_year
andget_inv_periods
to return an int, and a list of ints, respectively. This doesn't change the files that these files were created to output, since writing a string of a number and writing a number are equivalent via pandas. This does however come in handy for the fuel costs, for which we need to calculate fuel costs in future years based on elapsed times.build_fuel_cost
, with a fix to ensure we're multiplying costs by(1 + r)^num_years
, rather than(r)^num_years
.Testing
Manual, based on the
mvp_empty_dataframe
branch. For one year:For multiple years:
Output files are as expected.
Time to review
15-30 minutes. There's nothing too fancy in here, but we do have a few interesting pandas dataframe method calls.