Building model: Difference between revisions
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
"renovationShares", # Fraction of renovation type when renovation is done. | "renovationShares", # Fraction of renovation type when renovation is done. | ||
"renovation", # Percentage of renovations per year | "renovation", # Percentage of renovations per year | ||
" | "eventyear" # A dummy variable to combine time periods to numerical time axis. | ||
)), | )), | ||
formula = function(...) { | formula = function(...) { | ||
# Current building stock | # Current building stock | ||
Now <- buildingStock * heatingShares * efficiencies * | Now <- buildingStock * heatingShares * efficiencies * eventyear | ||
# Construction in ten years multiplied by fraction of energy classes and heating types. | # Construction in ten years multiplied by fraction of energy classes and heating types. | ||
New <- construction * 10 * efficienciesNew * buildingTypes * heatingSharesNew * | New <- construction * 10 * efficienciesNew * buildingTypes * heatingSharesNew * eventyear | ||
out <- EvalOutput(Ovariable("out", data = orbind(Now, New))) | out <- EvalOutput(Ovariable("out", data = orbind(Now, New))) | ||
out <- unkeep(out, cols = "Building2", sources = TRUE, prevresults = TRUE) | out <- unkeep(out, cols = "Building2", sources = TRUE, prevresults = TRUE) | ||
# All source indices can be unkept, because each has only one location. | # All source indices can be unkept, because each has only one location. | ||
renovationyear <- Ovariable("renovationyear", data = data.frame( | renovationyear <- Ovariable("renovationyear", data = data.frame( | ||
Renovationyear = ( | Renovationyear = c(2010, 2020, 2030, 2040, 2050), | ||
Age = NA, | Age = NA, | ||
Result = 1 | Result = 1 | ||
Line 57: | Line 51: | ||
temp <- out * renovationyear # temp is the building stock repeated for every potential renovation decade. | temp <- out * renovationyear # temp is the building stock repeated for every potential renovation decade. | ||
temp@output$Age <- temp@output$Renovationyear - temp@output$ | temp@output$Age <- temp@output$Renovationyear - temp@output$Eventyear | ||
# Floor area of renovations in ten years. Combine with continuous index Age. | # Floor area of renovations in ten years. Combine with continuous index Age. | ||
renovations <- continuousOps(temp, renovation, '*') * renovationShares * 10 | renovations <- continuousOps(temp, renovation, '*') * renovationShares * 10 | ||
marginals <- colnames(renovations@output)[renovations@marginal] | |||
out <- orbind(out, renovations * -1) # Equal amount stops being non-renovated. | out <- orbind(out * 1, renovations * -1) # Equal amount stops being non-renovated. | ||
out$Renovation <- "None" | out$Renovation <- "None" | ||
out <- orbind(out, renovations) | out <- orbind(out, renovations) | ||
out$Renovation <- as.factor(out$Renovation) | out$Renovation <- as.factor(out$Renovation) | ||
out <- as.data.frame(as.table(tapply( # Remove indices that are no longer needed | |||
out$Result, | |||
INDEX = out[marginals[!marginals %in% c("Constructed", "Renovationyear", "Age")]], | |||
FUN = "sum", | |||
na.rm = TRUE | |||
))) | |||
out$Eventyear <- as.numeric(levels(out$Eventyear)[out$Eventyear]) | |||
# tapply (and therefore oapply) changes continuous indices to factors! Must change back by hand. | |||
colnames(out)[colnames(out) == "City area"] <- "City.area" | |||
colnames(out)[colnames(out) == "Freq"] <- "Result" | |||
out <- out[!is.na(out$Result) , ] | |||
return(out) | return(out) |
Revision as of 04:37, 12 February 2014
[show] |
---|
Question
How to estimate the size of the building stock of a city, including heating properties, renovations etc? The situation is followed over time, and different policies can be implemented.
Answer
For an example, see Baseline building stock.
Rationale
Calculations
See also