Fixed some data
This commit is contained in:
parent
b816c060f3
commit
2d2de480df
27
Analysis.r
27
Analysis.r
@ -14,9 +14,19 @@ SUPPLY_RESULTS_WITH_SHIPPING <- list() #This shows the amount availble to ship t
|
|||||||
|
|
||||||
|
|
||||||
SHIPPING_COST <- 1.2874*26000 #Inflation adjusted from New Mexico Report
|
SHIPPING_COST <- 1.2874*26000 #Inflation adjusted from New Mexico Report
|
||||||
|
TEST <- RES$Per_5%>% left_join(read_csv("Data/Raw_Data/Curie_Spent_Fuel_Site_Totals.csv")) %>% mutate(Marginal_Value=Revenue/Total_Tons) %>% select(Year,Facility,Marginal_Value,Total_Tons) %>% group_by(Year) %>% arrange(Year,desc(Marginal_Value)) %>% mutate(Q=cumsum(Total_Tons)) %>% mutate(IN=Q<10000) %>% mutate(MIN=ZZMIN
|
||||||
|
TEST %>% filter(IN) %>% filter(Marginal_Value==min(Marginal_Value)) %>% print(n=100)
|
||||||
|
TEST %>% print(n=30)
|
||||||
|
TEST %>% arrange(Year,Marginal_Value)
|
||||||
|
TEST
|
||||||
|
TEST %>% filter(IN) %>% filter(Marginal_Value )
|
||||||
|
|
||||||
|
TEST <- RES[[1]]%>% left_join(read_csv("Data/Raw_Data/Curie_Spent_Fuel_Site_Totals.csv")) %>% select(Facility,Year,Revenue,Total_Tons) %>% mutate(Marginal=Revenue/Total_Tons) %>% group_by(Year) %>% arrange(Marginal) %>% mutate(IN=cumsum(Total_Tons)<10000)
|
||||||
|
TEST
|
||||||
|
|
||||||
for(i in 1:LENGTH){
|
for(i in 1:LENGTH){
|
||||||
RES[[i]] <- RES[[i]] %>% filter(!(Facility %in% c("Palo Verde","Vogtle"))) #The shipping cost is higher than the marginal value per SNF at these locations in the lat period of study 2083.
|
RES[[i]] <- RES[[i]] %>% filter(!(Facility %in% c("Palo Verde","Vogtle"))) #The shipping cost is higher than the marginal value per SNF at these locations in the lat period of study 2083.
|
||||||
RES[[i]]$Revenue <-CV2*as.numeric(RES[[i]]$Revenue)
|
RES[[i]]$Revenue <-CV1*as.numeric(RES[[i]]$Revenue)
|
||||||
RES[[i]]$Year<-as.numeric(RES[[i]]$Year)
|
RES[[i]]$Year<-as.numeric(RES[[i]]$Year)
|
||||||
DISCOUNT <- as.numeric(gsub("Per_","",names(RES)[i]))/100
|
DISCOUNT <- as.numeric(gsub("Per_","",names(RES)[i]))/100
|
||||||
SUPPLY_RESULTS[[i]] <- RES[[i]] %>% left_join(read_csv("Data/Raw_Data/Curie_Spent_Fuel_Site_Totals.csv")) %>% mutate(Marginal_Value=Revenue/Total_Tons) %>% select(Year,Marginal_Value,Total_Tons) %>% group_by(Year) %>% arrange(Year,desc(Marginal_Value)) %>% mutate(Q=cumsum(Total_Tons),Discount=factor(percent(DISCOUNT,1),levels=c("3%","5%","7%","10%")))
|
SUPPLY_RESULTS[[i]] <- RES[[i]] %>% left_join(read_csv("Data/Raw_Data/Curie_Spent_Fuel_Site_Totals.csv")) %>% mutate(Marginal_Value=Revenue/Total_Tons) %>% select(Year,Marginal_Value,Total_Tons) %>% group_by(Year) %>% arrange(Year,desc(Marginal_Value)) %>% mutate(Q=cumsum(Total_Tons),Discount=factor(percent(DISCOUNT,1),levels=c("3%","5%","7%","10%")))
|
||||||
@ -72,9 +82,11 @@ DEMAND_CURVE_FACET
|
|||||||
CIFS <- rbind(readRDS("Data/Cleaned_Data/Texas_CIFS_Costs.Rds"),readRDS("Data/Cleaned_Data/New_Mexico_CIFS_Costs.Rds"))
|
CIFS <- rbind(readRDS("Data/Cleaned_Data/Texas_CIFS_Costs.Rds"),readRDS("Data/Cleaned_Data/New_Mexico_CIFS_Costs.Rds"))
|
||||||
|
|
||||||
NPC <- CIFS %>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total) %>% group_by(Year,Location,Cost_Assumption,Total,Phase,Capacity) %>% summarize(Total=mean(Total)) %>% arrange(Location,Phase,Year) %>% mutate(Cost_3=Total/(1+0.03)^Year,Cost_5=Total/(1+0.05)^Year,Cost_7=Total/(1+0.07)^Year,Cost_10=Total/(1+0.1)^Year) %>% ungroup %>% group_by(Location,Phase,Capacity,Cost_Assumption) %>% summarize('3%'=sum(Cost_3),'5%'=sum(Cost_5),"7%"=sum(Cost_7),"10%"=sum(Cost_10)) %>% pivot_longer(c(-Phase,-Location,-Cost_Assumption,-Capacity),names_to="Discount",values_to="CIFS_Cost")
|
NPC <- CIFS %>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total) %>% group_by(Year,Location,Cost_Assumption,Total,Phase,Capacity) %>% summarize(Total=mean(Total)) %>% arrange(Location,Phase,Year) %>% mutate(Cost_3=Total/(1+0.03)^Year,Cost_5=Total/(1+0.05)^Year,Cost_7=Total/(1+0.07)^Year,Cost_10=Total/(1+0.1)^Year) %>% ungroup %>% group_by(Location,Phase,Capacity,Cost_Assumption) %>% summarize('3%'=sum(Cost_3),'5%'=sum(Cost_5),"7%"=sum(Cost_7),"10%"=sum(Cost_10)) %>% pivot_longer(c(-Phase,-Location,-Cost_Assumption,-Capacity),names_to="Discount",values_to="CIFS_Cost")
|
||||||
|
TEMP1 <- NPC%>% filter(Location=='Texas') %>% select(-CIFS_Cost) %>% mutate(Phase="Extended",Capacity=10^5) %>% unique
|
||||||
|
TEMP2 <- NPC %>% filter(Location=='Texas') %>% group_by(Location,Discount,Cost_Assumption) %>% summarize(CAP_CHANGE=max(Capacity)-min(Capacity),ST_COST=min(CIFS_Cost),END_COST=max(CIFS_Cost),SLOPE=(END_COST-ST_COST)/CAP_CHANGE,CIFS_Cost=ST_COST+SLOPE*(10^5-5000)) %>% select(Location,Discount,CIFS_Cost,Cost_Assumption)
|
||||||
|
TEMP <- TEMP1 %>% left_join(TEMP2)
|
||||||
|
NPC <- rbind(NPC,TEMP )
|
||||||
NPC <- NPC %>% filter(Cost_Assumption=="Average") %>% select(-Cost_Assumption)
|
NPC <- NPC %>% filter(Cost_Assumption=="Average") %>% select(-Cost_Assumption)
|
||||||
NPC
|
|
||||||
KEY_DATA
|
|
||||||
|
|
||||||
RETURN_DATA <- KEY_DATA %>% left_join(NPC) %>% filter(Q<=Capacity) %>% group_by(Year,Discount,Location,Phase,Capacity,CIFS_Cost) %>% summarize(Q=sum(Total_Tons),Revenue=sum(Marginal_Value*Total_Tons),P=Revenue/Q,Profit=sum(Revenue-CIFS_Cost)) %>% ungroup
|
RETURN_DATA <- KEY_DATA %>% left_join(NPC) %>% filter(Q<=Capacity) %>% group_by(Year,Discount,Location,Phase,Capacity,CIFS_Cost) %>% summarize(Q=sum(Total_Tons),Revenue=sum(Marginal_Value*Total_Tons),P=Revenue/Q,Profit=sum(Revenue-CIFS_Cost)) %>% ungroup
|
||||||
|
|
||||||
@ -88,9 +100,16 @@ RETURN_DATA <- RETURN_DATA %>% group_by(Discount,Location,Phase,Capacity,CIFS_C
|
|||||||
#RETURN_DATA
|
#RETURN_DATA
|
||||||
|
|
||||||
#RETURN_DATA <- RETURN_DATA %>% mutate(size=ifelse(Phase=="Partial","5,000 MTU Capacity (Phase 1)","40,000 MTU Capacity (Full Build Out)"))
|
#RETURN_DATA <- RETURN_DATA %>% mutate(size=ifelse(Phase=="Partial","5,000 MTU Capacity (Phase 1)","40,000 MTU Capacity (Full Build Out)"))
|
||||||
|
RETURN_DATA %>% filter(Phase=="Extended")
|
||||||
|
RETURN_DATA %>% pull(Capacity) %>% unique
|
||||||
|
RETURN_DATA %>% group_by(Year,Capacity,Discount) %>% filter(n()>1) %>% arrange(Year,Capacity)
|
||||||
|
png("Revenue.png",height=6,width=11,units="in",res=900)
|
||||||
|
ggplot(RETURN_DATA %>% filter(Discount=='5%'),aes(x=Year,y=Profit/10^9,color=Location))+geom_point()+scale_x_continuous(breaks=seq(1960,2085,by=5))
|
||||||
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
FOC_PLOT <- ggplot(RETURN_DATA,aes(x=Year,y=FOC/10^6,group=Discount,color=Discount))+facet_wrap(~Capacity,ncol=2)+scale_x_continuous(breaks=seq(1960,2083,by=10))+geom_point(size=0.5)+geom_step(linewidth=0.75)+ geom_hline(yintercept = 0, color = "black", linetype = "solid", size = 1)+theme(text = element_text(size = 16),legend.position = "top")+ylab("Million Dollars")
|
FOC_PLOT <- ggplot(RETURN_DATA,aes(x=Year,y=FOC/10^6,group=Discount,color=Discount))+facet_wrap(~Capacity,ncol=1,scales="free")+scale_x_continuous(breaks=seq(1960,2083,by=10))+geom_point(size=0.5)+geom_step(linewidth=0.75)+ geom_hline(yintercept = 0, color = "black", linetype = "solid", size = 1)+theme(text = element_text(size = 16),legend.position = "top")+ylab("Million Dollars")png("FOC_PLOT.png",width=8,height=18, units="in",res=1800)
|
||||||
FOC_PLOT
|
FOC_PLOT
|
||||||
|
dev.off()
|
||||||
|
|
||||||
DEMAND_CURVE_YEARS+geom_segment(aes(x = 0, y = C, xend = 5, yend = C),color="orange")+geom_segment(aes(x = 5, y = C, xend = 5, yend = M),color="orange")+geom_segment(aes(x = 5, y = M, xend = 140, yend = M),color="orange",arrow = arrow(length = unit(0.4, "cm")))
|
DEMAND_CURVE_YEARS+geom_segment(aes(x = 0, y = C, xend = 5, yend = C),color="orange")+geom_segment(aes(x = 5, y = C, xend = 5, yend = M),color="orange")+geom_segment(aes(x = 5, y = M, xend = 140, yend = M),color="orange",arrow = arrow(length = unit(0.4, "cm")))
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
######CIFS costs
|
######CIFS costs
|
||||||
|
dir.create("./Data/Cleaned_Data",recursive=TRUE,showWarnings=FALSE)
|
||||||
|
read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-3_Undiscounted_Cost_Estimates_Phase_1_Low.csv")
|
||||||
CIFS_TEXAS <- rbind( read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-3_Undiscounted_Cost_Estimates_Phase_1_Low.csv") %>% mutate(Phase='Partial',Cost_Assumption="Low"),read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-4_Undiscounted_Cost_Estimates_Phase_1_High.csv") %>% mutate(Phase='Partial',Cost_Assumption="High"), read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-5_Undiscounted_Cost_Estimates_Full_Low.csv") %>% mutate(Phase='Full',Cost_Assumption="Low"), read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-6_Undiscounted_Cost_Estimates_Full_High.csv") %>% mutate(Phase='Full',Cost_Assumption="High")) %>% mutate(Location="Texas",Capacity=ifelse(Phase=='Partial',5000,8*5000)) %>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total,everything())
|
CIFS_TEXAS <- rbind( read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-3_Undiscounted_Cost_Estimates_Phase_1_Low.csv") %>% mutate(Phase='Partial',Cost_Assumption="Low"),read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-4_Undiscounted_Cost_Estimates_Phase_1_High.csv") %>% mutate(Phase='Partial',Cost_Assumption="High"), read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-5_Undiscounted_Cost_Estimates_Full_Low.csv") %>% mutate(Phase='Full',Cost_Assumption="Low"), read_csv("./Data/Raw_Data/Cost_Tables/Texas/Table_C-6_Undiscounted_Cost_Estimates_Full_High.csv") %>% mutate(Phase='Full',Cost_Assumption="High")) %>% mutate(Location="Texas",Capacity=ifelse(Phase=='Partial',5000,8*5000)) %>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total,everything())
|
||||||
|
|
||||||
CIFS_TEXAS <- rbind(CIFS_TEXAS,CIFS_TEXAS %>% group_by(Year,Location,Phase,Capacity) %>% summarize(Cost_Assumption="Average",Total=mean(Total),Construction=mean(Construction),Transportation_to_CISF=mean(Transportation_to_CISF),Operations=mean(Operations),Transportation_to_Repository=mean(Transportation_to_Repository),Decommissioning=mean(Decommissioning)) %>% ungroup)
|
CIFS_TEXAS <- rbind(CIFS_TEXAS,CIFS_TEXAS %>% group_by(Year,Location,Phase,Capacity) %>% summarize(Cost_Assumption="Average",Total=mean(Total),Construction=mean(Construction),Transportation_to_CISF=mean(Transportation_to_CISF),Operations=mean(Operations),Transportation_to_Repository=mean(Transportation_to_Repository),Decommissioning=mean(Decommissioning)) %>% ungroup)
|
||||||
|
|
||||||
saveRDS(CIFS_TEXAS,"Data/Cleaned_Data/Texas_CIFS_Costs.Rds")
|
saveRDS(CIFS_TEXAS,"Data/Cleaned_Data/Texas_CIFS_Costs.Rds")
|
||||||
|
|
||||||
CIFS_NEW_MEXICO <- rbind( read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-3_Undiscounted_Cost_Estimates_Phase_1_Low.csv") %>% mutate(Phase='Partial',Cost_Assumption="Low"),read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-4_Undiscounted_Cost_Estimates_Phase_1_High.csv") %>% mutate(Phase='Partial',Cost_Assumption="High"), read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-5_Undiscounted_Cost_Estimates_Full_Low.csv") %>% mutate(Phase='Full',Cost_Assumption="Low"), read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-6_Undiscounted_Cost_Estimates_Full_High.csv") %>% mutate(Phase='Full',Cost_Assumption="High"))%>% mutate(Location="New Mexico",Capacity=ifelse(Phase=='Partial',8680,8680+5000*19))%>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total,everything())
|
CIFS_NEW_MEXICO <- rbind( read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-3_Undiscounted_Cost_Estimates_Phase_1_Low.csv") %>% mutate(Phase='Partial',Cost_Assumption="Low"),read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-4_Undiscounted_Cost_Estimates_Phase_1_High.csv") %>% mutate(Phase='Partial',Cost_Assumption="High"), read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-5_Undiscounted_Cost_Estimates_Full_Low.csv") %>% mutate(Phase='Full',Cost_Assumption="Low"), read_csv("./Data/Raw_Data/Cost_Tables/New_Mexico/Table_C-6_Undiscounted_Cost_Estimates_Full_High.csv") %>% mutate(Phase='Full',Cost_Assumption="High"))%>% mutate(Location="New Mexico",Capacity=ifelse(Phase=='Partial',8680,8680+5000*19))%>% select(Year,Location,Phase,Capacity,Cost_Assumption,Total,everything())
|
||||||
|
|||||||
@ -1,42 +1,42 @@
|
|||||||
Year,Construction,Transportation_to_CISF,Operations,Transportation_to_Repository,Decommissioning,Total
|
Year,Construction,Transportation_to_CISF,Operations,Transportation_to_Repository,Decommissioning,Total
|
||||||
1,76552618,73711378,5041229,0,0,155305226
|
5041229,0,0,155305226
|
||||||
2,65910317,142837839,5041229,0,0,213789386
|
5041229,0,0,213789386
|
||||||
3,11737391,2547465,5041229,0,0,19326086
|
5041229,0,0,19326086
|
||||||
4,40629430,7642396,5041229,0,0,53313056
|
5041229,0,0,53313056
|
||||||
5,40629430,7642396,5041229,0,0,53313056
|
5041229,0,0,53313056
|
||||||
6,40629430,7642396,5041229,0,0,53313056
|
5041229,0,0,53313056
|
||||||
7,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
8,40629430,7642396,5041229,0,0,53313056
|
5041229,0,0,53313056
|
||||||
9,9028762,1698310,5041229,0,0,15768302
|
5041229,0,0,15768302
|
||||||
10,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
11,3606215,0,5041229,0,0,8647444
|
5041229,0,0,8647444
|
||||||
12,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
13,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
14,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
15,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
16,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
17,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
18,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
19,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
20,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
21,17854730,0,5041229,0,0,22895959
|
5041229,0,0,22895959
|
||||||
22,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
23,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
24,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
25,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
26,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
27,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
28,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
29,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
30,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
31,3606215,0,5041229,0,0,8647444
|
5041229,0,0,8647444
|
||||||
32,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
33,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
34,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
35,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
36,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
37,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
38,0,0,5041229,0,0,5041229
|
5041229,0,0,5041229
|
||||||
39,0,0,5041229,125682289,0,130723519
|
5041229,125682289,0,130723519
|
||||||
40,0,0,5041229,125682289,0,130723519
|
5041229,125682289,0,130723519
|
||||||
41,0,0,0,0,56740382,56740382
|
0,0,56740382,56740382
|
||||||
|
|||||||
|
@ -38,5 +38,5 @@ Year,Construction,Transportation_to_CISF,Operations,Transportation_to_Repository
|
|||||||
37,0,0,12170532,0,0,12170532
|
37,0,0,12170532,0,0,12170532
|
||||||
38,0,0,12170532,0,0,12170532
|
38,0,0,12170532,0,0,12170532
|
||||||
39,0,0,12170532,125682289,0,137852821
|
39,0,0,12170532,125682289,0,137852821
|
||||||
40,0,0,12170532,0,125682289,137852821
|
40,0,0,12170532,125682289,0,137852821
|
||||||
41,0,0,0,0,56740382,56740382
|
41,0,0,0,0,56740382,56740382
|
||||||
|
|||||||
|
Loading…
x
Reference in New Issue
Block a user