Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
c0nb4 committed Jun 17, 2024
0 parents commit c13cbd8
Show file tree
Hide file tree
Showing 38 changed files with 19,206 additions and 0 deletions.
127 changes: 127 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# PyCharm project settings

.idea

# Project specific settings

p_settings_*.py
!p_settings_TEMPLATE.py


config.json
config_dev.json

# GitStuff

*.orig

# CampFlow Stuff

workspace/
results/

# example outputs

01_District_cool_e4.png

# output folder

output/

# Markdown preview

README.html

# Do not ignore static folder

!/vdistrict/static
22 changes: 22 additions & 0 deletions .gitlab/issue_templates/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
> Just stopping by to let us know about some issue you encountered with vDistrict?
Please feel free to delete all of this text and tell us what you think!

> If you want to suggest larger changes and/or adding new features to vDistrict,
please make sure to briefly answer the following few questions. For more
information on how to contribute to vDistrict, see our
[Contributors guide](../../doc/contributer.md).

> __Before submitting the issue,
please delete these first lines. Thanks for contributing!__

## What is the problem?

- ...

## Why do we want to solve it?

- ...

## How do we want to solve it?

- ...
21 changes: 21 additions & 0 deletions .gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
> Thank you for making a Merge Request to vDistrict!
> Please consider these points before submitting:
> - Mention the issue that
this Pull Request intends to solve, and briefly describe what the main changes
are.

> If you know someone who could review your code, please assign the person
below. If not, no worries, we will find someone for you.

> __Before submitting the merge request,
please delete these first lines. Thanks again for your MR!__


## Issue that is solved with this Merge Request?

- ...

## What are the main changes?

- ...
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# vDistrict - Django Project to collect and demonstrate functionalities of EBC Django-apps.

## Introduction

This repository contains a Django project to demonstrate the functionalities of several Django apps original developed at the [Institute for Energy Efficient Buildings and Indoor Climate](https://www.ebc.eonerc.rwth-aachen.de/cms/~dmzz/E-ON-ERC-EBC/). Among these are the TEASER and uesgraph API, as well as a GIS-based
interactive webpage.

This repository is currently mainted by the [Institute for Digital Networking of Buildings, Energy Supply Systems and Users](mailto:[email protected]) , if you have any questions don't hesitate to contact us.

We've set up this repository for testing and learning purposes. However, first you need
to learn how to configure your databases and the Django settings.



## Quick Guide installation and configuration

In this Quick Guide we assume you already have the connection details (IP, Port,
database name, username and password) for 3DCityDB (PostGIS) and InfluxDB. If not and
you are an administrator you can follow the
[administrator guide using docker](./doc/dev_docker.md), otherwise you should ask your supervisor.

First you need to ensure that you have installed all dependencies, we provide two installation guides for:
1. [Installation for Windows](./doc/user_windows.md)
2. [Installation for Linux](./doc/user_linux.md)

In addition you need to configure you Django settings. You can use this guide to [create your own settings](./doc/settings.md).

Please use this database if you want to run the tests:


Now you can run the migrations and work with vDistrict:

Run to create and synchronize the models (after the first `migrate` you will
get some errors, that the table `building` already exists, please just ignore it)

$ python manage.py migrate
$ python manage.py migrate --fake-initial

## First steps

After you followed the instructions above you can run your local Django server
with:

$ ./vDistrict python manage.py runserver


## Version

This is version 0.1.0. In development phase we will not guarantee to use strict semantic
versioning.


## Reference

The actual main part of 'django-citydb' is developed for:

(1) Remmen, P. Automated Calibration of Non-Residential Urban Building Energy Modeling = Automatisierte Kalibrierung von Simulationsmodellen Für Nichtwohngebäude Im Städtischen Maßstab, 1. Auflage.; E.ON Energy Research Center, RWTH Aachen University: Aachen, 2022. [Link](https://publications.rwth-aachen.de/record/843586/files/843586.pdf)


Current status of the code will be updated continously. List of publications:

[GityGML Import and Export for Dynamic Building Perfomance Simulation](https://www.researchgate.net/publication/308368722_CityGML_Import_and_Export_for_Dynamic_Building_Performance_Simulation_in_Modelica)


## Contact

Code is maintained by TU Berlin Institute for Digital Networking of Buildings, Energy Supply Systems and Users. [Contact Us](mailto:[email protected])


## License

[MIT](LICENSE)


## Acknowledgements

`django-citydb` has been developed within public funded projects
and with financial support by BMWK (Federal Ministry for Economics and Climate Action)

<img src="resources/bmwk_en_2023.png" width="200">
14 changes: 14 additions & 0 deletions doc/databases_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview of all available databases

| | PostGIS IP | PostGIS Port | PostGIS Name | PostGIS Username | PostGIS Password | Influx IP | Influx Port | Influx Name | Influx Username | Influx Password |
|--------|----------------|--------------|--------------|------------------|------------------|----------------|-------------|-------------|-----------------|-----------------|
| 1 Diss | 137.226.248.78 | 1101 | diss | | | 137.226.248.78 | 8086 | diss | | |
| 2 lth | 137.226.248.78 | 1100 | da_lth | admin | admin | 137.226.248.78 | 8086 | ba_lth | admin | admin |
| 3 | | | | | | | | | | |
| 4 | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
93 changes: 93 additions & 0 deletions doc/dev_docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Administrator Guide Using Docker

To set up databases, we will guide you through 2 steps:

1. Start `3dcitydb` docker with `PostgreSQL` and `PostGIS`
2. Start `InfluxDB` docker
3. Migrate EnergyADE and UtilityNetworksADE

If you don't know docker, have a look at: https://docs.docker.com/. There is a helpful
docker cheat sheet available here:
https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf.

We assume you have docker already installed on you system, if not, use this guide:
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce.

## 1. 3DCityDB

First we want to start a docker, that contains a `PostgreSQL` database, with
`PostGIS` extension and one database, with 3DCityDB schema.
- run the docker with:

$ docker run -dit --name {YOURNAME} -p {YOURPORT}:5432 -e "SRID=25832" -e "SRSNAME=urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH" -e "CITYDBNAME={YOURDB}" -e "POSTGRES_USER=admin" -e "POSTGRES_PASSWORD=admin" tumgis/3dcitydb-postgis

- --name for docker container name (e.g. citydb-docker)
- -p is to expose the postgres port 5432 (e.g. 5432:5432)
- CITYDBNAME for Database Name (e.g. citydb)
- POSTGRES_USER for Database user name (e. g. admin)
- POSTGRES_PASSWORD for Password (e. g. admin)
- SRID set the SRID reference (standardvalues / needed for 3dcitydb) ("25832")
- SRSName set the SRSName reference (standardvalues / needed for 3dcitydb) ("urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH")

## 2. InfluxDB

In addition to semantic data we store time series data using `InfluxDB`, to run the docker do the following:

- pull the influxdb docker image

$ docker pull influxdb

For persistence it is recommended, that you are using a mounted or shared folder
where you can store your backups to (in our example we are creating a folder in
media at the host machine)

- run the docker with the http api port 8086 exposed

$ docker run --name=influxdb -d -p 8086:8086 -v /media/influxdb_backup/:/backup influxdb

- jump into the influxdb console for Database and User creation

$ docker exec -it influxdb bash
$ influx

# CREATE DATABASE vdistrict
# CREATE USER vdistrict WITH PASSWORD 'vdistrict' WITH ALL PRIVILEGES

For Backup and restore have a look here:

https://www.influxdata.com/blog/backuprestore-of-influxdb-fromto-docker-containers/

## 3. Migrate EnergyADE and UtilityNetworksADE

1. Start 3DCityDB Importer/Exporter https://github.com/3dcitydb/importer-exporter
2. Select tab "Datenbank" and enter your database configuration and connect your database ("Verbinden")
3. Select tab "ADE Manager" and chose the path to `vDistrict/schema_mappings/EnergyADE_mapping` folder in this repository
4. Select "ADE registrieren"
5. Repeat step 3 and 4 with `vDistrict/schema_mappings/UtilityNetworksADE_mapping`


## Important Note : Restore

## InfluxDB

As i ran into quite a few problems while actually restoring the data, i would like to share my way how i got it to work:

1. create a docker container with a shared influxdb folder like: `-v /your/path/here:/var/lib/influxdb`
2. exec into the container with `exec -it containername /bin/bash`
3. restore your data with the restore command found in the link above (quickstart: `influxd restore -metadir /var/lib/influxdb/meta -datadir /var/lib/influxdb/data -database yourdatabase /backup/yourdatabase.backup`)
4. restart your container with "docker restart influxdb"
6. Enjoy your backup!

Troubleshooting if needed:

4. after done that you should restart the influxdb service (but that is not working, thus you have to follow the workaraound in step 5.)
5. Check if the data / meta / and wal directories with your database exist in the shared folder mentioned in 1. If no (i have no glue). So if yes, simply start another docker container
with for example : `docker run --name=influxdb -d -p 8086:8086 -v /media/influxdb_backup/:/backup -v /your/path/here:/var/lib/influxdb influxdb` (Attention: the second shared folder
with the actual data is very much needed :) )
6. Enjoy your backup!

#### Postgres

A very simple approach to backup and restore the postgres docker is explained here:

https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database/29913462#29913462
1 change: 1 addition & 0 deletions doc/dymola_interface.pth
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:\Program Files\Dymola 2019\Modelica\Library\python_interface\dymola.egg
Loading

0 comments on commit c13cbd8

Please sign in to comment.