Code Monkey home page Code Monkey logo

brick's Introduction

Building sector model with heterogeneous renovation and construction of the stock

R package brick, version 0.5.0

CRAN status R build status codecov

Purpose and Functionality

This building stock model represents residential and commercial buildings at customisable regional and temporal resolution. The building stock is quantified in floor area and distinguished by building type (SFH/MFH) and location (rural/urban). In each building category, construction cohorts are tracked explicitly. This allows to characterise buildings specifically for each of subset of buildings. The evolution of the building stock follows from the flows of constructed, renovated and demolished buildings and is optimised under cost minimisation with a benefit for heterogeneity in the choice of construction and renovation alternatives. This benefit captures heterogeneity in the preferences of the agents and the building structure.

Installation

For installation of the most recent package version an additional repository has to be added in R:

options(repos = c(CRAN = "@CRAN@", pik = "https://rse.pik-potsdam.de/r/packages"))

The additional repository can be made available permanently by adding the line above to a file called .Rprofile stored in the home folder of your system (Sys.glob("~") in R returns the home directory).

After that the most recent version of the package can be installed using install.packages:

install.packages("brick")

Package updates can be installed using update.packages (make sure that the additional repository has been added before running that command):

update.packages()

Questions / Problems

In case of questions / problems please contact Robin Hasse [email protected].

Citation

To cite package brick in publications use:

Hasse R, Rosemann R (2024). brick: Building sector model with heterogeneous renovation and construction of the stock. R package version 0.5.0, https://github.com/pik-piam/brick.

A BibTeX entry for LaTeX users is

@Manual{,
 title = {brick: Building sector model with heterogeneous renovation and construction of
the stock},
 author = {Robin Hasse and Ricarda Rosemann},
 year = {2024},
 note = {R package version 0.5.0},
 url = {https://github.com/pik-piam/brick},
}

brick's People

Contributors

robinhasse avatar ricardarosemann avatar pfuehrlich-pik avatar

Watchers

David Klein avatar  avatar

brick's Issues

Set price sensitivity

The price sensitivity for construction and renovation is a crucial parameter. So far, we have calibrated it manually such that technology shares are matched as well as possible without intangible cost and then adjusted the latter to match them "exactly". But this seems to lead to a very sensitive model and it is questionable if the price sensitivity should be derived as such. We have to invest more time and effort (literature study, econometrics, bottom up estimate, etc.) to better understand and eventually define this parameter.

Length of time step impacts results strongly

I wexpect similar results for T = {2020, 2025, 2030} and T = {2020, 2023, 2025, 2030} but BRICK doesn't behave well with changes in time step length. I suspect that the different contribution of zero renovation on the renovation heterogeneity has something to do with that. I already divide is by the length of the time step but this doesn't solve it yet.

move matching to mredgebuildings

The call of a matching run with BRICK should be moved to mredgebuildings. The corresponding config should also be part of the mredgebuildings repo that has BRICK as a dependency. This makes most sense because matching is part of calculating input data for BRICK even though this involves a BRICK (matching) run. Then, the switch matchingRun can be removed.

Smarter sendToSlurm

When starting BRICK locally with initModel, I often forget to set sendToSlurm = FALSE which gives a non-descriptive error as I don't have SLURM. I would suggest to

  • check if SLURM is installed
  • throw an indicative error if sendToSlurm = TRUE but SLURM is not installed
  • give sendToSlurm the default value of NULL or "auto" which will use SLURM only if available

Parameters don't have historic values

We only use the historic gdx to fix the values of v_stock, v_construction, v_renovation and v_demolition. All parameters are defined by the input gdx and not affected by the historic gdx. For historic periods, also the parameters should take the historic values.

Read REMIND prices

We need a function to read FE prices from REMIND GDX. Ideally, one can update the prices without rerunning the entire input data creation for BRICK to save time in coupled mode.

Default regionmapping for empty config setting

The default regionmapping config setting is an empty list. BRICK cannot handle this and throws an error that is not helpful. Instead, this should lead to country-level resolution as (to this date falsely) claimed in the default config.

Local regionmapping file is not available from installation

When running brick from the installed brick package with the regionmapping specified in the config, the run fails:

The regionmapping file cannot be found as it is not included in the package - all content of inst/input/ is ignored as by the .gitignore file, including any regionmapping file in input/ (which is the standard by the minimal.yaml file)

No flows in early matching time steps

In matching runs, I observed no values for flows in the first time step before the start year. They are zero for scenarios runs, too. But they exist (though I neither see them used in any equation). The missing values lead to failed reporting.

Remove colour (and label?) from technolgoy mapping

The technology mapping has columns for the label and colour of technologies that is used for some plots that remain in the BRICK code so far. I think every plot should use mip colours and we should get rind of this (already conflicting) duplication.

Throw error for ambiguous intangible assumptions

The creation of Parameters fails if one gives duplicate assumptions in one chunk of the intangible cost tables:

Error: gt_write_symbol:gdxError GDX error for p_specCostRen: Duplicate keys

This case should be specifically checked to give a helpful error message. Also wrong column elements need to throw an error. Currently, they'll just be ignored by left_join.

Keep some historic buildings in stock

It seems that our life time distribution for buildings needs a higher share of very old buildings. The oldest vintage disappear from stock entirely quite quickly which is not realistic considering historic preservation. The very poor matching of vintage references with our current life time implementation also suggests this.

grafik

I suggest to let the cumulative distribution function approach a value smaller than 1 for high life times, e.g. 0.9. That means that 10% of the initially constructed stock can remain forever and does not have to be demolished.

Precise life time calculation

The minimum shares of buildings to be demolished or renovated are calculated based on life time distributions for the building, the heating system and the building shell. Currently, the time of construction or installation is assumed to be the centre of the respective time step or vintage period. While this simplification seems to work well for short time steps, the more precise solution would be to assume a uniform distribution of construction/installation across the time span and integrate. For longer time steps, this might lead to more significantly different results than we can see right now.

Consider all investment cost

For heating system installations, we only consider capacity specific purchasing cost so far. This makes new installations extremely cheap in efficient buildings. Fixed investment cost for the actual installation work is not included so far. The BDEW Heizkostenvergleich could be a good starting point for initial estimates.

Pass time limit of Slurm job

Enable passing a certain time limit to the SLURM job in initModel().
This might enable faster starts of jobs and especially allows to continue working with SLURM if a maintenance window has been scheduled.

Easily restart last run

Back when there still was restartModel, one could leave the path empty and BRICK would find the most recent run and restart it. I found that quite convenient but we lost this functionality I believe. Now, leaving path empty leads to the default being executed, which I would keep. I'm wondering if we can still have this functionality. Maybe pass NA instead of NULL to path? But that isn't very intuitive. An alternative would be to introduce a new function like lastRun that returns the path of the last run. Then one could get what I mean with initModel(path = lastRun()). This suggestion probably doesn't work that simply because BRICK needs to know the output folder to look in which is an argument of initModel...

More helpful error if gams fails

If the gams optimisation fails, the user will only notice because the reporting cannot find symbols as output.gdx is missing.

Start Gams: output/base_2024-06-04_08.34.43/main.gms
Gams finished after 1 sec.
running reportBuildingStock ...
Error in readGdxSymbol(gdx, "v_stock") : 
  This file does not exist: output/base_2024-06-04_08.34.43/output.gdx

This is not very insightful. We should add checks after the execution of gams to either print a message that gams was successful or an indicative error message.

Permanent restart options

If a run was restarted with restart options but should late be restarted without them, the old options persist. I guess the respective file restartOptions.csv has to be written in any case, also overwriting with an empty file such that the old settings don't persist.

Share-dependent inconvenience cost

Robert after the IEAMC 2023 presentation:

wir brauchen share-dependent inconvenience costs - die Möglichkeit, eine bestimmte Technologien zu installieren wird einfacher, wenn sie verbreiteter ist. (mehr Techniker, mehr Angebote, ... auch höhere pipeline costs wenn gas boilers einen geringen Anteil haben (wurde ja auch gefragt)

Robert suggested to drop 2/3 of the incenvenience mark-up when reaching a particular threshold with the share of heat pumps in the stock.

To solve this within one optimisation, only the share within each subset of the stock (e.g. DEU, SFH, rural) can be considered.

Dynamic config setting for historic gdx

The historic gdx has to be given as a file path. It should be possible to also only the scenario name and let BRICK pick the most recent scenario with this name from the output folder.

Continuous definition of supply side assumptions

Users can currently select from 3 different scenarios for carrier prices and carrier emission intensities. I want to make this a continuous scenario definition where on can set a trajectory over time that can assume values between -1 (low) over 0 (central) to 1 (high).

Minor bugs

Issue to collect minor bugs so that they are not forgotten.

createInputData.R

  • l. 221 (Creation of set "typ"): Should be records = typ
  • l. 470 (Declaration of parameter p_specCostOpe): Unit should be USD/kWh.y

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.