diff --git a/Easy_IMPLAN.r b/Easy_IMPLAN.r new file mode 100644 index 0000000..d1d749f --- /dev/null +++ b/Easy_IMPLAN.r @@ -0,0 +1,62 @@ +library(tidyverse) +#R script to quickly find IMPLAN inputs or adjustment factors +GET_INPUTS_GAS <- function(YEAR){ + FILES <- list.files("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run") + FILE <- paste0("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run/",FILES[grep(paste0("-",YEAR),FILES)]) + #Dollar value added to the RNG in addition to the main production + RNG_ADD_YEARS <- c(0,380102,3097001,5943721,11224037,18050255,18050255) + RNG_ADD <- RNG_ADD_YEARS[YEAR-2023] + DF <- read_csv(FILE) %>% filter(ImpactType=="Direct",EventName=="Gas Production (Campbell)") + DF <- DF %>% mutate(IntermediateInputs=Output-EmployeeCompensation-ProprietorIncome-OtherPropertyIncome-TaxesOnProductionAndImports)%>% select(WageAndSalaryEmployment,EmployeeCompensation,Output,ProprietorEmployment,OtherPropertyIncome,Employment,IntermediateInputs)%>% mutate(Output=Output+RNG_ADD) + return(DF) +} +#Find the input values for the beet factories +GET_INPUTS_BEET <- function(YEAR,OP_COST=75){ + MAX_WASH_EMP <- 8 + MAX_GOSHEN_EMP <-15 + GOSHEN_WAGE <- 53007.10 + WASH_WAGE <- 71017.25 + + WASH_PROD <- c(0,0,0,35000,37500,50000,50000) + GOSHEN_PROD <- c(0,0,0,52500,112500,150000,150000) + + GOSHEN_OP_COST <- OP_COST*GOSHEN_PROD + WASH_OP_COST <- OP_COST*WASH_PROD + + GOSHEN_TAX_CRED <- GOSHEN_PROD*0.62*90 + WASH_TAX_CRED <- WASH_PROD*0.62*90 + + WASH_EMP <- MAX_WASH_EMP*(WASH_PROD)/max(WASH_PROD) + GOSHEN_EMP <- MAX_GOSHEN_EMP*(GOSHEN_PROD)/max(GOSHEN_PROD) + TOPI <- GOSHEN_EMP*0 + OTH_PROP <- GOSHEN_EMP*0 + + GOSHEN_COMP <- GOSHEN_WAGE*GOSHEN_EMP + WASH_COMP <- WASH_WAGE*WASH_EMP + + WASH_RETURN <- WASH_TAX_CRED-WASH_COMP-WASH_OP_COST + GOSHEN_RETURN <- GOSHEN_TAX_CRED-GOSHEN_COMP-GOSHEN_OP_COST + RES <- rbind(as.numeric(cbind(WASH_EMP,WASH_COMP,WASH_RETURN,TOPI,OTH_PROP,WASH_OP_COST)[YEAR-2023,]),as.numeric(cbind(GOSHEN_EMP,GOSHEN_COMP,GOSHEN_RETURN,TOPI,OTH_PROP,GOSHEN_OP_COST)[YEAR-2023,])) %>% as_tibble + colnames(RES) <- c("Wage_Emp","Compensation","Proprietor_Income","TOPI","OTHER_PROP","Inter_Inputs") + RES$County <- c("Washakie","Goshen") + RES <- RES %>% select(County,everything()) + + return(RES) +} + +4415*c(0.19,0.06) + +#Pull the truck and rail transportation induced, to remove it from IMPLAN results. Those costs are explicitly modeled. +GET_ADJ <- function(YEAR){ + FILES <- list.files("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run/") + FILE <- paste0("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run/",FILES[grep(paste0("-",YEAR),FILES)]) + DF <- read_csv(FILE) %>% filter(ImpactType=="Direct",IndustryCode %in% c(397,399),TagName=="beet purchase") + + DF$County <- gsub(" County, WY \\(2023\\)","",DF$DestinationRegion ) + DF <- DF %>% select(County, Industry=IndustryDescription,Output) %>% mutate(Output=-Output) + return(DF) +} + +GET_INPUTS_GAS(2028) +GET_INPUTS_BEET(2029,10) +GET_ADJ(2027) \ No newline at end of file diff --git a/Model_Timeline.ods b/Model_Timeline.ods index 90f0a4e..5b84d67 100644 Binary files a/Model_Timeline.ods and b/Model_Timeline.ods differ diff --git a/R_IMPLAN_Model.R b/R_IMPLAN_Model.R new file mode 100644 index 0000000..8c92eec --- /dev/null +++ b/R_IMPLAN_Model.R @@ -0,0 +1,142 @@ +#To Do + #Adjust to remove transportation cost + #Adjust to remove taxes on intermediate SBS production + + +##Inputs +COST_TO_BUILD_SKID <- 300000 +SKID_OP_COST <- 30000 +SKID_CONSTRUCTION_COST_RATIO <- 0.33 +SKID_EQUIP_COST_RATIO <- 1-0.33 +FACILITY_OP_EX <- 75 #$ per SBS produced +SBS_PURCHASE_PRICE <- 225 #$ per SBS produced (or molasses) +BEET_PURCHASE_PRICE <- 100 #$ per for the input price of beets that produce 1 ton of SBS +FACILITY_OP_COST <- 75 #$ per SBS produced +MTU_CARBON_PER_TON_BEET <- 0.62 #MTU carbon per ton of SBS injected +CARBON_TAX_CREDIT_PRICE <- 90 # $ per MTU of carbon +VCM_PRICE <- 70 # $ per MTU of carbon sold on the market +RNG_BONUS <- 15 #$/MMBTU +NG_PRICE <- 3 # $/MMBTU +MAX_WASH_EMP <- 8 #Total number of employees at the Washakie facility +MAX_GOSHEN_EMP <-15 #Total number of employees at the Goshen facility +RAIL_COST <- 0.054162 #Cost in ton miles of train freight. (inflation adjusted from https://www.bts.gov/content/average-freight-revenue-ton-mile) +TRUCK_COST <- 0.29028 #Cost in ton miles of truck freight. (inflation adjusted from https://www.bts.gov/content/average-freight-revenue-ton-mile) + WASHAKIE_TO_CAMPBELL <- 160 #Miles from Washakie SBS facility (and Wyoming Sugar) to Campbell skids + GOSHEN_TO_CAMPBELL <- 205 #Miles from Goshen SBS facility to Campbell skids + WESTON_TO_CAMPBELL <- 60 #Distance from the train depot for out of state beets in Upton, to the Campbell skids + OUT_STATE_TO_WESTON <- 400 #Avg distance from out of state beet suppliers and the Upton train depot. +#IMPLAN Inputs +GOSHEN_WAGE <- 53007.10 #Average wage at the Goshen facility (taken from regional IMPLAN data) +WASH_WAGE <- 71017.25 #Average wage at the Washakie facility (taken from regional IMPLAN data) +PER_BEET_SPENDING <- 0.6832346 #The percentage of expenses associated with buying beets when operating a beet processing facility. + +#Time Series Inputs + Year <- 2024:2030 + #Gas production non-renewable and renewable natural gas + GAS_PROD <- 1015*c(0,143500,124650,108277,94325,87253,87253) + RNG_PROD <- 1015*c(0,24436,199100,382110,721571,1160415,1160415) + #Capital investment in beet processing facilities + BEET_CAP_WASHAKIE <- c(0,0,2500000,2500000,0,0,0) + BEET_CAP_GOSHEN <- c(0,0,0,7500000,7500000,0,0) + #Beet purchases + TOTAL_SBS <- c(3000,10000,100000,175000,200000,240000,240000) #Total tons of SBS purchased or produced + WYOMING_SUGAR_PURCHASES <- c(3000,3000,43000,10000,10000,10000,10000) #Amount of SBS (or molasses) purchased from Wyoming Sugar LLC + PRODUCED_SGS <- c(0,0,0,87500,150000,200000,200000) #Amount of SBS produced by all CCF owned processing facilities + #Skids + CONSTRUCTED_SKIDS <- c(1,4,10,10,5,0,0) #Number of skids built in a given year + +######################Natural Gas +GAS_VALUE <- (RNG_PROD+GAS_PROD)*NG_PRICE +RNG_ADD_VALUE <- RNG_PROD*RNG_BONUS +GAS_TOTAL_VALUE <- GAS_VALUE+RNG_ADD_VALUE +#########################Beet Facility +#Find the percentage of total capital expenses for use in production allocation. +BEET_TOTAL_CAP_WASHAKIE <- c() +BEET_TOTAL_CAP_GOSHEN <- c() +for(i in 1:length(BEET_CAP_GOSHEN)){ + BEET_TOTAL_CAP_WASHAKIE[i] <- sum(BEET_CAP_WASHAKIE[1:i]) + BEET_TOTAL_CAP_GOSHEN[i] <- sum(BEET_CAP_GOSHEN[1:i]) +} +BEET_TOTAL_CAP <- BEET_TOTAL_CAP_WASHAKIE+BEET_TOTAL_CAP_GOSHEN +PROD_PER_WASHAKIE <- BEET_TOTAL_CAP_WASHAKIE/ifelse(BEET_TOTAL_CAP==0,1,BEET_TOTAL_CAP) +PROD_PER_GOSHEN <- BEET_TOTAL_CAP_GOSHEN/ifelse(BEET_TOTAL_CAP==0,1,BEET_TOTAL_CAP) + +#########################Beet Production +PROD_GOSHEN <- PRODUCED_SGS*PROD_PER_GOSHEN +PROD_WASHAKIE <- PRODUCED_SGS*PROD_PER_WASHAKIE + +VALUE_SGS_PRODUCED_GOSHEN <- PROD_GOSHEN*SBS_PURCHASE_PRICE +VALUE_SGS_PRODUCED_WASHAKIE <- PROD_GOSHEN*PROD_WASHAKIE + +OP_COST_GOSHEN <- PROD_GOSHEN*(FACILITY_OP_EX+BEET_PURCHASE_PRICE) +OP_COST_WASHAKIE <- PROD_WASHAKIE*(FACILITY_OP_EX+BEET_PURCHASE_PRICE) + + + +#Assume employment scales with production +WASH_EMP <- MAX_WASH_EMP*(PROD_WASHAKIE)/max(PROD_WASHAKIE) +GOSHEN_EMP <- MAX_GOSHEN_EMP*(PROD_GOSHEN)/max(PROD_GOSHEN) +#Total Compensation to employees +GOSHEN_COMP <- GOSHEN_WAGE*GOSHEN_EMP +WASH_COMP <- WASH_WAGE*WASH_EMP +#########################SBS Purchases +SBS_LOCAL_COST <- SBS_PURCHASE_PRICE*WYOMING_SUGAR_PURCHASES +SBS_NATIONAL_COST <- SBS_PURCHASE_PRICE*(TOTAL_SBS-WYOMING_SUGAR_PURCHASES-PRODUCED_SGS) +#########################Beet Purchases +GOSHEN_BEET_PURCHASE <- PROD_GOSHEN*BEET_PURCHASE_PRICE +WASHAKIE_BEET_PURCHASE <- PROD_WASHAKIE*BEET_PURCHASE_PRICE +#########################Skids +SKID_TOTAL_CONST_COST <- COST_TO_BUILD_SKID*CONSTRUCTED_SKIDS +SKID_EQUIP_COST <- SKID_TOTAL_CONST_COST*SKID_EQUIP_COST_RATIO #Cost of building the skid associated with equipment. +SKID_BUILD_COST <- SKID_TOTAL_CONST_COST*SKID_CONSTRUCTION_COST_RATIO #Cost of building the skid associated with general building costs. + +NUM_SKIDS <- 0 +ACTIVE_SKIDS <- c() +for(i in 1:length(CONSTRUCTED_SKIDS)){ + ACTIVE_SKIDS[i] <- NUM_SKIDS + NUM_SKIDS <- NUM_SKIDS+CONSTRUCTED_SKIDS[i] +} +SKID_MAINT_COST <- ACTIVE_SKIDS*SKID_OP_COST #Cost to upkeep the active skids +#########################Transportation Costs +FROM_GOSHEN_COST <- TRUCK_COST*PROD_GOSHEN*GOSHEN_TO_CAMPBELL #Cost to ship SBS from Goshen processing facility to the final site. +FROM_WASHAKIE_COST <- TRUCK_COST*(PROD_WASHAKIE+WYOMING_SUGAR_PURCHASES)*WASHAKIE_TO_CAMPBELL #Cost to ship SBS from Wyoming sugar and the Washakie processing facility to the final site. +FROM_WESTON_COST <- TRUCK_COST*WESTON_TO_CAMPBELL*(TOTAL_SBS-WYOMING_SUGAR_PURCHASES-PRODUCED_SGS) #Cost to ship out of state SGS from the Weston rail depot to the skids. +OUT_STATE_SHIPPING_COST <- RAIL_COST*OUT_STATE_TO_WESTON*(TOTAL_SBS-WYOMING_SUGAR_PURCHASES-PRODUCED_SGS) #Cost to ship the out of state SGS to the rail depot in Weston (Upton,WY) +###############Tax Credit and voluntary Carbon Market +CARBON_ABATEMENT <- TOTAL_SBS*MTU_CARBON_PER_TON_BEET +#Shift by one year, so credits are acquired after one year of injection +CARBON_ABATEMENT_SHIFT <- c(0,CARBON_ABATEMENT[-length(CARBON_ABATEMENT)]) +CARBON_TAX <- CARBON_ABATEMENT_SHIFT*CARBON_TAX_CREDIT_PRICE +VCM_CREDIT <- VCM_PRICE*CARBON_ABATEMENT +##################Adjustments + #Negative commodity output shock to remove the beet spending from the facility (since it is modeled separately) + BEET_REMOVAL_COEF_GOSHEN <- -PER_BEET_SPENDING*OP_COST_GOSHEN + BEET_REMOVAL_COEF_WASHAKIE <- -PER_BEET_SPENDING*OP_COST_WASHAKIE + #Negative transportation adjustments since direct transportation costs are modeled separately. + GET_ADJ <- function(YEAR){ + FILES <- list.files("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run/") + FILE <- paste0("./Raw_Output/Detailed_Economic_Indicators/Prelim-Run/",FILES[grep(paste0("-",YEAR),FILES)]) + DF <- read_csv(FILE) %>% filter(ImpactType=="Direct",IndustryCode %in% c(397,399),TagName=="beet purchase") + + DF$County <- gsub(" County, WY \\(2023\\)","",DF$DestinationRegion ) + DF$Year <- YEAR + DF <- DF %>% select(Year, County, Industry=IndustryDescription,Output) %>% mutate(Output=-Output) + return(DF) + } + YEARS_TO_PROC <- Year[c(-1,-7)] + for(i in YEARS_TO_PROC){ + if(!exists("ADJUST_COSTS")){ADJUST_COSTS <- GET_ADJ(i)} else{ADJUST_COSTS <- rbind(ADJUST_COSTS,GET_ADJ(i))} + } +WASHAKIE_TRUCK_ADJ <- rbind(ADJUST_COSTS %>% filter(County=="Washakie"),c(2024,"Washakie","Truck transportation",0),c(2030,"Weston","Rail transportation",0)) %>% unique %>% arrange(Year) %>% pull(Output) +WESTON_RAIL_ADJ <- rbind(ADJUST_COSTS %>% filter(County=="Weston",Industry=="Rail transportation"),c(2024,"Weston","Rail transportation",0),c(2030,"Weston","Rail transportation",0))%>% unique %>% arrange(Year) %>% pull(Output) +WESTON_TRUCK_ADJ <- rbind(ADJUST_COSTS %>% filter(County=="Weston",Industry=="Truck transportation"),c(2024,"Weston","Truck transportation",0),c(2030,"Weston","Rail transportation",0))%>% unique %>% arrange(Year) %>% pull(Output) + +DATA <- cbind(Year,CARBON_TAX,VCM_CREDIT,GAS_VALUE,RNG_ADD_VALUE, + SBS_LOCAL_COST,SBS_NATIONAL_COST,GOSHEN_BEET_PURCHASE,WASHAKIE_BEET_PURCHASE, + SKID_EQUIP_COST,SKID_BUILD_COST,SKID_MAINT_COST, + BEET_CAP_WASHAKIE,BEET_TOTAL_CAP_GOSHEN,OP_COST_WASHAKIE,OP_COST_GOSHEN,WASH_EMP,GOSHEN_EMP,WASH_COMP,GOSHEN_COMP,PROD_WASHAKIE,PROD_GOSHEN, + FROM_GOSHEN_COST,FROM_WASHAKIE_COST,FROM_WESTON_COST,OUT_STATE_SHIPPING_COST, + WASHAKIE_TRUCK_ADJ,WESTON_RAIL_ADJ,WESTON_TRUCK_ADJ,BEET_REMOVAL_COEF_GOSHEN,BEET_REMOVAL_COEF_WASHAKIE ) %>% as_tibble + + +