-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanada-reactor-build.Rmd
50 lines (46 loc) · 1.78 KB
/
canada-reactor-build.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "canada-reactor-plot"
author: "GeoffRussell"
date: "8/5/2022"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(lubridate)
```
## Data
```{r cars}
comma<-function(x) prettyNum(signif(x,digits=2),big.mark=",")
FukuDate<-ymd("2011-03-11")
bungalaE<-570e9
country<-"usa"
Country<-"USA"
country<-"canada"
Country<-"Canada"
df<-read_csv(paste0(country,"-reactors-mod.csv")) %>%
mutate(NameConnection=paste0(Name,' ',Connection),MWe=Gross) %>%
mutate(InFuku=(FukuDate<Connection & FukuDate>StartCon),
nBun=MWe*1e6*24*365*0.89/bungalaE,
fac=19/(Dur*12/nBun))
md<-comma(median(df$Dur,na.rm=TRUE))
mn<-comma(mean(df$Dur,na.rm=TRUE))
df %>% filter(!is.na(Dur)) %>% summarise(n=n())
nreactors<-as.numeric(df %>% filter(!is.na(Dur)) %>% summarise(n=n()))
yy<-30
p<-df %>% filter(!is.na(Dur)) %>% ggplot() +
geom_col(aes(reorder(NameConnection,Connection),Dur,fill=MWe))+
geom_text(aes(reorder(NameConnection,Connection),Dur+0.1,
label=paste0("(",comma(nBun),':',comma(fac),")"),hjust=0),size=1.7)+
coord_flip()+
annotate("text",x=2.5,y=yy,hjust=1,label=paste0("Number of reactors ",nreactors,""))+
annotate("text",x=4,y=yy,hjust=1,label=paste0("Mean ",mn," years"))+
annotate("text",x=5.5,y=yy,hjust=1,label=paste0("Median ",md," years"))+
annotate("text",x=7,y=yy,hjust=1,label="Data: IAEA PRIS")+
annotate("text",x=18,y=yy,hjust=1,size=2,label="(n:r)\nn=number of Bungala\nsolar farms (570 GWh/year)\nr=nuclear build speed\ncompared to Bungala\ne.g, 2=double, 3=triple")+
labs(title=paste0(Country," nuclear reactor construction times"),y="Years to grid connection",x="")
p
png(paste0(country,"-build-times.png"),width=2000,height=2000,units="px",res=300,type="cairo-png")
p
dev.off()
```