What is the optimal mix of dispatchable net-zero generation technologies in Germany? This involves replacing traditional coal and natural gas plants with the following net-zero technologies:
- Gas-fired plants with Carbon Capture and Storage (CCS)
- Hydrogen-fired plants
The transition to a net-zero electricity system requires not only the deployment of renewable technologies like solar and wind but also reliable dispatchable generation to maintain grid stability. This project focuses on identifying the most effective dispatchable technologies to support this transition in Germany.
Data Loading (data_loader.py):
-
Loaded and cleaned data from CSV files. Used Pandas for efficient data manipulation. Best Practice: Modular code with proper use of .gitignore to untrack large data files. Model Definition (model.py):
-
Defined optimization model using PuLP (linear programming). Structured decision variables, constraints, and objective function. Best Practice: Clear naming conventions and modular model setup for future flexibility. Optimization Execution (task_analysis.py):
-
Used Pytask for task-based workflow to run the optimization and save results as .pickle files. Best Practice: Step-by-step execution with separation of concerns for maintainability. Testing (test_data_loader.py):
-
Implemented unit tests using pytest to validate data integrity and loading process. Best Practice: Verifying data consistency to ensure correctness before running optimization. Git Version Control:
-
Used .gitignore to manage untracked large data files. Best Practice: Committed relevant changes, avoided tracking unnecessary data files, and made incremental commits.
-
main.py script included in the root folder can be run as well in case of modular failure.
Final Output: Optimization results saved as pickle files for easy reloading and analysis.
- Created a plot task to generate and save final optimization results plots to the BLD directory.
Best Practice: Ensured reproducibility and result accessibility without re-running the optimization. Effective Practices: -Modular code: Each step is isolated and reusable. -Testing: Ensures data integrity before optimization. -Version control: Follows git best practices for clean project management. -This structure ensures the project is scalable, reproducible, and maintainable.
The project highlights the cost-effectiveness of renewable energy sources like wind and solar in reducing electricity generation costs and reliance on fossil fuels. The optimization model shows that investing in renewables lowers long-term operational costs, though some non-renewable capacity is needed for energy security. It recommends a balanced investment strategy to support a sustainable and economically efficient energy mix.
final-project-skhalid531/ │ ├── files_project/ # Core project directory containing analysis and data management scripts │ ├── analysis/ │ │ ├── model.py # Defines optimization model (using PuLP) │ │ ├── task_analysis.py # Task-based workflow for optimization execution and testing │ │ └── plot_analysis.py # For generating plots and saving final output visuals │ ├── data_management/ │ │ ├── data_loader.py # Data loading and cleaning script │ │ ├── prepare_combined_data.py # Data cleaning functions │ │ ├── process_average_fixed_cost.py # Cleaning fixed cost data │ │ ├── process_estimated_capacity.py # Cleaning existing capacity data │ │ └── process_variable_electricity_cost.py # Cleaning variable cost data │ ├── results/ │ │ └── optimization_results.pkl # Saves optimization results as pickle file │ └── data/ │ └── raw_data/ # Folder containing raw data files (Yearly_Load.xlsx, hourly_renewable_capacity.xlsx, etc.) │ ├── BLD/ # Build directory for final output and plots │ └── plots/ # Saves the final plots generated during analysis │ ├── tests/ # Directory for test scripts │ └── analysis/ │ └── test_model.py # Tests to validate optimization results │ └── data_management/ │ └── test_data_loader.py # Tests for data loading functionality │ ├── .gitignore # Defines files and folders to be ignored by Git ├── environment.yml # Environment configuration file for setting up project dependencies ├── LICENSE # Project license file ├── main.py # Main script to run the full pipeline in case of modular faliure. ├── pyproject.toml # Project metadata and configuration for Pytask ├── README.md # Project README file └── requirements.txt # List of required Python dependencies
The analysis involves a linear optimization model designed to assess:
- Investment decisions for net-zero technologies.
- Dispatch patterns of technologies under varying demand and renewable generation scenarios.
- Load-following capabilities of hydrogen-fired plants.
- Efficiency losses in CCS systems.
The model will use Linear Programming, which includes:
- linear objective function.
- Linear constraints.
- Continuous decision variables.
This optimization model will be implemented using open-source Python packages:
-OptiMagic (PuLP) Approach
We will Define variables: GENERATION, INVESTMENT Set constraints: Energy balance, generation limits, storage Minimize cost: Total Cost = Variable Cost + Fixed Cost
-Why Might pytask --force Need to Be Run Multiple Times? -Pytask executes tasks based on dependencies, meaning:
1️⃣ First run: Cleans and processes raw data. 2️⃣ Second run: Runs optimization and generates results. 3️⃣ Third run: Creates and validates plots.
Since some tasks depend on others, running pytask --force multiple times ensures that all required files are created before they are used in the next steps.
- It is to be noted that Yearly_Load.xlsx and hourly_renewable capacity were ENTSO-E ERRA directly, and the rest were assumtions which where taken from all the different sources mentioned and compiled .xlsx files.
- Formulas used: -Electricity Generation Cost = (O&m Cost +(Fuel Cost + Co2Price x Co2 Intensity)) / Efficiency -The Variable Generation Cost (EUR/(MW*a)) = (Investment/Annuity Factor) + Fixed O&M Cost.
- Source: ENTSO-E ERAA 2022 Downloads
- Source: ENTSO-E ERAA 2022 Downloads
Average Fixed Costs based on assumptions of:
- Investment Cost [EUR/MW]
- Fixed O&M Cost [EUR/(MW*a)]
- Economic Lifetime
- Interest Rate
- Annuity Factor
Sources:
