Building model: Difference between revisions
Jump to navigation
Jump to search
Line 60: | Line 60: | ||
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 | temp2 <- EvalOutput(Ovariable("temp2", data = out)) | ||
temp2 <- unkeep(temp2, sources = TRUE, prevresults = TRUE) | |||
temp2@output <- fillna(temp2@output, marginals = colnames(temp2@output)[temp2@marginal]) | |||
temp2 <- oapply(temp2, cols = c("Constructed", "Renovationyear", "Age"), FUN = "sum", na.rm = TRUE) | |||
# 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]) | out$Eventyear <- as.numeric(levels(out$Eventyear)[out$Eventyear]) | ||
# tapply (and therefore oapply) changes continuous indices to factors! Must change back by hand. | # tapply (and therefore oapply) changes continuous indices to factors! Must change back by hand. | ||
Line 90: | Line 94: | ||
# Calculate the cumulative impact of the events on building stock to given years | # Calculate the cumulative impact of the events on building stock to given years | ||
timepoints <- function(X, | timepoints <- function(X, obsyear) { | ||
# Function timepoints takes an event list and turns that into existing crosscutting situations at | # Function timepoints takes an event list and turns that into existing crosscutting situations at | ||
# timepoints defined by years. | # timepoints defined by years. | ||
# X must be an ovariable with index | # X must be an ovariable with index Eventyear. | ||
# | # obsyear must be a vector of years. | ||
out <- data.frame() | out <- data.frame() | ||
for(i in | for(i in obsyear) { | ||
out <- rbind(out, data.frame( | out <- rbind(out, data.frame( | ||
Year = i, | |||
X@output[X@output$ | X@output[X@output$Eventyear <= i , ] | ||
)) | )) | ||
} | } | ||
X@output <- out | X@output <- out | ||
X@marginal <- c(TRUE, X@marginal) # Add | X@marginal <- c(TRUE, X@marginal) # Add Year to marginal | ||
return(X) | return(X) |
Revision as of 06:26, 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