Conversation
|
I believe the tests are failing because not all required dependencies are being installed; I see the tests fail because they can't import |
|
I see several small CSV files that seems like they could be combined into a single module containing a few dicts/constants:
Storing the data this way would also allow comments discussing things like units, sources, etc. Do you think a refactor like this would be compatible with the calculation workflow? |
|
There are a few very large CSV files. Which of these are source data, and which can be calculated using the source data and the scripts in this PR? |
|
Yeah I can help - we'll need to add the packages in Pipfile, then run |
|
The Data folder should be rename data (lower case). That is a convention we have. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That would be nice. You can look at |
be0edd5 to
7bc25e5
Compare
I don't believe we need |
Which CSV files are you referring to? (Direct) Source data:
Source data pulled from a paper (so formatting can be changed easily):
Calculated using script in PR: -buses_NEEMregion.csv (this is created from a function using NEEM dir in this PR). It takes some hours to run (I didn't time it exactly). I have a backup function that uses the NEEM dir (and the mapping function) if any buses are excluded or don't match this csv file.
|
Yes, this is possible. |
|
|
||
| make_dir(outpath) | ||
|
|
||
| base_grid = Grid(['USA']) |
There was a problem hiding this comment.
should grid be a parameter of the function? In the future, the Gridclass could be instantiated withEurope`, who knows!
There was a problem hiding this comment.
For this method of calculating investment costs, we have regional multipliers that only exist for regions in the U.S. (the shapefile has NEEM regions). This whole thing would break for Europe, for sure.
Thanks, your list clears things up a bit. I think in general we want to avoid having unnecessary large data files in the repos, but it seems like most of the big ones are source data. Let's document the provenance of these as well, perhaps with README files in the appropriate subdirectories. |
98e0778 to
276f4cb
Compare
276f4cb to
8631000
Compare
|
Attribution is added, so I believe this is ready for any necessary final review. Two new features in the last week:
|
|
Are you done with cleaning the git commit history? |
We could always make it cleaner... but I think the vast majority of the commits now are either meaningful or hard-to-squash. |
Note: Not all tests are done.
This adds cost calculations for all new (added since base_grid) transmission, generation, and storage capacity.
create_mapping_files.pycontains functions that help create shapefiles and map lat/lon points to regions from shapefiles.investment_costs.pyuses these mappings to find the regional cost multipliers (for both generation/storage and ac transmission).Fundamental calculations
There are 3 separate cost calculations: one for dclines, one for branches, one for plants.
branches: calculate_ac_inv_costs
For all capacity added on a line, the investment cost is:
Cost ($2010) = rateA (MW) * lengthMi (miles) * costMWmi ($2010/MW-mi) * mult (regional cost multiplier, unitless)Then all lines are summed.
For all capacity added on a transformer, the investment cost is:
Cost (per transformer at a given kV level, $2010)Now that I'm thinking about this again, this is a flawed method because if we're only slightly scaling a transformer, this is overestimating the cost. Might be better to apply to completely new transformers only? Either ignore this cost or reevaluate its calculation.
dclines: calculate_dc_inv_costs
For all capacity added on a dcline, the investment cost is:
Cost ($2015) = Pmax (MW) * lengthMi (miles) * costMWmi ($2015/MW-mi) + dc_term_cost (DC terminal cost $2015)Then all line costs are summed.
plant: calculate_gen_inv_costs
For all capacity added on a plant, the investment cost is:
Cost ($2018) = Pmax (MW) * CAPEX ($2018/MW) * reg_cap_cost_mult (regional capital cost multiplier, unitless)Then all costs are summed by technology (so you can ignore the non-renewables/storage if you want).
Methods
branches: calculate_ac_inv_costs
grid.branch.rateA - base_grid.branch.rateAselect_kv. Labeled "kV_cost."select_kv. Labeled "kV_cost."Warning: Now that I think about this again, I bet the transformer costs are too high with this method. If we upgrade the rating just slightly, it's going to count this as an entirely new transformer. We could just drop this investment cost altogether, or just include on totally new transformers? Not sure.
dcline: calculate_dc_inv_costs
grid.dcline.Pmax - base_grid.dcline.Pmaxplant: calculate_gen_inv_costs
grid.plant.Pmax - base_grid.plant.PmaxWarning: there's a lot of messy code here right now because I'm manually dropping a lot of subtypes of technologies so we only have one type.
Mapping functions
sjoin_nearest: joins a geodataframe of Points and Polygons/Multipolygons. Used in
points_to_polys.points_to_polys: joins a dataframe (which includes lat and lon columns) with a shapefile. Used in
bus_to_neem_regandplant_to_reeds_reg.Functions used for AC regional multiplier mapping
bus_to_neem_reg: maps bus locations to NEEM regions. Used in
write_bus_neem_mapand (if there are errors in the mapping file produced inwrite_bus_neem_map), this function is also used in_calculate_ac_inv_costs.write_bus_neem_map: maps all base_grid bus locations to NEEM regions and produces a csv mapping file: regionsNEEM.shp. This csv is used in
_calculate_ac_inv_costs.Functions used for generation/storage regional multiplier mapping
write_poly_shapefile: Using a csv with specified geometry, creates the shapefile for ReEDS wind resource regions: rs.shp. This shp is used in
plant_to_reeds_reg.plant_to_reeds_reg: maps plant locations to ReEDS regions. Used in
_calculate_gen_inv_costs.Sources (more specifics to follow in README)
branches: calculate_ac_inv_costs
branches: calculate_dc_inv_costs
plant: calculate_gen_inv_costs
To do:
requirements.txt not necessarily correct -- will need to fix pipfile.
Untested on storage scenarios.
Write tests for calculate_gen_inv_costs.
$Dollar-years are inconsistent. Need a function to convert to inflate to proper year.
If we want to have financial information other than the default ATB values, a separate financials module will be useful for CAPEX/other calculations.
Figure out issue with transformers described above.
Find correct wind and solar classes (based on wind speed, irradience) to map to ATB costs and ReEDS regional cost multipliers.
check that not using costs for underground lines.