Skip to content
Snippets Groups Projects
Commit 026da5f0 authored by Ben Anderson's avatar Ben Anderson
Browse files

amendments to ensure clarity

parent 69d7197b
No related branches found
No related tags found
No related merge requests found
## Introduction ## Introduction
This version of the baseline microsimulation model uses a household dataset (n = 1800) with household size (occupancy) set to match the UK 2011 Census distributions together with regression coefficients from [@parkerThesis2014] to construct a synthetic household level micro-component water consumption dataset.
```{r Set model v1 version} ```{r Set model v1 version}
modelVersion <- "v1_3" modelVersion <- "v1_3"
``` ```
> Model: `r modelVersion`
This version of the baseline microsimulation model uses a household dataset (n = 1800) with household size (occupancy) set to match the UK 2011 Census distributions together with regression coefficients from [@parkerThesis2014] to construct a synthetic household level micro-component water consumption dataset.
```{r Set model 1 paths} ```{r Set model 1 paths}
...@@ -13,7 +15,7 @@ modelVersion <- "v1_3" ...@@ -13,7 +15,7 @@ modelVersion <- "v1_3"
if(startsWith(userName, "ben")) # => BA laptop if(startsWith(userName, "ben")) # => BA laptop
m1iPath <- paste0(iPath, "model_v1/") m1iPath <- paste0(iPath, "model_v1/")
if(startsWith(userName, "ben")) # => BA laptop if(startsWith(userName, "ben")) # => BA laptop
m1oPath <- paste0(oPath, "model_v1/") m1oPath <- paste0(dPath, "model_outputs/model_v1/")
# set paths for DM laptop ---- # set paths for DM laptop ----
if(startsWith(userName, "despina")) # => DM laptop if(startsWith(userName, "despina")) # => DM laptop
...@@ -25,7 +27,7 @@ print(paste0("User: ",userName)) ...@@ -25,7 +27,7 @@ print(paste0("User: ",userName))
print(paste0("Platform: ",sysName)) print(paste0("Platform: ",sysName))
print(paste0("Model version: ",modelVersion)) print(paste0("Model version: ",modelVersion))
print(paste0("Input data path: ",m1iPath)) print(paste0("Input data path: ",m1iPath))
print(paste0("Output data path: ",oPath)) print(paste0("Output data path: ",m1oPath))
``` ```
...@@ -456,7 +458,7 @@ estPlot ...@@ -456,7 +458,7 @@ estPlot
# Grey scale version if required # Grey scale version if required
estPlot <- estPlot + theme_bw() estPlot <- estPlot + theme_bw()
ggsave("Fig2_CompareModelv1_3withEST2013.pdf", dpi = 400) ggsave(paste0("plots_v1/Fig2_CompareModelv1_3withEST2013.pdf"), dpi = 400)
``` ```
...@@ -480,7 +482,7 @@ summaryDT <- hhDataFinalDaily_v1_3DT[, .(meanBasin = mean(Basin.baseline), ...@@ -480,7 +482,7 @@ summaryDT <- hhDataFinalDaily_v1_3DT[, .(meanBasin = mean(Basin.baseline),
meanWC = mean(WC.baseline), meanWC = mean(WC.baseline),
meanWashingMachine = mean(WashingMachine.baseline) meanWashingMachine = mean(WashingMachine.baseline)
), by = .(occupancy, metered)] ), by = .(occupancy, metered)]
oFile <- paste0(oPath,"summary_output-hh-baseline-mcm-consumption_",format(Sys.time(), "%Y-%m-%d"), "_", modelVersion, ".csv") oFile <- paste0(m1oPath,"summary_output-hh-baseline-mcm-consumption_",format(Sys.time(), "%Y-%m-%d"), "_", modelVersion, ".csv")
write.csv(summaryDT, oFile) write.csv(summaryDT, oFile)
...@@ -496,9 +498,10 @@ write.csv(keepDT, oFile) ...@@ -496,9 +498,10 @@ write.csv(keepDT, oFile)
# compress it # compress it
# now gzip new one # now gzip new one
print(paste0("gzipping file to: ", oFile, ".gz")) # print(paste0("gzipping file to: ", oFile, ".gz"))
cmd <- paste0("gzip -f ", oFile) # forces over-write # cmd <- paste0("gzip -f ", oFile) # forces over-write
try(system(cmd)) # in case it fails (it will on windows - you will be left with a .csv file) # try(system(cmd)) # in case it fails (it will on windows - you will be left with a .csv file)
# path issue - fails
``` ```
Data written to: Data written to:
......
...@@ -5,14 +5,13 @@ modelVersion <- "v2_0" ...@@ -5,14 +5,13 @@ modelVersion <- "v2_0"
library(dplyr) # after model v1 has run (interferes with data.table) library(dplyr) # after model v1 has run (interferes with data.table)
``` ```
```{r Set model 2 paths} ```{r Set model 2 paths}
# set model v2 paths for BA laptop ---- # set model v2 paths for BA laptop ----
if(startsWith(userName, "ben")) # => BA laptop if(startsWith(userName, "ben")) # => BA laptop
m2iPath <- paste0(iPath, "model_v2/") m2iPath <- paste0(iPath, "model_v2/")
if(startsWith(userName, "ben")) # => BA laptop if(startsWith(userName, "ben")) # => BA laptop
m2oPath <- paste0(oPath, "model_v2/") m2oPath <- paste0(dPath, "model_outputs/model_v2/")
# set paths for DM laptop ---- # set paths for DM laptop ----
if(startsWith(userName, "despina")) # => DM laptop if(startsWith(userName, "despina")) # => DM laptop
...@@ -24,12 +23,15 @@ print(paste0("User: ",userName)) ...@@ -24,12 +23,15 @@ print(paste0("User: ",userName))
print(paste0("Platform: ",sysName)) print(paste0("Platform: ",sysName))
print(paste0("Model version: ",modelVersion)) print(paste0("Model version: ",modelVersion))
print(paste0("Input data path: ",m2iPath)) print(paste0("Input data path: ",m2iPath))
print(paste0("Output data path: ",oPath)) print(paste0("Output data path: ",m2oPath))
``` ```
## Introduction ## Introduction
This code generates monthly household water demand for 1800 households, using information derived from the SPRG Survey such as frequency of use for different end uses. The code also uses information that is derived from water company and other reports such as 'At home with water' report by the Energy Saving Trust. As we do not have access to details of litres per usage for metered vs non-metered households, this model produces estimates which do not differ substabtially between metered and non-metered households.
> Model: `r modelVersion`
This code generates monthly household water demand for 1800 households, using information derived from the SPRG Survey such as frequency of use for different end uses. The code also uses information that is derived from water company and other reports such as 'At home with water' report by the Energy Saving Trust. As we do not have access to details of litres per usage for metered vs non-metered households, this model produces estimates which do not differ substantially between metered and non-metered households.
Objectives: Objectives:
...@@ -788,6 +790,8 @@ plotDT <- rbind(estDT, mtDT) ...@@ -788,6 +790,8 @@ plotDT <- rbind(estDT, mtDT)
plotDT <- plotDT[, Usage := as.factor(Usage)] plotDT <- plotDT[, Usage := as.factor(Usage)]
plotDT <- plotDT[, UsageRo := relevel(Usage, "Total")] # put usage at the end plotDT <- plotDT[, UsageRo := relevel(Usage, "Total")] # put usage at the end
plotDT[, source := ifelse(source %like% "IMPETUS", "Model", source)]
myPlot <- ggplot(plotDT, aes(x=UsageRo, fill = source)) + myPlot <- ggplot(plotDT, aes(x=UsageRo, fill = source)) +
geom_col(aes(y = vol), position = "dodge") + geom_col(aes(y = vol), position = "dodge") +
labs(y = "Mean l/day", labs(y = "Mean l/day",
...@@ -796,6 +800,8 @@ myPlot <- ggplot(plotDT, aes(x=UsageRo, fill = source)) + ...@@ -796,6 +800,8 @@ myPlot <- ggplot(plotDT, aes(x=UsageRo, fill = source)) +
myPlot myPlot
ggsave(paste0("plots_v2/compareWithESTlitres.pdf") , dpi = 400)
myPlot <- ggplot(plotDT[Usage != "Total"], aes(x=UsageRo, fill = source)) + myPlot <- ggplot(plotDT[Usage != "Total"], aes(x=UsageRo, fill = source)) +
geom_col(aes(y = pcTot), position = "dodge") + geom_col(aes(y = pcTot), position = "dodge") +
labs(y = "% total", labs(y = "% total",
...@@ -804,6 +810,8 @@ myPlot <- ggplot(plotDT[Usage != "Total"], aes(x=UsageRo, fill = source)) + ...@@ -804,6 +810,8 @@ myPlot <- ggplot(plotDT[Usage != "Total"], aes(x=UsageRo, fill = source)) +
myPlot myPlot
ggsave(paste0("plots_v2/compareWithESTpercent.pdf") , dpi = 400)
``` ```
## Save data ## Save data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment