Download and install:
R (https://www.r-project.org/)
R studio (https://www.rstudio.com/)
For Linux users, install following libraries:
sudo apt install build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev sudo apt-get install libxml2-dev
install.packages('devtools') devtools::install_github('JGCRI/rgcam') devtools::install_github('JGCRI/plutus')
This example will give you a step-by-step instruction on using the core functionality of plutus
.
The default data and assumptions used in plutus
can be found in GCAM v5.3 (See Table 1). However, if any of those files listed in Table 1 have been updated in your GCAM run, it is necessary to use the updated values in plutus
as well. plutus
uses argument gcamdataFile
to specify the path to ALL of the updated files.
Table 1: Data and assumption files. "~\" represents the path to your GCAM v5.3 home folder.
| Data or Assumption | Technology | Region | Data File in GCAM v5.3|
|---|---|---|---|
| Overnight capital costs | Electricity generation technologies | Global | ~\input\gcamdata\outputs\L2233.GlobalIntTechCapital_elec.csv
~\input\gcamdata\outputs\L2233.GlobalTechCapital_elecPassthru.csv |
| Overnight capital costs | Cooling technologies | Global | ~\input\gcamdata\outputs\L2233.GlobalIntTechCapital_elec_cool.csv
~\input\gcamdata\outputs\L2233.GlobalTechCapital_elec_cool.csv |
| Capacity factors | Electricity generation technologies | Global | ~\input\gcamdata\outputs\L223.GlobalTechCapFac_elec.csv |
| Capacity factors | Intermittant technologies | Global | ~\input\gcamdata\outputs\L223.GlobalIntTechCapFac_elec.csv |
| Capacity factors | Intermittant technologies | Regional | ~\input\gcamdata\outputs\L223.StubTechCapFactor_elec.csv |
| Lifetime and steepness| Electricity generation technologies | Global | ~\input\gcamdata\inst\extdata\energy\A23.globaltech_retirement.csv |
Note: In this example, our GCAM sample dataset is based on the default data and assumptions, so we do not need to update those files in plutus
.
plutus::gcamInvest
to estimate stranded assets and electricity investmentsHere are the core arguments we used in this example:
gcamdatabase
: FULL path to the GCAM output XML database folder.reReadData
: If TRUE, plutus
will read the GCAM database and create a queryData.proj file under the output directory.scenOrigNames
: Choose scenarios to read in. Default = 'All' will read all the scenarios.regionsSelect
: Choose regions to read in. Defaul = NULL will read all the regions.saveData
: If TRUE, plutus
will save data by different aggregated classes.# Load required packages library(plutus) library(dplyr) # Set your directory based on the example dataset location workdir <- 'E:/plutus_example/' # provide path to the desired GCAM database folder that holds .basex files. path_to_gcamdatabase <- file.path(workdir, 'IDBNexus_gcam5p3_HadGEM2-ES_rcp8p5') # Specify the path to data file folder if any data files has been updated # path_to_gcamdataFile <- 'E:/plutus_example/gcamdataFile' # Use plutus::gcamInvest to calculate stranded assets and electricity investments invest <- plutus::gcamInvest(gcamdatabase = path_to_gcamdatabase, dataProjFile = file.path(workdir, 'outputs', 'dataProj.proj'), dirOutputs = file.path(workdir, 'outputs'), reReadData = T, # gcamdataFile = path_to_gcamdataFile, # Use this argument if any data files has been updated scenOrigNames = c('Reference'), regionsSelect = c('USA', 'China'), saveData = T)
library(plutus) library(dplyr) invest <- plutus::gcamInvest(gcamdatabase = NULL, dataProjFile = plutus::exampleGCAMproj, scenOrigNames = 'Reference', regionsSelect = c('USA', 'China'), saveData = F)
plutus::gcamInvest
returns a list containing:
data
: a dataframe with the post-processed GCAM output showing stranded assets and electricity investments (see Table 2) by scenario, region, technology, and time period dataAggParam
: a dataframe with the data aggregated to the parameterdataAggClass1
: a dataframe with the data aggregated to class 1dataAggclass2
: a dataframe with the data aggregated to class 2scenarios
: A list of the scenariosqueries
: A list of the queries used to extract the datadata
contains the most detailed information. Check the structure and content of data
and select the most relevant columns including scenario, region, param, class1 (= fuel types), x (= year), units, and value.
# Get dataframe with post-processed outputs for stranded assets and electricity investment df_invest <- invest$data # Check dataframe structure str(df_invest) # Select key variables df_invest_sub <- df_invest %>% dplyr::select(scenario, region, param, class1, x, units, value) %>% dplyr::rename(fuel = class1, year = x) head(df_invest_sub) # Check out 8 parameters unique(df_invest$param)
There are eight different parameters in the output showing stranded assets or electricity investments in terms of monetary value (Billion 2010 USD) or installed capacity (GW). The detailed descriptions are in Table 2. GCAM v5.3 is operated in five-years time step with 2015 as the final calibration year (base year). Annual value is the value calculated at each time step. Cumulative value represents the cumulative total over five-year time step.
Table 2: Descriptions of output parameters for stranded assets and electricity investments.
| Parameter | Description | Unit | |---|---|---| | elecNewCapCost | 5-year electricity capacity installations | Billion 2015 USD | | elecNewCapGW | 5-year electricity capacity installations | Gigawatts | | elecAnnualRetPrematureCost | 5-year premature retirements | Billion 2015 USD | | elecAnnualRetPrematureGW | 5-year premature retirements | Gigawatts | | elecCumCapCost | Cumulative electricity capacity installations | Billion 2015 USD | | elecCumCapGW | Cumulative electricity capacity installations | Gigawatts | | elecCumRetPrematureCost | Cumulative premature retirements | Billion 2015 USD | | elecCumRetPrematureGW | Cumulative premature retirements | Gigawatts |
**Note: the new electricity investment and stranded assets in the base year (2015) are set to 0.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.