DOI: 10.5281/zenodo.15219958
title: Supporting data and code: Beyond Economic Dispatch: Modeling Renewable Purchase Agreements in Production Cost Models

description: This repository provides the necessary data and Python code to replicate the experiments and generate the figures presented in our manuscript: "Supporting data and code: Beyond Economic Dispatch: Modeling Renewable Purchase Agreements in Production Cost Models". 

Contents:



pownet.zip: Contains PowNet version 3.2, the specific version of the simulation software used in this study.

inputs.zip: Contains essential modeling inputs required by PowNet for the experiments, including network data, and pre-generated synthetic load and solar time series.

scripts.zip: Contains the Python scripts used for installing PowNet, optionally regenerating synthetic data, running simulation experiments, processing results, and generating figures.

thai_data.zip (Reference Only): Contains raw data related to the 2023 Thai power system. This data served as a reference during the creation of the PowNet inputs for this study but is not required to run the replication experiments themselves. Code to process the raw data is also provided.


System Requirements:



Python version 3.10+

pip package manager


Setup Instructions:





Download and Unzip Core Files: Download pownet.zip, inputs.zip, scripts.zip, and thai_data.zip. Extract their contents into the same parent folder. Your directory structure should look like this:







Parent_Folder/
├── pownet/        # from pownet.zip
├── inputs/        # from inputs.zip
├── scripts/       # from scripts.zip├── thai_data.zip/       # from scripts.zip
├── figures/       # Created by scripts later├── outputs/       # Created by scripts later








Install PowNet:



Open your terminal or command prompt.

Navigate into the pownet directory that you just extracted:




cd path/to/Parent_Folder/pownet

pip install -e .







These commands install PowNet and its required dependencies into your active Python environment.




Workflow and Usage:

Note: All subsequent Python script commands should be run from the scripts directory. Navigate to it first:







cd path/to/Parent_Folder/scripts




1. Generate Synthetic Time Series (Optional):



This step is optional as the required time series files are already provided within the inputs directory (extracted from inputs.zip). If you wish to regenerate them:

Run the generation scripts:







python create_synthetic_load.py
python create_synthetic_solar.py






Evaluate the generated time series (optional):







python eval_synthetic_load.py
python eval_synthetic_solar.py







2. Calculate Total Solar Availability:



Process solar scenarios using data from the inputs directory:







python process_scenario_solar.py







3. Experiment 1: Compare Strategies for Modeling Purchase Obligations:



Run the base case simulations for different modeling strategies:



No Must-Take (NoMT):







python run_basecase.py --model_name "TH23NMT"






Zero-Cost Renewables (ZCR):







python run_basecase.py --model_name "TH23ZC"






Penalized Curtailment (Proposed Method):







python run_basecase.py --model_name "TH23"








Run the base case simulation for the Minimum Capacity (MinCap) strategy: 







python run_min_cap.pyThis is a new script because we need to modify the objective function and add constraints.






4. Experiment 2: Simulate Partial-Firm Contract Switching:



Run simulations comparing the base case with the partial-firm contract scenario:



Base Case Scenario:



python run_scenarios.py --model_name "TH23"




Partial-Firm Contract Scenario:







python run_scenarios.py --model_name "TH23ESB"









5. Visualize Results:



Generate all figures presented in the manuscript:







python run_viz.py






Figures will typically be saved in afigures directory within the Parent_Folder.


 

To run sensitivity analysis code:



Extract and move Python scripts in "sensitivitiy_analysis_code.zip" to "scripts/" directory.

Run scripts to perform the sensitivity analysis



run_storage_sensitivity.py with your chosen set of storage parameters: charging & discharging efficiencies, and storage capacity factor

run_penalty_sensitivity.py with your choice of penalty factor (multipliers of the contract costs)



Visualize the results



viz_line_usage.py: visualize line congestion

viz_sensitivity.py: visualize model outputs

analyze_cycling_behavior.py: evaluate unintended storage cycling




To perform in-sample stability test:



Run validate_scenarios_gen.py for generation by fuel types

Run validate_scenarios_solar.py for solar curtailment