Difference between revisions of "Building model"

From Testiwiki
Jump to: navigation, search
(Calculations)
(Calculations: buildings still need bug fix)
Line 20: Line 20:
 
library(OpasnetUtils)
 
library(OpasnetUtils)
  
#########3# Calculate all building events (constructions, demolitions, renovations)
+
########## Calculate all building events (constructions, demolitions, renovations)
  
 
buildings <- Ovariable("buildings",  
 
buildings <- Ovariable("buildings",  
Line 32: Line 32:
 
"renovationShares", # Fraction of renovation type when renovation is done.
 
"renovationShares", # Fraction of renovation type when renovation is done.
 
"rateBuildings", # Percentage of renovations and other relative changes per year
 
"rateBuildings", # Percentage of renovations and other relative changes per year
# "eventyear", # A dummy variable to combine time periods to numerical time axis.
 
 
"year" # A data.frame of years for which observations are calculated. This requires timepoints function.
 
"year" # A data.frame of years for which observations are calculated. This requires timepoints function.
 
)),
 
)),
 
formula = function(...) {
 
formula = function(...) {
# Current building stock
+
######## Current building stock
 
stock <- stockBuildings * heatingShares * efficiencyShares
 
stock <- stockBuildings * heatingShares * efficiencyShares
  
if(!"Built" %in% colnames(stock@output)) { # Make a duplicate of Time because Built is needed later.
+
# if(!"Startyear" %in% colnames(stock@output)) { # Make a duplicate of Time because Startyear is needed later.
marginals <- colnames(stock@output)[stock@marginal]
+
# marginals <- colnames(stock@output)[stock@marginal]
stock@output$Built <- stock@output$Time
+
# stock@output$Startyear <- stock@output$Time
stock@marginal <- colnames(stock@output) %in% c(marginals, "Built")
+
# stock@marginal <- colnames(stock@output) %in% c(marginals, "Startyear")
}
+
# }
  
 
#### Changes in building stock due to construction etc.
 
#### Changes in building stock due to construction etc.
Line 49: Line 48:
 
# change <- changeBuildings  
 
# change <- changeBuildings  
 
change <- timepoints(changeBuildings, obsyear, sumtimecol = FALSE) # Cumulative changes at certain timepoints.
 
change <- timepoints(changeBuildings, obsyear, sumtimecol = FALSE) # Cumulative changes at certain timepoints.
stock@output$Time <- as.numeric(as.character(stock@output$Time))
 
stock@output$Built <- as.numeric(as.character(stock@output$Built))
 
  
stock@output <- orbind(stock, change)
+
nw <- stock
stock@output$Age <- stock@output$Time - stock@output$Built
+
nw@output$Time <- as.numeric(as.character(nw@output$Time))
stock@marginal <- colnames(stock@output) %in% c(
+
nw@output <- subset(nw@output, Time == max(Time))
"Age",
+
colnames(nw@output)[colnames(nw@output) == "Time"] <- "Startyear"
colnames(stock@output)[stock@marginal],
+
changeBuildings@output$Startyear <- as.numeric(as.character(changeBuildings@output$Startyear))
colnames(changeBuildings@output)[changeBuildings@marginal]
+
 
)
+
nw <- unkeep(nw, prevresults = TRUE, sources = TRUE)
stock <- unkeep(stock, prevresults = TRUE, sources = TRUE)
+
 
# nonrenovated <- oapply(stock, cols = character(), FUN = sum) # Simplify row structure
+
nw@output <- orbind(nw, unkeep(1 * changeBuildings, prevresults = TRUE, sources = TRUE))
# if("Renovation" %in% colnames(nonrenovated@output)) {nonrenovated@output <- subset(
+
# nw <-
# nonrenovated@output,  
+
# stock <- unkeep(change, cols = "Startyear")
# Renovation == "None",
 
# colnames(nonrenovated@output) != "Renovation"
 
# )}
 
  
reno <- nonrenovated * renovationShares
+
# change@marginal <- colnames(change@output) %in% c(
 +
# "Age",
 +
# colnames(stock@output)[stock@marginal],
 +
# colnames(changeBuildings@output)[changeBuildings@marginal]
 +
# )
 +
# change <- unkeep(change, cols = "Startyear", prevresults = TRUE, sources = TRUE)
 
 
# Floor area of renovations in ten years. Combine with continuous index Age.
+
########### Floor area of renovations. Combine with continuous index Age.
reno <- continuousOps(stock, renovationRate, '*') * renovationShares * 10
+
reno <- nw * renovationShares
reno@output$Built <- reno@output$Time # Renovation is the new event.
+
marginals <- colnames(reno@output)[reno@marginal]
reno <- unkeep(reno, cols = c("Age", "Time"), sources = TRUE, prevresults = TRUE)
+
reno@output$Age <- as.numeric(as.character(reno@output$Time)) -
 +
as.numeric(as.character(reno@output$Startyear))
 +
reno@marginal <- colnames(reno@output) %in% marginals
  
temp2 <- orbind(temp1 * 1, reno * -1) # Equal amount stops being non-renovated.
+
reno <- reno * 0.03 # continuousOps(reno, renovationRate, '*') FIX continuousOps
temp2$Renovation <- "None"
+
reno@output$Startyear <- reno@output$Time # Renovation is the new event.
temp2 <- orbind(temp2, reno) # Temp2: Construction + renovation in data.frame
+
reno <- oapply(reno, cols = c("Age", "Time"), FUN = sum)
temp2$Renovation <- as.factor(temp2$Renovation)
+
reno <- timepoints(reno, obstime)  
 +
reno@output <- reno@output[result(reno) != 0 , ]
  
temp3 <- Ovariable(output = temp2)) # Temp3: Like Temp2 but ovariable
+
out <- reno * -1 # Equal amount stops being non-renovated.
temp3 <- unkeep(temp3, sources = TRUE, prevresults = TRUE)
+
out@output$Renovation <- "None"
# temp3@output <- fillna(temp3@output, marginals = colnames(temp3@output)[temp3@marginal]) # WHY THIS? CANNOT FILLNA AMOUNTS!
+
out@output$Renovation <- as.factor(out@output$Renovation)
# colnames(temp3@output)[colnames(temp3@output) == "City area"] <- "City.area"
+
out <- orbind(out, reno) # Temp2: Construction + renovation in data.frame
  
# temp4: Drop redundant time indices
+
for(i in colnames(reno@output)[reno@marginal]) {
temp4 <- oapply(temp3, cols = c("Built", "Age"), FUN = "sum", na.rm = TRUE)
+
out[[i]][is.na(out[[i]])] <- "Not known"
# temp4@output <- temp4@output[!is.na(result(temp4)) , ]
+
}
  
# Calculate cumulative events at timepoints defined by obsyear.
 
out <- timepoints(temp4, obsyear = obsyear)
 
 
return(out)
 
return(out)
 
}
 
}

Revision as of 21:43, 16 February 2015



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 examples of model use, see Building stock in Kuopio and Climate change policies and health in Kuopio.

Rationale

Error creating thumbnail: Unable to save thumbnail to destination
Causal diagram of the building model.

Calculations

+ Show code

Dependencies

  • Exposure to PM2.5 in Finland
  • OpasnetUtils/Drafts
  • Energy use of buildings
  • Ovariables used or produced and example pages where they are used:
    • Building stock in Kuopio
      • buildingStock, # Current building stock
      • renovation, # Percentage of renovations per year
      • renovationShares, # Fraction of renovation type when renovation is done.
      • construction, # Construction rate in the future
      • constructionAreas,
      • buildingTypes, # A dummy variable to combine two different indices: Building and Building2
      • heatingShares, # Heating types of current buildings
      • heatingSharesNew, # Heating types of the buildings in the future
      • buildings,
    • Energy use of buildings
      • energyUse,
      • efficienciesNew, # Energy efficiencies in the future
      • savingPotential,
    • Climate change policies and health in Kuopio
      • eventyear, # A dummy variable to combine time periods to numerical time axis.
      • efficiencies, # Energy efficiencies of current buildings
      • obsyear # Years for which observations are calculated. This requires timepoints function.


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