Building model: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(→‎Calculations: improved code)
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.
"eventyear", # A dummy variable to combine time periods to numerical time axis.
"obsyear" # Years for which observations are calculated. This requires timepoints function.
)),
)),
formula = function(...) {
formula = function(...) {
Line 40: Line 41:
New <- construction * 10 * efficienciesNew * buildingTypes * heatingSharesNew * eventyear
New <- construction * 10 * efficienciesNew * buildingTypes * heatingSharesNew * eventyear
out <- EvalOutput(Ovariable("out", data = orbind(Now, New)))
temp1 <- EvalOutput(Ovariable("temp1", data = orbind(Now, New))) # All construction
out <- unkeep(out, cols = "Building2", sources = TRUE, prevresults = TRUE)
temp1 <- unkeep(temp1, 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.


Line 49: Line 50:
Result = 1
Result = 1
))
))
temp <- out * renovationyear # temp is the building stock repeated for every potential renovation decade.
reno <- temp1 * renovationyear # reno is the building stock repeated for every potential renovation decade.
temp@output$Age <- temp@output$Renovationyear - temp@output$Eventyear
reno@output$Age <- reno@output$Renovationyear - reno@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  
reno <- continuousOps(reno, renovation, '*') * renovationShares * 10  
# marginals <- colnames(renovations@output)[renovations@marginal]
 
out <- orbind(out * 1, renovations * -1) # Equal amount stops being non-renovated.
temp2 <- orbind(temp1 * 1, reno * -1) # Equal amount stops being non-renovated.
out$Renovation <- "None"
temp2$Renovation <- "None"
out <- orbind(out, renovations)
temp2 <- orbind(temp2, reno) # Temp2: Construction + renovation in data.frame
out$Renovation <- as.factor(out$Renovation)
temp2$Renovation <- as.factor(temp2$Renovation)
temp2 <- EvalOutput(Ovariable("temp2", data = out))
 
temp2 <- unkeep(temp2, sources = TRUE, prevresults = TRUE)
temp3 <- EvalOutput(Ovariable("buildings", data = temp2)) # Temp3: Like Temp2 but ovariable
temp2@output <- fillna(temp2@output, marginals = colnames(temp2@output)[temp2@marginal])
temp3 <- unkeep(temp3, sources = TRUE, prevresults = TRUE)
out <- oapply(temp2, cols = c("Constructed", "Renovationyear", "Age"), FUN = "sum", na.rm = TRUE)@output
temp3@output <- fillna(temp3@output, marginals = colnames(temp3@output)[temp3@marginal])
# out <- as.data.frame(as.table(tapply( # Remove indices that are no longer needed
 
# out$Result,
# temp4: Drop redundant time indices
# INDEX = out[marginals[!marginals %in% c("Constructed", "Renovationyear", #"Age")]],
temp4 <- CollapseMarginal(temp3, cols = c("Constructed", "Renovationyear", "Age"), FUN = "sum")
# FUN = "sum",
temp4@output$Eventyear <- as.numeric(levels(temp4@output$Eventyear)[temp4@output$Eventyear])
# 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.
# tapply (and therefore oapply) changes continuous indices to factors! Must change back by hand.
colnames(out)[colnames(out) == "City area"] <- "City.area"
colnames(temp4@output)[colnames(temp4@output) == "City area"] <- "City.area"
colnames(out)[colnames(out) == "Freq"] <- "Result"
temp4@output <- temp4@output[!is.na(result(temp4)) , ]
out <- out[!is.na(out$Result) , ]


# Calculate cumulative events at timepoints defined by obsyear.
out <- timepoints(temp4, obsyear = obsyear)
return(out)
return(out)
}
}
Line 99: Line 98:
# X must be an ovariable with index Eventyear.
# X must be an ovariable with index Eventyear.
# obsyear must be a vector of years.
# obsyear must be a vector of years.
out <- data.frame()
out <- data.frame()


Line 109: Line 109:
X@output <- out
X@output <- out
X@marginal <- c(TRUE, X@marginal) # Add Year to marginal
X@marginal <- c(TRUE, X@marginal) # Add Year to marginal
X <- CollapseMarginal(X, cols = "Eventyear", FUN = "sum")
X@output <- X@output[!is.na(result(X)) , ]
return(X)
return(X)
}
}

Revision as of 11:31, 12 February 2014



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

+ Show code

See also

Urgenche research project 2011 - 2014: city-level climate change mitigation
Urgenche pages

Urgenche main page · Category:Urgenche · Urgenche project page (password-protected)

Relevant data
Building stock data in Urgenche‎ · Building regulations in Finland · Concentration-response to PM2.5 · Emission factors for burning processes · ERF of indoor dampness on respiratory health effects · ERF of several environmental pollutions · General criteria for land use · Indoor environment quality (IEQ) factors · Intake fractions of PM · Land use in Urgenche · Land use and boundary in Urgenche · Energy use of buildings

Relevant methods
Building model · Energy balance · Health impact assessment · Opasnet map · Help:Drawing graphs · OpasnetUtils‎ · Recommended R functions‎ · Using summary tables‎

City Kuopio
Climate change policies and health in Kuopio (assessment) · Climate change policies in Kuopio (plausible city-level climate policies) · Health impacts of energy consumption in Kuopio · Building stock in Kuopio · Cost curves for energy (prioritization of options) · Energy balance in Kuopio (energy data) · Energy consumption and GHG emissions in Kuopio by sector · Energy consumption classes (categorisation) · Energy consumption of heating of buildings in Kuopio · Energy transformations (energy production and use processes) · Fuels used by Haapaniemi energy plant · Greenhouse gas emissions in Kuopio · Haapaniemi energy plant in Kuopio · Land use in Kuopio · Building data availability in Kuopio · Password-protected pages: File:Heat use in Kuopio.csv · Kuopio housing

City Basel
Buildings in Basel (password-protected)

Energy balances
Energy balance in Basel · Energy balance in Kuopio · Energy balance in Stuttgart · Energy balance in Suzhou


References