Using PyPSA with table input interface to produce series of least-cost energy systems with all firm technologies, removing the most valuable technology consecutively.
git clone https://github.com/carnegie/clab_all_firm --recursive
The setup described below uses conda for easy package management.
cd clab_all_firm
conda env create -f clab_pypsa/env.yaml
conda activate pypsa_table
Follow installation instructions to install Gurobi. Free licenses for academics are available.
If you already have Gurobi installed on your computer, you may find it useful to execute the following commands in the pypsa_table environment:
conda config --add channels https://conda.anaconda.org/gurobi
conda install gurobi
The data input files are stored in input_data
including the main excel file that defines the electricity network input_data/all_firm_case.xlsx
. It also contains wind and solar capacity factors and demand data for the contiguous United States as well as cost input data.
The script component_removal.py
runs the optimization, determines the most valuable technology and removes it from the system which is then reoptimized. This process continues until only wind and solar generators are in the system. The script is run in the pypsa_table environment with the following command:
python component_removal.py --order most --dont_remove_SW
where the options are:
-
--order most
: the order in which the components are removed, either most valuable or least valuable -
--dont_remove_SW
: if this option is not used, the script will also remove solar and wind generators from the system -
-c
: the name of the case file, default is_case
which runs the main case fileall_firm_case.xlsx
The outputs are stored in the output_data
directory in a subdirectory named accoring to the case.
The results are plotted with the interactive jupyter notebook plot_results.ipynb
. The notebook is run with the following command:
jupyter notebook plot_results.ipynb
and plots the results in the figures/
directory.