This project provides the code that translates outputs from the Integrated Planning Model (IPM) into inputs for the United State Environmental Protection Agency's (USEPA) computable general equilibrium (CGE) model, SAGE, to analyze the potential economy-wide impacts of power sector related regulations. The code is intended to be adaptable for different regulatory scenarios modeled in IPM, allowing users to generate corresponding SAGE inputs for those analyses.
This project uses the open-source software environment of R to facilitate public access and transparency under EPA's Science Integrity Policy. Since its initial development, the code has been enhanced to accommodate additional Regulatory Impact Analyses (RIAs) which rely on IPM v6 results for their analysis. Outputs from other versions of IPM may not be compatible with the build process.
See the "Quick Start Guide" for concise instructions explaining how to setup the data and run the code. More details can be found below, and in the ReadMe of each directory.
| Directory Name | Description |
|---|---|
build |
Data and code to preprocess raw IPM results |
documentation |
Variable definitions and explanation of input file for SAGE |
intermediates |
Intermediate data outputs |
output |
Results. SAGE input file and other outputs are stored here by default |
scripts |
Core scripts to generate SAGE input file |
utilities |
Library and function scripts that support the core scripts |
Note: Each directory contains a ReadMe.md file describing the contents of the directory.
To run the build process, set the working directory to the root directory of the project. The process has two parts: (1) preprocess the IPM results, and (2) generate the SAGE input file from the preprocessed data. For convenience, part (1) can be run separately from part (2) or from within the main control script in part (2). The following steps outline the process to generate the SAGE input file.
| Part | Script Name | Description |
|---|---|---|
| (1) | preprocess_big_xlsx_data.R |
Script to import and preprocess raw IPM results |
| (2) | 00_main.R |
Main control script to generate SAGE inputs from IPM results |
The IPM results directory must have a short name related to the RIA used in its analysis (e.g., "2025_mats_repeal_final") and be placed in the build/ipm directory before running the build process.
Preprocess the IPM results using script preprocess_big_xlsx_data.R. This script imports files from build/ipm/<RIA name> directory and saves the processed files to the build/data/<RIA name> directory. The script is designed to be run separately from the core scripts in the scripts directory.
Generate the SAGE inputs by running the main control script 00_main.R. This control script reads in the pre-processed Excel or R data files from the build/data/<RIA name> directory and generates the SAGE input file in the output/<RIA name> directory. The script can be run directly in an R environment or through RStudio. The control script sources other scripts in the scripts directory to perform specific tasks, such as cleaning data and aggregating IPM results to SAGE regions. The following table summarizes the key scripts used in the data generation process:
| Script Name | Description |
|---|---|
00_main.R |
Main control script to generate SAGE inputs from IPM results |
01_capacity_shares.R |
Script to calculate capacity shares by plant and fuel type |
02_compiling_ipm_output_data.R |
Script to compile fuel expense, total annual, transmission, and regional cost |
03_making_capital_charge_rate_table.R |
Script to create capital charge rate |
04_aggregating_ipm_output.R |
Script to aggregate costs by SAGE regions |
05_map_ipm_years_to_sage.R |
Script to map costs from IPM model years to SAGE model years |
06_create_real_resource_table_inputs.R |
Script to create real resource cost table |